twitter/pelikan

Twemcache metrics inconsistency during slab eviction

michalbiesek opened this issue · 2 comments

General Information

During slab eviction operation, all items in slab which is currently evicted are removed from hashtable, but unfortunately stats related to this operation are not updated, which could result in misleading information about current state of db.

Reproduction steps

I think the simplest steps would be to follow scenario presented in:

START_TEST(test_evict_lru_basic)

and print the stats just after inserting all the items (where eviction happened), e.g.:

  • item_linked_curr 3
  • item_curr 3
  • item_unlink 0

This is not consistent with state of hashtable in the end of test ( only one item is present there)

Additional Information

if (it->is_linked) {
it->is_linked = 0;
hashtable_delete(item_key(it), it->klen, hash_table);

I think what is missing here is updating the statistics (SLAB_METRIC) related to this operation, e.g. item_linked_curr, item_unlink ...

Good find! If you don't get to it I will fix it in the next week or two.

@thinkingfish
I would like to leave the fix to you, since I will not be able to perform this fix in next two weeks.