Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 86 by phy...@gmail.com: function assoc_delete may not work
http://code.google.com/p/memcached/issues/detail?id=86

When delete item, assoc_delete need to rebuild h_next for related keys.
However, I think the existing code for 1.4.0 will not work like that, it
should change like this:

void assoc_delete(const char *key, const size_t nkey) {
    item **before = _hashitem_before(key, nkey);

    if (*before) {
        item *nxt;
        hash_items--;
        /* The DTrace probe cannot be triggered as the last instruction
         * due to possible tail-optimization by the compiler
         */
        MEMCACHED_ASSOC_DELETE(key, nkey, hash_items);
        nxt = (*before)->h_next;
        (*before)->h_next = 0;   /* probably pointless, but whatever. */
-        *before = nxt;
+        (*before)->h_next = nxt->h_next;
        return;
    }
    /* Note:  we never actually get here.  the callers don't delete things
       they can't find. */
    assert(*before != 0);
}



--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

Reply via email to