Commit 67feab1e authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:4765], remove usage of txn OMTs from toku_brt_root_put_cmd

git-svn-id: file:///svn/toku/tokudb@43494 c7de825b-a66e-492c-adef-691d508d4ae1
parent f84b04c1
...@@ -901,9 +901,6 @@ brt_leaf_apply_cmd_once ( ...@@ -901,9 +901,6 @@ brt_leaf_apply_cmd_once (
const BRT_MSG cmd, const BRT_MSG cmd,
u_int32_t idx, u_int32_t idx,
LEAFENTRY le, LEAFENTRY le,
OMT snapshot_xids,
OMT live_list_reverse,
OMT live_root_txns,
uint64_t *workdonep uint64_t *workdonep
); );
...@@ -916,10 +913,7 @@ brt_leaf_put_cmd ( ...@@ -916,10 +913,7 @@ brt_leaf_put_cmd (
BRTNODE leafnode, BRTNODE leafnode,
BASEMENTNODE bn, BASEMENTNODE bn,
BRT_MSG cmd, BRT_MSG cmd,
uint64_t *workdone, uint64_t *workdone
OMT snapshot_txnids,
OMT live_list_reverse,
OMT live_root_txns
); );
void toku_apply_cmd_to_leaf( void toku_apply_cmd_to_leaf(
...@@ -928,10 +922,7 @@ void toku_apply_cmd_to_leaf( ...@@ -928,10 +922,7 @@ void toku_apply_cmd_to_leaf(
DESCRIPTOR desc, DESCRIPTOR desc,
BRTNODE node, BRTNODE node,
BRT_MSG cmd, BRT_MSG cmd,
uint64_t *workdone, uint64_t *workdone
OMT snapshot_txnids,
OMT live_list_reverse,
OMT live_root_txns
); );
// FIXME needs toku prefix // FIXME needs toku prefix
...@@ -941,10 +932,7 @@ void brtnode_put_cmd ( ...@@ -941,10 +932,7 @@ void brtnode_put_cmd (
DESCRIPTOR desc, DESCRIPTOR desc,
BRTNODE node, BRTNODE node,
BRT_MSG cmd, BRT_MSG cmd,
bool is_fresh, bool is_fresh
OMT snapshot_txnids,
OMT live_list_reverse,
OMT live_root_txns
); );
void toku_flusher_thread_set_callback(void (*callback_f)(int, void*), void* extra); void toku_flusher_thread_set_callback(void (*callback_f)(int, void*), void* extra);
......
...@@ -139,10 +139,7 @@ int toku_testsetup_insert_to_leaf (BRT brt, BLOCKNUM blocknum, char *key, int ke ...@@ -139,10 +139,7 @@ int toku_testsetup_insert_to_leaf (BRT brt, BLOCKNUM blocknum, char *key, int ke
&brt->h->cmp_descriptor, &brt->h->cmp_descriptor,
node, node,
&cmd, &cmd,
true, true
NULL,
NULL,
NULL
); );
toku_verify_or_set_counts(node); toku_verify_or_set_counts(node);
......
...@@ -1461,9 +1461,6 @@ brt_leaf_apply_cmd_once ( ...@@ -1461,9 +1461,6 @@ brt_leaf_apply_cmd_once (
const BRT_MSG cmd, const BRT_MSG cmd,
u_int32_t idx, u_int32_t idx,
LEAFENTRY le, LEAFENTRY le,
OMT snapshot_xids,
OMT live_list_reverse,
OMT live_root_txns,
uint64_t *workdone uint64_t *workdone
) )
// Effect: Apply cmd to leafentry (msn is ignored) // Effect: Apply cmd to leafentry (msn is ignored)
...@@ -1486,7 +1483,7 @@ brt_leaf_apply_cmd_once ( ...@@ -1486,7 +1483,7 @@ brt_leaf_apply_cmd_once (
// That means le is guaranteed to not cause a sigsegv but it may point to a mempool that is // That means le is guaranteed to not cause a sigsegv but it may point to a mempool that is
// no longer in use. We'll have to release the old mempool later. // no longer in use. We'll have to release the old mempool later.
{ {
int r = apply_msg_to_leafentry(cmd, le, &newsize, &new_le, bn->buffer, &bn->buffer_mempool, &maybe_free, snapshot_xids, live_list_reverse, live_root_txns, &numbytes_delta); int r = apply_msg_to_leafentry(cmd, le, &newsize, &new_le, bn->buffer, &bn->buffer_mempool, &maybe_free, &numbytes_delta);
invariant(r==0); invariant(r==0);
} }
...@@ -1557,9 +1554,6 @@ struct setval_extra_s { ...@@ -1557,9 +1554,6 @@ struct setval_extra_s {
const DBT *key; const DBT *key;
u_int32_t idx; u_int32_t idx;
LEAFENTRY le; LEAFENTRY le;
OMT snapshot_txnids;
OMT live_list_reverse;
OMT live_root_txns;
uint64_t * workdone; // set by brt_leaf_apply_cmd_once() uint64_t * workdone; // set by brt_leaf_apply_cmd_once()
}; };
...@@ -1591,7 +1585,6 @@ static void setval_fun (const DBT *new_val, void *svextra_v) { ...@@ -1591,7 +1585,6 @@ static void setval_fun (const DBT *new_val, void *svextra_v) {
} }
brt_leaf_apply_cmd_once(svextra->leafnode, svextra->bn, &msg, brt_leaf_apply_cmd_once(svextra->leafnode, svextra->bn, &msg,
svextra->idx, svextra->le, svextra->idx, svextra->le,
svextra->snapshot_txnids, svextra->live_list_reverse, svextra->live_root_txns,
svextra->workdone); svextra->workdone);
svextra->setval_r = 0; svextra->setval_r = 0;
} }
...@@ -1602,7 +1595,7 @@ static void setval_fun (const DBT *new_val, void *svextra_v) { ...@@ -1602,7 +1595,7 @@ static void setval_fun (const DBT *new_val, void *svextra_v) {
// would be to put a dummy msn in the messages created by setval_fun(), but preserving // would be to put a dummy msn in the messages created by setval_fun(), but preserving
// the original msn seems cleaner and it preserves accountability at a lower layer. // the original msn seems cleaner and it preserves accountability at a lower layer.
static int do_update(brt_update_func update_fun, DESCRIPTOR desc, BRTNODE leafnode, BASEMENTNODE bn, BRT_MSG cmd, int idx, static int do_update(brt_update_func update_fun, DESCRIPTOR desc, BRTNODE leafnode, BASEMENTNODE bn, BRT_MSG cmd, int idx,
LEAFENTRY le, OMT snapshot_txnids, OMT live_list_reverse, OMT live_root_txns, LEAFENTRY le,
uint64_t * workdone) { uint64_t * workdone) {
LEAFENTRY le_for_update; LEAFENTRY le_for_update;
DBT key; DBT key;
...@@ -1645,7 +1638,7 @@ static int do_update(brt_update_func update_fun, DESCRIPTOR desc, BRTNODE leafno ...@@ -1645,7 +1638,7 @@ static int do_update(brt_update_func update_fun, DESCRIPTOR desc, BRTNODE leafno
} }
struct setval_extra_s setval_extra = {setval_tag, FALSE, 0, leafnode, bn, cmd->msn, cmd->xids, struct setval_extra_s setval_extra = {setval_tag, FALSE, 0, leafnode, bn, cmd->msn, cmd->xids,
keyp, idx, le_for_update, snapshot_txnids, live_list_reverse, live_root_txns, workdone}; keyp, idx, le_for_update, workdone};
// call handlerton's brt->update_fun(), which passes setval_extra to setval_fun() // call handlerton's brt->update_fun(), which passes setval_extra to setval_fun()
FAKE_DB(db, desc); FAKE_DB(db, desc);
int r = update_fun( int r = update_fun(
...@@ -1669,10 +1662,7 @@ brt_leaf_put_cmd ( ...@@ -1669,10 +1662,7 @@ brt_leaf_put_cmd (
BRTNODE leafnode, // bn is within leafnode BRTNODE leafnode, // bn is within leafnode
BASEMENTNODE bn, BASEMENTNODE bn,
BRT_MSG cmd, BRT_MSG cmd,
uint64_t *workdone, uint64_t *workdone
OMT snapshot_txnids,
OMT live_list_reverse,
OMT live_root_txns
) )
// Effect: // Effect:
// Put a cmd into a leaf. // Put a cmd into a leaf.
...@@ -1712,7 +1702,7 @@ brt_leaf_put_cmd ( ...@@ -1712,7 +1702,7 @@ brt_leaf_put_cmd (
assert(r==0); assert(r==0);
storeddata=storeddatav; storeddata=storeddatav;
} }
brt_leaf_apply_cmd_once(leafnode, bn, cmd, idx, storeddata, snapshot_txnids, live_list_reverse, live_root_txns, workdone); brt_leaf_apply_cmd_once(leafnode, bn, cmd, idx, storeddata, workdone);
// if the insertion point is within a window of the right edge of // if the insertion point is within a window of the right edge of
// the leaf then it is sequential // the leaf then it is sequential
...@@ -1744,7 +1734,7 @@ brt_leaf_put_cmd ( ...@@ -1744,7 +1734,7 @@ brt_leaf_put_cmd (
while (1) { while (1) {
u_int32_t num_leafentries_before = toku_omt_size(bn->buffer); u_int32_t num_leafentries_before = toku_omt_size(bn->buffer);
brt_leaf_apply_cmd_once(leafnode, bn, cmd, idx, storeddata, snapshot_txnids, live_list_reverse, live_root_txns, workdone); brt_leaf_apply_cmd_once(leafnode, bn, cmd, idx, storeddata, workdone);
{ {
// Now we must find the next leafentry. // Now we must find the next leafentry.
...@@ -1790,7 +1780,7 @@ brt_leaf_put_cmd ( ...@@ -1790,7 +1780,7 @@ brt_leaf_put_cmd (
storeddata=storeddatav; storeddata=storeddatav;
int deleted = 0; int deleted = 0;
if (!le_is_clean(storeddata)) { //If already clean, nothing to do. if (!le_is_clean(storeddata)) { //If already clean, nothing to do.
brt_leaf_apply_cmd_once(leafnode, bn, cmd, idx, storeddata, snapshot_txnids, live_list_reverse, live_root_txns, workdone); brt_leaf_apply_cmd_once(leafnode, bn, cmd, idx, storeddata, workdone);
u_int32_t new_omt_size = toku_omt_size(bn->buffer); u_int32_t new_omt_size = toku_omt_size(bn->buffer);
if (new_omt_size != omt_size) { if (new_omt_size != omt_size) {
assert(new_omt_size+1 == omt_size); assert(new_omt_size+1 == omt_size);
...@@ -1816,7 +1806,7 @@ brt_leaf_put_cmd ( ...@@ -1816,7 +1806,7 @@ brt_leaf_put_cmd (
storeddata=storeddatav; storeddata=storeddatav;
int deleted = 0; int deleted = 0;
if (le_has_xids(storeddata, cmd->xids)) { if (le_has_xids(storeddata, cmd->xids)) {
brt_leaf_apply_cmd_once(leafnode, bn, cmd, idx, storeddata, snapshot_txnids, live_list_reverse, live_root_txns, workdone); brt_leaf_apply_cmd_once(leafnode, bn, cmd, idx, storeddata, workdone);
u_int32_t new_omt_size = toku_omt_size(bn->buffer); u_int32_t new_omt_size = toku_omt_size(bn->buffer);
if (new_omt_size != omt_size) { if (new_omt_size != omt_size) {
assert(new_omt_size+1 == omt_size); assert(new_omt_size+1 == omt_size);
...@@ -1837,10 +1827,10 @@ brt_leaf_put_cmd ( ...@@ -1837,10 +1827,10 @@ brt_leaf_put_cmd (
r = toku_omt_find_zero(bn->buffer, toku_cmd_leafval_heaviside, &be, r = toku_omt_find_zero(bn->buffer, toku_cmd_leafval_heaviside, &be,
&storeddatav, &idx); &storeddatav, &idx);
if (r==DB_NOTFOUND) { if (r==DB_NOTFOUND) {
r = do_update(update_fun, desc, leafnode, bn, cmd, idx, NULL, snapshot_txnids, live_list_reverse, live_root_txns, workdone); r = do_update(update_fun, desc, leafnode, bn, cmd, idx, NULL, workdone);
} else if (r==0) { } else if (r==0) {
storeddata=storeddatav; storeddata=storeddatav;
r = do_update(update_fun, desc, leafnode, bn, cmd, idx, storeddata, snapshot_txnids, live_list_reverse, live_root_txns, workdone); r = do_update(update_fun, desc, leafnode, bn, cmd, idx, storeddata, workdone);
} // otherwise, a worse error, just return it } // otherwise, a worse error, just return it
break; break;
} }
...@@ -1852,7 +1842,7 @@ brt_leaf_put_cmd ( ...@@ -1852,7 +1842,7 @@ brt_leaf_put_cmd (
r = toku_omt_fetch(bn->buffer, idx, &storeddatav); r = toku_omt_fetch(bn->buffer, idx, &storeddatav);
assert(r==0); assert(r==0);
storeddata=storeddatav; storeddata=storeddatav;
r = do_update(update_fun, desc, leafnode, bn, cmd, idx, storeddata, snapshot_txnids, live_list_reverse, live_root_txns, workdone); r = do_update(update_fun, desc, leafnode, bn, cmd, idx, storeddata, workdone);
// TODO(leif): This early return means get_leaf_reactivity() // TODO(leif): This early return means get_leaf_reactivity()
// and VERIFY_NODE() never get called. Is this a problem? // and VERIFY_NODE() never get called. Is this a problem?
assert(r==0); assert(r==0);
...@@ -2328,10 +2318,7 @@ toku_bnc_flush_to_child( ...@@ -2328,10 +2318,7 @@ toku_bnc_flush_to_child(
desc, desc,
child, child,
&brtcmd, &brtcmd,
is_fresh, is_fresh
NULL, // pass NULL omts (snapshot_txnids and live_list_reverse)
NULL, // we're going to handle GC ourselves next
NULL
); );
})); }));
...@@ -2397,10 +2384,7 @@ brtnode_put_cmd ( ...@@ -2397,10 +2384,7 @@ brtnode_put_cmd (
DESCRIPTOR desc, DESCRIPTOR desc,
BRTNODE node, BRTNODE node,
BRT_MSG cmd, BRT_MSG cmd,
bool is_fresh, bool is_fresh
OMT snapshot_txnids,
OMT live_list_reverse,
OMT live_root_txns
) )
// Effect: Push CMD into the subtree rooted at NODE. // Effect: Push CMD into the subtree rooted at NODE.
// If NODE is a leaf, then // If NODE is a leaf, then
...@@ -2423,10 +2407,7 @@ brtnode_put_cmd ( ...@@ -2423,10 +2407,7 @@ brtnode_put_cmd (
desc, desc,
node, node,
cmd, cmd,
&workdone, &workdone
snapshot_txnids,
live_list_reverse,
live_root_txns
); );
} else { } else {
brt_nonleaf_put_cmd(compare_fun, desc, node, cmd, is_fresh); brt_nonleaf_put_cmd(compare_fun, desc, node, cmd, is_fresh);
...@@ -2446,10 +2427,7 @@ void toku_apply_cmd_to_leaf( ...@@ -2446,10 +2427,7 @@ void toku_apply_cmd_to_leaf(
DESCRIPTOR desc, DESCRIPTOR desc,
BRTNODE node, BRTNODE node,
BRT_MSG cmd, BRT_MSG cmd,
uint64_t *workdone, uint64_t *workdone
OMT snapshot_txnids,
OMT live_list_reverse,
OMT live_root_txns
) )
{ {
VERIFY_NODE(t, node); VERIFY_NODE(t, node);
...@@ -2490,10 +2468,7 @@ void toku_apply_cmd_to_leaf( ...@@ -2490,10 +2468,7 @@ void toku_apply_cmd_to_leaf(
node, node,
BLB(node, childnum), BLB(node, childnum),
cmd, cmd,
workdone, workdone);
snapshot_txnids,
live_list_reverse,
live_root_txns);
} else { } else {
STATUS_VALUE(BRT_MSN_DISCARDS)++; STATUS_VALUE(BRT_MSN_DISCARDS)++;
} }
...@@ -2508,10 +2483,7 @@ void toku_apply_cmd_to_leaf( ...@@ -2508,10 +2483,7 @@ void toku_apply_cmd_to_leaf(
node, node,
BLB(node, childnum), BLB(node, childnum),
cmd, cmd,
workdone, workdone);
snapshot_txnids,
live_list_reverse,
live_root_txns);
} else { } else {
STATUS_VALUE(BRT_MSN_DISCARDS)++; STATUS_VALUE(BRT_MSN_DISCARDS)++;
} }
...@@ -2529,10 +2501,6 @@ static void push_something_at_root (struct brt_header *h, BRTNODE *nodep, BRT_MS ...@@ -2529,10 +2501,6 @@ static void push_something_at_root (struct brt_header *h, BRTNODE *nodep, BRT_MS
{ {
BRTNODE node = *nodep; BRTNODE node = *nodep;
toku_assert_entire_node_in_memory(node); toku_assert_entire_node_in_memory(node);
TOKULOGGER logger = toku_cachefile_logger(h->cf);
OMT snapshot_txnids = logger ? logger->snapshot_txnids : NULL;
OMT live_list_reverse = logger ? logger->live_list_reverse : NULL;
OMT live_root_txns = logger ? logger->live_root_txns : NULL;
MSN cmd_msn = cmd->msn; MSN cmd_msn = cmd->msn;
invariant(cmd_msn.msn > node->max_msn_applied_to_node_on_disk.msn); invariant(cmd_msn.msn > node->max_msn_applied_to_node_on_disk.msn);
brtnode_put_cmd( brtnode_put_cmd(
...@@ -2541,10 +2509,7 @@ static void push_something_at_root (struct brt_header *h, BRTNODE *nodep, BRT_MS ...@@ -2541,10 +2509,7 @@ static void push_something_at_root (struct brt_header *h, BRTNODE *nodep, BRT_MS
&h->cmp_descriptor, &h->cmp_descriptor,
node, node,
cmd, cmd,
true, true
snapshot_txnids,
live_list_reverse,
live_root_txns
); );
// //
// assumption is that brtnode_put_cmd will // assumption is that brtnode_put_cmd will
...@@ -3944,7 +3909,7 @@ do_brt_leaf_put_cmd(BRT t, BRTNODE leafnode, BASEMENTNODE bn, BRTNODE ancestor, ...@@ -3944,7 +3909,7 @@ do_brt_leaf_put_cmd(BRT t, BRTNODE leafnode, BASEMENTNODE bn, BRTNODE ancestor,
toku_fill_dbt(&hk, key, keylen); toku_fill_dbt(&hk, key, keylen);
DBT hv; DBT hv;
BRT_MSG_S brtcmd = { type, msn, xids, .u.id = { &hk, toku_fill_dbt(&hv, val, vallen) } }; BRT_MSG_S brtcmd = { type, msn, xids, .u.id = { &hk, toku_fill_dbt(&hv, val, vallen) } };
brt_leaf_put_cmd(t->compare_fun, t->update_fun, &t->h->cmp_descriptor, leafnode, bn, &brtcmd, &BP_WORKDONE(ancestor, childnum), NULL, NULL, NULL); // pass NULL omts (snapshot_txnids and live_list_reverse) to prevent GC from running on message application for a query brt_leaf_put_cmd(t->compare_fun, t->update_fun, &t->h->cmp_descriptor, leafnode, bn, &brtcmd, &BP_WORKDONE(ancestor, childnum)); // pass NULL omts (snapshot_txnids and live_list_reverse) to prevent GC from running on message application for a query
} else { } else {
STATUS_VALUE(BRT_MSN_DISCARDS)++; STATUS_VALUE(BRT_MSN_DISCARDS)++;
} }
......
...@@ -2741,7 +2741,7 @@ static void add_pair_to_leafnode (struct leaf_buf *lbuf, unsigned char *key, int ...@@ -2741,7 +2741,7 @@ static void add_pair_to_leafnode (struct leaf_buf *lbuf, unsigned char *key, int
DBT theval = { .data = val, .size = vallen }; DBT theval = { .data = val, .size = vallen };
BRT_MSG_S cmd = { BRT_INSERT, ZERO_MSN, lbuf->xids, .u.id = { &thekey, &theval } }; BRT_MSG_S cmd = { BRT_INSERT, ZERO_MSN, lbuf->xids, .u.id = { &thekey, &theval } };
uint64_t workdone=0; uint64_t workdone=0;
brt_leaf_apply_cmd_once(leafnode, BLB(leafnode,0), &cmd, idx, NULL, NULL, NULL, NULL, &workdone); brt_leaf_apply_cmd_once(leafnode, BLB(leafnode,0), &cmd, idx, NULL, &workdone);
} }
static int write_literal(struct dbout *out, void*data, size_t len) { static int write_literal(struct dbout *out, void*data, size_t len) {
......
...@@ -39,7 +39,7 @@ append_leaf(BRTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen ...@@ -39,7 +39,7 @@ append_leaf(BRTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen
// apply an insert to the leaf node // apply an insert to the leaf node
BRT_MSG_S cmd = { BRT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &theval } }; BRT_MSG_S cmd = { BRT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &theval } };
brt_leaf_apply_cmd_once(leafnode, BLB(leafnode,0), &cmd, idx, NULL, NULL, NULL, NULL, NULL); brt_leaf_apply_cmd_once(leafnode, BLB(leafnode,0), &cmd, idx, NULL, NULL);
leafnode->max_msn_applied_to_node_on_disk = msn; leafnode->max_msn_applied_to_node_on_disk = msn;
......
...@@ -47,7 +47,7 @@ append_leaf(BRT brt, BRTNODE leafnode, void *key, size_t keylen, void *val, size ...@@ -47,7 +47,7 @@ append_leaf(BRT brt, BRTNODE leafnode, void *key, size_t keylen, void *val, size
BRT_MSG_S cmd = { BRT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &theval } }; BRT_MSG_S cmd = { BRT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &theval } };
u_int64_t workdone=0; u_int64_t workdone=0;
toku_apply_cmd_to_leaf(brt->compare_fun, brt->update_fun, &brt->h->cmp_descriptor, leafnode, &cmd, &workdone, NULL, NULL, NULL); toku_apply_cmd_to_leaf(brt->compare_fun, brt->update_fun, &brt->h->cmp_descriptor, leafnode, &cmd, &workdone);
{ {
int r = toku_brt_lookup(brt, &thekey, lookup_checkf, &pair); int r = toku_brt_lookup(brt, &thekey, lookup_checkf, &pair);
assert(r==0); assert(r==0);
...@@ -55,7 +55,7 @@ append_leaf(BRT brt, BRTNODE leafnode, void *key, size_t keylen, void *val, size ...@@ -55,7 +55,7 @@ append_leaf(BRT brt, BRTNODE leafnode, void *key, size_t keylen, void *val, size
} }
BRT_MSG_S badcmd = { BRT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &badval } }; BRT_MSG_S badcmd = { BRT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &badval } };
toku_apply_cmd_to_leaf(brt->compare_fun, brt->update_fun, &brt->h->cmp_descriptor, leafnode, &badcmd, &workdone, NULL, NULL, NULL); toku_apply_cmd_to_leaf(brt->compare_fun, brt->update_fun, &brt->h->cmp_descriptor, leafnode, &badcmd, &workdone);
// message should be rejected for duplicate msn, row should still have original val // message should be rejected for duplicate msn, row should still have original val
...@@ -68,7 +68,7 @@ append_leaf(BRT brt, BRTNODE leafnode, void *key, size_t keylen, void *val, size ...@@ -68,7 +68,7 @@ append_leaf(BRT brt, BRTNODE leafnode, void *key, size_t keylen, void *val, size
// now verify that message with proper msn gets through // now verify that message with proper msn gets through
msn = next_dummymsn(); msn = next_dummymsn();
BRT_MSG_S cmd2 = { BRT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &val2 } }; BRT_MSG_S cmd2 = { BRT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &val2 } };
toku_apply_cmd_to_leaf(brt->compare_fun, brt->update_fun, &brt->h->cmp_descriptor, leafnode, &cmd2, &workdone, NULL, NULL, NULL); toku_apply_cmd_to_leaf(brt->compare_fun, brt->update_fun, &brt->h->cmp_descriptor, leafnode, &cmd2, &workdone);
// message should be accepted, val should have new value // message should be accepted, val should have new value
{ {
...@@ -80,7 +80,7 @@ append_leaf(BRT brt, BRTNODE leafnode, void *key, size_t keylen, void *val, size ...@@ -80,7 +80,7 @@ append_leaf(BRT brt, BRTNODE leafnode, void *key, size_t keylen, void *val, size
// now verify that message with lesser (older) msn is rejected // now verify that message with lesser (older) msn is rejected
msn.msn = msn.msn - 10; msn.msn = msn.msn - 10;
BRT_MSG_S cmd3 = { BRT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &badval } }; BRT_MSG_S cmd3 = { BRT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &badval } };
toku_apply_cmd_to_leaf(brt->compare_fun, brt->update_fun, &brt->h->cmp_descriptor, leafnode, &cmd3, &workdone, NULL, NULL, NULL); toku_apply_cmd_to_leaf(brt->compare_fun, brt->update_fun, &brt->h->cmp_descriptor, leafnode, &cmd3, &workdone);
// message should be rejected, val should still have value in pair2 // message should be rejected, val should still have value in pair2
{ {
......
...@@ -125,9 +125,9 @@ insert_random_message_to_leaf(BRT t, BRTNODE leafnode, BASEMENTNODE blb, LEAFENT ...@@ -125,9 +125,9 @@ insert_random_message_to_leaf(BRT t, BRTNODE leafnode, BASEMENTNODE blb, LEAFENT
msg.u.id.val = valdbt; msg.u.id.val = valdbt;
size_t memsize; size_t memsize;
int64_t numbytes; int64_t numbytes;
int r = apply_msg_to_leafentry(&msg, NULL, &memsize, save, NULL, NULL, NULL, NULL, NULL, NULL, &numbytes); int r = apply_msg_to_leafentry(&msg, NULL, &memsize, save, NULL, NULL, NULL, &numbytes);
assert_zero(r); assert_zero(r);
brt_leaf_put_cmd(t->compare_fun, t->update_fun, NULL, leafnode, blb, &msg, NULL, NULL, NULL, NULL); brt_leaf_put_cmd(t->compare_fun, t->update_fun, NULL, leafnode, blb, &msg, NULL);
if (msn.msn > blb->max_msn_applied.msn) { if (msn.msn > blb->max_msn_applied.msn) {
blb->max_msn_applied = msn; blb->max_msn_applied = msn;
} }
...@@ -166,13 +166,13 @@ insert_same_message_to_leaves(BRT t, BRTNODE child1, BASEMENTNODE blb1, BRTNODE ...@@ -166,13 +166,13 @@ insert_same_message_to_leaves(BRT t, BRTNODE child1, BASEMENTNODE blb1, BRTNODE
msg.u.id.val = valdbt; msg.u.id.val = valdbt;
size_t memsize; size_t memsize;
int64_t numbytes; int64_t numbytes;
int r = apply_msg_to_leafentry(&msg, NULL, &memsize, save, NULL, NULL, NULL, NULL, NULL, NULL, &numbytes); int r = apply_msg_to_leafentry(&msg, NULL, &memsize, save, NULL, NULL, NULL, &numbytes);
assert_zero(r); assert_zero(r);
brt_leaf_put_cmd(t->compare_fun, t->update_fun, NULL, child1, blb1, &msg, NULL, NULL, NULL, NULL); brt_leaf_put_cmd(t->compare_fun, t->update_fun, NULL, child1, blb1, &msg, NULL);
if (msn.msn > blb1->max_msn_applied.msn) { if (msn.msn > blb1->max_msn_applied.msn) {
blb1->max_msn_applied = msn; blb1->max_msn_applied = msn;
} }
brt_leaf_put_cmd(t->compare_fun, t->update_fun, NULL, child2, blb2, &msg, NULL, NULL, NULL, NULL); brt_leaf_put_cmd(t->compare_fun, t->update_fun, NULL, child2, blb2, &msg, NULL);
if (msn.msn > blb2->max_msn_applied.msn) { if (msn.msn > blb2->max_msn_applied.msn) {
blb2->max_msn_applied = msn; blb2->max_msn_applied = msn;
} }
...@@ -584,7 +584,7 @@ flush_to_leaf(BRT t, bool make_leaf_up_to_date, bool use_flush) { ...@@ -584,7 +584,7 @@ flush_to_leaf(BRT t, bool make_leaf_up_to_date, bool use_flush) {
if (make_leaf_up_to_date) { if (make_leaf_up_to_date) {
for (i = 0; i < num_parent_messages; ++i) { for (i = 0; i < num_parent_messages; ++i) {
if (!parent_messages_is_fresh[i]) { if (!parent_messages_is_fresh[i]) {
toku_apply_cmd_to_leaf(t->compare_fun, t->update_fun, &t->h->descriptor, child, parent_messages[i], NULL, NULL, NULL, NULL); toku_apply_cmd_to_leaf(t->compare_fun, t->update_fun, &t->h->descriptor, child, parent_messages[i], NULL);
} }
} }
for (i = 0; i < 8; ++i) { for (i = 0; i < 8; ++i) {
...@@ -808,7 +808,7 @@ flush_to_leaf_with_keyrange(BRT t, bool make_leaf_up_to_date) { ...@@ -808,7 +808,7 @@ flush_to_leaf_with_keyrange(BRT t, bool make_leaf_up_to_date) {
for (i = 0; i < num_parent_messages; ++i) { for (i = 0; i < num_parent_messages; ++i) {
if (dummy_cmp(NULL, parent_messages[i]->u.id.key, &childkeys[7]) <= 0 && if (dummy_cmp(NULL, parent_messages[i]->u.id.key, &childkeys[7]) <= 0 &&
!parent_messages_is_fresh[i]) { !parent_messages_is_fresh[i]) {
toku_apply_cmd_to_leaf(t->compare_fun, t->update_fun, &t->h->descriptor, child, parent_messages[i], NULL, NULL, NULL, NULL); toku_apply_cmd_to_leaf(t->compare_fun, t->update_fun, &t->h->descriptor, child, parent_messages[i], NULL);
} }
} }
for (i = 0; i < 8; ++i) { for (i = 0; i < 8; ++i) {
...@@ -997,8 +997,8 @@ compare_apply_and_flush(BRT t, bool make_leaf_up_to_date) { ...@@ -997,8 +997,8 @@ compare_apply_and_flush(BRT t, bool make_leaf_up_to_date) {
if (make_leaf_up_to_date) { if (make_leaf_up_to_date) {
for (i = 0; i < num_parent_messages; ++i) { for (i = 0; i < num_parent_messages; ++i) {
if (!parent_messages_is_fresh[i]) { if (!parent_messages_is_fresh[i]) {
toku_apply_cmd_to_leaf(t->compare_fun, t->update_fun, &t->h->descriptor, child1, parent_messages[i], NULL, NULL, NULL, NULL); toku_apply_cmd_to_leaf(t->compare_fun, t->update_fun, &t->h->descriptor, child1, parent_messages[i], NULL);
toku_apply_cmd_to_leaf(t->compare_fun, t->update_fun, &t->h->descriptor, child2, parent_messages[i], NULL, NULL, NULL, NULL); toku_apply_cmd_to_leaf(t->compare_fun, t->update_fun, &t->h->descriptor, child2, parent_messages[i], NULL);
} }
} }
for (i = 0; i < 8; ++i) { for (i = 0; i < 8; ++i) {
......
...@@ -399,7 +399,7 @@ test_le_apply(ULE ule_initial, BRT_MSG msg, ULE ule_expected) { ...@@ -399,7 +399,7 @@ test_le_apply(ULE ule_initial, BRT_MSG msg, ULE ule_expected) {
&result_memsize, &result_memsize,
&le_result, &le_result,
NULL, NULL,
NULL, NULL, NULL, NULL, NULL, &ignoreme); NULL, NULL, &ignoreme);
CKERR(r); CKERR(r);
if (le_result) if (le_result)
......
...@@ -42,7 +42,7 @@ append_leaf(BRTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen ...@@ -42,7 +42,7 @@ append_leaf(BRTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen
// apply an insert to the leaf node // apply an insert to the leaf node
BRT_MSG_S cmd = { BRT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &theval } }; BRT_MSG_S cmd = { BRT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &theval } };
brt_leaf_apply_cmd_once(leafnode, BLB(leafnode, 0), &cmd, idx, NULL, NULL, NULL, NULL, NULL); brt_leaf_apply_cmd_once(leafnode, BLB(leafnode, 0), &cmd, idx, NULL, NULL);
// Create bad tree (don't do following): // Create bad tree (don't do following):
// leafnode->max_msn_applied_to_node = msn; // leafnode->max_msn_applied_to_node = msn;
......
...@@ -30,7 +30,7 @@ append_leaf(BRTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen ...@@ -30,7 +30,7 @@ append_leaf(BRTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen
// apply an insert to the leaf node // apply an insert to the leaf node
MSN msn = next_dummymsn(); MSN msn = next_dummymsn();
BRT_MSG_S cmd = { BRT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &theval } }; BRT_MSG_S cmd = { BRT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &theval } };
brt_leaf_apply_cmd_once(leafnode, BLB(leafnode, 0), &cmd, idx, NULL, NULL, NULL, NULL, NULL); brt_leaf_apply_cmd_once(leafnode, BLB(leafnode, 0), &cmd, idx, NULL, NULL);
// dont forget to dirty the node // dont forget to dirty the node
leafnode->dirty = 1; leafnode->dirty = 1;
......
...@@ -31,7 +31,7 @@ append_leaf(BRTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen ...@@ -31,7 +31,7 @@ append_leaf(BRTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen
// apply an insert to the leaf node // apply an insert to the leaf node
MSN msn = next_dummymsn(); MSN msn = next_dummymsn();
BRT_MSG_S cmd = { BRT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &theval } }; BRT_MSG_S cmd = { BRT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &theval } };
brt_leaf_apply_cmd_once(leafnode, BLB(leafnode, 0), &cmd, idx, NULL, NULL, NULL, NULL, NULL); brt_leaf_apply_cmd_once(leafnode, BLB(leafnode, 0), &cmd, idx, NULL, NULL);
// dont forget to dirty the node // dont forget to dirty the node
leafnode->dirty = 1; leafnode->dirty = 1;
......
...@@ -30,7 +30,7 @@ append_leaf(BRTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen ...@@ -30,7 +30,7 @@ append_leaf(BRTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen
// apply an insert to the leaf node // apply an insert to the leaf node
MSN msn = next_dummymsn(); MSN msn = next_dummymsn();
BRT_MSG_S cmd = { BRT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &theval } }; BRT_MSG_S cmd = { BRT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &theval } };
brt_leaf_apply_cmd_once(leafnode, BLB(leafnode, 0), &cmd, idx, NULL, NULL, NULL, NULL, NULL); brt_leaf_apply_cmd_once(leafnode, BLB(leafnode, 0), &cmd, idx, NULL, NULL);
// dont forget to dirty the node // dont forget to dirty the node
leafnode->dirty = 1; leafnode->dirty = 1;
......
...@@ -31,7 +31,7 @@ append_leaf(BRTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen ...@@ -31,7 +31,7 @@ append_leaf(BRTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen
// apply an insert to the leaf node // apply an insert to the leaf node
MSN msn = next_dummymsn(); MSN msn = next_dummymsn();
BRT_MSG_S cmd = { BRT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &theval } }; BRT_MSG_S cmd = { BRT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &theval } };
brt_leaf_apply_cmd_once(leafnode, BLB(leafnode,0), &cmd, idx, NULL, NULL, NULL, NULL, NULL); brt_leaf_apply_cmd_once(leafnode, BLB(leafnode,0), &cmd, idx, NULL, NULL);
// dont forget to dirty the node // dont forget to dirty the node
leafnode->dirty = 1; leafnode->dirty = 1;
......
...@@ -31,7 +31,7 @@ append_leaf(BRTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen ...@@ -31,7 +31,7 @@ append_leaf(BRTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen
// apply an insert to the leaf node // apply an insert to the leaf node
MSN msn = next_dummymsn(); MSN msn = next_dummymsn();
BRT_MSG_S cmd = { BRT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &theval } }; BRT_MSG_S cmd = { BRT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &theval } };
brt_leaf_apply_cmd_once(leafnode, BLB(leafnode, 0), &cmd, idx, NULL, NULL, NULL, NULL, NULL); brt_leaf_apply_cmd_once(leafnode, BLB(leafnode, 0), &cmd, idx, NULL, NULL);
// dont forget to dirty the node // dont forget to dirty the node
leafnode->dirty = 1; leafnode->dirty = 1;
......
...@@ -30,7 +30,7 @@ append_leaf(BRTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen ...@@ -30,7 +30,7 @@ append_leaf(BRTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen
// apply an insert to the leaf node // apply an insert to the leaf node
MSN msn = next_dummymsn(); MSN msn = next_dummymsn();
BRT_MSG_S cmd = { BRT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &theval } }; BRT_MSG_S cmd = { BRT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &theval } };
brt_leaf_apply_cmd_once(leafnode, BLB(leafnode, 0), &cmd, idx, NULL, NULL, NULL, NULL, NULL); brt_leaf_apply_cmd_once(leafnode, BLB(leafnode, 0), &cmd, idx, NULL, NULL);
// dont forget to dirty the node // dont forget to dirty the node
leafnode->dirty = 1; leafnode->dirty = 1;
......
...@@ -344,9 +344,6 @@ apply_msg_to_leafentry(BRT_MSG msg, // message to apply to leafentry ...@@ -344,9 +344,6 @@ apply_msg_to_leafentry(BRT_MSG msg, // message to apply to leafentry
OMT omt, OMT omt,
struct mempool *mp, struct mempool *mp,
void **maybe_free, void **maybe_free,
OMT snapshot_xids,
OMT live_list_reverse,
OMT live_root_txns,
int64_t * numbytes_delta_p) { // change in total size of key and val, not including any overhead int64_t * numbytes_delta_p) { // change in total size of key and val, not including any overhead
ULE_S ule; ULE_S ule;
int rval; int rval;
...@@ -360,9 +357,6 @@ apply_msg_to_leafentry(BRT_MSG msg, // message to apply to leafentry ...@@ -360,9 +357,6 @@ apply_msg_to_leafentry(BRT_MSG msg, // message to apply to leafentry
oldnumbytes = ule_get_innermost_numbytes(&ule); oldnumbytes = ule_get_innermost_numbytes(&ule);
} }
msg_modify_ule(&ule, msg); // modify unpacked leafentry msg_modify_ule(&ule, msg); // modify unpacked leafentry
if (snapshot_xids && live_list_reverse && live_root_txns) {
garbage_collection(&ule, snapshot_xids, live_list_reverse, live_root_txns);
}
rval = le_pack(&ule, // create packed leafentry rval = le_pack(&ule, // create packed leafentry
new_leafentry_memorysize, new_leafentry_memorysize,
new_leafentry_p, new_leafentry_p,
......
...@@ -59,9 +59,6 @@ int apply_msg_to_leafentry(BRT_MSG msg, ...@@ -59,9 +59,6 @@ int apply_msg_to_leafentry(BRT_MSG msg,
OMT omt, OMT omt,
struct mempool *mp, struct mempool *mp,
void **maybe_free, void **maybe_free,
OMT snapshot_xids,
OMT live_list_reverse,
OMT live_root_txns,
int64_t * numbytes_delta_p); int64_t * numbytes_delta_p);
int garbage_collect_leafentry(LEAFENTRY old_leaf_entry, int garbage_collect_leafentry(LEAFENTRY old_leaf_entry,
......
...@@ -109,7 +109,9 @@ run_test (void) { ...@@ -109,7 +109,9 @@ run_test (void) {
r = txn->commit(txn, 0); CKERR(r); r = txn->commit(txn, 0); CKERR(r);
r = db->stat64(db, NULL, &s); CKERR(r); r = db->stat64(db, NULL, &s); CKERR(r);
assert(s.bt_nkeys <= 1 && s.bt_dsize == 0); // garbage collection is not happening here yet, so
// the number of keys should be 1
assert(s.bt_nkeys == 1 && s.bt_dsize == 0);
} }
// verify update of non-existing key inserts a row // verify update of non-existing key inserts a row
...@@ -123,7 +125,7 @@ run_test (void) { ...@@ -123,7 +125,7 @@ run_test (void) {
DB_BTREE_STAT64 s; DB_BTREE_STAT64 s;
r = db->stat64(db, NULL, &s); CKERR(r); r = db->stat64(db, NULL, &s); CKERR(r);
assert(s.bt_nkeys == 1 && s.bt_dsize == sizeof key + sizeof val); assert(s.bt_nkeys == 2 && s.bt_dsize == sizeof key + sizeof val);
r = db->close(db, 0); CKERR(r); r = db->close(db, 0); CKERR(r);
...@@ -133,7 +135,7 @@ run_test (void) { ...@@ -133,7 +135,7 @@ run_test (void) {
r = txn->commit(txn, 0); CKERR(r); r = txn->commit(txn, 0); CKERR(r);
r = db->stat64(db, NULL, &s); CKERR(r); r = db->stat64(db, NULL, &s); CKERR(r);
assert(s.bt_nkeys == 1 && s.bt_dsize == sizeof key + sizeof val); assert(s.bt_nkeys == 2 && s.bt_dsize == sizeof key + sizeof val);
} }
// verify update callback overwrites the row // verify update callback overwrites the row
...@@ -147,7 +149,7 @@ run_test (void) { ...@@ -147,7 +149,7 @@ run_test (void) {
DB_BTREE_STAT64 s; DB_BTREE_STAT64 s;
r = db->stat64(db, NULL, &s); CKERR(r); r = db->stat64(db, NULL, &s); CKERR(r);
assert(s.bt_nkeys == 1 && s.bt_dsize == sizeof key + sizeof val); assert(s.bt_nkeys == 2 && s.bt_dsize == sizeof key + sizeof val);
r = db->close(db, 0); CKERR(r); r = db->close(db, 0); CKERR(r);
...@@ -157,7 +159,7 @@ run_test (void) { ...@@ -157,7 +159,7 @@ run_test (void) {
r = txn->commit(txn, 0); CKERR(r); r = txn->commit(txn, 0); CKERR(r);
r = db->stat64(db, NULL, &s); CKERR(r); r = db->stat64(db, NULL, &s); CKERR(r);
assert(s.bt_nkeys == 1 && s.bt_dsize == sizeof key + sizeof val); assert(s.bt_nkeys == 2 && s.bt_dsize == sizeof key + sizeof val);
} }
// verify update callback deletes the row // verify update callback deletes the row
...@@ -172,7 +174,7 @@ run_test (void) { ...@@ -172,7 +174,7 @@ run_test (void) {
DB_BTREE_STAT64 s; DB_BTREE_STAT64 s;
r = db->stat64(db, NULL, &s); CKERR(r); r = db->stat64(db, NULL, &s); CKERR(r);
assert(s.bt_nkeys == 1 && s.bt_dsize == sizeof key + sizeof val); assert(s.bt_nkeys <= 2 && s.bt_dsize == sizeof key + sizeof val);
// update it again, this should delete the row // update it again, this should delete the row
r = env->txn_begin(env, 0, &txn, 0); CKERR(r); r = env->txn_begin(env, 0, &txn, 0); CKERR(r);
...@@ -180,7 +182,7 @@ run_test (void) { ...@@ -180,7 +182,7 @@ run_test (void) {
r = txn->commit(txn, 0); CKERR(r); r = txn->commit(txn, 0); CKERR(r);
r = db->stat64(db, NULL, &s); CKERR(r); r = db->stat64(db, NULL, &s); CKERR(r);
assert(s.bt_nkeys <= 1 && s.bt_dsize == 0); // since garbage collection may not occur, the key count may not be updated assert(s.bt_nkeys <= 2 && s.bt_dsize == 0); // since garbage collection may not occur, the key count may not be updated
r = db->close(db, 0); CKERR(r); r = db->close(db, 0); CKERR(r);
...@@ -190,7 +192,7 @@ run_test (void) { ...@@ -190,7 +192,7 @@ run_test (void) {
r = txn->commit(txn, 0); CKERR(r); r = txn->commit(txn, 0); CKERR(r);
r = db->stat64(db, NULL, &s); CKERR(r); r = db->stat64(db, NULL, &s); CKERR(r);
assert(s.bt_nkeys <= 1 && s.bt_dsize == 0); assert(s.bt_nkeys <= 2 && s.bt_dsize == 0);
} }
r = db->close(db, 0); CKERR(r); r = db->close(db, 0); CKERR(r);
......
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