Skip to content

Various crash consistency bugs for pslab memcached. #4

Description

@iangneal

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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions