[SPY-97] decode and test for unlock cases of NOT_FOUND, NOT_MY_VBUCKET and ETMPFAIL Created: 19/Aug/12  Updated: 29/May/13

Status: Open
Project: Spymemcached Java Client
Component/s: None
Affects Version/s: 2.8.2
Fix Version/s: .next
Security Level: Public

Type: Improvement Priority: Major
Reporter: Matt Ingenthron Assignee: Michael Nitschinger
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   
Current unlock implementation does not read the response and do anything with it. It simply says okay for any received responses.

Tests and implementation should check for the various responses expected. This should be documented somewhere and implementation should follow the documentation, but just to show what the current server implementation is I plucked this out of the server code for ep_engine:


        ENGINE_ERROR_CODE rv = e->unlockKey(key, vbucket, cas, ep_current_time());

        if (rv == ENGINE_SUCCESS) {
            *msg = "UNLOCKED";
        } else if (rv == ENGINE_TMPFAIL){
            *msg = "UNLOCK_ERROR";
            res = PROTOCOL_BINARY_RESPONSE_ETMPFAIL;
        } else {
            if (e->isDegradedMode()) {
                *msg = "LOCK_TMP_ERROR";
                return PROTOCOL_BINARY_RESPONSE_ETMPFAIL;
            }

            RCPtr<VBucket> vb = e->getVBucket(vbucket);
            if (!vb) {
                *msg = "That's not my bucket.";
                res = PROTOCOL_BINARY_RESPONSE_NOT_MY_VBUCKET;
            }
            *msg = "NOT_FOUND";
            res = PROTOCOL_BINARY_RESPONSE_KEY_ENOENT;
        }

Generated at Wed Aug 20 05:54:59 CDT 2014 using JIRA 5.2.4#845-sha1:c9f4cc41abe72fb236945343a1f485c2c844dac9.