Created
September 15, 2016 10:05
-
-
Save jimwwalker/e9e4e964e7047498e3dabb53ca7b0afa to your computer and use it in GitHub Desktop.
LWW HLC broken test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static enum test_result test_set_meta_lww(ENGINE_HANDLE *h, | |
ENGINE_HANDLE_V1 *h1) { | |
// put some random metadata | |
ItemMetaData itemMeta; | |
itemMeta.revSeqno = 10; | |
itemMeta.exptime = 0; | |
itemMeta.flags = 0xdeadbeef; | |
std::string key("key"); | |
// write key 2 times, but pretend they came from nodes | |
// a) who has a clock ahead of us (we start with 20...) | |
// b) who has a clock that is behind us. | |
// last-write wins... | |
checkeq(0, get_int_stat(h, h1, "ep_num_ops_set_meta"), | |
"Expect zero setMeta ops"); | |
// nodeA thinks its 20 o-clock | |
itemMeta.cas = 20; | |
set_with_meta(h, h1, "key", 3, "node-A", 7, 0, &itemMeta, 0, false, | |
PROTOCOL_BINARY_RAW_BYTES, true, gethrtime(), 1); | |
checkeq(PROTOCOL_BINARY_RESPONSE_SUCCESS, last_status.load(), "Expected success"); | |
// nodeB writes last in realtime, but is his document accepted? | |
itemMeta.cas = 19; | |
set_with_meta(h, h1, "key", 3, "node-B", 7, 0, &itemMeta, 0, false, | |
PROTOCOL_BINARY_RAW_BYTES, true, gethrtime(), 1); | |
// checkeq(PROTOCOL_BINARY_RESPONSE_SUCCESS, last_status.load(), "Expected success"); | |
check_key_value(h, h1, "key", "node-B", 7); | |
return SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment