Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various crash consistency bugs for pslab memcached. #4

Open
iangneal opened this issue May 3, 2021 · 0 comments · May be fixed by #6
Open

Various crash consistency bugs for pslab memcached. #4

iangneal opened this issue May 3, 2021 · 0 comments · May be fixed by #6

Comments

@iangneal
Copy link

iangneal commented May 3, 2021

Bug 1

  • CAS ID is not persisted, potentially causing atomicity problems for client operations if the persistent memcached service experiences a failure and restarts.

    memcached-pmem/items.c

    Lines 537 to 538 in 8f121f6

    /* Allocate a new CAS ID on link. */
    ITEM_set_cas(it, (settings.use_cas) ? get_cas_id() : 0);

Bug 2

  • CAS ID is updated after item is linked, so even if Bug 1 is fixed (i.e., CAS ID field is made persistent), then it is still possible for the item to be linked before the CAS ID is persisted, leading to the same issue as Bug 1.

    memcached-pmem/items.c

    Lines 537 to 538 in 8f121f6

    /* Allocate a new CAS ID on link. */
    ITEM_set_cas(it, (settings.use_cas) ? get_cas_id() : 0);

Bug 3

  • Time field is updated after item is linked. On a crash, this could cause the item to have an uninitialized time, causing it to be evicted from the service earlier than expected.

memcached-pmem/items.c

Lines 519 to 522 in 8f121f6

it->it_flags |= ITEM_LINKED;
pmem_member_persist(it, it_flags);
it->time = current_time;
pmem_member_persist(it, time);

memcached-pmem/items.c

Lines 134 to 136 in 8f121f6

if ((it->time <= oldest_live)
|| (oldest_cas != 0 && cas != 0 && cas < oldest_cas)) {
return 1;

@iangneal iangneal linked a pull request Nov 4, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant