Nits
skyelves opened this issue · 1 comments
skyelves commented
Lines 261 to 293 in a2f3225
switch ((uint64_t)ret) { | |
case 0: // key existed | |
mass_node_unlock(n); | |
return 0; | |
case 1: // key inserted | |
mass_node_unlock(n); | |
return 1; | |
case -1: { // need to create a deeper layer | |
create_new_layer(n, key, len, off, val); | |
mass_node_unlock(n); | |
return 1; | |
} | |
case -2: { // mass_node is full, need to split and promote | |
uint64_t fence = 0; | |
mass_node *n1 = mass_node_split(n, &fence); | |
assert(fence); | |
uint64_t cur = get_next_keyslice(key, len, off); | |
// equal is not possible | |
if (mass_compare_key(cur, fence) < 0) | |
assert((uint64_t)border_mass_node_insert(n, key, len, off, val, 0 /* is_link */) == 1); | |
else | |
assert((uint64_t)border_mass_node_insert(n1, key, len, off, val, 0 /* is_link */) == 1); | |
mass_tree_promote_split_mass_node(mt, n, fence, n1); | |
return 1; | |
} | |
default: // need to go to a deeper layer | |
mass_node_unlock(n); | |
r = (mass_node *)ret; | |
// if we need to advance to next layer, then key offset will not exceed key length | |
off += sizeof(uint64_t); | |
goto again; | |
} |
这里ret是uint_64类型, case里面包含-1和-2,不合适
UncP commented
是的