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

[t:4741], more simplifications

git-svn-id: file:///svn/toku/tokudb@43542 c7de825b-a66e-492c-adef-691d508d4ae1
parent 6f9fddc7
...@@ -892,7 +892,8 @@ brt_leaf_apply_cmd_once ( ...@@ -892,7 +892,8 @@ 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,
uint64_t *workdonep uint64_t *workdonep,
STAT64INFO stats_to_update
); );
// FIXME needs toku prefix // FIXME needs toku prefix
...@@ -904,7 +905,8 @@ brt_leaf_put_cmd ( ...@@ -904,7 +905,8 @@ brt_leaf_put_cmd (
BRTNODE leafnode, BRTNODE leafnode,
BASEMENTNODE bn, BASEMENTNODE bn,
BRT_MSG cmd, BRT_MSG cmd,
uint64_t *workdone uint64_t *workdone,
STAT64INFO stats_to_update
); );
void toku_apply_cmd_to_leaf( void toku_apply_cmd_to_leaf(
...@@ -913,7 +915,8 @@ void toku_apply_cmd_to_leaf( ...@@ -913,7 +915,8 @@ 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,
STAT64INFO stats_to_update
); );
// FIXME needs toku prefix // FIXME needs toku prefix
...@@ -923,7 +926,8 @@ void brtnode_put_cmd ( ...@@ -923,7 +926,8 @@ void brtnode_put_cmd (
DESCRIPTOR desc, DESCRIPTOR desc,
BRTNODE node, BRTNODE node,
BRT_MSG cmd, BRT_MSG cmd,
bool is_fresh bool is_fresh,
STAT64INFO stats_to_update
); );
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,7 +139,8 @@ int toku_testsetup_insert_to_leaf (BRT brt, BLOCKNUM blocknum, char *key, int ke ...@@ -139,7 +139,8 @@ 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
); );
toku_verify_or_set_counts(node); toku_verify_or_set_counts(node);
......
...@@ -1395,12 +1395,13 @@ brt_leaf_delete_leafentry ( ...@@ -1395,12 +1395,13 @@ brt_leaf_delete_leafentry (
void void
brt_leaf_apply_cmd_once ( brt_leaf_apply_cmd_once (
BRTNODE leafnode, BRTNODE UU(leafnode),
BASEMENTNODE bn, BASEMENTNODE bn,
const BRT_MSG cmd, const BRT_MSG cmd,
u_int32_t idx, u_int32_t idx,
LEAFENTRY le, LEAFENTRY le,
uint64_t *workdone uint64_t *workdone,
STAT64INFO stats_to_update
) )
// Effect: Apply cmd to leafentry (msn is ignored) // Effect: Apply cmd to leafentry (msn is ignored)
// Calculate work done by message on leafentry and add it to caller's workdone counter. // Calculate work done by message on leafentry and add it to caller's workdone counter.
...@@ -1473,9 +1474,12 @@ brt_leaf_apply_cmd_once ( ...@@ -1473,9 +1474,12 @@ brt_leaf_apply_cmd_once (
// now update stat64 statistics // now update stat64 statistics
bn->stat64_delta.numrows += numrows_delta; bn->stat64_delta.numrows += numrows_delta;
bn->stat64_delta.numbytes += numbytes_delta; bn->stat64_delta.numbytes += numbytes_delta;
// the only reason stats_to_update may be null is for tests
if (stats_to_update) {
stats_to_update->numrows += numrows_delta;
stats_to_update->numbytes += numbytes_delta;
}
STAT64INFO_S deltas = {.numrows = numrows_delta, .numbytes = numbytes_delta};
update_header_stats(&(leafnode->h->in_memory_stats), &(deltas));
} }
static const uint32_t setval_tag = 0xee0ccb99; // this was gotten by doing "cat /dev/random|head -c4|od -x" to get a random number. We want to make sure that the user actually passes us the setval_extra_s that we passed in. static const uint32_t setval_tag = 0xee0ccb99; // this was gotten by doing "cat /dev/random|head -c4|od -x" to get a random number. We want to make sure that the user actually passes us the setval_extra_s that we passed in.
...@@ -1492,6 +1496,7 @@ struct setval_extra_s { ...@@ -1492,6 +1496,7 @@ struct setval_extra_s {
u_int32_t idx; u_int32_t idx;
LEAFENTRY le; LEAFENTRY le;
uint64_t * workdone; // set by brt_leaf_apply_cmd_once() uint64_t * workdone; // set by brt_leaf_apply_cmd_once()
STAT64INFO stats_to_update;
}; };
/* /*
...@@ -1522,7 +1527,7 @@ static void setval_fun (const DBT *new_val, void *svextra_v) { ...@@ -1522,7 +1527,7 @@ 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->workdone); svextra->workdone, svextra->stats_to_update);
svextra->setval_r = 0; svextra->setval_r = 0;
} }
} }
...@@ -1533,7 +1538,8 @@ static void setval_fun (const DBT *new_val, void *svextra_v) { ...@@ -1533,7 +1538,8 @@ static void setval_fun (const DBT *new_val, void *svextra_v) {
// 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, LEAFENTRY le,
uint64_t * workdone) { uint64_t * workdone,
STAT64INFO stats_to_update) {
LEAFENTRY le_for_update; LEAFENTRY le_for_update;
DBT key; DBT key;
const DBT *keyp; const DBT *keyp;
...@@ -1575,7 +1581,7 @@ static int do_update(brt_update_func update_fun, DESCRIPTOR desc, BRTNODE leafno ...@@ -1575,7 +1581,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, workdone}; keyp, idx, le_for_update, workdone, stats_to_update};
// 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(
...@@ -1599,7 +1605,8 @@ brt_leaf_put_cmd ( ...@@ -1599,7 +1605,8 @@ 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,
STAT64INFO stats_to_update
) )
// Effect: // Effect:
// Put a cmd into a leaf. // Put a cmd into a leaf.
...@@ -1639,7 +1646,7 @@ brt_leaf_put_cmd ( ...@@ -1639,7 +1646,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, workdone); brt_leaf_apply_cmd_once(leafnode, bn, cmd, idx, storeddata, workdone, stats_to_update);
// 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
...@@ -1671,7 +1678,7 @@ brt_leaf_put_cmd ( ...@@ -1671,7 +1678,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, workdone); brt_leaf_apply_cmd_once(leafnode, bn, cmd, idx, storeddata, workdone, stats_to_update);
{ {
// Now we must find the next leafentry. // Now we must find the next leafentry.
...@@ -1717,7 +1724,7 @@ brt_leaf_put_cmd ( ...@@ -1717,7 +1724,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, workdone); brt_leaf_apply_cmd_once(leafnode, bn, cmd, idx, storeddata, workdone, stats_to_update);
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);
...@@ -1743,7 +1750,7 @@ brt_leaf_put_cmd ( ...@@ -1743,7 +1750,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, workdone); brt_leaf_apply_cmd_once(leafnode, bn, cmd, idx, storeddata, workdone, stats_to_update);
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);
...@@ -1764,10 +1771,10 @@ brt_leaf_put_cmd ( ...@@ -1764,10 +1771,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, workdone); r = do_update(update_fun, desc, leafnode, bn, cmd, idx, NULL, workdone, stats_to_update);
} else if (r==0) { } else if (r==0) {
storeddata=storeddatav; storeddata=storeddatav;
r = do_update(update_fun, desc, leafnode, bn, cmd, idx, storeddata, workdone); r = do_update(update_fun, desc, leafnode, bn, cmd, idx, storeddata, workdone, stats_to_update);
} // otherwise, a worse error, just return it } // otherwise, a worse error, just return it
break; break;
} }
...@@ -1779,7 +1786,7 @@ brt_leaf_put_cmd ( ...@@ -1779,7 +1786,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, workdone); r = do_update(update_fun, desc, leafnode, bn, cmd, idx, storeddata, workdone, stats_to_update);
// 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);
...@@ -2238,6 +2245,7 @@ toku_bnc_flush_to_child( ...@@ -2238,6 +2245,7 @@ toku_bnc_flush_to_child(
{ {
assert(bnc); assert(bnc);
assert(toku_fifo_n_entries(bnc->buffer)>0); assert(toku_fifo_n_entries(bnc->buffer)>0);
STAT64INFO_S stats_delta = {0,0};
FIFO_ITERATE( FIFO_ITERATE(
bnc->buffer, key, keylen, val, vallen, type, msn, xids, is_fresh, bnc->buffer, key, keylen, val, vallen, type, msn, xids, is_fresh,
({ ({
...@@ -2250,10 +2258,11 @@ toku_bnc_flush_to_child( ...@@ -2250,10 +2258,11 @@ toku_bnc_flush_to_child(
&h->cmp_descriptor, &h->cmp_descriptor,
child, child,
&brtcmd, &brtcmd,
is_fresh is_fresh,
&stats_delta
); );
})); }));
update_header_stats(&h->in_memory_stats, &stats_delta);
// Run garbage collection, if we are a leaf entry. // Run garbage collection, if we are a leaf entry.
TOKULOGGER logger = toku_cachefile_logger(h->cf); TOKULOGGER logger = toku_cachefile_logger(h->cf);
if (child->height == 0 && logger) { if (child->height == 0 && logger) {
...@@ -2316,7 +2325,8 @@ brtnode_put_cmd ( ...@@ -2316,7 +2325,8 @@ brtnode_put_cmd (
DESCRIPTOR desc, DESCRIPTOR desc,
BRTNODE node, BRTNODE node,
BRT_MSG cmd, BRT_MSG cmd,
bool is_fresh bool is_fresh,
STAT64INFO stats_to_update
) )
// 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
...@@ -2339,7 +2349,8 @@ brtnode_put_cmd ( ...@@ -2339,7 +2349,8 @@ brtnode_put_cmd (
desc, desc,
node, node,
cmd, cmd,
&workdone &workdone,
stats_to_update
); );
} else { } else {
brt_nonleaf_put_cmd(compare_fun, desc, node, cmd, is_fresh); brt_nonleaf_put_cmd(compare_fun, desc, node, cmd, is_fresh);
...@@ -2359,7 +2370,8 @@ void toku_apply_cmd_to_leaf( ...@@ -2359,7 +2370,8 @@ 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,
STAT64INFO stats_to_update
) )
{ {
VERIFY_NODE(t, node); VERIFY_NODE(t, node);
...@@ -2400,7 +2412,8 @@ void toku_apply_cmd_to_leaf( ...@@ -2400,7 +2412,8 @@ void toku_apply_cmd_to_leaf(
node, node,
BLB(node, childnum), BLB(node, childnum),
cmd, cmd,
workdone); workdone,
stats_to_update);
} else { } else {
STATUS_VALUE(BRT_MSN_DISCARDS)++; STATUS_VALUE(BRT_MSN_DISCARDS)++;
} }
...@@ -2415,7 +2428,8 @@ void toku_apply_cmd_to_leaf( ...@@ -2415,7 +2428,8 @@ void toku_apply_cmd_to_leaf(
node, node,
BLB(node, childnum), BLB(node, childnum),
cmd, cmd,
workdone); workdone,
stats_to_update);
} else { } else {
STATUS_VALUE(BRT_MSN_DISCARDS)++; STATUS_VALUE(BRT_MSN_DISCARDS)++;
} }
...@@ -2435,14 +2449,19 @@ static void push_something_at_root (struct brt_header *h, BRTNODE *nodep, BRT_MS ...@@ -2435,14 +2449,19 @@ static void push_something_at_root (struct brt_header *h, BRTNODE *nodep, BRT_MS
toku_assert_entire_node_in_memory(node); toku_assert_entire_node_in_memory(node);
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);
STAT64INFO_S stats_delta = {0,0};
brtnode_put_cmd( brtnode_put_cmd(
h->compare_fun, h->compare_fun,
h->update_fun, h->update_fun,
&h->cmp_descriptor, &h->cmp_descriptor,
node, node,
cmd, cmd,
true true,
&stats_delta
); );
if (stats_delta.numbytes || stats_delta.numrows) {
update_header_stats(&h->in_memory_stats, &stats_delta);
}
// //
// assumption is that brtnode_put_cmd will // assumption is that brtnode_put_cmd will
// mark the node as dirty. // mark the node as dirty.
...@@ -3791,7 +3810,7 @@ fifo_offset_msn_cmp(void *extrap, const void *va, const void *vb) ...@@ -3791,7 +3810,7 @@ fifo_offset_msn_cmp(void *extrap, const void *va, const void *vb)
* basement node. * basement node.
*/ */
static void static void
do_brt_leaf_put_cmd(BRT t, BRTNODE leafnode, BASEMENTNODE bn, BRTNODE ancestor, int childnum, const struct fifo_entry *entry) do_brt_leaf_put_cmd(BRT t, BRTNODE leafnode, BASEMENTNODE bn, BRTNODE ancestor, int childnum, const struct fifo_entry *entry, STAT64INFO stats_to_update)
{ {
// The messages are being iterated over in (key,msn) order or just in // The messages are being iterated over in (key,msn) order or just in
// msn order, so all the messages for one key, from one buffer, are in // msn order, so all the messages for one key, from one buffer, are in
...@@ -3810,7 +3829,16 @@ do_brt_leaf_put_cmd(BRT t, BRTNODE leafnode, BASEMENTNODE bn, BRTNODE ancestor, ...@@ -3810,7 +3829,16 @@ 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)); // 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),
stats_to_update
);
} else { } else {
STATUS_VALUE(BRT_MSN_DISCARDS)++; STATUS_VALUE(BRT_MSN_DISCARDS)++;
} }
...@@ -3822,6 +3850,7 @@ struct iterate_do_brt_leaf_put_cmd_extra { ...@@ -3822,6 +3850,7 @@ struct iterate_do_brt_leaf_put_cmd_extra {
BASEMENTNODE bn; BASEMENTNODE bn;
BRTNODE ancestor; BRTNODE ancestor;
int childnum; int childnum;
STAT64INFO stats_to_update;
}; };
static int static int
...@@ -3831,7 +3860,7 @@ iterate_do_brt_leaf_put_cmd(OMTVALUE v, u_int32_t UU(idx), void *extrap) ...@@ -3831,7 +3860,7 @@ iterate_do_brt_leaf_put_cmd(OMTVALUE v, u_int32_t UU(idx), void *extrap)
const long offset = (long) v; const long offset = (long) v;
NONLEAF_CHILDINFO bnc = BNC(e->ancestor, e->childnum); NONLEAF_CHILDINFO bnc = BNC(e->ancestor, e->childnum);
const struct fifo_entry *entry = toku_fifo_get_entry(bnc->buffer, offset); const struct fifo_entry *entry = toku_fifo_get_entry(bnc->buffer, offset);
do_brt_leaf_put_cmd(e->t, e->leafnode, e->bn, e->ancestor, e->childnum, entry); do_brt_leaf_put_cmd(e->t, e->leafnode, e->bn, e->ancestor, e->childnum, entry, e->stats_to_update);
return 0; return 0;
} }
...@@ -3959,6 +3988,7 @@ bnc_apply_messages_to_basement_node( ...@@ -3959,6 +3988,7 @@ bnc_apply_messages_to_basement_node(
// Determine the offsets in the message trees between which we need to // Determine the offsets in the message trees between which we need to
// apply messages from this buffer // apply messages from this buffer
STAT64INFO_S stats_delta = {0,0};
u_int32_t stale_lbi, stale_ube; u_int32_t stale_lbi, stale_ube;
if (!bn->stale_ancestor_messages_applied) { if (!bn->stale_ancestor_messages_applied) {
find_bounds_within_message_tree(&t->h->cmp_descriptor, t->compare_fun, bnc->stale_message_tree, bnc->buffer, bounds, &stale_lbi, &stale_ube); find_bounds_within_message_tree(&t->h->cmp_descriptor, t->compare_fun, bnc->stale_message_tree, bnc->buffer, bounds, &stale_lbi, &stale_ube);
...@@ -4006,13 +4036,13 @@ bnc_apply_messages_to_basement_node( ...@@ -4006,13 +4036,13 @@ bnc_apply_messages_to_basement_node(
for (int i = 0; i < buffer_size; ++i) { for (int i = 0; i < buffer_size; ++i) {
*msgs_applied = TRUE; *msgs_applied = TRUE;
const struct fifo_entry *entry = toku_fifo_get_entry(bnc->buffer, offsets[i]); const struct fifo_entry *entry = toku_fifo_get_entry(bnc->buffer, offsets[i]);
do_brt_leaf_put_cmd(t, leafnode, bn, ancestor, childnum, entry); do_brt_leaf_put_cmd(t, leafnode, bn, ancestor, childnum, entry, &stats_delta);
} }
toku_free(offsets); toku_free(offsets);
} else if (stale_lbi == stale_ube) { } else if (stale_lbi == stale_ube) {
// No stale messages to apply, we just apply fresh messages. // No stale messages to apply, we just apply fresh messages.
struct iterate_do_brt_leaf_put_cmd_extra iter_extra = { .t = t, .leafnode = leafnode, .bn = bn, .ancestor = ancestor, .childnum = childnum }; struct iterate_do_brt_leaf_put_cmd_extra iter_extra = { .t = t, .leafnode = leafnode, .bn = bn, .ancestor = ancestor, .childnum = childnum, .stats_to_update = &stats_delta};
if (fresh_ube - fresh_lbi > 0) *msgs_applied = TRUE; if (fresh_ube - fresh_lbi > 0) *msgs_applied = TRUE;
r = toku_omt_iterate_on_range(bnc->fresh_message_tree, fresh_lbi, fresh_ube, iterate_do_brt_leaf_put_cmd, &iter_extra); r = toku_omt_iterate_on_range(bnc->fresh_message_tree, fresh_lbi, fresh_ube, iterate_do_brt_leaf_put_cmd, &iter_extra);
assert_zero(r); assert_zero(r);
...@@ -4020,7 +4050,7 @@ bnc_apply_messages_to_basement_node( ...@@ -4020,7 +4050,7 @@ bnc_apply_messages_to_basement_node(
// No fresh messages to apply, we just apply stale messages. // No fresh messages to apply, we just apply stale messages.
if (stale_ube - stale_lbi > 0) *msgs_applied = TRUE; if (stale_ube - stale_lbi > 0) *msgs_applied = TRUE;
struct iterate_do_brt_leaf_put_cmd_extra iter_extra = { .t = t, .leafnode = leafnode, .bn = bn, .ancestor = ancestor, .childnum = childnum }; struct iterate_do_brt_leaf_put_cmd_extra iter_extra = { .t = t, .leafnode = leafnode, .bn = bn, .ancestor = ancestor, .childnum = childnum , .stats_to_update = &stats_delta};
r = toku_omt_iterate_on_range(bnc->stale_message_tree, stale_lbi, stale_ube, iterate_do_brt_leaf_put_cmd, &iter_extra); r = toku_omt_iterate_on_range(bnc->stale_message_tree, stale_lbi, stale_ube, iterate_do_brt_leaf_put_cmd, &iter_extra);
assert_zero(r); assert_zero(r);
...@@ -4053,7 +4083,7 @@ bnc_apply_messages_to_basement_node( ...@@ -4053,7 +4083,7 @@ bnc_apply_messages_to_basement_node(
// but a smaller MSN. We'll apply it, then get the next // but a smaller MSN. We'll apply it, then get the next
// stale message into stale_i and stale_v. // stale message into stale_i and stale_v.
const struct fifo_entry *stale_entry = toku_fifo_get_entry(bnc->buffer, stale_offset); const struct fifo_entry *stale_entry = toku_fifo_get_entry(bnc->buffer, stale_offset);
do_brt_leaf_put_cmd(t, leafnode, bn, ancestor, childnum, stale_entry); do_brt_leaf_put_cmd(t, leafnode, bn, ancestor, childnum, stale_entry, &stats_delta);
stale_i++; stale_i++;
if (stale_i != stale_ube) { if (stale_i != stale_ube) {
invariant(stale_i < stale_ube); invariant(stale_i < stale_ube);
...@@ -4066,7 +4096,7 @@ bnc_apply_messages_to_basement_node( ...@@ -4066,7 +4096,7 @@ bnc_apply_messages_to_basement_node(
// but a smaller MSN. We'll apply it, then get the next // but a smaller MSN. We'll apply it, then get the next
// fresh message into fresh_i and fresh_v. // fresh message into fresh_i and fresh_v.
const struct fifo_entry *fresh_entry = toku_fifo_get_entry(bnc->buffer, fresh_offset); const struct fifo_entry *fresh_entry = toku_fifo_get_entry(bnc->buffer, fresh_offset);
do_brt_leaf_put_cmd(t, leafnode, bn, ancestor, childnum, fresh_entry); do_brt_leaf_put_cmd(t, leafnode, bn, ancestor, childnum, fresh_entry, &stats_delta);
fresh_i++; fresh_i++;
if (fresh_i != fresh_ube) { if (fresh_i != fresh_ube) {
invariant(fresh_i < fresh_ube); invariant(fresh_i < fresh_ube);
...@@ -4085,7 +4115,7 @@ bnc_apply_messages_to_basement_node( ...@@ -4085,7 +4115,7 @@ bnc_apply_messages_to_basement_node(
while (stale_i < stale_ube) { while (stale_i < stale_ube) {
const long stale_offset = (long) stale_v; const long stale_offset = (long) stale_v;
const struct fifo_entry *stale_entry = toku_fifo_get_entry(bnc->buffer, stale_offset); const struct fifo_entry *stale_entry = toku_fifo_get_entry(bnc->buffer, stale_offset);
do_brt_leaf_put_cmd(t, leafnode, bn, ancestor, childnum, stale_entry); do_brt_leaf_put_cmd(t, leafnode, bn, ancestor, childnum, stale_entry, &stats_delta);
stale_i++; stale_i++;
if (stale_i != stale_ube) { if (stale_i != stale_ube) {
r = toku_omt_fetch(bnc->stale_message_tree, stale_i, &stale_v); r = toku_omt_fetch(bnc->stale_message_tree, stale_i, &stale_v);
...@@ -4097,7 +4127,7 @@ bnc_apply_messages_to_basement_node( ...@@ -4097,7 +4127,7 @@ bnc_apply_messages_to_basement_node(
while (fresh_i < fresh_ube) { while (fresh_i < fresh_ube) {
const long fresh_offset = (long) fresh_v; const long fresh_offset = (long) fresh_v;
const struct fifo_entry *fresh_entry = toku_fifo_get_entry(bnc->buffer, fresh_offset); const struct fifo_entry *fresh_entry = toku_fifo_get_entry(bnc->buffer, fresh_offset);
do_brt_leaf_put_cmd(t, leafnode, bn, ancestor, childnum, fresh_entry); do_brt_leaf_put_cmd(t, leafnode, bn, ancestor, childnum, fresh_entry, &stats_delta);
fresh_i++; fresh_i++;
if (fresh_i != fresh_ube) { if (fresh_i != fresh_ube) {
r = toku_omt_fetch(bnc->fresh_message_tree, fresh_i, &fresh_v); r = toku_omt_fetch(bnc->fresh_message_tree, fresh_i, &fresh_v);
...@@ -4105,6 +4135,12 @@ bnc_apply_messages_to_basement_node( ...@@ -4105,6 +4135,12 @@ bnc_apply_messages_to_basement_node(
} }
} }
} }
//
// update stats
//
if (stats_delta.numbytes || stats_delta.numrows) {
update_header_stats(&t->h->in_memory_stats, &stats_delta);
}
// We can't delete things out of the fresh tree inside the above // We can't delete things out of the fresh tree inside the above
// procedures because we're still looking at the fresh tree. Instead // procedures because we're still looking at the fresh tree. Instead
// we have to move messages after we're done looking at it. // we have to move messages after we're done looking at it.
......
...@@ -2694,7 +2694,7 @@ static void add_pair_to_leafnode (struct leaf_buf *lbuf, unsigned char *key, int ...@@ -2694,7 +2694,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, &workdone); brt_leaf_apply_cmd_once(leafnode, BLB(leafnode,0), &cmd, idx, NULL, &workdone, NULL);
} }
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); brt_leaf_apply_cmd_once(leafnode, BLB(leafnode,0), &cmd, idx, NULL, 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); toku_apply_cmd_to_leaf(brt->compare_fun, brt->update_fun, &brt->h->cmp_descriptor, leafnode, &cmd, &workdone, NULL);
{ {
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); toku_apply_cmd_to_leaf(brt->compare_fun, brt->update_fun, &brt->h->cmp_descriptor, leafnode, &badcmd, &workdone, NULL);
// 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); toku_apply_cmd_to_leaf(brt->compare_fun, brt->update_fun, &brt->h->cmp_descriptor, leafnode, &cmd2, &workdone, NULL);
// 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); toku_apply_cmd_to_leaf(brt->compare_fun, brt->update_fun, &brt->h->cmp_descriptor, leafnode, &cmd3, &workdone, NULL);
// message should be rejected, val should still have value in pair2 // message should be rejected, val should still have value in pair2
{ {
......
...@@ -127,7 +127,7 @@ insert_random_message_to_leaf(BRT t, BRTNODE leafnode, BASEMENTNODE blb, LEAFENT ...@@ -127,7 +127,7 @@ insert_random_message_to_leaf(BRT t, BRTNODE leafnode, BASEMENTNODE blb, LEAFENT
int64_t numbytes; int64_t numbytes;
int r = apply_msg_to_leafentry(&msg, NULL, &memsize, save, 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); brt_leaf_put_cmd(t->compare_fun, t->update_fun, NULL, leafnode, blb, &msg, NULL, 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;
} }
...@@ -168,11 +168,11 @@ insert_same_message_to_leaves(BRT t, BRTNODE child1, BASEMENTNODE blb1, BRTNODE ...@@ -168,11 +168,11 @@ insert_same_message_to_leaves(BRT t, BRTNODE child1, BASEMENTNODE blb1, BRTNODE
int64_t numbytes; int64_t numbytes;
int r = apply_msg_to_leafentry(&msg, NULL, &memsize, save, 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); brt_leaf_put_cmd(t->compare_fun, t->update_fun, NULL, child1, blb1, &msg, NULL, 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); brt_leaf_put_cmd(t->compare_fun, t->update_fun, NULL, child2, blb2, &msg, NULL, 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); toku_apply_cmd_to_leaf(t->compare_fun, t->update_fun, &t->h->descriptor, child, parent_messages[i], NULL, 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); toku_apply_cmd_to_leaf(t->compare_fun, t->update_fun, &t->h->descriptor, child, parent_messages[i], NULL, NULL);
} }
} }
for (i = 0; i < 8; ++i) { for (i = 0; i < 8; ++i) {
...@@ -1001,8 +1001,8 @@ compare_apply_and_flush(BRT t, bool make_leaf_up_to_date) { ...@@ -1001,8 +1001,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); toku_apply_cmd_to_leaf(t->compare_fun, t->update_fun, &t->h->descriptor, child1, parent_messages[i], NULL, NULL);
toku_apply_cmd_to_leaf(t->compare_fun, t->update_fun, &t->h->descriptor, child2, parent_messages[i], NULL); toku_apply_cmd_to_leaf(t->compare_fun, t->update_fun, &t->h->descriptor, child2, parent_messages[i], NULL, NULL);
} }
} }
for (i = 0; i < 8; ++i) { for (i = 0; i < 8; ++i) {
......
...@@ -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); brt_leaf_apply_cmd_once(leafnode, BLB(leafnode, 0), &cmd, idx, NULL, 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); brt_leaf_apply_cmd_once(leafnode, BLB(leafnode, 0), &cmd, idx, NULL, 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); brt_leaf_apply_cmd_once(leafnode, BLB(leafnode, 0), &cmd, idx, NULL, 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); brt_leaf_apply_cmd_once(leafnode, BLB(leafnode, 0), &cmd, idx, NULL, 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); brt_leaf_apply_cmd_once(leafnode, BLB(leafnode,0), &cmd, idx, NULL, 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); brt_leaf_apply_cmd_once(leafnode, BLB(leafnode, 0), &cmd, idx, NULL, 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); brt_leaf_apply_cmd_once(leafnode, BLB(leafnode, 0), &cmd, idx, NULL, NULL, NULL);
// dont forget to dirty the node // dont forget to dirty the node
leafnode->dirty = 1; leafnode->dirty = 1;
......
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