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 (
const BRT_MSG cmd,
u_int32_t idx,
LEAFENTRY le,
OMT snapshot_xids,
OMT live_list_reverse,
OMT live_root_txns,
uint64_t *workdonep
);
......@@ -916,10 +913,7 @@ brt_leaf_put_cmd (
BRTNODE leafnode,
BASEMENTNODE bn,
BRT_MSG cmd,
uint64_t *workdone,
OMT snapshot_txnids,
OMT live_list_reverse,
OMT live_root_txns
uint64_t *workdone
);
void toku_apply_cmd_to_leaf(
......@@ -928,10 +922,7 @@ void toku_apply_cmd_to_leaf(
DESCRIPTOR desc,
BRTNODE node,
BRT_MSG cmd,
uint64_t *workdone,
OMT snapshot_txnids,
OMT live_list_reverse,
OMT live_root_txns
uint64_t *workdone
);
// FIXME needs toku prefix
......@@ -941,10 +932,7 @@ void brtnode_put_cmd (
DESCRIPTOR desc,
BRTNODE node,
BRT_MSG cmd,
bool is_fresh,
OMT snapshot_txnids,
OMT live_list_reverse,
OMT live_root_txns
bool is_fresh
);
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
&brt->h->cmp_descriptor,
node,
&cmd,
true,
NULL,
NULL,
NULL
true
);
toku_verify_or_set_counts(node);
......
......@@ -1461,9 +1461,6 @@ brt_leaf_apply_cmd_once (
const BRT_MSG cmd,
u_int32_t idx,
LEAFENTRY le,
OMT snapshot_xids,
OMT live_list_reverse,
OMT live_root_txns,
uint64_t *workdone
)
// Effect: Apply cmd to leafentry (msn is ignored)
......@@ -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
// 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);
}
......@@ -1557,9 +1554,6 @@ struct setval_extra_s {
const DBT *key;
u_int32_t idx;
LEAFENTRY le;
OMT snapshot_txnids;
OMT live_list_reverse;
OMT live_root_txns;
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) {
}
brt_leaf_apply_cmd_once(svextra->leafnode, svextra->bn, &msg,
svextra->idx, svextra->le,
svextra->snapshot_txnids, svextra->live_list_reverse, svextra->live_root_txns,
svextra->workdone);
svextra->setval_r = 0;
}
......@@ -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
// 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,
LEAFENTRY le, OMT snapshot_txnids, OMT live_list_reverse, OMT live_root_txns,
LEAFENTRY le,
uint64_t * workdone) {
LEAFENTRY le_for_update;
DBT key;
......@@ -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,
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()
FAKE_DB(db, desc);
int r = update_fun(
......@@ -1669,10 +1662,7 @@ brt_leaf_put_cmd (
BRTNODE leafnode, // bn is within leafnode
BASEMENTNODE bn,
BRT_MSG cmd,
uint64_t *workdone,
OMT snapshot_txnids,
OMT live_list_reverse,
OMT live_root_txns
uint64_t *workdone
)
// Effect:
// Put a cmd into a leaf.
......@@ -1712,7 +1702,7 @@ brt_leaf_put_cmd (
assert(r==0);
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
// the leaf then it is sequential
......@@ -1744,7 +1734,7 @@ brt_leaf_put_cmd (
while (1) {
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.
......@@ -1790,7 +1780,7 @@ brt_leaf_put_cmd (
storeddata=storeddatav;
int deleted = 0;
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);
if (new_omt_size != omt_size) {
assert(new_omt_size+1 == omt_size);
......@@ -1816,7 +1806,7 @@ brt_leaf_put_cmd (
storeddata=storeddatav;
int deleted = 0;
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);
if (new_omt_size != omt_size) {
assert(new_omt_size+1 == omt_size);
......@@ -1837,10 +1827,10 @@ brt_leaf_put_cmd (
r = toku_omt_find_zero(bn->buffer, toku_cmd_leafval_heaviside, &be,
&storeddatav, &idx);
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) {
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
break;
}
......@@ -1852,7 +1842,7 @@ brt_leaf_put_cmd (
r = toku_omt_fetch(bn->buffer, idx, &storeddatav);
assert(r==0);
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()
// and VERIFY_NODE() never get called. Is this a problem?
assert(r==0);
......@@ -2328,10 +2318,7 @@ toku_bnc_flush_to_child(
desc,
child,
&brtcmd,
is_fresh,
NULL, // pass NULL omts (snapshot_txnids and live_list_reverse)
NULL, // we're going to handle GC ourselves next
NULL
is_fresh
);
}));
......@@ -2397,10 +2384,7 @@ brtnode_put_cmd (
DESCRIPTOR desc,
BRTNODE node,
BRT_MSG cmd,
bool is_fresh,
OMT snapshot_txnids,
OMT live_list_reverse,
OMT live_root_txns
bool is_fresh
)
// Effect: Push CMD into the subtree rooted at NODE.
// If NODE is a leaf, then
......@@ -2423,10 +2407,7 @@ brtnode_put_cmd (
desc,
node,
cmd,
&workdone,
snapshot_txnids,
live_list_reverse,
live_root_txns
&workdone
);
} else {
brt_nonleaf_put_cmd(compare_fun, desc, node, cmd, is_fresh);
......@@ -2446,10 +2427,7 @@ void toku_apply_cmd_to_leaf(
DESCRIPTOR desc,
BRTNODE node,
BRT_MSG cmd,
uint64_t *workdone,
OMT snapshot_txnids,
OMT live_list_reverse,
OMT live_root_txns
uint64_t *workdone
)
{
VERIFY_NODE(t, node);
......@@ -2490,10 +2468,7 @@ void toku_apply_cmd_to_leaf(
node,
BLB(node, childnum),
cmd,
workdone,
snapshot_txnids,
live_list_reverse,
live_root_txns);
workdone);
} else {
STATUS_VALUE(BRT_MSN_DISCARDS)++;
}
......@@ -2508,10 +2483,7 @@ void toku_apply_cmd_to_leaf(
node,
BLB(node, childnum),
cmd,
workdone,
snapshot_txnids,
live_list_reverse,
live_root_txns);
workdone);
} else {
STATUS_VALUE(BRT_MSN_DISCARDS)++;
}
......@@ -2529,10 +2501,6 @@ static void push_something_at_root (struct brt_header *h, BRTNODE *nodep, BRT_MS
{
BRTNODE node = *nodep;
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;
invariant(cmd_msn.msn > node->max_msn_applied_to_node_on_disk.msn);
brtnode_put_cmd(
......@@ -2541,10 +2509,7 @@ static void push_something_at_root (struct brt_header *h, BRTNODE *nodep, BRT_MS
&h->cmp_descriptor,
node,
cmd,
true,
snapshot_txnids,
live_list_reverse,
live_root_txns
true
);
//
// assumption is that brtnode_put_cmd will
......@@ -3944,7 +3909,7 @@ do_brt_leaf_put_cmd(BRT t, BRTNODE leafnode, BASEMENTNODE bn, BRTNODE ancestor,
toku_fill_dbt(&hk, key, keylen);
DBT hv;
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 {
STATUS_VALUE(BRT_MSN_DISCARDS)++;
}
......
......@@ -2741,7 +2741,7 @@ static void add_pair_to_leafnode (struct leaf_buf *lbuf, unsigned char *key, int
DBT theval = { .data = val, .size = vallen };
BRT_MSG_S cmd = { BRT_INSERT, ZERO_MSN, lbuf->xids, .u.id = { &thekey, &theval } };
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) {
......
......@@ -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
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;
......
......@@ -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 } };
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);
assert(r==0);
......@@ -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 } };
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
......@@ -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
msn = next_dummymsn();
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
{
......@@ -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
msn.msn = msn.msn - 10;
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
{
......
......@@ -125,9 +125,9 @@ insert_random_message_to_leaf(BRT t, BRTNODE leafnode, BASEMENTNODE blb, LEAFENT
msg.u.id.val = valdbt;
size_t memsize;
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);
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) {
blb->max_msn_applied = msn;
}
......@@ -166,13 +166,13 @@ insert_same_message_to_leaves(BRT t, BRTNODE child1, BASEMENTNODE blb1, BRTNODE
msg.u.id.val = valdbt;
size_t memsize;
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);
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) {
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) {
blb2->max_msn_applied = msn;
}
......@@ -584,7 +584,7 @@ flush_to_leaf(BRT t, bool make_leaf_up_to_date, bool use_flush) {
if (make_leaf_up_to_date) {
for (i = 0; i < num_parent_messages; ++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) {
......@@ -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) {
if (dummy_cmp(NULL, parent_messages[i]->u.id.key, &childkeys[7]) <= 0 &&
!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) {
......@@ -997,8 +997,8 @@ compare_apply_and_flush(BRT t, bool make_leaf_up_to_date) {
if (make_leaf_up_to_date) {
for (i = 0; i < num_parent_messages; ++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, child2, 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);
}
}
for (i = 0; i < 8; ++i) {
......
......@@ -399,7 +399,7 @@ test_le_apply(ULE ule_initial, BRT_MSG msg, ULE ule_expected) {
&result_memsize,
&le_result,
NULL,
NULL, NULL, NULL, NULL, NULL, &ignoreme);
NULL, NULL, &ignoreme);
CKERR(r);
if (le_result)
......
......@@ -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
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):
// 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
// apply an insert to the leaf node
MSN msn = next_dummymsn();
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
leafnode->dirty = 1;
......
......@@ -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
MSN msn = next_dummymsn();
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
leafnode->dirty = 1;
......
......@@ -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
MSN msn = next_dummymsn();
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
leafnode->dirty = 1;
......
......@@ -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
MSN msn = next_dummymsn();
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
leafnode->dirty = 1;
......
......@@ -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
MSN msn = next_dummymsn();
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
leafnode->dirty = 1;
......
......@@ -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
MSN msn = next_dummymsn();
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
leafnode->dirty = 1;
......
......@@ -344,9 +344,6 @@ apply_msg_to_leafentry(BRT_MSG msg, // message to apply to leafentry
OMT omt,
struct mempool *mp,
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
ULE_S ule;
int rval;
......@@ -360,9 +357,6 @@ apply_msg_to_leafentry(BRT_MSG msg, // message to apply to leafentry
oldnumbytes = ule_get_innermost_numbytes(&ule);
}
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
new_leafentry_memorysize,
new_leafentry_p,
......
......@@ -59,9 +59,6 @@ int apply_msg_to_leafentry(BRT_MSG msg,
OMT omt,
struct mempool *mp,
void **maybe_free,
OMT snapshot_xids,
OMT live_list_reverse,
OMT live_root_txns,
int64_t * numbytes_delta_p);
int garbage_collect_leafentry(LEAFENTRY old_leaf_entry,
......
......@@ -109,7 +109,9 @@ run_test (void) {
r = txn->commit(txn, 0); 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
......@@ -123,7 +125,7 @@ run_test (void) {
DB_BTREE_STAT64 s;
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);
......@@ -133,7 +135,7 @@ run_test (void) {
r = txn->commit(txn, 0); 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
......@@ -147,7 +149,7 @@ run_test (void) {
DB_BTREE_STAT64 s;
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);
......@@ -157,7 +159,7 @@ run_test (void) {
r = txn->commit(txn, 0); 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
......@@ -172,7 +174,7 @@ run_test (void) {
DB_BTREE_STAT64 s;
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
r = env->txn_begin(env, 0, &txn, 0); CKERR(r);
......@@ -180,7 +182,7 @@ run_test (void) {
r = txn->commit(txn, 0); 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);
......@@ -190,7 +192,7 @@ run_test (void) {
r = txn->commit(txn, 0); 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);
......
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