mirror of
https://github.com/MariaDB/server.git
synced 2025-02-01 19:41:47 +01:00
fixes #5762 oldest_referenced_xid and oldest_referenced_xid_known now share a prefix, which makes searching for them together a little easier
git-svn-id: file:///svn/toku/tokudb@51667 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
ea0736aa1c
commit
b604b9d6fc
13 changed files with 66 additions and 66 deletions
|
@ -730,7 +730,7 @@ static void ftnode_finalize_split(FTNODE node, FTNODE B, MSN max_msn_applied_to_
|
|||
B->max_msn_applied_to_node_on_disk = max_msn_applied_to_node;
|
||||
|
||||
// The new node in the split inherits the oldest known reference xid
|
||||
B->oldest_known_referenced_xid = node->oldest_known_referenced_xid;
|
||||
B->oldest_referenced_xid_known = node->oldest_known_referenced_xid;
|
||||
|
||||
node->dirty = 1;
|
||||
B->dirty = 1;
|
||||
|
@ -1107,7 +1107,7 @@ flush_this_child(
|
|||
|
||||
// now we have a bnc to flush to the child. pass down the parent's
|
||||
// oldest known referenced xid as we flush down to the child.
|
||||
toku_bnc_flush_to_child(h, bnc, child, node->oldest_known_referenced_xid);
|
||||
toku_bnc_flush_to_child(h, bnc, child, node->oldest_referenced_xid_known);
|
||||
destroy_nonleaf_childinfo(bnc);
|
||||
}
|
||||
|
||||
|
@ -1528,7 +1528,7 @@ static void ft_flush_some_child(
|
|||
NONLEAF_CHILDINFO bnc = NULL;
|
||||
paranoid_invariant(parent->height>0);
|
||||
toku_assert_entire_node_in_memory(parent);
|
||||
TXNID oldest_referenced_xid = parent->oldest_known_referenced_xid;
|
||||
TXNID oldest_referenced_xid = parent->oldest_referenced_xid_known;
|
||||
|
||||
// pick the child we want to flush to
|
||||
int childnum = fa->pick_child(ft, parent, fa->extra);
|
||||
|
@ -1917,7 +1917,7 @@ place_node_and_bnc_on_background_thread(
|
|||
//
|
||||
void toku_ft_flush_node_on_background_thread(FT h, FTNODE parent)
|
||||
{
|
||||
TXNID oldest_known_referenced_xid = parent->oldest_known_referenced_xid;
|
||||
TXNID oldest_referenced_xid_known = parent->oldest_known_referenced_xid;
|
||||
//
|
||||
// first let's see if we can detach buffer on client thread
|
||||
// and pick the child we want to flush to
|
||||
|
@ -1934,7 +1934,7 @@ void toku_ft_flush_node_on_background_thread(FT h, FTNODE parent)
|
|||
// In this case, we could not lock the child, so just place the parent on the background thread
|
||||
// In the callback, we will use toku_ft_flush_some_child, which checks to
|
||||
// see if we should blow away the old basement nodes.
|
||||
place_node_and_bnc_on_background_thread(h, parent, NULL, oldest_known_referenced_xid);
|
||||
place_node_and_bnc_on_background_thread(h, parent, NULL, oldest_referenced_xid_known);
|
||||
}
|
||||
else {
|
||||
//
|
||||
|
@ -1963,7 +1963,7 @@ void toku_ft_flush_node_on_background_thread(FT h, FTNODE parent)
|
|||
// so, because we know for sure the child is not
|
||||
// reactive, we can unpin the parent
|
||||
//
|
||||
place_node_and_bnc_on_background_thread(h, child, bnc, oldest_known_referenced_xid);
|
||||
place_node_and_bnc_on_background_thread(h, child, bnc, oldest_referenced_xid_known);
|
||||
toku_unpin_ftnode(h, parent);
|
||||
}
|
||||
else {
|
||||
|
@ -1973,7 +1973,7 @@ void toku_ft_flush_node_on_background_thread(FT h, FTNODE parent)
|
|||
toku_unpin_ftnode(h, child);
|
||||
// Again, we'll have the parent on the background thread, so
|
||||
// we don't need to destroy the basement nodes yet.
|
||||
place_node_and_bnc_on_background_thread(h, parent, NULL, oldest_known_referenced_xid);
|
||||
place_node_and_bnc_on_background_thread(h, parent, NULL, oldest_referenced_xid_known);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -258,7 +258,7 @@ struct ftnode {
|
|||
// A better heuristic would be the oldest live txnid, but we use this since it
|
||||
// still works well most of the time, and its readily available on the inject
|
||||
// code path.
|
||||
TXNID oldest_known_referenced_xid;
|
||||
TXNID oldest_referenced_xid_known;
|
||||
|
||||
// array of size n_children, consisting of ftnode partitions
|
||||
// each one is associated with a child
|
||||
|
|
56
ft/ft-ops.cc
56
ft/ft-ops.cc
|
@ -752,7 +752,7 @@ void toku_ftnode_clone_callback(
|
|||
rebalance_ftnode_leaf(node, ft->h->basementnodesize);
|
||||
}
|
||||
|
||||
cloned_node->oldest_known_referenced_xid = node->oldest_known_referenced_xid;
|
||||
cloned_node->oldest_referenced_xid_known = node->oldest_known_referenced_xid;
|
||||
cloned_node->max_msn_applied_to_node_on_disk = node->max_msn_applied_to_node_on_disk;
|
||||
cloned_node->flags = node->flags;
|
||||
cloned_node->thisnodename = node->thisnodename;
|
||||
|
@ -1390,7 +1390,7 @@ toku_initialize_empty_ftnode (FTNODE n, BLOCKNUM nodename, int height, int num_c
|
|||
n->childkeys = 0;
|
||||
n->bp = 0;
|
||||
n->n_children = num_children;
|
||||
n->oldest_known_referenced_xid = TXNID_NONE;
|
||||
n->oldest_referenced_xid_known = TXNID_NONE;
|
||||
|
||||
if (num_children > 0) {
|
||||
XMALLOC_N(num_children-1, n->childkeys);
|
||||
|
@ -1751,7 +1751,7 @@ toku_ft_bn_apply_cmd (
|
|||
DESCRIPTOR desc,
|
||||
BASEMENTNODE bn,
|
||||
FT_MSG cmd,
|
||||
TXNID oldest_known_referenced_xid,
|
||||
TXNID oldest_referenced_xid_known,
|
||||
GC_INFO gc_info,
|
||||
uint64_t *workdone,
|
||||
STAT64INFO stats_to_update
|
||||
|
@ -1794,7 +1794,7 @@ toku_ft_bn_apply_cmd (
|
|||
assert_zero(r);
|
||||
CAST_FROM_VOIDP(storeddata, storeddatav);
|
||||
}
|
||||
toku_ft_bn_apply_cmd_once(bn, cmd, idx, storeddata, oldest_known_referenced_xid, gc_info, workdone, stats_to_update);
|
||||
toku_ft_bn_apply_cmd_once(bn, cmd, idx, storeddata, oldest_referenced_xid_known, gc_info, workdone, stats_to_update);
|
||||
|
||||
// if the insertion point is within a window of the right edge of
|
||||
// the leaf then it is sequential
|
||||
|
@ -1822,7 +1822,7 @@ toku_ft_bn_apply_cmd (
|
|||
if (r == DB_NOTFOUND) break;
|
||||
assert_zero(r);
|
||||
CAST_FROM_VOIDP(storeddata, storeddatav);
|
||||
toku_ft_bn_apply_cmd_once(bn, cmd, idx, storeddata, oldest_known_referenced_xid, gc_info, workdone, stats_to_update);
|
||||
toku_ft_bn_apply_cmd_once(bn, cmd, idx, storeddata, oldest_referenced_xid_known, gc_info, workdone, stats_to_update);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -1838,7 +1838,7 @@ toku_ft_bn_apply_cmd (
|
|||
CAST_FROM_VOIDP(storeddata, storeddatav);
|
||||
int deleted = 0;
|
||||
if (!le_is_clean(storeddata)) { //If already clean, nothing to do.
|
||||
toku_ft_bn_apply_cmd_once(bn, cmd, idx, storeddata, oldest_known_referenced_xid, gc_info, workdone, stats_to_update);
|
||||
toku_ft_bn_apply_cmd_once(bn, cmd, idx, storeddata, oldest_referenced_xid_known, gc_info, workdone, stats_to_update);
|
||||
uint32_t new_omt_size = toku_omt_size(bn->buffer);
|
||||
if (new_omt_size != omt_size) {
|
||||
paranoid_invariant(new_omt_size+1 == omt_size);
|
||||
|
@ -1864,7 +1864,7 @@ toku_ft_bn_apply_cmd (
|
|||
CAST_FROM_VOIDP(storeddata, storeddatav);
|
||||
int deleted = 0;
|
||||
if (le_has_xids(storeddata, cmd->xids)) {
|
||||
toku_ft_bn_apply_cmd_once(bn, cmd, idx, storeddata, oldest_known_referenced_xid, gc_info, workdone, stats_to_update);
|
||||
toku_ft_bn_apply_cmd_once(bn, cmd, idx, storeddata, oldest_referenced_xid_known, gc_info, workdone, stats_to_update);
|
||||
uint32_t new_omt_size = toku_omt_size(bn->buffer);
|
||||
if (new_omt_size != omt_size) {
|
||||
paranoid_invariant(new_omt_size+1 == omt_size);
|
||||
|
@ -1885,10 +1885,10 @@ toku_ft_bn_apply_cmd (
|
|||
r = toku_omt_find_zero(bn->buffer, toku_cmd_leafval_heaviside, &be,
|
||||
&storeddatav, &idx);
|
||||
if (r==DB_NOTFOUND) {
|
||||
r = do_update(update_fun, desc, bn, cmd, idx, NULL, oldest_known_referenced_xid, gc_info, workdone, stats_to_update);
|
||||
r = do_update(update_fun, desc, bn, cmd, idx, NULL, oldest_referenced_xid_known, gc_info, workdone, stats_to_update);
|
||||
} else if (r==0) {
|
||||
CAST_FROM_VOIDP(storeddata, storeddatav);
|
||||
r = do_update(update_fun, desc, bn, cmd, idx, storeddata, oldest_known_referenced_xid, gc_info, workdone, stats_to_update);
|
||||
r = do_update(update_fun, desc, bn, cmd, idx, storeddata, oldest_referenced_xid_known, gc_info, workdone, stats_to_update);
|
||||
} // otherwise, a worse error, just return it
|
||||
break;
|
||||
}
|
||||
|
@ -1900,7 +1900,7 @@ toku_ft_bn_apply_cmd (
|
|||
r = toku_omt_fetch(bn->buffer, idx, &storeddatav);
|
||||
assert_zero(r);
|
||||
CAST_FROM_VOIDP(storeddata, storeddatav);
|
||||
r = do_update(update_fun, desc, bn, cmd, idx, storeddata, oldest_known_referenced_xid, gc_info, workdone, stats_to_update);
|
||||
r = do_update(update_fun, desc, bn, cmd, idx, storeddata, oldest_referenced_xid_known, gc_info, workdone, stats_to_update);
|
||||
assert_zero(r);
|
||||
|
||||
if (num_leafentries_before == toku_omt_size(bn->buffer)) {
|
||||
|
@ -2139,7 +2139,7 @@ ft_basement_node_gc_once(BASEMENTNODE bn,
|
|||
const xid_omt_t &snapshot_xids,
|
||||
const rx_omt_t &referenced_xids,
|
||||
const xid_omt_t &live_root_txns,
|
||||
TXNID oldest_known_referenced_xid,
|
||||
TXNID oldest_referenced_xid_known,
|
||||
STAT64INFO_S * delta)
|
||||
{
|
||||
paranoid_invariant(leaf_entry);
|
||||
|
@ -2150,7 +2150,7 @@ ft_basement_node_gc_once(BASEMENTNODE bn,
|
|||
}
|
||||
|
||||
// Don't run garbage collection if this leafentry decides it's not worth it.
|
||||
if (!toku_le_worth_running_garbage_collection(leaf_entry, oldest_known_referenced_xid)) {
|
||||
if (!toku_le_worth_running_garbage_collection(leaf_entry, oldest_referenced_xid_known)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
|
@ -2182,7 +2182,7 @@ ft_basement_node_gc_once(BASEMENTNODE bn,
|
|||
snapshot_xids,
|
||||
referenced_xids,
|
||||
live_root_txns,
|
||||
oldest_known_referenced_xid,
|
||||
oldest_referenced_xid_known,
|
||||
&numbytes_delta);
|
||||
|
||||
numrows_delta = 0;
|
||||
|
@ -2223,7 +2223,7 @@ basement_node_gc_all_les(BASEMENTNODE bn,
|
|||
const xid_omt_t &snapshot_xids,
|
||||
const rx_omt_t &referenced_xids,
|
||||
const xid_omt_t &live_root_txns,
|
||||
TXNID oldest_known_referenced_xid,
|
||||
TXNID oldest_referenced_xid_known,
|
||||
STAT64INFO_S * delta)
|
||||
{
|
||||
int r = 0;
|
||||
|
@ -2235,7 +2235,7 @@ basement_node_gc_all_les(BASEMENTNODE bn,
|
|||
r = toku_omt_fetch(bn->buffer, index, &storedatav);
|
||||
assert_zero(r);
|
||||
CAST_FROM_VOIDP(leaf_entry, storedatav);
|
||||
ft_basement_node_gc_once(bn, index, leaf_entry, snapshot_xids, referenced_xids, live_root_txns, oldest_known_referenced_xid, delta);
|
||||
ft_basement_node_gc_once(bn, index, leaf_entry, snapshot_xids, referenced_xids, live_root_txns, oldest_referenced_xid_known, delta);
|
||||
// Check if the leaf entry was deleted or not.
|
||||
if (num_leafentries_before == toku_omt_size(bn->buffer)) {
|
||||
++index;
|
||||
|
@ -2250,7 +2250,7 @@ ft_leaf_gc_all_les(FTNODE node,
|
|||
const xid_omt_t &snapshot_xids,
|
||||
const rx_omt_t &referenced_xids,
|
||||
const xid_omt_t &live_root_txns,
|
||||
TXNID oldest_known_referenced_xid)
|
||||
TXNID oldest_referenced_xid_known)
|
||||
{
|
||||
toku_assert_entire_node_in_memory(node);
|
||||
paranoid_invariant_zero(node->height);
|
||||
|
@ -2261,7 +2261,7 @@ ft_leaf_gc_all_les(FTNODE node,
|
|||
STAT64INFO_S delta;
|
||||
delta.numrows = 0;
|
||||
delta.numbytes = 0;
|
||||
basement_node_gc_all_les(bn, snapshot_xids, referenced_xids, live_root_txns, oldest_known_referenced_xid, &delta);
|
||||
basement_node_gc_all_les(bn, snapshot_xids, referenced_xids, live_root_txns, oldest_referenced_xid_known, &delta);
|
||||
toku_ft_update_stats(&ft->in_memory_stats, delta);
|
||||
}
|
||||
}
|
||||
|
@ -2287,7 +2287,7 @@ ft_leaf_run_gc(FTNODE node, FT ft) {
|
|||
// Using the oldest xid in either the referenced_xids or live_root_txns
|
||||
// snapshots is not sufficient, because there could be something older that is neither
|
||||
// live nor referenced, but instead aborted somewhere above us as a message in the tree.
|
||||
ft_leaf_gc_all_les(node, ft, snapshot_txnids, referenced_xids, live_root_txns, node->oldest_known_referenced_xid);
|
||||
ft_leaf_gc_all_les(node, ft, snapshot_txnids, referenced_xids, live_root_txns, node->oldest_referenced_xid_known);
|
||||
|
||||
// Free the OMT's we used for garbage collecting.
|
||||
snapshot_txnids.destroy();
|
||||
|
@ -2300,7 +2300,7 @@ void toku_bnc_flush_to_child(
|
|||
FT ft,
|
||||
NONLEAF_CHILDINFO bnc,
|
||||
FTNODE child,
|
||||
TXNID oldest_known_referenced_xid
|
||||
TXNID oldest_referenced_xid_known
|
||||
)
|
||||
{
|
||||
paranoid_invariant(bnc);
|
||||
|
@ -2337,7 +2337,7 @@ void toku_bnc_flush_to_child(
|
|||
);
|
||||
remaining_memsize -= FIFO_CURRENT_ENTRY_MEMSIZE;
|
||||
}));
|
||||
child->oldest_known_referenced_xid = oldest_known_referenced_xid;
|
||||
child->oldest_referenced_xid_known = oldest_known_referenced_xid;
|
||||
|
||||
invariant(remaining_memsize == 0);
|
||||
if (stats_delta.numbytes || stats_delta.numrows) {
|
||||
|
@ -2440,7 +2440,7 @@ void toku_ft_leaf_apply_cmd(
|
|||
|
||||
// Pass the oldest possible live xid value to each basementnode
|
||||
// when we apply messages to them.
|
||||
TXNID oldest_known_referenced_xid = node->oldest_known_referenced_xid;
|
||||
TXNID oldest_referenced_xid_known = node->oldest_known_referenced_xid;
|
||||
|
||||
if (ft_msg_applies_once(cmd)) {
|
||||
unsigned int childnum = (target_childnum >= 0
|
||||
|
@ -2454,7 +2454,7 @@ void toku_ft_leaf_apply_cmd(
|
|||
desc,
|
||||
bn,
|
||||
cmd,
|
||||
oldest_known_referenced_xid,
|
||||
oldest_referenced_xid_known,
|
||||
gc_info,
|
||||
workdone,
|
||||
stats_to_update);
|
||||
|
@ -2471,7 +2471,7 @@ void toku_ft_leaf_apply_cmd(
|
|||
desc,
|
||||
BLB(node, childnum),
|
||||
cmd,
|
||||
oldest_known_referenced_xid,
|
||||
oldest_referenced_xid_known,
|
||||
gc_info,
|
||||
workdone,
|
||||
stats_to_update);
|
||||
|
@ -2506,8 +2506,8 @@ static void inject_message_in_locked_node(
|
|||
// Update the oldest known referenced xid for this node if it is younger
|
||||
// than the one currently known. Otherwise, it's better to keep the heurstic
|
||||
// we have and ignore this one.
|
||||
if (oldest_referenced_xid >= node->oldest_known_referenced_xid) {
|
||||
node->oldest_known_referenced_xid = oldest_referenced_xid;
|
||||
if (oldest_referenced_xid >= node->oldest_referenced_xid_known) {
|
||||
node->oldest_referenced_xid_known = oldest_referenced_xid;
|
||||
}
|
||||
|
||||
// Get the MSN from the header. Now that we have a write lock on the
|
||||
|
@ -4386,10 +4386,10 @@ toku_apply_ancestors_messages_to_node (FT_HANDLE t, FTNODE node, ANCESTORS ances
|
|||
VERIFY_NODE(t, node);
|
||||
invariant(node->height == 0);
|
||||
|
||||
TXNID oldest_referenced_xid = ancestors->node->oldest_known_referenced_xid;
|
||||
TXNID oldest_referenced_xid = ancestors->node->oldest_referenced_xid_known;
|
||||
for (ANCESTORS curr_ancestors = ancestors; curr_ancestors; curr_ancestors = curr_ancestors->next) {
|
||||
if (curr_ancestors->node->oldest_known_referenced_xid > oldest_referenced_xid) {
|
||||
oldest_referenced_xid = curr_ancestors->node->oldest_known_referenced_xid;
|
||||
if (curr_ancestors->node->oldest_referenced_xid_known > oldest_referenced_xid) {
|
||||
oldest_referenced_xid = curr_ancestors->node->oldest_referenced_xid_known;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -365,7 +365,7 @@ serialize_ftnode_info_size(FTNODE node)
|
|||
retval += 4; // nodesize
|
||||
retval += 4; // flags
|
||||
retval += 4; // height;
|
||||
retval += 8; // oldest_known_referenced_xid
|
||||
retval += 8; // oldest_referenced_xid_known
|
||||
retval += node->totalchildkeylens; // total length of pivots
|
||||
retval += (node->n_children-1)*4; // encode length of each pivot
|
||||
if (node->height > 0) {
|
||||
|
@ -389,7 +389,7 @@ static void serialize_ftnode_info(FTNODE node,
|
|||
wbuf_nocrc_uint(&wb, 0); // write a dummy value for where node->nodesize used to be
|
||||
wbuf_nocrc_uint(&wb, node->flags);
|
||||
wbuf_nocrc_int (&wb, node->height);
|
||||
wbuf_TXNID(&wb, node->oldest_known_referenced_xid);
|
||||
wbuf_TXNID(&wb, node->oldest_referenced_xid_known);
|
||||
|
||||
// pivot information
|
||||
for (int i = 0; i < node->n_children-1; i++) {
|
||||
|
@ -1259,7 +1259,7 @@ deserialize_ftnode_info(
|
|||
(void) rbuf_int(&rb); // optimized_for_upgrade
|
||||
}
|
||||
if (node->layout_version_read_from_disk >= FT_LAYOUT_VERSION_22) {
|
||||
rbuf_TXNID(&rb, &node->oldest_known_referenced_xid);
|
||||
rbuf_TXNID(&rb, &node->oldest_referenced_xid_known);
|
||||
}
|
||||
|
||||
// now create the basement nodes or childinfos, depending on whether this is a
|
||||
|
@ -1509,7 +1509,7 @@ static FTNODE alloc_ftnode_for_deserialize(uint32_t fullhash, BLOCKNUM blocknum)
|
|||
node->thisnodename = blocknum;
|
||||
node->dirty = 0;
|
||||
node->bp = nullptr;
|
||||
node->oldest_known_referenced_xid = TXNID_NONE;
|
||||
node->oldest_referenced_xid_known = TXNID_NONE;
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ void toku_le_apply_msg(FT_MSG msg,
|
|||
void **maybe_free,
|
||||
int64_t * numbytes_delta_p);
|
||||
|
||||
bool toku_le_worth_running_garbage_collection(LEAFENTRY le, TXNID oldest_known_referenced_xid);
|
||||
bool toku_le_worth_running_garbage_collection(LEAFENTRY le, TXNID oldest_referenced_xid_known);
|
||||
|
||||
void toku_le_garbage_collect(LEAFENTRY old_leaf_entry,
|
||||
LEAFENTRY *new_leaf_entry,
|
||||
|
@ -189,7 +189,7 @@ void toku_le_garbage_collect(LEAFENTRY old_leaf_entry,
|
|||
const xid_omt_t &snapshot_xids,
|
||||
const rx_omt_t &referenced_xids,
|
||||
const xid_omt_t &live_root_txns,
|
||||
TXNID oldest_known_referenced_xid,
|
||||
TXNID oldest_referenced_xid_known,
|
||||
int64_t * numbytes_delta_p);
|
||||
|
||||
#endif /* TOKU_LEAFENTRY_H */
|
||||
|
|
|
@ -293,7 +293,7 @@ test_prefetching(void) {
|
|||
sn.height = 1;
|
||||
sn.n_children = 3;
|
||||
sn.dirty = 1;
|
||||
sn.oldest_known_referenced_xid = TXNID_NONE;
|
||||
sn.oldest_referenced_xid_known = TXNID_NONE;
|
||||
|
||||
uint64_t key1 = 100;
|
||||
uint64_t key2 = 200;
|
||||
|
|
|
@ -246,7 +246,7 @@ test_serialize_nonleaf(void) {
|
|||
sn.height = 1;
|
||||
sn.n_children = 2;
|
||||
sn.dirty = 1;
|
||||
sn.oldest_known_referenced_xid = TXNID_NONE;
|
||||
sn.oldest_referenced_xid_known = TXNID_NONE;
|
||||
hello_string = toku_strdup("hello");
|
||||
MALLOC_N(2, sn.bp);
|
||||
MALLOC_N(1, sn.childkeys);
|
||||
|
@ -345,7 +345,7 @@ test_serialize_leaf(void) {
|
|||
sn.height = 0;
|
||||
sn.n_children = 2;
|
||||
sn.dirty = 1;
|
||||
sn.oldest_known_referenced_xid = TXNID_NONE;
|
||||
sn.oldest_referenced_xid_known = TXNID_NONE;
|
||||
LEAFENTRY elts[3];
|
||||
elts[0] = le_malloc("a", "aval");
|
||||
elts[1] = le_malloc("b", "bval");
|
||||
|
|
|
@ -74,7 +74,7 @@ test_serialize_leaf(int valsize, int nelts, double entropy) {
|
|||
sn->height = 0;
|
||||
sn->n_children = 8;
|
||||
sn->dirty = 1;
|
||||
sn->oldest_known_referenced_xid = TXNID_NONE;
|
||||
sn->oldest_referenced_xid_known = TXNID_NONE;
|
||||
MALLOC_N(sn->n_children, sn->bp);
|
||||
MALLOC_N(sn->n_children-1, sn->childkeys);
|
||||
sn->totalchildkeylens = 0;
|
||||
|
@ -197,7 +197,7 @@ test_serialize_nonleaf(int valsize, int nelts, double entropy) {
|
|||
sn.height = 1;
|
||||
sn.n_children = 8;
|
||||
sn.dirty = 1;
|
||||
sn.oldest_known_referenced_xid = TXNID_NONE;
|
||||
sn.oldest_referenced_xid_known = TXNID_NONE;
|
||||
MALLOC_N(sn.n_children, sn.bp);
|
||||
MALLOC_N(sn.n_children-1, sn.childkeys);
|
||||
sn.totalchildkeylens = 0;
|
||||
|
|
|
@ -223,7 +223,7 @@ test_serialize_leaf_check_msn(enum ftnode_verify_type bft, bool do_clone) {
|
|||
sn.height = 0;
|
||||
sn.n_children = 2;
|
||||
sn.dirty = 1;
|
||||
sn.oldest_known_referenced_xid = TXNID_NONE;
|
||||
sn.oldest_referenced_xid_known = TXNID_NONE;
|
||||
MALLOC_N(sn.n_children, sn.bp);
|
||||
MALLOC_N(1, sn.childkeys);
|
||||
toku_fill_dbt(&sn.childkeys[0], toku_xmemdup("b", 2), 2);
|
||||
|
@ -369,7 +369,7 @@ test_serialize_leaf_with_large_pivots(enum ftnode_verify_type bft, bool do_clone
|
|||
sn.height = 0;
|
||||
sn.n_children = nrows;
|
||||
sn.dirty = 1;
|
||||
sn.oldest_known_referenced_xid = TXNID_NONE;
|
||||
sn.oldest_referenced_xid_known = TXNID_NONE;
|
||||
|
||||
MALLOC_N(sn.n_children, sn.bp);
|
||||
MALLOC_N(sn.n_children-1, sn.childkeys);
|
||||
|
@ -515,7 +515,7 @@ test_serialize_leaf_with_many_rows(enum ftnode_verify_type bft, bool do_clone) {
|
|||
sn.height = 0;
|
||||
sn.n_children = 1;
|
||||
sn.dirty = 1;
|
||||
sn.oldest_known_referenced_xid = TXNID_NONE;
|
||||
sn.oldest_referenced_xid_known = TXNID_NONE;
|
||||
|
||||
MALLOC_N(sn.n_children, sn.bp);
|
||||
MALLOC_N(sn.n_children-1, sn.childkeys);
|
||||
|
@ -659,7 +659,7 @@ test_serialize_leaf_with_large_rows(enum ftnode_verify_type bft, bool do_clone)
|
|||
sn.height = 0;
|
||||
sn.n_children = 1;
|
||||
sn.dirty = 1;
|
||||
sn.oldest_known_referenced_xid = TXNID_NONE;
|
||||
sn.oldest_referenced_xid_known = TXNID_NONE;
|
||||
|
||||
MALLOC_N(sn.n_children, sn.bp);
|
||||
MALLOC_N(sn.n_children-1, sn.childkeys);
|
||||
|
@ -810,7 +810,7 @@ test_serialize_leaf_with_empty_basement_nodes(enum ftnode_verify_type bft, bool
|
|||
sn.height = 0;
|
||||
sn.n_children = 7;
|
||||
sn.dirty = 1;
|
||||
sn.oldest_known_referenced_xid = TXNID_NONE;
|
||||
sn.oldest_referenced_xid_known = TXNID_NONE;
|
||||
MALLOC_N(sn.n_children, sn.bp);
|
||||
MALLOC_N(sn.n_children-1, sn.childkeys);
|
||||
toku_fill_dbt(&sn.childkeys[0], toku_xmemdup("A", 2), 2);
|
||||
|
@ -962,7 +962,7 @@ test_serialize_leaf_with_multiple_empty_basement_nodes(enum ftnode_verify_type b
|
|||
sn.height = 0;
|
||||
sn.n_children = 4;
|
||||
sn.dirty = 1;
|
||||
sn.oldest_known_referenced_xid = TXNID_NONE;
|
||||
sn.oldest_referenced_xid_known = TXNID_NONE;
|
||||
MALLOC_N(sn.n_children, sn.bp);
|
||||
MALLOC_N(sn.n_children-1, sn.childkeys);
|
||||
toku_fill_dbt(&sn.childkeys[0], toku_xmemdup("A", 2), 2);
|
||||
|
@ -1083,7 +1083,7 @@ test_serialize_leaf(enum ftnode_verify_type bft, bool do_clone) {
|
|||
sn.height = 0;
|
||||
sn.n_children = 2;
|
||||
sn.dirty = 1;
|
||||
sn.oldest_known_referenced_xid = TXNID_NONE;
|
||||
sn.oldest_referenced_xid_known = TXNID_NONE;
|
||||
MALLOC_N(sn.n_children, sn.bp);
|
||||
MALLOC_N(1, sn.childkeys);
|
||||
toku_fill_dbt(&sn.childkeys[0], toku_xmemdup("b", 2), 2);
|
||||
|
@ -1226,7 +1226,7 @@ test_serialize_nonleaf(enum ftnode_verify_type bft, bool do_clone) {
|
|||
sn.height = 1;
|
||||
sn.n_children = 2;
|
||||
sn.dirty = 1;
|
||||
sn.oldest_known_referenced_xid = TXNID_NONE;
|
||||
sn.oldest_referenced_xid_known = TXNID_NONE;
|
||||
hello_string = toku_strdup("hello");
|
||||
MALLOC_N(2, sn.bp);
|
||||
MALLOC_N(1, sn.childkeys);
|
||||
|
|
|
@ -702,12 +702,12 @@ test_le_apply_messages(void) {
|
|||
test_le_committed_apply();
|
||||
}
|
||||
|
||||
static bool ule_worth_running_garbage_collection(ULE ule, TXNID oldest_known_referenced_xid) {
|
||||
static bool ule_worth_running_garbage_collection(ULE ule, TXNID oldest_referenced_xid_known) {
|
||||
LEAFENTRY le;
|
||||
size_t initial_memsize;
|
||||
int r = le_pack(ule, &initial_memsize, &le, nullptr, nullptr, nullptr); CKERR(r);
|
||||
invariant_notnull(le);
|
||||
bool worth_running = toku_le_worth_running_garbage_collection(le, oldest_known_referenced_xid);
|
||||
bool worth_running = toku_le_worth_running_garbage_collection(le, oldest_referenced_xid_known);
|
||||
toku_free(le);
|
||||
return worth_running;
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ static void test_oldest_referenced_xid_gets_propogated(void) {
|
|||
assert(node->height == 1);
|
||||
assert(node->n_children == 1);
|
||||
assert(BP_BLOCKNUM(node, 0).b == grandchild_leaf_blocknum.b);
|
||||
assert(node->oldest_known_referenced_xid == TXNID_NONE);
|
||||
assert(node->oldest_referenced_xid_known == TXNID_NONE);
|
||||
toku_unpin_ftnode(t->ft, node);
|
||||
|
||||
// now verify the root - keep it pinned so we can flush it below
|
||||
|
@ -115,11 +115,11 @@ static void test_oldest_referenced_xid_gets_propogated(void) {
|
|||
assert(node->n_children == 1);
|
||||
assert(BP_BLOCKNUM(node, 0).b == child_nonleaf_blocknum.b);
|
||||
assert(toku_bnc_nbytesinbuf(BNC(node, 0)) > 0);
|
||||
assert(node->oldest_known_referenced_xid == TXNID_NONE);
|
||||
assert(node->oldest_referenced_xid_known == TXNID_NONE);
|
||||
|
||||
// set the root's oldest referenced xid to something special
|
||||
const TXNID flush_xid = 25000;
|
||||
node->oldest_known_referenced_xid = flush_xid;
|
||||
node->oldest_referenced_xid_known = flush_xid;
|
||||
|
||||
// do the flush
|
||||
struct flusher_advice fa;
|
||||
|
@ -147,7 +147,7 @@ static void test_oldest_referenced_xid_gets_propogated(void) {
|
|||
NULL,
|
||||
&node
|
||||
);
|
||||
assert(node->oldest_known_referenced_xid == flush_xid);
|
||||
assert(node->oldest_referenced_xid_known == flush_xid);
|
||||
|
||||
toku_unpin_ftnode(t->ft, node);
|
||||
r = toku_close_ft_handle_nolsn(t, 0); assert(r==0);
|
||||
|
|
|
@ -91,7 +91,7 @@ setup_ftnode_header(struct ftnode *node)
|
|||
node->height = 0;
|
||||
node->dirty = 1;
|
||||
node->totalchildkeylens = 0;
|
||||
node->oldest_known_referenced_xid = TXNID_NONE;
|
||||
node->oldest_referenced_xid_known = TXNID_NONE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -393,7 +393,7 @@ toku_le_apply_msg(FT_MSG msg, // message to apply to leafentry
|
|||
ule_cleanup(&ule);
|
||||
}
|
||||
|
||||
bool toku_le_worth_running_garbage_collection(LEAFENTRY le, TXNID oldest_known_referenced_xid) {
|
||||
bool toku_le_worth_running_garbage_collection(LEAFENTRY le, TXNID oldest_referenced_xid_known) {
|
||||
// Effect: Quickly determines if it's worth trying to run garbage collection on a leafentry
|
||||
// Return: True if it makes sense to try garbage collection, false otherwise.
|
||||
// Rationale: Garbage collection is likely to clean up under two circumstances:
|
||||
|
@ -409,7 +409,7 @@ bool toku_le_worth_running_garbage_collection(LEAFENTRY le, TXNID oldest_known_r
|
|||
} else {
|
||||
paranoid_invariant(le->u.mvcc.num_cxrs == 1);
|
||||
}
|
||||
return le->u.mvcc.num_pxrs > 0 && le_outermost_uncommitted_xid(le) < oldest_known_referenced_xid;
|
||||
return le->u.mvcc.num_pxrs > 0 && le_outermost_uncommitted_xid(le) < oldest_referenced_xid_known;
|
||||
}
|
||||
|
||||
// Garbage collect one leaf entry, using the given OMT's.
|
||||
|
@ -440,7 +440,7 @@ toku_le_garbage_collect(LEAFENTRY old_leaf_entry,
|
|||
const xid_omt_t &snapshot_xids,
|
||||
const rx_omt_t &referenced_xids,
|
||||
const xid_omt_t &live_root_txns,
|
||||
TXNID oldest_known_referenced_xid,
|
||||
TXNID oldest_referenced_xid_known,
|
||||
int64_t * numbytes_delta_p) {
|
||||
ULE_S ule;
|
||||
int64_t oldnumbytes = 0;
|
||||
|
@ -455,7 +455,7 @@ toku_le_garbage_collect(LEAFENTRY old_leaf_entry,
|
|||
// The oldest known refeferenced xid is a lower bound on the oldest possible
|
||||
// live xid, so we use that. It's usually close enough to get rid of most
|
||||
// garbage in leafentries.
|
||||
TXNID oldest_possible_live_xid = oldest_known_referenced_xid;
|
||||
TXNID oldest_possible_live_xid = oldest_referenced_xid_known;
|
||||
ule_try_promote_provisional_outermost(&ule, oldest_possible_live_xid);
|
||||
ule_garbage_collect(&ule, snapshot_xids, referenced_xids, live_root_txns);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue