Commit eeff9dbc authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

[t:4741] rename functions that apply cmds, to reference the objects they're...

[t:4741] rename functions that apply cmds, to reference the objects they're dealing with (i.e. leaf->bn)

git-svn-id: file:///svn/toku/tokudb@43546 c7de825b-a66e-492c-adef-691d508d4ae1
parent b67af553
......@@ -884,9 +884,8 @@ typedef struct {
void toku_brt_get_status(BRT_STATUS);
// FIXME needs toku prefix
void
brt_leaf_apply_cmd_once (
toku_brt_bn_apply_cmd_once (
BASEMENTNODE bn,
const BRT_MSG cmd,
u_int32_t idx,
......@@ -895,9 +894,8 @@ brt_leaf_apply_cmd_once (
STAT64INFO stats_to_update
);
// FIXME needs toku prefix
void
brt_leaf_put_cmd (
toku_brt_bn_apply_cmd (
brt_compare_func compare_fun,
brt_update_func update_fun,
DESCRIPTOR desc,
......@@ -907,7 +905,8 @@ brt_leaf_put_cmd (
STAT64INFO stats_to_update
);
void toku_apply_cmd_to_leaf(
void
toku_brt_leaf_apply_cmd (
brt_compare_func compare_fun,
brt_update_func update_fun,
DESCRIPTOR desc,
......@@ -917,8 +916,8 @@ void toku_apply_cmd_to_leaf(
STAT64INFO stats_to_update
);
// FIXME needs toku prefix
void brtnode_put_cmd (
void
toku_brt_node_put_cmd (
brt_compare_func compare_fun,
brt_update_func update_fun,
DESCRIPTOR desc,
......
......@@ -133,7 +133,7 @@ int toku_testsetup_insert_to_leaf (BRT brt, BLOCKNUM blocknum, char *key, int ke
.u.id={toku_fill_dbt(&keydbt, key, keylen),
toku_fill_dbt(&valdbt, val, vallen)}};
brtnode_put_cmd (
toku_brt_node_put_cmd (
brt->h->compare_fun,
brt->h->update_fun,
&brt->h->cmp_descriptor,
......
......@@ -1394,7 +1394,7 @@ brt_leaf_delete_leafentry (
}
void
brt_leaf_apply_cmd_once (
toku_brt_bn_apply_cmd_once (
BASEMENTNODE bn,
const BRT_MSG cmd,
u_int32_t idx,
......@@ -1486,14 +1486,14 @@ struct setval_extra_s {
u_int32_t tag;
BOOL did_set_val;
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 toku_brt_bn_apply_cmd_once
BASEMENTNODE bn;
MSN msn; // captured from original message, not currently used
XIDS xids;
const DBT *key;
u_int32_t idx;
LEAFENTRY le;
uint64_t * workdone; // set by brt_leaf_apply_cmd_once()
uint64_t * workdone; // set by toku_brt_bn_apply_cmd_once()
STAT64INFO stats_to_update;
};
......@@ -1510,7 +1510,7 @@ static void setval_fun (const DBT *new_val, void *svextra_v) {
svextra->did_set_val = TRUE;
{
// can't leave scope until brt_leaf_apply_cmd_once if
// can't leave scope until toku_brt_bn_apply_cmd_once if
// this is a delete
DBT val;
BRT_MSG_S msg = { BRT_NONE, svextra->msn, svextra->xids,
......@@ -1523,14 +1523,14 @@ static void setval_fun (const DBT *new_val, void *svextra_v) {
toku_init_dbt(&val);
msg.u.id.val = &val;
}
brt_leaf_apply_cmd_once(svextra->bn, &msg,
toku_brt_bn_apply_cmd_once(svextra->bn, &msg,
svextra->idx, svextra->le,
svextra->workdone, svextra->stats_to_update);
svextra->setval_r = 0;
}
}
// We are already past the msn filter (in brt_leaf_put_cmd(), which calls do_update()),
// We are already past the msn filter (in toku_brt_bn_apply_cmd(), which calls do_update()),
// 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
// the original msn seems cleaner and it preserves accountability at a lower layer.
......@@ -1596,7 +1596,7 @@ static int do_update(brt_update_func update_fun, DESCRIPTOR desc, BASEMENTNODE b
// Should be renamed as something like "apply_cmd_to_basement()."
void
brt_leaf_put_cmd (
toku_brt_bn_apply_cmd (
brt_compare_func compare_fun,
brt_update_func update_fun,
DESCRIPTOR desc,
......@@ -1643,7 +1643,7 @@ brt_leaf_put_cmd (
assert(r==0);
storeddata=storeddatav;
}
brt_leaf_apply_cmd_once(bn, cmd, idx, storeddata, workdone, stats_to_update);
toku_brt_bn_apply_cmd_once(bn, cmd, idx, storeddata, workdone, stats_to_update);
// if the insertion point is within a window of the right edge of
// the leaf then it is sequential
......@@ -1675,7 +1675,7 @@ brt_leaf_put_cmd (
while (1) {
u_int32_t num_leafentries_before = toku_omt_size(bn->buffer);
brt_leaf_apply_cmd_once(bn, cmd, idx, storeddata, workdone, stats_to_update);
toku_brt_bn_apply_cmd_once(bn, cmd, idx, storeddata, workdone, stats_to_update);
{
// Now we must find the next leafentry.
......@@ -1721,7 +1721,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(bn, cmd, idx, storeddata, workdone, stats_to_update);
toku_brt_bn_apply_cmd_once(bn, cmd, idx, storeddata, workdone, stats_to_update);
u_int32_t new_omt_size = toku_omt_size(bn->buffer);
if (new_omt_size != omt_size) {
assert(new_omt_size+1 == omt_size);
......@@ -1747,7 +1747,7 @@ brt_leaf_put_cmd (
storeddata=storeddatav;
int deleted = 0;
if (le_has_xids(storeddata, cmd->xids)) {
brt_leaf_apply_cmd_once(bn, cmd, idx, storeddata, workdone, stats_to_update);
toku_brt_bn_apply_cmd_once(bn, cmd, idx, storeddata, workdone, stats_to_update);
u_int32_t new_omt_size = toku_omt_size(bn->buffer);
if (new_omt_size != omt_size) {
assert(new_omt_size+1 == omt_size);
......@@ -2044,10 +2044,10 @@ brt_nonleaf_put_cmd (brt_compare_func compare_fun, DESCRIPTOR desc, BRTNODE node
{
//
// see comments in toku_apply_cmd_to_leaf
// see comments in toku_brt_leaf_apply_cmd
// to understand why we handle setting
// node->max_msn_applied_to_node_on_disk here,
// and don't do it in brtnode_put_cmd
// and don't do it in toku_brt_node_put_cmd
//
MSN cmd_msn = cmd->msn;
invariant(cmd_msn.msn > node->max_msn_applied_to_node_on_disk.msn);
......@@ -2249,7 +2249,7 @@ toku_bnc_flush_to_child(
DBT hk,hv;
BRT_MSG_S brtcmd = { type, msn, xids, .u.id= {toku_fill_dbt(&hk, key, keylen),
toku_fill_dbt(&hv, val, vallen)} };
brtnode_put_cmd(
toku_brt_node_put_cmd(
h->compare_fun,
h->update_fun,
&h->cmp_descriptor,
......@@ -2318,7 +2318,7 @@ void bring_node_fully_into_memory(BRTNODE node, struct brt_header* h)
}
void
brtnode_put_cmd (
toku_brt_node_put_cmd (
brt_compare_func compare_fun,
brt_update_func update_fun,
DESCRIPTOR desc,
......@@ -2335,14 +2335,14 @@ brtnode_put_cmd (
{
toku_assert_entire_node_in_memory(node);
//
// see comments in toku_apply_cmd_to_leaf
// see comments in toku_brt_leaf_apply_cmd
// to understand why we don't handle setting
// node->max_msn_applied_to_node_on_disk here,
// and instead defer to these functions
//
if (node->height==0) {
uint64_t workdone = 0;
toku_apply_cmd_to_leaf(
toku_brt_leaf_apply_cmd(
compare_fun,
update_fun,
desc,
......@@ -2363,7 +2363,7 @@ static const struct pivot_bounds infinite_bounds = {.lower_bound_exclusive=NULL,
// Effect: applies the cmd to the leaf if the appropriate basement node is in memory.
// This function is called during message injection and/or flushing, so the entire
// node MUST be in memory.
void toku_apply_cmd_to_leaf(
void toku_brt_leaf_apply_cmd(
brt_compare_func compare_fun,
brt_update_func update_fun,
DESCRIPTOR desc,
......@@ -2377,7 +2377,7 @@ void toku_apply_cmd_to_leaf(
toku_assert_entire_node_in_memory(node);
//
// Because toku_apply_cmd_to_leaf is called with the intent of permanently
// Because toku_brt_leaf_apply_cmd is called with the intent of permanently
// applying a message to a leaf node (meaning the message is permanently applied
// and will be purged from the system after this call, as opposed to
// maybe_apply_ancestors_messages_to_node, which applies a message
......@@ -2394,7 +2394,7 @@ void toku_apply_cmd_to_leaf(
// maybe_apply_ancestors_messages_to_node) to answer a query
//
// This is why we handle node->max_msn_applied_to_node_on_disk both here
// and in brt_nonleaf_put_cmd, as opposed to in one location, brtnode_put_cmd.
// and in brt_nonleaf_put_cmd, as opposed to in one location, toku_brt_node_put_cmd.
//
MSN cmd_msn = cmd->msn;
if (cmd_msn.msn > node->max_msn_applied_to_node_on_disk.msn) {
......@@ -2405,7 +2405,7 @@ void toku_apply_cmd_to_leaf(
unsigned int childnum = toku_brtnode_which_child(node, cmd->u.id.key, desc, compare_fun);
if (cmd->msn.msn > BLB(node, childnum)->max_msn_applied.msn) {
BLB(node, childnum)->max_msn_applied = cmd->msn;
brt_leaf_put_cmd(compare_fun,
toku_brt_bn_apply_cmd(compare_fun,
update_fun,
desc,
BLB(node, childnum),
......@@ -2420,7 +2420,7 @@ void toku_apply_cmd_to_leaf(
for (int childnum=0; childnum<node->n_children; childnum++) {
if (cmd->msn.msn > BLB(node, childnum)->max_msn_applied.msn) {
BLB(node, childnum)->max_msn_applied = cmd->msn;
brt_leaf_put_cmd(compare_fun,
toku_brt_bn_apply_cmd(compare_fun,
update_fun,
desc,
BLB(node, childnum),
......@@ -2447,7 +2447,7 @@ static void push_something_at_root (struct brt_header *h, BRTNODE *nodep, BRT_MS
MSN cmd_msn = cmd->msn;
invariant(cmd_msn.msn > node->max_msn_applied_to_node_on_disk.msn);
STAT64INFO_S stats_delta = {0,0};
brtnode_put_cmd(
toku_brt_node_put_cmd(
h->compare_fun,
h->update_fun,
&h->cmp_descriptor,
......@@ -2460,7 +2460,7 @@ static void push_something_at_root (struct brt_header *h, BRTNODE *nodep, BRT_MS
update_header_stats(&h->in_memory_stats, &stats_delta);
}
//
// assumption is that brtnode_put_cmd will
// assumption is that toku_brt_node_put_cmd will
// mark the node as dirty.
// enforcing invariant here.
//
......@@ -2543,7 +2543,7 @@ toku_brt_root_put_cmd (struct brt_header *h, BRT_MSG_S * cmd)
cmd->msn.msn = node->max_msn_applied_to_node_on_disk.msn + 1;
// Note, the lower level function that filters messages based on
// msn, (brt_leaf_put_cmd() or brt_nonleaf_put_cmd()) will capture
// msn, (toku_brt_bn_apply_cmd() or brt_nonleaf_put_cmd()) will capture
// the msn and store it in the relevant node, including the root
// node. This is how the new msn is set in the root.
......@@ -3803,11 +3803,11 @@ fifo_offset_msn_cmp(void *extrap, const void *va, const void *vb)
/**
* Given a fifo_entry, either decompose it into its parameters and call
* brt_leaf_put_cmd, or discard it, based on its MSN and the MSN of the
* toku_brt_bn_apply_cmd, or discard it, based on its MSN and the MSN of the
* basement node.
*/
static void
do_brt_leaf_put_cmd(BRT t, BASEMENTNODE bn, BRTNODE ancestor, int childnum, const struct fifo_entry *entry, STAT64INFO stats_to_update)
do_bn_apply_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
// msn order, so all the messages for one key, from one buffer, are in
......@@ -3826,7 +3826,7 @@ do_brt_leaf_put_cmd(BRT t, BASEMENTNODE bn, BRTNODE ancestor, int childnum, cons
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(
toku_brt_bn_apply_cmd(
t->compare_fun,
t->update_fun,
&t->h->cmp_descriptor,
......@@ -3840,7 +3840,7 @@ do_brt_leaf_put_cmd(BRT t, BASEMENTNODE bn, BRTNODE ancestor, int childnum, cons
}
}
struct iterate_do_brt_leaf_put_cmd_extra {
struct iterate_do_bn_apply_cmd_extra {
BRT t;
BASEMENTNODE bn;
BRTNODE ancestor;
......@@ -3849,13 +3849,13 @@ struct iterate_do_brt_leaf_put_cmd_extra {
};
static int
iterate_do_brt_leaf_put_cmd(OMTVALUE v, u_int32_t UU(idx), void *extrap)
iterate_do_bn_apply_cmd(OMTVALUE v, u_int32_t UU(idx), void *extrap)
{
struct iterate_do_brt_leaf_put_cmd_extra *e = extrap;
struct iterate_do_bn_apply_cmd_extra *e = extrap;
const long offset = (long) v;
NONLEAF_CHILDINFO bnc = BNC(e->ancestor, e->childnum);
const struct fifo_entry *entry = toku_fifo_get_entry(bnc->buffer, offset);
do_brt_leaf_put_cmd(e->t, e->bn, e->ancestor, e->childnum, entry, e->stats_to_update);
do_bn_apply_cmd(e->t, e->bn, e->ancestor, e->childnum, entry, e->stats_to_update);
return 0;
}
......@@ -4030,23 +4030,23 @@ bnc_apply_messages_to_basement_node(
for (int i = 0; i < buffer_size; ++i) {
*msgs_applied = TRUE;
const struct fifo_entry *entry = toku_fifo_get_entry(bnc->buffer, offsets[i]);
do_brt_leaf_put_cmd(t, bn, ancestor, childnum, entry, &stats_delta);
do_bn_apply_cmd(t, bn, ancestor, childnum, entry, &stats_delta);
}
toku_free(offsets);
} else if (stale_lbi == stale_ube) {
// No stale messages to apply, we just apply fresh messages.
struct iterate_do_brt_leaf_put_cmd_extra iter_extra = { .t = t, .bn = bn, .ancestor = ancestor, .childnum = childnum, .stats_to_update = &stats_delta};
struct iterate_do_bn_apply_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;
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_bn_apply_cmd, &iter_extra);
assert_zero(r);
} else if (fresh_lbi == fresh_ube) {
// No fresh messages to apply, we just apply stale messages.
if (stale_ube - stale_lbi > 0) *msgs_applied = TRUE;
struct iterate_do_brt_leaf_put_cmd_extra iter_extra = { .t = t, .bn = bn, .ancestor = ancestor, .childnum = childnum , .stats_to_update = &stats_delta};
struct iterate_do_bn_apply_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_bn_apply_cmd, &iter_extra);
assert_zero(r);
} else {
// We have stale and fresh messages but no broadcasts. We can
......@@ -4077,7 +4077,7 @@ bnc_apply_messages_to_basement_node(
// but a smaller MSN. We'll apply it, then get the next
// stale message into stale_i and stale_v.
const struct fifo_entry *stale_entry = toku_fifo_get_entry(bnc->buffer, stale_offset);
do_brt_leaf_put_cmd(t, bn, ancestor, childnum, stale_entry, &stats_delta);
do_bn_apply_cmd(t, bn, ancestor, childnum, stale_entry, &stats_delta);
stale_i++;
if (stale_i != stale_ube) {
invariant(stale_i < stale_ube);
......@@ -4090,7 +4090,7 @@ bnc_apply_messages_to_basement_node(
// but a smaller MSN. We'll apply it, then get the next
// fresh message into fresh_i and fresh_v.
const struct fifo_entry *fresh_entry = toku_fifo_get_entry(bnc->buffer, fresh_offset);
do_brt_leaf_put_cmd(t, bn, ancestor, childnum, fresh_entry, &stats_delta);
do_bn_apply_cmd(t, bn, ancestor, childnum, fresh_entry, &stats_delta);
fresh_i++;
if (fresh_i != fresh_ube) {
invariant(fresh_i < fresh_ube);
......@@ -4109,7 +4109,7 @@ bnc_apply_messages_to_basement_node(
while (stale_i < stale_ube) {
const long stale_offset = (long) stale_v;
const struct fifo_entry *stale_entry = toku_fifo_get_entry(bnc->buffer, stale_offset);
do_brt_leaf_put_cmd(t, bn, ancestor, childnum, stale_entry, &stats_delta);
do_bn_apply_cmd(t, bn, ancestor, childnum, stale_entry, &stats_delta);
stale_i++;
if (stale_i != stale_ube) {
r = toku_omt_fetch(bnc->stale_message_tree, stale_i, &stale_v);
......@@ -4121,7 +4121,7 @@ bnc_apply_messages_to_basement_node(
while (fresh_i < fresh_ube) {
const long fresh_offset = (long) fresh_v;
const struct fifo_entry *fresh_entry = toku_fifo_get_entry(bnc->buffer, fresh_offset);
do_brt_leaf_put_cmd(t, bn, ancestor, childnum, fresh_entry, &stats_delta);
do_bn_apply_cmd(t, bn, ancestor, childnum, fresh_entry, &stats_delta);
fresh_i++;
if (fresh_i != fresh_ube) {
r = toku_omt_fetch(bnc->fresh_message_tree, fresh_i, &fresh_v);
......
......@@ -2694,7 +2694,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(BLB(leafnode,0), &cmd, idx, NULL, &workdone, NULL);
toku_brt_bn_apply_cmd_once(BLB(leafnode,0), &cmd, idx, NULL, &workdone, NULL);
}
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(BLB(leafnode,0), &cmd, idx, NULL, NULL, NULL);
toku_brt_bn_apply_cmd_once(BLB(leafnode,0), &cmd, idx, NULL, 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);
toku_brt_leaf_apply_cmd(brt->compare_fun, brt->update_fun, &brt->h->cmp_descriptor, leafnode, &cmd, &workdone, NULL);
{
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);
toku_brt_leaf_apply_cmd(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
......@@ -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);
toku_brt_leaf_apply_cmd(brt->compare_fun, brt->update_fun, &brt->h->cmp_descriptor, leafnode, &cmd2, &workdone, NULL);
// 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);
toku_brt_leaf_apply_cmd(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
{
......
......@@ -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
// it into blb, and save it in output param save
static void
insert_random_message_to_leaf(BRT t, BASEMENTNODE blb, LEAFENTRY *save, XIDS xids, int pfx)
insert_random_message_to_bn(BRT t, BASEMENTNODE blb, LEAFENTRY *save, XIDS xids, int pfx)
{
int keylen = (random() % 16) + 16;
int vallen = (random() % 128) + 16;
......@@ -127,7 +127,7 @@ insert_random_message_to_leaf(BRT t, BASEMENTNODE blb, LEAFENTRY *save, XIDS xid
int64_t 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, blb, &msg, NULL, NULL);
toku_brt_bn_apply_cmd(t->compare_fun, t->update_fun, NULL, blb, &msg, NULL, NULL);
if (msn.msn > blb->max_msn_applied.msn) {
blb->max_msn_applied = msn;
}
......@@ -139,7 +139,7 @@ insert_random_message_to_leaf(BRT t, BASEMENTNODE blb, LEAFENTRY *save, XIDS xid
// used for making two leaf nodes the same in order to compare the result
// of 'maybe_apply' and a normal buffer flush
static void
insert_same_message_to_leaves(BRT t, BASEMENTNODE blb1, BASEMENTNODE blb2, LEAFENTRY *save, XIDS xids, int pfx)
insert_same_message_to_bns(BRT t, BASEMENTNODE blb1, BASEMENTNODE blb2, LEAFENTRY *save, XIDS xids, int pfx)
{
int keylen = (random() % 16) + 16;
int vallen = (random() % 128) + 16;
......@@ -168,11 +168,11 @@ insert_same_message_to_leaves(BRT t, BASEMENTNODE blb1, BASEMENTNODE blb2, LEAFE
int64_t 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, blb1, &msg, NULL, NULL);
toku_brt_bn_apply_cmd(t->compare_fun, t->update_fun, NULL, blb1, &msg, NULL, 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, blb2, &msg, NULL, NULL);
toku_brt_bn_apply_cmd(t->compare_fun, t->update_fun, NULL, blb2, &msg, NULL, NULL);
if (msn.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) {
int total_size = 0;
for (i = 0; total_size < 128*1024; ++i) {
total_size -= child_blbs[i%8]->n_bytes_in_buffer;
insert_random_message_to_leaf(t, child_blbs[i%8], &child_messages[i], xids_123, i%8);
insert_random_message_to_bn(t, child_blbs[i%8], &child_messages[i], xids_123, i%8);
total_size += child_blbs[i%8]->n_bytes_in_buffer;
if (i % 8 < 7) {
u_int32_t keylen;
......@@ -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);
toku_brt_leaf_apply_cmd(t->compare_fun, t->update_fun, &t->h->descriptor, child, parent_messages[i], NULL, NULL);
}
}
for (i = 0; i < 8; ++i) {
......@@ -771,7 +771,7 @@ flush_to_leaf_with_keyrange(BRT t, bool make_leaf_up_to_date) {
int total_size = 0;
for (i = 0; total_size < 128*1024; ++i) {
total_size -= child_blbs[i%8]->n_bytes_in_buffer;
insert_random_message_to_leaf(t, child_blbs[i%8], &child_messages[i], xids_123, i%8);
insert_random_message_to_bn(t, child_blbs[i%8], &child_messages[i], xids_123, i%8);
total_size += child_blbs[i%8]->n_bytes_in_buffer;
u_int32_t keylen;
char *key = le_key_and_len(child_messages[i], &keylen);
......@@ -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);
toku_brt_leaf_apply_cmd(t->compare_fun, t->update_fun, &t->h->descriptor, child, parent_messages[i], NULL, NULL);
}
}
for (i = 0; i < 8; ++i) {
......@@ -958,7 +958,7 @@ compare_apply_and_flush(BRT t, bool make_leaf_up_to_date) {
int total_size = 0;
for (i = 0; total_size < 128*1024; ++i) {
total_size -= child1_blbs[i%8]->n_bytes_in_buffer;
insert_same_message_to_leaves(t, child1_blbs[i%8], child2_blbs[i%8], &child_messages[i], xids_123, i%8);
insert_same_message_to_bns(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;
if (i % 8 < 7) {
u_int32_t keylen;
......@@ -1001,8 +1001,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);
toku_apply_cmd_to_leaf(t->compare_fun, t->update_fun, &t->h->descriptor, child2, parent_messages[i], NULL, NULL);
toku_brt_leaf_apply_cmd(t->compare_fun, t->update_fun, &t->h->descriptor, child1, parent_messages[i], NULL, NULL);
toku_brt_leaf_apply_cmd(t->compare_fun, t->update_fun, &t->h->descriptor, child2, parent_messages[i], NULL, NULL);
}
}
for (i = 0; i < 8; ++i) {
......
......@@ -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(BLB(leafnode, 0), &cmd, idx, NULL, NULL, NULL);
toku_brt_bn_apply_cmd_once(BLB(leafnode, 0), &cmd, idx, NULL, 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(BLB(leafnode, 0), &cmd, idx, NULL, NULL, NULL);
toku_brt_bn_apply_cmd_once(BLB(leafnode, 0), &cmd, idx, NULL, 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(BLB(leafnode, 0), &cmd, idx, NULL, NULL, NULL);
toku_brt_bn_apply_cmd_once(BLB(leafnode, 0), &cmd, idx, NULL, 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(BLB(leafnode, 0), &cmd, idx, NULL, NULL, NULL);
toku_brt_bn_apply_cmd_once(BLB(leafnode, 0), &cmd, idx, NULL, 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(BLB(leafnode,0), &cmd, idx, NULL, NULL, NULL);
toku_brt_bn_apply_cmd_once(BLB(leafnode,0), &cmd, idx, NULL, 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(BLB(leafnode, 0), &cmd, idx, NULL, NULL, NULL);
toku_brt_bn_apply_cmd_once(BLB(leafnode, 0), &cmd, idx, NULL, 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(BLB(leafnode, 0), &cmd, idx, NULL, NULL, NULL);
toku_brt_bn_apply_cmd_once(BLB(leafnode, 0), &cmd, idx, NULL, NULL, NULL);
// dont forget to dirty the node
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