mirror of
https://github.com/MariaDB/server.git
synced 2025-02-01 11:31:51 +01:00
Refs Tokutek/ft-index#46 Rename dmt_size->num_klpairs, dmt_iterate*->iterate*
This commit is contained in:
parent
4d3451acd0
commit
a5e7b6aca6
22 changed files with 87 additions and 90 deletions
10
ft/bndata.cc
10
ft/bndata.cc
|
@ -186,7 +186,7 @@ void bn_data::serialize_to_wbuf(struct wbuf *const wb) {
|
|||
//
|
||||
// iterate over leafentries and place them into the buffer
|
||||
//
|
||||
dmt_iterate<struct wbuf, wbufwriteleafentry>(wb);
|
||||
iterate<struct wbuf, wbufwriteleafentry>(wb);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -552,7 +552,7 @@ void bn_data::split_klpairs(
|
|||
{
|
||||
// We use move_leafentries_to during a split, and the split algorithm should never call this
|
||||
// if it's splitting on a boundary, so there must be some leafentries in the range to move.
|
||||
paranoid_invariant(split_at < dmt_size());
|
||||
paranoid_invariant(split_at < num_klpairs());
|
||||
|
||||
right_bd->init_zero();
|
||||
|
||||
|
@ -568,7 +568,7 @@ void bn_data::split_klpairs(
|
|||
left_dmt_builder.create(split_at, m_disksize_of_keys); // overkill, but safe (builder will realloc at the end)
|
||||
|
||||
klpair_dmt_t::builder right_dmt_builder;
|
||||
right_dmt_builder.create(dmt_size() - split_at, m_disksize_of_keys); // overkill, but safe (builder will realloc at the end)
|
||||
right_dmt_builder.create(num_klpairs() - split_at, m_disksize_of_keys); // overkill, but safe (builder will realloc at the end)
|
||||
|
||||
split_klpairs_extra extra(this, right_bd, &left_dmt_builder, &right_dmt_builder, &new_left_mp, split_at);
|
||||
|
||||
|
@ -625,7 +625,7 @@ void bn_data::verify_mempool(void) {
|
|||
m_buffer.iterate_ptr< decltype(state), verify_le_in_mempool >(&state);
|
||||
}
|
||||
|
||||
uint32_t bn_data::dmt_size(void) const {
|
||||
uint32_t bn_data::num_klpairs(void) const {
|
||||
return m_buffer.size();
|
||||
}
|
||||
|
||||
|
@ -648,7 +648,7 @@ void bn_data::set_contents_as_clone_of_sorted_array(
|
|||
{
|
||||
//Enforce "just created" invariant.
|
||||
paranoid_invariant_zero(m_disksize_of_keys);
|
||||
paranoid_invariant_zero(dmt_size());
|
||||
paranoid_invariant_zero(num_klpairs());
|
||||
paranoid_invariant_null(toku_mempool_get_base(&m_buffer_mempool));
|
||||
paranoid_invariant_zero(toku_mempool_get_size(&m_buffer_mempool));
|
||||
|
||||
|
|
11
ft/bndata.h
11
ft/bndata.h
|
@ -193,22 +193,19 @@ public:
|
|||
void verify_mempool(void);
|
||||
|
||||
// size() of key dmt
|
||||
// TODO(yoni): maybe rename to something like num_klpairs
|
||||
uint32_t dmt_size(void) const;
|
||||
uint32_t num_klpairs(void) const;
|
||||
|
||||
// iterate() on key dmt (and associated leafentries)
|
||||
// TODO(yoni): rename to iterate
|
||||
template<typename iterate_extra_t,
|
||||
int (*f)(const void * key, const uint32_t keylen, const LEAFENTRY &, const uint32_t, iterate_extra_t *const)>
|
||||
int dmt_iterate(iterate_extra_t *const iterate_extra) const {
|
||||
return dmt_iterate_on_range<iterate_extra_t, f>(0, dmt_size(), iterate_extra);
|
||||
int iterate(iterate_extra_t *const iterate_extra) const {
|
||||
return iterate_on_range<iterate_extra_t, f>(0, num_klpairs(), iterate_extra);
|
||||
}
|
||||
|
||||
// iterate_on_range() on key dmt (and associated leafentries)
|
||||
// TODO(yoni): rename to iterate_on_range
|
||||
template<typename iterate_extra_t,
|
||||
int (*f)(const void * key, const uint32_t keylen, const LEAFENTRY &, const uint32_t, iterate_extra_t *const)>
|
||||
int dmt_iterate_on_range(const uint32_t left, const uint32_t right, iterate_extra_t *const iterate_extra) const {
|
||||
int iterate_on_range(const uint32_t left, const uint32_t right, iterate_extra_t *const iterate_extra) const {
|
||||
klpair_iterate_extra<iterate_extra_t> klpair_extra = { iterate_extra, this };
|
||||
return m_buffer.iterate_on_range< klpair_iterate_extra<iterate_extra_t>, klpair_iterate_wrapper<iterate_extra_t, f> >(left, right, &klpair_extra);
|
||||
}
|
||||
|
|
|
@ -689,16 +689,16 @@ ftleaf_get_split_loc(
|
|||
switch (split_mode) {
|
||||
case SPLIT_LEFT_HEAVY: {
|
||||
*num_left_bns = node->n_children;
|
||||
*num_left_les = BLB_DATA(node, *num_left_bns - 1)->dmt_size();
|
||||
*num_left_les = BLB_DATA(node, *num_left_bns - 1)->num_klpairs();
|
||||
if (*num_left_les == 0) {
|
||||
*num_left_bns = node->n_children - 1;
|
||||
*num_left_les = BLB_DATA(node, *num_left_bns - 1)->dmt_size();
|
||||
*num_left_les = BLB_DATA(node, *num_left_bns - 1)->num_klpairs();
|
||||
}
|
||||
goto exit;
|
||||
}
|
||||
case SPLIT_RIGHT_HEAVY: {
|
||||
*num_left_bns = 1;
|
||||
*num_left_les = BLB_DATA(node, 0)->dmt_size() ? 1 : 0;
|
||||
*num_left_les = BLB_DATA(node, 0)->num_klpairs() ? 1 : 0;
|
||||
goto exit;
|
||||
}
|
||||
case SPLIT_EVENLY: {
|
||||
|
@ -708,7 +708,7 @@ ftleaf_get_split_loc(
|
|||
uint32_t size_so_far = 0;
|
||||
for (int i = 0; i < node->n_children; i++) {
|
||||
bn_data* bd = BLB_DATA(node, i);
|
||||
uint32_t n_leafentries = bd->dmt_size();
|
||||
uint32_t n_leafentries = bd->num_klpairs();
|
||||
for (uint32_t j=0; j < n_leafentries; j++) {
|
||||
size_t size_this_le;
|
||||
int rr = bd->fetch_klpair_disksize(j, &size_this_le);
|
||||
|
@ -725,7 +725,7 @@ ftleaf_get_split_loc(
|
|||
(*num_left_les)--;
|
||||
} else if (*num_left_bns > 1) {
|
||||
(*num_left_bns)--;
|
||||
*num_left_les = BLB_DATA(node, *num_left_bns - 1)->dmt_size();
|
||||
*num_left_les = BLB_DATA(node, *num_left_bns - 1)->num_klpairs();
|
||||
} else {
|
||||
// we are trying to split a leaf with only one
|
||||
// leafentry in it
|
||||
|
@ -754,7 +754,7 @@ move_leafentries(
|
|||
)
|
||||
//Effect: move leafentries in the range [lbi, upe) from src_omt to newly created dest_omt
|
||||
{
|
||||
invariant(ube == src_bn->data_buffer.dmt_size());
|
||||
invariant(ube == src_bn->data_buffer.num_klpairs());
|
||||
src_bn->data_buffer.split_klpairs(&dest_bn->data_buffer, lbi);
|
||||
}
|
||||
|
||||
|
@ -852,7 +852,7 @@ ftleaf_split(
|
|||
ftleaf_get_split_loc(node, split_mode, &num_left_bns, &num_left_les);
|
||||
{
|
||||
// did we split right on the boundary between basement nodes?
|
||||
const bool split_on_boundary = (num_left_les == 0) || (num_left_les == (int) BLB_DATA(node, num_left_bns - 1)->dmt_size());
|
||||
const bool split_on_boundary = (num_left_les == 0) || (num_left_les == (int) BLB_DATA(node, num_left_bns - 1)->num_klpairs());
|
||||
// Now we know where we are going to break it
|
||||
// the two nodes will have a total of n_children+1 basement nodes
|
||||
// and n_children-1 pivots
|
||||
|
@ -913,7 +913,7 @@ ftleaf_split(
|
|||
move_leafentries(BLB(B, curr_dest_bn_index),
|
||||
BLB(node, curr_src_bn_index),
|
||||
num_left_les, // first row to be moved to B
|
||||
BLB_DATA(node, curr_src_bn_index)->dmt_size() // number of rows in basement to be split
|
||||
BLB_DATA(node, curr_src_bn_index)->num_klpairs() // number of rows in basement to be split
|
||||
);
|
||||
BLB_MAX_MSN_APPLIED(B, curr_dest_bn_index) = BLB_MAX_MSN_APPLIED(node, curr_src_bn_index);
|
||||
curr_dest_bn_index++;
|
||||
|
@ -958,7 +958,7 @@ ftleaf_split(
|
|||
bn_data* bd = BLB_DATA(node, num_left_bns - 1);
|
||||
uint32_t keylen;
|
||||
void *key;
|
||||
int rr = bd->fetch_key_and_len(bd->dmt_size() - 1, &keylen, &key);
|
||||
int rr = bd->fetch_key_and_len(bd->num_klpairs() - 1, &keylen, &key);
|
||||
invariant_zero(rr);
|
||||
toku_memdup_dbt(splitk, key, keylen);
|
||||
}
|
||||
|
@ -1173,7 +1173,7 @@ merge_leaf_nodes(FTNODE a, FTNODE b)
|
|||
// this bool states if the last basement node in a has any items or not
|
||||
// If it does, then it stays in the merge. If it does not, the last basement node
|
||||
// of a gets eliminated because we do not have a pivot to store for it (because it has no elements)
|
||||
const bool a_has_tail = a_last_bd->dmt_size() > 0;
|
||||
const bool a_has_tail = a_last_bd->num_klpairs() > 0;
|
||||
|
||||
// move each basement node from b to a
|
||||
// move the pivots, adding one of what used to be max(a)
|
||||
|
@ -1200,7 +1200,7 @@ merge_leaf_nodes(FTNODE a, FTNODE b)
|
|||
if (a_has_tail) {
|
||||
uint32_t keylen;
|
||||
void *key;
|
||||
int rr = a_last_bd->fetch_key_and_len(a_last_bd->dmt_size() - 1, &keylen, &key);
|
||||
int rr = a_last_bd->fetch_key_and_len(a_last_bd->num_klpairs() - 1, &keylen, &key);
|
||||
invariant_zero(rr);
|
||||
toku_memdup_dbt(&a->childkeys[a->n_children-1], key, keylen);
|
||||
a->totalchildkeylens += keylen;
|
||||
|
|
56
ft/ft-ops.cc
56
ft/ft-ops.cc
|
@ -419,7 +419,7 @@ get_leaf_num_entries(FTNODE node) {
|
|||
int i;
|
||||
toku_assert_entire_node_in_memory(node);
|
||||
for ( i = 0; i < node->n_children; i++) {
|
||||
result += BLB_DATA(node, i)->dmt_size();
|
||||
result += BLB_DATA(node, i)->num_klpairs();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -1910,7 +1910,7 @@ toku_ft_bn_apply_cmd (
|
|||
void* key = NULL;
|
||||
uint32_t keylen = 0;
|
||||
|
||||
uint32_t dmt_size;
|
||||
uint32_t num_klpairs;
|
||||
int r;
|
||||
struct cmd_leafval_heaviside_extra be = {compare_fun, desc, cmd->u.id.key};
|
||||
|
||||
|
@ -1922,7 +1922,7 @@ toku_ft_bn_apply_cmd (
|
|||
case FT_INSERT: {
|
||||
uint32_t idx;
|
||||
if (doing_seqinsert) {
|
||||
idx = bn->data_buffer.dmt_size();
|
||||
idx = bn->data_buffer.num_klpairs();
|
||||
DBT kdbt;
|
||||
r = bn->data_buffer.fetch_key_and_len(idx-1, &kdbt.size, &kdbt.data);
|
||||
if (r != 0) goto fz;
|
||||
|
@ -1950,7 +1950,7 @@ toku_ft_bn_apply_cmd (
|
|||
// the leaf then it is sequential
|
||||
// window = min(32, number of leaf entries/16)
|
||||
{
|
||||
uint32_t s = bn->data_buffer.dmt_size();
|
||||
uint32_t s = bn->data_buffer.num_klpairs();
|
||||
uint32_t w = s / 16;
|
||||
if (w == 0) w = 1;
|
||||
if (w > 32) w = 32;
|
||||
|
@ -1985,8 +1985,8 @@ toku_ft_bn_apply_cmd (
|
|||
case FT_COMMIT_BROADCAST_ALL:
|
||||
case FT_OPTIMIZE:
|
||||
// Apply to all leafentries
|
||||
dmt_size = bn->data_buffer.dmt_size();
|
||||
for (uint32_t idx = 0; idx < dmt_size; ) {
|
||||
num_klpairs = bn->data_buffer.num_klpairs();
|
||||
for (uint32_t idx = 0; idx < num_klpairs; ) {
|
||||
DBT curr_keydbt;
|
||||
void* curr_keyp = NULL;
|
||||
uint32_t curr_keylen = 0;
|
||||
|
@ -2000,26 +2000,26 @@ toku_ft_bn_apply_cmd (
|
|||
if (!le_is_clean(storeddata)) { //If already clean, nothing to do.
|
||||
toku_ft_bn_apply_cmd_once(bn, cmd, idx, storeddata, oldest_referenced_xid_known, gc_info, workdone, stats_to_update);
|
||||
// at this point, we cannot trust cmd->u.id.key to be valid.
|
||||
uint32_t new_dmt_size = bn->data_buffer.dmt_size();
|
||||
if (new_dmt_size != dmt_size) {
|
||||
paranoid_invariant(new_dmt_size+1 == dmt_size);
|
||||
uint32_t new_dmt_size = bn->data_buffer.num_klpairs();
|
||||
if (new_dmt_size != num_klpairs) {
|
||||
paranoid_invariant(new_dmt_size+1 == num_klpairs);
|
||||
//Item was deleted.
|
||||
deleted = 1;
|
||||
}
|
||||
}
|
||||
if (deleted)
|
||||
dmt_size--;
|
||||
num_klpairs--;
|
||||
else
|
||||
idx++;
|
||||
}
|
||||
paranoid_invariant(bn->data_buffer.dmt_size() == dmt_size);
|
||||
paranoid_invariant(bn->data_buffer.num_klpairs() == num_klpairs);
|
||||
|
||||
break;
|
||||
case FT_COMMIT_BROADCAST_TXN:
|
||||
case FT_ABORT_BROADCAST_TXN:
|
||||
// Apply to all leafentries if txn is represented
|
||||
dmt_size = bn->data_buffer.dmt_size();
|
||||
for (uint32_t idx = 0; idx < dmt_size; ) {
|
||||
num_klpairs = bn->data_buffer.num_klpairs();
|
||||
for (uint32_t idx = 0; idx < num_klpairs; ) {
|
||||
DBT curr_keydbt;
|
||||
void* curr_keyp = NULL;
|
||||
uint32_t curr_keylen = 0;
|
||||
|
@ -2032,19 +2032,19 @@ toku_ft_bn_apply_cmd (
|
|||
int deleted = 0;
|
||||
if (le_has_xids(storeddata, cmd->xids)) {
|
||||
toku_ft_bn_apply_cmd_once(bn, cmd, idx, storeddata, oldest_referenced_xid_known, gc_info, workdone, stats_to_update);
|
||||
uint32_t new_dmt_size = bn->data_buffer.dmt_size();
|
||||
if (new_dmt_size != dmt_size) {
|
||||
paranoid_invariant(new_dmt_size+1 == dmt_size);
|
||||
uint32_t new_dmt_size = bn->data_buffer.num_klpairs();
|
||||
if (new_dmt_size != num_klpairs) {
|
||||
paranoid_invariant(new_dmt_size+1 == num_klpairs);
|
||||
//Item was deleted.
|
||||
deleted = 1;
|
||||
}
|
||||
}
|
||||
if (deleted)
|
||||
dmt_size--;
|
||||
num_klpairs--;
|
||||
else
|
||||
idx++;
|
||||
}
|
||||
paranoid_invariant(bn->data_buffer.dmt_size() == dmt_size);
|
||||
paranoid_invariant(bn->data_buffer.num_klpairs() == num_klpairs);
|
||||
|
||||
break;
|
||||
case FT_UPDATE: {
|
||||
|
@ -2073,7 +2073,7 @@ toku_ft_bn_apply_cmd (
|
|||
// apply to all leafentries.
|
||||
uint32_t idx = 0;
|
||||
uint32_t num_leafentries_before;
|
||||
while (idx < (num_leafentries_before = bn->data_buffer.dmt_size())) {
|
||||
while (idx < (num_leafentries_before = bn->data_buffer.num_klpairs())) {
|
||||
void* curr_key = nullptr;
|
||||
uint32_t curr_keylen = 0;
|
||||
r = bn->data_buffer.fetch_klpair(idx, &storeddata, &curr_keylen, &curr_key);
|
||||
|
@ -2091,7 +2091,7 @@ toku_ft_bn_apply_cmd (
|
|||
r = do_update(update_fun, desc, bn, cmd, idx, storeddata, curr_key, curr_keylen, oldest_referenced_xid_known, gc_info, workdone, stats_to_update);
|
||||
assert_zero(r);
|
||||
|
||||
if (num_leafentries_before == bn->data_buffer.dmt_size()) {
|
||||
if (num_leafentries_before == bn->data_buffer.num_klpairs()) {
|
||||
// we didn't delete something, so increment the index.
|
||||
idx++;
|
||||
}
|
||||
|
@ -2404,7 +2404,7 @@ basement_node_gc_all_les(BASEMENTNODE bn,
|
|||
int r = 0;
|
||||
uint32_t index = 0;
|
||||
uint32_t num_leafentries_before;
|
||||
while (index < (num_leafentries_before = bn->data_buffer.dmt_size())) {
|
||||
while (index < (num_leafentries_before = bn->data_buffer.num_klpairs())) {
|
||||
void* keyp = NULL;
|
||||
uint32_t keylen = 0;
|
||||
LEAFENTRY leaf_entry;
|
||||
|
@ -2423,7 +2423,7 @@ basement_node_gc_all_les(BASEMENTNODE bn,
|
|||
delta
|
||||
);
|
||||
// Check if the leaf entry was deleted or not.
|
||||
if (num_leafentries_before == bn->data_buffer.dmt_size()) {
|
||||
if (num_leafentries_before == bn->data_buffer.num_klpairs()) {
|
||||
++index;
|
||||
}
|
||||
}
|
||||
|
@ -4929,7 +4929,7 @@ ok: ;
|
|||
switch (search->direction) {
|
||||
case FT_SEARCH_LEFT:
|
||||
idx++;
|
||||
if (idx >= bn->data_buffer.dmt_size()) {
|
||||
if (idx >= bn->data_buffer.num_klpairs()) {
|
||||
if (ftcursor->interrupt_cb && ftcursor->interrupt_cb(ftcursor->interrupt_cb_extra)) {
|
||||
return TOKUDB_INTERRUPTED;
|
||||
}
|
||||
|
@ -5604,7 +5604,7 @@ ft_cursor_shortcut (
|
|||
int r = 0;
|
||||
// if we are searching towards the end, limit is last element
|
||||
// if we are searching towards the beginning, limit is the first element
|
||||
uint32_t limit = (direction > 0) ? (bd->dmt_size() - 1) : 0;
|
||||
uint32_t limit = (direction > 0) ? (bd->num_klpairs() - 1) : 0;
|
||||
|
||||
//Starting with the prev, find the first real (non-provdel) leafentry.
|
||||
while (index != limit) {
|
||||
|
@ -5895,7 +5895,7 @@ keysrange_in_leaf_partition (FT_HANDLE brt, FTNODE node,
|
|||
*less = idx_left;
|
||||
*equal_left = (r==0) ? 1 : 0;
|
||||
|
||||
uint32_t size = bn->data_buffer.dmt_size();
|
||||
uint32_t size = bn->data_buffer.num_klpairs();
|
||||
uint32_t idx_right = size;
|
||||
r = -1;
|
||||
if (single_basement && key_right) {
|
||||
|
@ -6155,7 +6155,7 @@ static int get_key_after_bytes_in_basementnode(FT ft, BASEMENTNODE bn, const DBT
|
|||
assert(r == 0 || r == DB_NOTFOUND);
|
||||
}
|
||||
struct get_key_after_bytes_iterate_extra iter_extra = {skip_len, skipped, callback, cb_extra};
|
||||
r = bn->data_buffer.dmt_iterate_on_range<get_key_after_bytes_iterate_extra, get_key_after_bytes_iterate>(idx_left, bn->data_buffer.dmt_size(), &iter_extra);
|
||||
r = bn->data_buffer.iterate_on_range<get_key_after_bytes_iterate_extra, get_key_after_bytes_iterate>(idx_left, bn->data_buffer.num_klpairs(), &iter_extra);
|
||||
|
||||
// Invert the sense of r == 0 (meaning the iterate finished, which means we didn't find what we wanted)
|
||||
if (r == 1) {
|
||||
|
@ -6351,7 +6351,7 @@ toku_dump_ftnode (FILE *file, FT_HANDLE brt, BLOCKNUM blocknum, int depth, const
|
|||
});
|
||||
}
|
||||
else {
|
||||
int size = BLB_DATA(node, i)->dmt_size();
|
||||
int size = BLB_DATA(node, i)->num_klpairs();
|
||||
if (0)
|
||||
for (int j=0; j<size; j++) {
|
||||
LEAFENTRY le;
|
||||
|
@ -6533,7 +6533,7 @@ static bool is_empty_fast_iter (FT_HANDLE brt, FTNODE node) {
|
|||
} else {
|
||||
// leaf: If the dmt is empty, we are happy.
|
||||
for (int i = 0; i < node->n_children; i++) {
|
||||
if (BLB_DATA(node, i)->dmt_size()) {
|
||||
if (BLB_DATA(node, i)->num_klpairs()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -424,7 +424,7 @@ toku_verify_ftnode_internal(FT_HANDLE brt,
|
|||
}
|
||||
else {
|
||||
BASEMENTNODE bn = BLB(node, i);
|
||||
for (uint32_t j = 0; j < bn->data_buffer.dmt_size(); j++) {
|
||||
for (uint32_t j = 0; j < bn->data_buffer.num_klpairs(); j++) {
|
||||
VERIFY_ASSERTION((rootmsn.msn >= this_msn.msn), 0, "leaf may have latest msn, but cannot be greater than root msn");
|
||||
DBT kdbt = get_ith_key_dbt(bn, j);
|
||||
if (curr_less_pivot) {
|
||||
|
|
2
ft/ft.cc
2
ft/ft.cc
|
@ -1078,7 +1078,7 @@ garbage_helper(BLOCKNUM blocknum, int64_t UU(size), int64_t UU(address), void *e
|
|||
}
|
||||
for (int i = 0; i < node->n_children; ++i) {
|
||||
bn_data* bd = BLB_DATA(node, i);
|
||||
r = bd->dmt_iterate<struct garbage_helper_extra, garbage_leafentry_helper>(info);
|
||||
r = bd->iterate<struct garbage_helper_extra, garbage_leafentry_helper>(info);
|
||||
if (r != 0) {
|
||||
goto exit;
|
||||
}
|
||||
|
|
|
@ -353,7 +353,7 @@ serialize_ftnode_partition(FTNODE node, int i, struct sub_block *sb) {
|
|||
bn_data* bd = BLB_DATA(node, i);
|
||||
|
||||
wbuf_nocrc_char(&wb, ch);
|
||||
wbuf_nocrc_uint(&wb, bd->dmt_size());
|
||||
wbuf_nocrc_uint(&wb, bd->num_klpairs());
|
||||
|
||||
bd->serialize_to_wbuf(&wb);
|
||||
}
|
||||
|
@ -518,7 +518,7 @@ rebalance_ftnode_leaf(FTNODE node, unsigned int basementnodesize)
|
|||
// Count number of leaf entries in this leaf (num_le).
|
||||
uint32_t num_le = 0;
|
||||
for (uint32_t i = 0; i < num_orig_basements; i++) {
|
||||
num_le += BLB_DATA(node, i)->dmt_size();
|
||||
num_le += BLB_DATA(node, i)->num_klpairs();
|
||||
}
|
||||
|
||||
uint32_t num_alloc = num_le ? num_le : 1; // simplify logic below by always having at least one entry per array
|
||||
|
@ -545,8 +545,8 @@ rebalance_ftnode_leaf(FTNODE node, unsigned int basementnodesize)
|
|||
for (uint32_t i = 0; i < num_orig_basements; i++) {
|
||||
bn_data* bd = BLB_DATA(node, i);
|
||||
struct array_info ai {.offset = curr_le, .le_array = leafpointers, .key_sizes_array = key_sizes, .key_ptr_array = key_pointers };
|
||||
bd->dmt_iterate<array_info, array_item>(&ai);
|
||||
curr_le += bd->dmt_size();
|
||||
bd->iterate<array_info, array_item>(&ai);
|
||||
curr_le += bd->num_klpairs();
|
||||
}
|
||||
|
||||
// Create an array that will store indexes of new pivots.
|
||||
|
|
|
@ -2917,7 +2917,7 @@ static void add_pair_to_leafnode (struct leaf_buf *lbuf, unsigned char *key, int
|
|||
// #3588 TODO just make a clean ule and append it to the omt
|
||||
// #3588 TODO can do the rebalancing here and avoid a lot of work later
|
||||
FTNODE leafnode = lbuf->node;
|
||||
uint32_t idx = BLB_DATA(leafnode, 0)->dmt_size();
|
||||
uint32_t idx = BLB_DATA(leafnode, 0)->num_klpairs();
|
||||
DBT thekey = { .data = key, .size = (uint32_t) keylen };
|
||||
DBT theval = { .data = val, .size = (uint32_t) vallen };
|
||||
FT_MSG_S cmd = { .type = FT_INSERT,
|
||||
|
|
|
@ -362,7 +362,7 @@ test_serialize_leaf_check_msn(enum ftnode_verify_type bft, bool do_clone) {
|
|||
if (bn > 0) {
|
||||
assert(dest_ndd[bn].start >= dest_ndd[bn-1].start + dest_ndd[bn-1].size);
|
||||
}
|
||||
for (uint32_t i = 0; i < BLB_DATA(dn, bn)->dmt_size(); i++) {
|
||||
for (uint32_t i = 0; i < BLB_DATA(dn, bn)->num_klpairs(); i++) {
|
||||
LEAFENTRY curr_le;
|
||||
uint32_t curr_keylen;
|
||||
void* curr_key;
|
||||
|
@ -504,8 +504,8 @@ test_serialize_leaf_with_large_pivots(enum ftnode_verify_type bft, bool do_clone
|
|||
if (bn > 0) {
|
||||
assert(dest_ndd[bn].start >= dest_ndd[bn-1].start + dest_ndd[bn-1].size);
|
||||
}
|
||||
assert(BLB_DATA(dn, bn)->dmt_size() > 0);
|
||||
for (uint32_t i = 0; i < BLB_DATA(dn, bn)->dmt_size(); i++) {
|
||||
assert(BLB_DATA(dn, bn)->num_klpairs() > 0);
|
||||
for (uint32_t i = 0; i < BLB_DATA(dn, bn)->num_klpairs(); i++) {
|
||||
LEAFENTRY curr_le;
|
||||
uint32_t curr_keylen;
|
||||
void* curr_key;
|
||||
|
@ -636,8 +636,8 @@ test_serialize_leaf_with_many_rows(enum ftnode_verify_type bft, bool do_clone) {
|
|||
if (bn > 0) {
|
||||
assert(dest_ndd[bn].start >= dest_ndd[bn-1].start + dest_ndd[bn-1].size);
|
||||
}
|
||||
assert(BLB_DATA(dn, bn)->dmt_size() > 0);
|
||||
for (uint32_t i = 0; i < BLB_DATA(dn, bn)->dmt_size(); i++) {
|
||||
assert(BLB_DATA(dn, bn)->num_klpairs() > 0);
|
||||
for (uint32_t i = 0; i < BLB_DATA(dn, bn)->num_klpairs(); i++) {
|
||||
LEAFENTRY curr_le;
|
||||
uint32_t curr_keylen;
|
||||
void* curr_key;
|
||||
|
@ -786,8 +786,8 @@ test_serialize_leaf_with_large_rows(enum ftnode_verify_type bft, bool do_clone)
|
|||
if (bn > 0) {
|
||||
assert(dest_ndd[bn].start >= dest_ndd[bn-1].start + dest_ndd[bn-1].size);
|
||||
}
|
||||
assert(BLB_DATA(dn, bn)->dmt_size() > 0);
|
||||
for (uint32_t i = 0; i < BLB_DATA(dn, bn)->dmt_size(); i++) {
|
||||
assert(BLB_DATA(dn, bn)->num_klpairs() > 0);
|
||||
for (uint32_t i = 0; i < BLB_DATA(dn, bn)->num_klpairs(); i++) {
|
||||
LEAFENTRY curr_le;
|
||||
uint32_t curr_keylen;
|
||||
void* curr_key;
|
||||
|
@ -924,7 +924,7 @@ test_serialize_leaf_with_empty_basement_nodes(enum ftnode_verify_type bft, bool
|
|||
if (bn > 0) {
|
||||
assert(dest_ndd[bn].start >= dest_ndd[bn-1].start + dest_ndd[bn-1].size);
|
||||
}
|
||||
for (uint32_t i = 0; i < BLB_DATA(dn, bn)->dmt_size(); i++) {
|
||||
for (uint32_t i = 0; i < BLB_DATA(dn, bn)->num_klpairs(); i++) {
|
||||
LEAFENTRY curr_le;
|
||||
uint32_t curr_keylen;
|
||||
void* curr_key;
|
||||
|
@ -1045,7 +1045,7 @@ test_serialize_leaf_with_multiple_empty_basement_nodes(enum ftnode_verify_type b
|
|||
if (i > 0) {
|
||||
assert(dest_ndd[i].start >= dest_ndd[i-1].start + dest_ndd[i-1].size);
|
||||
}
|
||||
assert(BLB_DATA(dn, i)->dmt_size() == 0);
|
||||
assert(BLB_DATA(dn, i)->num_klpairs() == 0);
|
||||
}
|
||||
}
|
||||
toku_ftnode_free(&dn);
|
||||
|
|
|
@ -119,7 +119,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
|
|||
DBT theval; toku_fill_dbt(&theval, val, vallen);
|
||||
|
||||
// get an index that we can use to create a new leaf entry
|
||||
uint32_t idx = BLB_DATA(leafnode, 0)->dmt_size();
|
||||
uint32_t idx = BLB_DATA(leafnode, 0)->num_klpairs();
|
||||
|
||||
MSN msn = next_dummymsn();
|
||||
|
||||
|
|
|
@ -733,7 +733,7 @@ flush_to_leaf(FT_HANDLE t, bool make_leaf_up_to_date, bool use_flush) {
|
|||
|
||||
int total_messages = 0;
|
||||
for (i = 0; i < 8; ++i) {
|
||||
total_messages += BLB_DATA(child, i)->dmt_size();
|
||||
total_messages += BLB_DATA(child, i)->num_klpairs();
|
||||
}
|
||||
assert(total_messages <= num_parent_messages + num_child_messages);
|
||||
|
||||
|
@ -746,7 +746,7 @@ flush_to_leaf(FT_HANDLE t, bool make_leaf_up_to_date, bool use_flush) {
|
|||
memset(parent_messages_present, 0, sizeof parent_messages_present);
|
||||
memset(child_messages_present, 0, sizeof child_messages_present);
|
||||
for (int j = 0; j < 8; ++j) {
|
||||
uint32_t len = BLB_DATA(child, j)->dmt_size();
|
||||
uint32_t len = BLB_DATA(child, j)->num_klpairs();
|
||||
for (uint32_t idx = 0; idx < len; ++idx) {
|
||||
LEAFENTRY le;
|
||||
DBT keydbt, valdbt;
|
||||
|
@ -968,7 +968,7 @@ flush_to_leaf_with_keyrange(FT_HANDLE t, bool make_leaf_up_to_date) {
|
|||
|
||||
int total_messages = 0;
|
||||
for (i = 0; i < 8; ++i) {
|
||||
total_messages += BLB_DATA(child, i)->dmt_size();
|
||||
total_messages += BLB_DATA(child, i)->num_klpairs();
|
||||
}
|
||||
assert(total_messages <= num_parent_messages + num_child_messages);
|
||||
|
||||
|
@ -1146,8 +1146,8 @@ compare_apply_and_flush(FT_HANDLE t, bool make_leaf_up_to_date) {
|
|||
for (int j = 0; j < 8; ++j) {
|
||||
bn_data* first = BLB_DATA(child1, j);
|
||||
bn_data* second = BLB_DATA(child2, j);
|
||||
uint32_t len = first->dmt_size();
|
||||
assert(len == second->dmt_size());
|
||||
uint32_t len = first->num_klpairs();
|
||||
assert(len == second->num_klpairs());
|
||||
for (uint32_t idx = 0; idx < len; ++idx) {
|
||||
LEAFENTRY le1, le2;
|
||||
DBT key1dbt, val1dbt, key2dbt, val2dbt;
|
||||
|
|
|
@ -348,7 +348,7 @@ doit (int state) {
|
|||
assert(node->height == 0);
|
||||
assert(!node->dirty);
|
||||
assert(node->n_children == 1);
|
||||
assert(BLB_DATA(node, 0)->dmt_size() == 1);
|
||||
assert(BLB_DATA(node, 0)->num_klpairs() == 1);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
|
||||
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
|
@ -364,7 +364,7 @@ doit (int state) {
|
|||
assert(node->height == 0);
|
||||
assert(!node->dirty);
|
||||
assert(node->n_children == 1);
|
||||
assert(BLB_DATA(node, 0)->dmt_size() == 1);
|
||||
assert(BLB_DATA(node, 0)->num_klpairs() == 1);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
|
||||
}
|
||||
else if (state == ft_flush_aflter_merge || state == flt_flush_before_unpin_remove) {
|
||||
|
@ -381,7 +381,7 @@ doit (int state) {
|
|||
assert(node->height == 0);
|
||||
assert(!node->dirty);
|
||||
assert(node->n_children == 1);
|
||||
assert(BLB_DATA(node, 0)->dmt_size() == 2);
|
||||
assert(BLB_DATA(node, 0)->num_klpairs() == 2);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -359,7 +359,7 @@ doit (int state) {
|
|||
assert(node->height == 0);
|
||||
assert(!node->dirty);
|
||||
assert(node->n_children == 1);
|
||||
assert(BLB_DATA(node, 0)->dmt_size() == 2);
|
||||
assert(BLB_DATA(node, 0)->num_klpairs() == 2);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
|
||||
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
|
@ -375,7 +375,7 @@ doit (int state) {
|
|||
assert(node->height == 0);
|
||||
assert(!node->dirty);
|
||||
assert(node->n_children == 1);
|
||||
assert(BLB_DATA(node, 0)->dmt_size() == 2);
|
||||
assert(BLB_DATA(node, 0)->num_klpairs() == 2);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
|
||||
|
||||
|
||||
|
|
|
@ -342,7 +342,7 @@ doit (bool after_split) {
|
|||
assert(node->height == 0);
|
||||
assert(!node->dirty);
|
||||
assert(node->n_children == 1);
|
||||
assert(BLB_DATA(node, 0)->dmt_size() == 1);
|
||||
assert(BLB_DATA(node, 0)->num_klpairs() == 1);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
|
||||
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
|
@ -358,7 +358,7 @@ doit (bool after_split) {
|
|||
assert(node->height == 0);
|
||||
assert(!node->dirty);
|
||||
assert(node->n_children == 1);
|
||||
assert(BLB_DATA(node, 0)->dmt_size() == 1);
|
||||
assert(BLB_DATA(node, 0)->num_klpairs() == 1);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
|
||||
}
|
||||
else {
|
||||
|
@ -375,7 +375,7 @@ doit (bool after_split) {
|
|||
assert(node->height == 0);
|
||||
assert(!node->dirty);
|
||||
assert(node->n_children == 1);
|
||||
assert(BLB_DATA(node, 0)->dmt_size() == 2);
|
||||
assert(BLB_DATA(node, 0)->num_klpairs() == 2);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
|
|||
DBT theval; toku_fill_dbt(&theval, val, vallen);
|
||||
|
||||
// get an index that we can use to create a new leaf entry
|
||||
uint32_t idx = BLB_DATA(leafnode, 0)->dmt_size();
|
||||
uint32_t idx = BLB_DATA(leafnode, 0)->num_klpairs();
|
||||
|
||||
MSN msn = next_dummymsn();
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
|
|||
DBT theval; toku_fill_dbt(&theval, val, vallen);
|
||||
|
||||
// get an index that we can use to create a new leaf entry
|
||||
uint32_t idx = BLB_DATA(leafnode, 0)->dmt_size();
|
||||
uint32_t idx = BLB_DATA(leafnode, 0)->num_klpairs();
|
||||
|
||||
// apply an insert to the leaf node
|
||||
MSN msn = next_dummymsn();
|
||||
|
|
|
@ -112,7 +112,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
|
|||
DBT theval; toku_fill_dbt(&theval, val, vallen);
|
||||
|
||||
// get an index that we can use to create a new leaf entry
|
||||
uint32_t idx = BLB_DATA(leafnode, 0)->dmt_size();
|
||||
uint32_t idx = BLB_DATA(leafnode, 0)->num_klpairs();
|
||||
|
||||
// apply an insert to the leaf node
|
||||
MSN msn = next_dummymsn();
|
||||
|
|
|
@ -111,7 +111,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
|
|||
DBT theval; toku_fill_dbt(&theval, val, vallen);
|
||||
|
||||
// get an index that we can use to create a new leaf entry
|
||||
uint32_t idx = BLB_DATA(leafnode, 0)->dmt_size();
|
||||
uint32_t idx = BLB_DATA(leafnode, 0)->num_klpairs();
|
||||
|
||||
// apply an insert to the leaf node
|
||||
MSN msn = next_dummymsn();
|
||||
|
|
|
@ -112,7 +112,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
|
|||
DBT theval; toku_fill_dbt(&theval, val, vallen);
|
||||
|
||||
// get an index that we can use to create a new leaf entry
|
||||
uint32_t idx = BLB_DATA(leafnode, 0)->dmt_size();
|
||||
uint32_t idx = BLB_DATA(leafnode, 0)->num_klpairs();
|
||||
|
||||
// apply an insert to the leaf node
|
||||
MSN msn = next_dummymsn();
|
||||
|
|
|
@ -114,7 +114,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
|
|||
toku_fill_dbt(&theval, val, vallen);
|
||||
|
||||
// get an index that we can use to create a new leaf entry
|
||||
uint32_t idx = BLB_DATA(leafnode, 0)->dmt_size();
|
||||
uint32_t idx = BLB_DATA(leafnode, 0)->num_klpairs();
|
||||
|
||||
// apply an insert to the leaf node
|
||||
MSN msn = next_dummymsn();
|
||||
|
|
|
@ -111,7 +111,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
|
|||
DBT theval; toku_fill_dbt(&theval, val, vallen);
|
||||
|
||||
// get an index that we can use to create a new leaf entry
|
||||
uint32_t idx = BLB_DATA(leafnode, 0)->dmt_size();
|
||||
uint32_t idx = BLB_DATA(leafnode, 0)->num_klpairs();
|
||||
|
||||
// apply an insert to the leaf node
|
||||
MSN msn = next_dummymsn();
|
||||
|
|
|
@ -315,9 +315,9 @@ dump_node (int f, BLOCKNUM blocknum, FT h) {
|
|||
}
|
||||
} else {
|
||||
printf(" n_bytes_in_buffer= %" PRIu64 "", BLB_DATA(n, i)->get_disk_size());
|
||||
printf(" items_in_buffer=%u\n", BLB_DATA(n, i)->dmt_size());
|
||||
printf(" items_in_buffer=%u\n", BLB_DATA(n, i)->num_klpairs());
|
||||
if (dump_data) {
|
||||
BLB_DATA(n, i)->dmt_iterate<void, print_le>(NULL);
|
||||
BLB_DATA(n, i)->iterate<void, print_le>(NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue