Commit f3701dcc authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:3088], fix bug

git-svn-id: file:///svn/toku/tokudb@26086 c7de825b-a66e-492c-adef-691d508d4ae1
parent 85840905
...@@ -1633,7 +1633,7 @@ brt_leaf_put_cmd (BRT t, BRTNODE node, BRT_MSG cmd, ...@@ -1633,7 +1633,7 @@ brt_leaf_put_cmd (BRT t, BRTNODE node, BRT_MSG cmd,
lazy_assert_zero(r); lazy_assert_zero(r);
storeddata=storeddatav; storeddata=storeddatav;
int deleted = 0; int deleted = 0;
if (le_num_xids(storeddata)>0) { if (!le_is_clean(storeddata)) {
// Apply to all leafentries // Apply to all leafentries
if (le_latest_is_del(storeddata)) { if (le_latest_is_del(storeddata)) {
brt_leaf_delete_leafentry(node, idx, storeddata); brt_leaf_delete_leafentry(node, idx, storeddata);
...@@ -1673,7 +1673,7 @@ brt_leaf_put_cmd (BRT t, BRTNODE node, BRT_MSG cmd, ...@@ -1673,7 +1673,7 @@ brt_leaf_put_cmd (BRT t, BRTNODE node, BRT_MSG cmd,
lazy_assert_zero(r); lazy_assert_zero(r);
storeddata=storeddatav; storeddata=storeddatav;
int deleted = 0; int deleted = 0;
if (le_num_xids(storeddata) > 0) { //If already clean, nothing to do. if (!le_is_clean(storeddata)) { //If already clean, nothing to do.
r = brt_leaf_apply_cmd_once(node, cmd, idx, storeddata, logger); r = brt_leaf_apply_cmd_once(node, cmd, idx, storeddata, logger);
if (r!=0) return r; if (r!=0) return r;
u_int32_t new_omt_size = toku_omt_size(node->u.l.buffer); u_int32_t new_omt_size = toku_omt_size(node->u.l.buffer);
......
...@@ -125,7 +125,7 @@ void wbuf_nocrc_LEAFENTRY(struct wbuf *w, LEAFENTRY le); ...@@ -125,7 +125,7 @@ void wbuf_nocrc_LEAFENTRY(struct wbuf *w, LEAFENTRY le);
int print_leafentry (FILE *outf, LEAFENTRY v); // Print a leafentry out in human-readable form. int print_leafentry (FILE *outf, LEAFENTRY v); // Print a leafentry out in human-readable form.
int le_latest_is_del(LEAFENTRY le); // Return true if it is a provisional delete. int le_latest_is_del(LEAFENTRY le); // Return true if it is a provisional delete.
uint32_t le_num_xids(LEAFENTRY le); //Return how many xids exist (0 does not count) BOOL le_is_clean(LEAFENTRY le); //Return how many xids exist (0 does not count)
int le_has_xids(LEAFENTRY le, XIDS xids); // Return true transaction represented by xids is still provisional in this leafentry (le's xid stack is a superset or equal to xids) int le_has_xids(LEAFENTRY le, XIDS xids); // Return true transaction represented by xids is still provisional in this leafentry (le's xid stack is a superset or equal to xids)
u_int32_t le_latest_keylen (LEAFENTRY le); // Return the latest keylen. u_int32_t le_latest_keylen (LEAFENTRY le); // Return the latest keylen.
void* le_latest_val (LEAFENTRY le); // Return the latest val (return NULL for provisional deletes) void* le_latest_val (LEAFENTRY le); // Return the latest val (return NULL for provisional deletes)
......
...@@ -949,30 +949,20 @@ le_clean_xids(LEAFENTRY le, ...@@ -949,30 +949,20 @@ le_clean_xids(LEAFENTRY le,
#endif #endif
} }
uint32_t BOOL
le_num_xids(LEAFENTRY le) { le_is_clean(LEAFENTRY le) {
uint8_t type = le->type; uint8_t type = le->type;
uint32_t rval; uint32_t rval;
switch (type) { switch (type) {
case LE_CLEAN: case LE_CLEAN:
rval = 0; rval = TRUE;
break; break;
case LE_MVCC:; case LE_MVCC:;
uint32_t num_cuxrs = toku_dtoh32(le->u.mvcc.num_cxrs); rval = FALSE;
invariant(num_cuxrs);
uint32_t num_puxrs = le->u.mvcc.num_pxrs;
rval = num_cuxrs + num_puxrs - 1;
break; break;
default: default:
invariant(FALSE); invariant(FALSE);
} }
#if ULE_DEBUG
ULE_S ule;
le_unpack(&ule, le);
uint32_t slow_rval = ule.num_cuxrs + ule.num_puxrs - 1;
invariant(slow_rval == rval);
ule_cleanup(&ule);
#endif
return rval; return rval;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment