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

[t:4741], remove unnecessary parameters

git-svn-id: file:///svn/toku/tokudb@43544 c7de825b-a66e-492c-adef-691d508d4ae1
parent a692b565
...@@ -887,7 +887,6 @@ void toku_brt_get_status(BRT_STATUS); ...@@ -887,7 +887,6 @@ void toku_brt_get_status(BRT_STATUS);
// FIXME needs toku prefix // FIXME needs toku prefix
void void
brt_leaf_apply_cmd_once ( brt_leaf_apply_cmd_once (
BRTNODE leafnode,
BASEMENTNODE bn, BASEMENTNODE bn,
const BRT_MSG cmd, const BRT_MSG cmd,
u_int32_t idx, u_int32_t idx,
...@@ -902,7 +901,6 @@ brt_leaf_put_cmd ( ...@@ -902,7 +901,6 @@ brt_leaf_put_cmd (
brt_compare_func compare_fun, brt_compare_func compare_fun,
brt_update_func update_fun, brt_update_func update_fun,
DESCRIPTOR desc, DESCRIPTOR desc,
BRTNODE leafnode,
BASEMENTNODE bn, BASEMENTNODE bn,
BRT_MSG cmd, BRT_MSG cmd,
uint64_t *workdone, uint64_t *workdone,
......
...@@ -1395,7 +1395,6 @@ brt_leaf_delete_leafentry ( ...@@ -1395,7 +1395,6 @@ brt_leaf_delete_leafentry (
void void
brt_leaf_apply_cmd_once ( brt_leaf_apply_cmd_once (
BRTNODE UU(leafnode),
BASEMENTNODE bn, BASEMENTNODE bn,
const BRT_MSG cmd, const BRT_MSG cmd,
u_int32_t idx, u_int32_t idx,
...@@ -1488,7 +1487,6 @@ struct setval_extra_s { ...@@ -1488,7 +1487,6 @@ struct setval_extra_s {
BOOL did_set_val; BOOL did_set_val;
int setval_r; // any error code that setval_fun wants to return goes here. int setval_r; // any error code that setval_fun wants to return goes here.
// need arguments for brt_leaf_apply_cmd_once // need arguments for brt_leaf_apply_cmd_once
BRTNODE leafnode; // bn is within leafnode
BASEMENTNODE bn; BASEMENTNODE bn;
MSN msn; // captured from original message, not currently used MSN msn; // captured from original message, not currently used
XIDS xids; XIDS xids;
...@@ -1525,7 +1523,7 @@ static void setval_fun (const DBT *new_val, void *svextra_v) { ...@@ -1525,7 +1523,7 @@ static void setval_fun (const DBT *new_val, void *svextra_v) {
toku_init_dbt(&val); toku_init_dbt(&val);
msg.u.id.val = &val; msg.u.id.val = &val;
} }
brt_leaf_apply_cmd_once(svextra->leafnode, svextra->bn, &msg, brt_leaf_apply_cmd_once(svextra->bn, &msg,
svextra->idx, svextra->le, svextra->idx, svextra->le,
svextra->workdone, svextra->stats_to_update); svextra->workdone, svextra->stats_to_update);
svextra->setval_r = 0; svextra->setval_r = 0;
...@@ -1536,7 +1534,7 @@ static void setval_fun (const DBT *new_val, void *svextra_v) { ...@@ -1536,7 +1534,7 @@ static void setval_fun (const DBT *new_val, void *svextra_v) {
// so capturing the msn in the setval_extra_s is not strictly required. The alternative // so capturing the msn in the setval_extra_s is not strictly required. The alternative
// 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, BASEMENTNODE bn, BRT_MSG cmd, int idx,
LEAFENTRY le, LEAFENTRY le,
uint64_t * workdone, uint64_t * workdone,
STAT64INFO stats_to_update) { STAT64INFO stats_to_update) {
...@@ -1580,7 +1578,7 @@ static int do_update(brt_update_func update_fun, DESCRIPTOR desc, BRTNODE leafno ...@@ -1580,7 +1578,7 @@ static int do_update(brt_update_func update_fun, DESCRIPTOR desc, BRTNODE leafno
le_for_update = NULL; le_for_update = NULL;
} }
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, bn, cmd->msn, cmd->xids,
keyp, idx, le_for_update, workdone, stats_to_update}; 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);
...@@ -1602,7 +1600,6 @@ brt_leaf_put_cmd ( ...@@ -1602,7 +1600,6 @@ brt_leaf_put_cmd (
brt_compare_func compare_fun, brt_compare_func compare_fun,
brt_update_func update_fun, brt_update_func update_fun,
DESCRIPTOR desc, DESCRIPTOR desc,
BRTNODE leafnode, // bn is within leafnode
BASEMENTNODE bn, BASEMENTNODE bn,
BRT_MSG cmd, BRT_MSG cmd,
uint64_t *workdone, uint64_t *workdone,
...@@ -1646,7 +1643,7 @@ brt_leaf_put_cmd ( ...@@ -1646,7 +1643,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, stats_to_update); brt_leaf_apply_cmd_once(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
...@@ -1678,7 +1675,7 @@ brt_leaf_put_cmd ( ...@@ -1678,7 +1675,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, stats_to_update); brt_leaf_apply_cmd_once(bn, cmd, idx, storeddata, workdone, stats_to_update);
{ {
// Now we must find the next leafentry. // Now we must find the next leafentry.
...@@ -1724,7 +1721,7 @@ brt_leaf_put_cmd ( ...@@ -1724,7 +1721,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, stats_to_update); brt_leaf_apply_cmd_once(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);
...@@ -1750,7 +1747,7 @@ brt_leaf_put_cmd ( ...@@ -1750,7 +1747,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, stats_to_update); brt_leaf_apply_cmd_once(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);
...@@ -1771,10 +1768,10 @@ brt_leaf_put_cmd ( ...@@ -1771,10 +1768,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, stats_to_update); r = do_update(update_fun, desc, 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, stats_to_update); r = do_update(update_fun, desc, bn, cmd, idx, storeddata, workdone, stats_to_update);
} // otherwise, a worse error, just return it } // otherwise, a worse error, just return it
break; break;
} }
...@@ -1786,7 +1783,7 @@ brt_leaf_put_cmd ( ...@@ -1786,7 +1783,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, stats_to_update); r = do_update(update_fun, desc, 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);
...@@ -2411,7 +2408,6 @@ void toku_apply_cmd_to_leaf( ...@@ -2411,7 +2408,6 @@ void toku_apply_cmd_to_leaf(
brt_leaf_put_cmd(compare_fun, brt_leaf_put_cmd(compare_fun,
update_fun, update_fun,
desc, desc,
node,
BLB(node, childnum), BLB(node, childnum),
cmd, cmd,
workdone, workdone,
...@@ -2427,7 +2423,6 @@ void toku_apply_cmd_to_leaf( ...@@ -2427,7 +2423,6 @@ void toku_apply_cmd_to_leaf(
brt_leaf_put_cmd(compare_fun, brt_leaf_put_cmd(compare_fun,
update_fun, update_fun,
desc, desc,
node,
BLB(node, childnum), BLB(node, childnum),
cmd, cmd,
workdone, workdone,
...@@ -3812,7 +3807,7 @@ fifo_offset_msn_cmp(void *extrap, const void *va, const void *vb) ...@@ -3812,7 +3807,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, STAT64INFO stats_to_update) do_brt_leaf_put_cmd(BRT t, 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
...@@ -3835,7 +3830,6 @@ do_brt_leaf_put_cmd(BRT t, BRTNODE leafnode, BASEMENTNODE bn, BRTNODE ancestor, ...@@ -3835,7 +3830,6 @@ do_brt_leaf_put_cmd(BRT t, BRTNODE leafnode, BASEMENTNODE bn, BRTNODE ancestor,
t->compare_fun, t->compare_fun,
t->update_fun, t->update_fun,
&t->h->cmp_descriptor, &t->h->cmp_descriptor,
leafnode,
bn, bn,
&brtcmd, &brtcmd,
&BP_WORKDONE(ancestor, childnum), &BP_WORKDONE(ancestor, childnum),
...@@ -3848,7 +3842,6 @@ do_brt_leaf_put_cmd(BRT t, BRTNODE leafnode, BASEMENTNODE bn, BRTNODE ancestor, ...@@ -3848,7 +3842,6 @@ do_brt_leaf_put_cmd(BRT t, BRTNODE leafnode, BASEMENTNODE bn, BRTNODE ancestor,
struct iterate_do_brt_leaf_put_cmd_extra { struct iterate_do_brt_leaf_put_cmd_extra {
BRT t; BRT t;
BRTNODE leafnode; // bn is within leafnode
BASEMENTNODE bn; BASEMENTNODE bn;
BRTNODE ancestor; BRTNODE ancestor;
int childnum; int childnum;
...@@ -3862,7 +3855,7 @@ iterate_do_brt_leaf_put_cmd(OMTVALUE v, u_int32_t UU(idx), void *extrap) ...@@ -3862,7 +3855,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, e->stats_to_update); do_brt_leaf_put_cmd(e->t, e->bn, e->ancestor, e->childnum, entry, e->stats_to_update);
return 0; return 0;
} }
...@@ -3977,7 +3970,6 @@ find_bounds_within_message_tree( ...@@ -3977,7 +3970,6 @@ find_bounds_within_message_tree(
static int static int
bnc_apply_messages_to_basement_node( bnc_apply_messages_to_basement_node(
BRT t, // used for comparison function BRT t, // used for comparison function
BRTNODE leafnode, // used to update header stats for keyrange
BASEMENTNODE bn, // where to apply messages BASEMENTNODE bn, // where to apply messages
BRTNODE ancestor, // the ancestor node where we can find messages to apply BRTNODE ancestor, // the ancestor node where we can find messages to apply
int childnum, // which child buffer of ancestor contains messages we want int childnum, // which child buffer of ancestor contains messages we want
...@@ -4038,13 +4030,13 @@ bnc_apply_messages_to_basement_node( ...@@ -4038,13 +4030,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, &stats_delta); do_brt_leaf_put_cmd(t, 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, .stats_to_update = &stats_delta}; struct iterate_do_brt_leaf_put_cmd_extra iter_extra = { .t = t, .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);
...@@ -4052,7 +4044,7 @@ bnc_apply_messages_to_basement_node( ...@@ -4052,7 +4044,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 , .stats_to_update = &stats_delta}; struct iterate_do_brt_leaf_put_cmd_extra iter_extra = { .t = t, .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);
...@@ -4085,7 +4077,7 @@ bnc_apply_messages_to_basement_node( ...@@ -4085,7 +4077,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, &stats_delta); do_brt_leaf_put_cmd(t, 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);
...@@ -4098,7 +4090,7 @@ bnc_apply_messages_to_basement_node( ...@@ -4098,7 +4090,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, &stats_delta); do_brt_leaf_put_cmd(t, 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);
...@@ -4117,7 +4109,7 @@ bnc_apply_messages_to_basement_node( ...@@ -4117,7 +4109,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, &stats_delta); do_brt_leaf_put_cmd(t, 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);
...@@ -4129,7 +4121,7 @@ bnc_apply_messages_to_basement_node( ...@@ -4129,7 +4121,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, &stats_delta); do_brt_leaf_put_cmd(t, 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);
...@@ -4186,7 +4178,6 @@ maybe_apply_ancestors_messages_to_node (BRT t, BRTNODE node, ANCESTORS ancestors ...@@ -4186,7 +4178,6 @@ maybe_apply_ancestors_messages_to_node (BRT t, BRTNODE node, ANCESTORS ancestors
assert(BP_STATE(curr_ancestors->node, curr_ancestors->childnum) == PT_AVAIL); assert(BP_STATE(curr_ancestors->node, curr_ancestors->childnum) == PT_AVAIL);
bnc_apply_messages_to_basement_node( bnc_apply_messages_to_basement_node(
t, t,
node,
curr_bn, curr_bn,
curr_ancestors->node, curr_ancestors->node,
curr_ancestors->childnum, curr_ancestors->childnum,
......
...@@ -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, NULL); brt_leaf_apply_cmd_once(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, NULL); brt_leaf_apply_cmd_once(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;
......
...@@ -98,7 +98,7 @@ insert_random_message(NONLEAF_CHILDINFO bnc, BRT_MSG_S **save, bool *is_fresh_ou ...@@ -98,7 +98,7 @@ insert_random_message(NONLEAF_CHILDINFO bnc, BRT_MSG_S **save, bool *is_fresh_ou
// generate a random message with xids and a key starting with pfx, insert // generate a random message with xids and a key starting with pfx, insert
// it into blb, and save it in output param save // it into blb, and save it in output param save
static void static void
insert_random_message_to_leaf(BRT t, BRTNODE leafnode, BASEMENTNODE blb, LEAFENTRY *save, XIDS xids, int pfx) insert_random_message_to_leaf(BRT t, BASEMENTNODE blb, LEAFENTRY *save, XIDS xids, int pfx)
{ {
int keylen = (random() % 16) + 16; int keylen = (random() % 16) + 16;
int vallen = (random() % 128) + 16; int vallen = (random() % 128) + 16;
...@@ -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, NULL); brt_leaf_put_cmd(t->compare_fun, t->update_fun, NULL, 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;
} }
...@@ -139,7 +139,7 @@ insert_random_message_to_leaf(BRT t, BRTNODE leafnode, BASEMENTNODE blb, LEAFENT ...@@ -139,7 +139,7 @@ insert_random_message_to_leaf(BRT t, BRTNODE leafnode, BASEMENTNODE blb, LEAFENT
// used for making two leaf nodes the same in order to compare the result // used for making two leaf nodes the same in order to compare the result
// of 'maybe_apply' and a normal buffer flush // of 'maybe_apply' and a normal buffer flush
static void static void
insert_same_message_to_leaves(BRT t, BRTNODE child1, BASEMENTNODE blb1, BRTNODE child2, BASEMENTNODE blb2, LEAFENTRY *save, XIDS xids, int pfx) insert_same_message_to_leaves(BRT t, BASEMENTNODE blb1, BASEMENTNODE blb2, LEAFENTRY *save, XIDS xids, int pfx)
{ {
int keylen = (random() % 16) + 16; int keylen = (random() % 16) + 16;
int vallen = (random() % 128) + 16; int vallen = (random() % 128) + 16;
...@@ -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, NULL); brt_leaf_put_cmd(t->compare_fun, t->update_fun, NULL, 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, NULL); brt_leaf_put_cmd(t->compare_fun, t->update_fun, NULL, 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;
} }
...@@ -544,7 +544,7 @@ flush_to_leaf(BRT t, bool make_leaf_up_to_date, bool use_flush) { ...@@ -544,7 +544,7 @@ flush_to_leaf(BRT t, bool make_leaf_up_to_date, bool use_flush) {
int total_size = 0; int total_size = 0;
for (i = 0; total_size < 128*1024; ++i) { for (i = 0; total_size < 128*1024; ++i) {
total_size -= child_blbs[i%8]->n_bytes_in_buffer; total_size -= child_blbs[i%8]->n_bytes_in_buffer;
insert_random_message_to_leaf(t, child, child_blbs[i%8], &child_messages[i], xids_123, i%8); insert_random_message_to_leaf(t, child_blbs[i%8], &child_messages[i], xids_123, i%8);
total_size += child_blbs[i%8]->n_bytes_in_buffer; total_size += child_blbs[i%8]->n_bytes_in_buffer;
if (i % 8 < 7) { if (i % 8 < 7) {
u_int32_t keylen; u_int32_t keylen;
...@@ -771,7 +771,7 @@ flush_to_leaf_with_keyrange(BRT t, bool make_leaf_up_to_date) { ...@@ -771,7 +771,7 @@ flush_to_leaf_with_keyrange(BRT t, bool make_leaf_up_to_date) {
int total_size = 0; int total_size = 0;
for (i = 0; total_size < 128*1024; ++i) { for (i = 0; total_size < 128*1024; ++i) {
total_size -= child_blbs[i%8]->n_bytes_in_buffer; total_size -= child_blbs[i%8]->n_bytes_in_buffer;
insert_random_message_to_leaf(t, child, child_blbs[i%8], &child_messages[i], xids_123, i%8); insert_random_message_to_leaf(t, child_blbs[i%8], &child_messages[i], xids_123, i%8);
total_size += child_blbs[i%8]->n_bytes_in_buffer; total_size += child_blbs[i%8]->n_bytes_in_buffer;
u_int32_t keylen; u_int32_t keylen;
char *key = le_key_and_len(child_messages[i], &keylen); char *key = le_key_and_len(child_messages[i], &keylen);
...@@ -958,7 +958,7 @@ compare_apply_and_flush(BRT t, bool make_leaf_up_to_date) { ...@@ -958,7 +958,7 @@ compare_apply_and_flush(BRT t, bool make_leaf_up_to_date) {
int total_size = 0; int total_size = 0;
for (i = 0; total_size < 128*1024; ++i) { for (i = 0; total_size < 128*1024; ++i) {
total_size -= child1_blbs[i%8]->n_bytes_in_buffer; total_size -= child1_blbs[i%8]->n_bytes_in_buffer;
insert_same_message_to_leaves(t, child1, child1_blbs[i%8], child2, child2_blbs[i%8], &child_messages[i], xids_123, i%8); insert_same_message_to_leaves(t, child1_blbs[i%8], child2_blbs[i%8], &child_messages[i], xids_123, i%8);
total_size += child1_blbs[i%8]->n_bytes_in_buffer; total_size += child1_blbs[i%8]->n_bytes_in_buffer;
if (i % 8 < 7) { if (i % 8 < 7) {
u_int32_t keylen; u_int32_t keylen;
......
...@@ -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); brt_leaf_apply_cmd_once(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, NULL); brt_leaf_apply_cmd_once(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, NULL); brt_leaf_apply_cmd_once(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, NULL); brt_leaf_apply_cmd_once(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, NULL); brt_leaf_apply_cmd_once(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, NULL); brt_leaf_apply_cmd_once(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, NULL); brt_leaf_apply_cmd_once(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