Skip to content

Commit

Permalink
Merge pull request #47 from michalbiesek/slab-reserve
Browse files Browse the repository at this point in the history
Reset item in case of reserve
  • Loading branch information
michalbiesek authored Aug 22, 2019
2 parents c1c5234 + 9a46536 commit e84e4c7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/storage/slab/slab.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ _slab_recreate_items(struct slab *slab)
}
} else if (it->in_freeq) {
_slab_put_item_into_freeq(it, slab->id);
} else if (it->klen && it->vlen == 0) {
/* item could be only reserved before reset */
item_release(&it);
}
}
}
Expand Down
3 changes: 0 additions & 3 deletions test/storage/slab_pmem/check_slab_pmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1003,9 +1003,6 @@ START_TEST(test_evict_refcount)
status = item_reserve(&it, &key, &val, val.len, 0, INT32_MAX);
ck_assert_msg(status == ITEM_OK, "item_reserve not OK - return status %d", status);

test_teardown(0);
slab_setup(&options, &metrics);

status = item_reserve(&nit, &key, &val, val.len, 0, INT32_MAX);
ck_assert_msg(status == ITEM_ENOMEM, "item_reserve should fail - return status %d", status);

Expand Down

0 comments on commit e84e4c7

Please sign in to comment.