mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 06:44:16 +01:00
[t:4901] rename struct ft { FT h } to { FT ft }
git-svn-id: file:///svn/toku/tokudb@43771 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
f0cd39e1a0
commit
51dacb892c
38 changed files with 433 additions and 433 deletions
|
@ -110,7 +110,7 @@ toku_create_new_ftnode (
|
|||
int n_children)
|
||||
{
|
||||
return create_new_ftnode_with_dep_nodes(
|
||||
t->h,
|
||||
t->ft,
|
||||
result,
|
||||
height,
|
||||
n_children,
|
||||
|
@ -135,12 +135,12 @@ toku_pin_ftnode(
|
|||
void *node_v;
|
||||
*msgs_applied = FALSE;
|
||||
int r = toku_cachetable_get_and_pin_nonblocking(
|
||||
brt->h->cf,
|
||||
brt->ft->cf,
|
||||
blocknum,
|
||||
fullhash,
|
||||
&node_v,
|
||||
NULL,
|
||||
get_write_callbacks_for_node(brt->h),
|
||||
get_write_callbacks_for_node(brt->ft),
|
||||
toku_ftnode_fetch_callback,
|
||||
toku_ftnode_pf_req_callback,
|
||||
toku_ftnode_pf_callback,
|
||||
|
@ -232,7 +232,7 @@ void
|
|||
toku_unpin_ftnode_read_only(FT_HANDLE brt, FTNODE node)
|
||||
{
|
||||
int r = toku_cachetable_unpin(
|
||||
brt->h->cf,
|
||||
brt->ft->cf,
|
||||
node->thisnodename,
|
||||
node->fullhash,
|
||||
(enum cachetable_dirty) node->dirty,
|
||||
|
|
|
@ -266,14 +266,14 @@ toku_ft_hot_optimize(FT_HANDLE brt,
|
|||
u_int32_t fullhash;
|
||||
|
||||
{
|
||||
toku_ft_grab_treelock(brt->h);
|
||||
toku_ft_grab_treelock(brt->ft);
|
||||
|
||||
// Get root node (the first parent of each successive HOT
|
||||
// call.)
|
||||
toku_calculate_root_offset_pointer(brt->h, &root_key, &fullhash);
|
||||
toku_calculate_root_offset_pointer(brt->ft, &root_key, &fullhash);
|
||||
struct ftnode_fetch_extra bfe;
|
||||
fill_bfe_for_full_read(&bfe, brt->h);
|
||||
toku_pin_ftnode_off_client_thread(brt->h,
|
||||
fill_bfe_for_full_read(&bfe, brt->ft);
|
||||
toku_pin_ftnode_off_client_thread(brt->ft,
|
||||
(BLOCKNUM) root_key,
|
||||
fullhash,
|
||||
&bfe,
|
||||
|
@ -283,7 +283,7 @@ toku_ft_hot_optimize(FT_HANDLE brt,
|
|||
&root);
|
||||
toku_assert_entire_node_in_memory(root);
|
||||
|
||||
toku_ft_release_treelock(brt->h);
|
||||
toku_ft_release_treelock(brt->ft);
|
||||
}
|
||||
|
||||
// Prepare HOT diagnostics.
|
||||
|
@ -311,12 +311,12 @@ toku_ft_hot_optimize(FT_HANDLE brt,
|
|||
// This should recurse to the bottom of the tree and then
|
||||
// return.
|
||||
if (root->height > 0) {
|
||||
flush_some_child(brt->h, root, &advice);
|
||||
flush_some_child(brt->ft, root, &advice);
|
||||
} else {
|
||||
// Since there are no children to flush, we should abort
|
||||
// the HOT call.
|
||||
flusher.rightmost_leaf_seen = 1;
|
||||
toku_unpin_ftnode_off_client_thread(brt->h, root);
|
||||
toku_unpin_ftnode_off_client_thread(brt->ft, root);
|
||||
}
|
||||
|
||||
// Set the highest pivot key seen here, since the parent may
|
||||
|
|
|
@ -418,8 +418,8 @@ struct ft_options {
|
|||
};
|
||||
|
||||
struct ft_handle {
|
||||
// The header is shared. It is also ephemeral.
|
||||
FT h;
|
||||
// The fractal tree.
|
||||
FT ft;
|
||||
|
||||
on_redirect_callback redirect_callback;
|
||||
void *redirect_callback_extra;
|
||||
|
|
250
ft/ft-ops.c
250
ft/ft-ops.c
|
@ -562,7 +562,7 @@ ft_cursor_rightmost_child_wanted(FT_CURSOR cursor, FT_HANDLE brt, FTNODE node)
|
|||
} else if (cursor->range_lock_right_key.data == NULL) {
|
||||
return -1;
|
||||
} else {
|
||||
return toku_ftnode_which_child(node, &cursor->range_lock_right_key, &brt->h->cmp_descriptor, brt->h->compare_fun);
|
||||
return toku_ftnode_which_child(node, &cursor->range_lock_right_key, &brt->ft->cmp_descriptor, brt->ft->compare_fun);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2611,7 +2611,7 @@ int
|
|||
toku_ft_optimize (FT_HANDLE brt) {
|
||||
int r = 0;
|
||||
|
||||
TOKULOGGER logger = toku_cachefile_logger(brt->h->cf);
|
||||
TOKULOGGER logger = toku_cachefile_logger(brt->ft->cf);
|
||||
TXNID oldest = toku_logger_get_oldest_living_xid(logger, NULL);
|
||||
|
||||
XIDS root_xids = xids_get_root_xids();
|
||||
|
@ -2629,7 +2629,7 @@ toku_ft_optimize (FT_HANDLE brt) {
|
|||
toku_init_dbt(&key);
|
||||
toku_init_dbt(&val);
|
||||
FT_MSG_S ftcmd = { FT_OPTIMIZE, ZERO_MSN, message_xids, .u.id={&key,&val}};
|
||||
r = toku_ft_root_put_cmd(brt->h, &ftcmd);
|
||||
r = toku_ft_root_put_cmd(brt->ft, &ftcmd);
|
||||
xids_destroy(&message_xids);
|
||||
return r;
|
||||
}
|
||||
|
@ -2637,7 +2637,7 @@ toku_ft_optimize (FT_HANDLE brt) {
|
|||
int
|
||||
toku_ft_load(FT_HANDLE brt, TOKUTXN txn, char const * new_iname, int do_fsync, LSN *load_lsn) {
|
||||
int r = 0;
|
||||
char const * old_iname = toku_cachefile_fname_in_env(brt->h->cf);
|
||||
char const * old_iname = toku_cachefile_fname_in_env(brt->ft->cf);
|
||||
int do_log = 1;
|
||||
r = toku_ft_load_recovery(txn, old_iname, new_iname, do_fsync, do_log, load_lsn);
|
||||
return r;
|
||||
|
@ -2657,14 +2657,14 @@ int
|
|||
toku_ft_log_put (TOKUTXN txn, FT_HANDLE brt, const DBT *key, const DBT *val) {
|
||||
int r = 0;
|
||||
TOKULOGGER logger = toku_txn_logger(txn);
|
||||
if (logger && brt->h->txnid_that_suppressed_recovery_logs == TXNID_NONE) {
|
||||
if (logger && brt->ft->txnid_that_suppressed_recovery_logs == TXNID_NONE) {
|
||||
BYTESTRING keybs = {.len=key->size, .data=key->data};
|
||||
BYTESTRING valbs = {.len=val->size, .data=val->data};
|
||||
TXNID xid = toku_txn_get_txnid(txn);
|
||||
// if (type == FT_INSERT)
|
||||
r = toku_log_enq_insert(logger, (LSN*)0, 0, toku_cachefile_filenum(brt->h->cf), xid, keybs, valbs);
|
||||
r = toku_log_enq_insert(logger, (LSN*)0, 0, toku_cachefile_filenum(brt->ft->cf), xid, keybs, valbs);
|
||||
// else
|
||||
// r = toku_log_enq_insert_no_overwrite(logger, (LSN*)0, 0, toku_cachefile_filenum(brt->h->cf), xid, keybs, valbs);
|
||||
// r = toku_log_enq_insert_no_overwrite(logger, (LSN*)0, 0, toku_cachefile_filenum(brt->ft->cf), xid, keybs, valbs);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
@ -2680,9 +2680,9 @@ toku_ft_log_put_multiple (TOKUTXN txn, FT_HANDLE src_ft, FT_HANDLE *brts, int nu
|
|||
int i;
|
||||
int num_unsuppressed_fts = 0;
|
||||
for (i = 0; i < num_fts; i++) {
|
||||
if (brts[i]->h->txnid_that_suppressed_recovery_logs == TXNID_NONE) {
|
||||
if (brts[i]->ft->txnid_that_suppressed_recovery_logs == TXNID_NONE) {
|
||||
//Logging not suppressed for this brt.
|
||||
fnums[num_unsuppressed_fts++] = toku_cachefile_filenum(brts[i]->h->cf);
|
||||
fnums[num_unsuppressed_fts++] = toku_cachefile_filenum(brts[i]->ft->cf);
|
||||
}
|
||||
}
|
||||
if (num_unsuppressed_fts) {
|
||||
|
@ -2690,7 +2690,7 @@ toku_ft_log_put_multiple (TOKUTXN txn, FT_HANDLE src_ft, FT_HANDLE *brts, int nu
|
|||
BYTESTRING keybs = {.len=key->size, .data=key->data};
|
||||
BYTESTRING valbs = {.len=val->size, .data=val->data};
|
||||
TXNID xid = toku_txn_get_txnid(txn);
|
||||
FILENUM src_filenum = src_ft ? toku_cachefile_filenum(src_ft->h->cf) : FILENUM_NONE;
|
||||
FILENUM src_filenum = src_ft ? toku_cachefile_filenum(src_ft->ft->cf) : FILENUM_NONE;
|
||||
r = toku_log_enq_insert_multiple(logger, (LSN*)0, 0, src_filenum, filenums, xid, keybs, valbs);
|
||||
}
|
||||
}
|
||||
|
@ -2704,36 +2704,36 @@ toku_ft_maybe_insert (FT_HANDLE brt, DBT *key, DBT *val, TOKUTXN txn, BOOL oplsn
|
|||
XIDS message_xids = xids_get_root_xids(); //By default use committed messages
|
||||
TXNID xid = toku_txn_get_txnid(txn);
|
||||
if (txn) {
|
||||
if (brt->h->txnid_that_created_or_locked_when_empty != xid) {
|
||||
if (brt->ft->txnid_that_created_or_locked_when_empty != xid) {
|
||||
BYTESTRING keybs = {key->size, key->data};
|
||||
r = toku_logger_save_rollback_cmdinsert(txn, toku_cachefile_filenum(brt->h->cf), &keybs);
|
||||
r = toku_logger_save_rollback_cmdinsert(txn, toku_cachefile_filenum(brt->ft->cf), &keybs);
|
||||
if (r!=0) return r;
|
||||
r = toku_txn_note_ft(txn, brt->h);
|
||||
r = toku_txn_note_ft(txn, brt->ft);
|
||||
if (r!=0) return r;
|
||||
//We have transactions, and this is not 2440. We must send the full root-to-leaf-path
|
||||
message_xids = toku_txn_get_xids(txn);
|
||||
}
|
||||
else if (txn->ancestor_txnid64 != brt->h->root_xid_that_created) {
|
||||
else if (txn->ancestor_txnid64 != brt->ft->root_xid_that_created) {
|
||||
//We have transactions, and this is 2440, however the txn doing 2440 did not create the dictionary. We must send the full root-to-leaf-path
|
||||
message_xids = toku_txn_get_xids(txn);
|
||||
}
|
||||
}
|
||||
TOKULOGGER logger = toku_txn_logger(txn);
|
||||
if (do_logging && logger &&
|
||||
brt->h->txnid_that_suppressed_recovery_logs == TXNID_NONE) {
|
||||
brt->ft->txnid_that_suppressed_recovery_logs == TXNID_NONE) {
|
||||
BYTESTRING keybs = {.len=key->size, .data=key->data};
|
||||
BYTESTRING valbs = {.len=val->size, .data=val->data};
|
||||
if (type == FT_INSERT) {
|
||||
r = toku_log_enq_insert(logger, (LSN*)0, 0, toku_cachefile_filenum(brt->h->cf), xid, keybs, valbs);
|
||||
r = toku_log_enq_insert(logger, (LSN*)0, 0, toku_cachefile_filenum(brt->ft->cf), xid, keybs, valbs);
|
||||
}
|
||||
else {
|
||||
r = toku_log_enq_insert_no_overwrite(logger, (LSN*)0, 0, toku_cachefile_filenum(brt->h->cf), xid, keybs, valbs);
|
||||
r = toku_log_enq_insert_no_overwrite(logger, (LSN*)0, 0, toku_cachefile_filenum(brt->ft->cf), xid, keybs, valbs);
|
||||
}
|
||||
if (r!=0) return r;
|
||||
}
|
||||
|
||||
LSN treelsn;
|
||||
if (oplsn_valid && oplsn.lsn <= (treelsn = toku_ft_checkpoint_lsn(brt->h)).lsn) {
|
||||
if (oplsn_valid && oplsn.lsn <= (treelsn = toku_ft_checkpoint_lsn(brt->ft)).lsn) {
|
||||
r = 0;
|
||||
} else {
|
||||
r = toku_ft_send_insert(brt, key, val, message_xids, type);
|
||||
|
@ -2746,7 +2746,7 @@ ft_send_update_msg(FT_HANDLE brt, FT_MSG_S *msg, TOKUTXN txn) {
|
|||
msg->xids = (txn
|
||||
? toku_txn_get_xids(txn)
|
||||
: xids_get_root_xids());
|
||||
int r = toku_ft_root_put_cmd(brt->h, msg);
|
||||
int r = toku_ft_root_put_cmd(brt->ft, msg);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -2760,27 +2760,27 @@ toku_ft_maybe_update(FT_HANDLE brt, const DBT *key, const DBT *update_function_e
|
|||
if (txn) {
|
||||
BYTESTRING keybs = { key->size, key->data };
|
||||
r = toku_logger_save_rollback_cmdupdate(
|
||||
txn, toku_cachefile_filenum(brt->h->cf), &keybs);
|
||||
txn, toku_cachefile_filenum(brt->ft->cf), &keybs);
|
||||
if (r != 0) { goto cleanup; }
|
||||
r = toku_txn_note_ft(txn, brt->h);
|
||||
r = toku_txn_note_ft(txn, brt->ft);
|
||||
if (r != 0) { goto cleanup; }
|
||||
}
|
||||
|
||||
TOKULOGGER logger = toku_txn_logger(txn);
|
||||
if (do_logging && logger &&
|
||||
brt->h->txnid_that_suppressed_recovery_logs == TXNID_NONE) {
|
||||
brt->ft->txnid_that_suppressed_recovery_logs == TXNID_NONE) {
|
||||
BYTESTRING keybs = {.len=key->size, .data=key->data};
|
||||
BYTESTRING extrabs = {.len=update_function_extra->size,
|
||||
.data=update_function_extra->data};
|
||||
r = toku_log_enq_update(logger, NULL, 0,
|
||||
toku_cachefile_filenum(brt->h->cf),
|
||||
toku_cachefile_filenum(brt->ft->cf),
|
||||
xid, keybs, extrabs);
|
||||
if (r != 0) { goto cleanup; }
|
||||
}
|
||||
|
||||
LSN treelsn;
|
||||
if (oplsn_valid &&
|
||||
oplsn.lsn <= (treelsn = toku_ft_checkpoint_lsn(brt->h)).lsn) {
|
||||
oplsn.lsn <= (treelsn = toku_ft_checkpoint_lsn(brt->ft)).lsn) {
|
||||
r = 0;
|
||||
} else {
|
||||
FT_MSG_S msg = { FT_UPDATE, ZERO_MSN, NULL,
|
||||
|
@ -2801,26 +2801,26 @@ toku_ft_maybe_update_broadcast(FT_HANDLE brt, const DBT *update_function_extra,
|
|||
TXNID xid = toku_txn_get_txnid(txn);
|
||||
u_int8_t resetting = is_resetting_op ? 1 : 0;
|
||||
if (txn) {
|
||||
r = toku_logger_save_rollback_cmdupdatebroadcast(txn, toku_cachefile_filenum(brt->h->cf), resetting);
|
||||
r = toku_logger_save_rollback_cmdupdatebroadcast(txn, toku_cachefile_filenum(brt->ft->cf), resetting);
|
||||
if (r != 0) { goto cleanup; }
|
||||
r = toku_txn_note_ft(txn, brt->h);
|
||||
r = toku_txn_note_ft(txn, brt->ft);
|
||||
if (r != 0) { goto cleanup; }
|
||||
}
|
||||
|
||||
TOKULOGGER logger = toku_txn_logger(txn);
|
||||
if (do_logging && logger &&
|
||||
brt->h->txnid_that_suppressed_recovery_logs == TXNID_NONE) {
|
||||
brt->ft->txnid_that_suppressed_recovery_logs == TXNID_NONE) {
|
||||
BYTESTRING extrabs = {.len=update_function_extra->size,
|
||||
.data=update_function_extra->data};
|
||||
r = toku_log_enq_updatebroadcast(logger, NULL, 0,
|
||||
toku_cachefile_filenum(brt->h->cf),
|
||||
toku_cachefile_filenum(brt->ft->cf),
|
||||
xid, extrabs, resetting);
|
||||
if (r != 0) { goto cleanup; }
|
||||
}
|
||||
|
||||
LSN treelsn;
|
||||
if (oplsn_valid &&
|
||||
oplsn.lsn <= (treelsn = toku_ft_checkpoint_lsn(brt->h)).lsn) {
|
||||
oplsn.lsn <= (treelsn = toku_ft_checkpoint_lsn(brt->ft)).lsn) {
|
||||
r = 0;
|
||||
} else {
|
||||
DBT nullkey;
|
||||
|
@ -2837,7 +2837,7 @@ cleanup:
|
|||
int
|
||||
toku_ft_send_insert(FT_HANDLE brt, DBT *key, DBT *val, XIDS xids, enum ft_msg_type type) {
|
||||
FT_MSG_S ftcmd = { type, ZERO_MSN, xids, .u.id = { key, val }};
|
||||
int r = toku_ft_root_put_cmd(brt->h, &ftcmd);
|
||||
int r = toku_ft_root_put_cmd(brt->ft, &ftcmd);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -2845,7 +2845,7 @@ int
|
|||
toku_ft_send_commit_any(FT_HANDLE brt, DBT *key, XIDS xids) {
|
||||
DBT val;
|
||||
FT_MSG_S ftcmd = { FT_COMMIT_ANY, ZERO_MSN, xids, .u.id = { key, toku_init_dbt(&val) }};
|
||||
int r = toku_ft_root_put_cmd(brt->h, &ftcmd);
|
||||
int r = toku_ft_root_put_cmd(brt->ft, &ftcmd);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -2857,10 +2857,10 @@ int
|
|||
toku_ft_log_del(TOKUTXN txn, FT_HANDLE brt, const DBT *key) {
|
||||
int r = 0;
|
||||
TOKULOGGER logger = toku_txn_logger(txn);
|
||||
if (logger && brt->h->txnid_that_suppressed_recovery_logs == TXNID_NONE) {
|
||||
if (logger && brt->ft->txnid_that_suppressed_recovery_logs == TXNID_NONE) {
|
||||
BYTESTRING keybs = {.len=key->size, .data=key->data};
|
||||
TXNID xid = toku_txn_get_txnid(txn);
|
||||
r = toku_log_enq_delete_any(logger, (LSN*)0, 0, toku_cachefile_filenum(brt->h->cf), xid, keybs);
|
||||
r = toku_log_enq_delete_any(logger, (LSN*)0, 0, toku_cachefile_filenum(brt->ft->cf), xid, keybs);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
@ -2876,9 +2876,9 @@ toku_ft_log_del_multiple (TOKUTXN txn, FT_HANDLE src_ft, FT_HANDLE *brts, int nu
|
|||
int i;
|
||||
int num_unsuppressed_fts = 0;
|
||||
for (i = 0; i < num_fts; i++) {
|
||||
if (brts[i]->h->txnid_that_suppressed_recovery_logs == TXNID_NONE) {
|
||||
if (brts[i]->ft->txnid_that_suppressed_recovery_logs == TXNID_NONE) {
|
||||
//Logging not suppressed for this brt.
|
||||
fnums[num_unsuppressed_fts++] = toku_cachefile_filenum(brts[i]->h->cf);
|
||||
fnums[num_unsuppressed_fts++] = toku_cachefile_filenum(brts[i]->ft->cf);
|
||||
}
|
||||
}
|
||||
if (num_unsuppressed_fts) {
|
||||
|
@ -2886,7 +2886,7 @@ toku_ft_log_del_multiple (TOKUTXN txn, FT_HANDLE src_ft, FT_HANDLE *brts, int nu
|
|||
BYTESTRING keybs = {.len=key->size, .data=key->data};
|
||||
BYTESTRING valbs = {.len=val->size, .data=val->data};
|
||||
TXNID xid = toku_txn_get_txnid(txn);
|
||||
FILENUM src_filenum = src_ft ? toku_cachefile_filenum(src_ft->h->cf) : FILENUM_NONE;
|
||||
FILENUM src_filenum = src_ft ? toku_cachefile_filenum(src_ft->ft->cf) : FILENUM_NONE;
|
||||
r = toku_log_enq_delete_multiple(logger, (LSN*)0, 0, src_filenum, filenums, xid, keybs, valbs);
|
||||
}
|
||||
}
|
||||
|
@ -2899,30 +2899,30 @@ toku_ft_maybe_delete(FT_HANDLE brt, DBT *key, TOKUTXN txn, BOOL oplsn_valid, LSN
|
|||
XIDS message_xids = xids_get_root_xids(); //By default use committed messages
|
||||
TXNID xid = toku_txn_get_txnid(txn);
|
||||
if (txn) {
|
||||
if (brt->h->txnid_that_created_or_locked_when_empty != xid) {
|
||||
if (brt->ft->txnid_that_created_or_locked_when_empty != xid) {
|
||||
BYTESTRING keybs = {key->size, key->data};
|
||||
r = toku_logger_save_rollback_cmddelete(txn, toku_cachefile_filenum(brt->h->cf), &keybs);
|
||||
r = toku_logger_save_rollback_cmddelete(txn, toku_cachefile_filenum(brt->ft->cf), &keybs);
|
||||
if (r!=0) return r;
|
||||
r = toku_txn_note_ft(txn, brt->h);
|
||||
r = toku_txn_note_ft(txn, brt->ft);
|
||||
if (r!=0) return r;
|
||||
//We have transactions, and this is not 2440. We must send the full root-to-leaf-path
|
||||
message_xids = toku_txn_get_xids(txn);
|
||||
}
|
||||
else if (txn->ancestor_txnid64 != brt->h->root_xid_that_created) {
|
||||
else if (txn->ancestor_txnid64 != brt->ft->root_xid_that_created) {
|
||||
//We have transactions, and this is 2440, however the txn doing 2440 did not create the dictionary. We must send the full root-to-leaf-path
|
||||
message_xids = toku_txn_get_xids(txn);
|
||||
}
|
||||
}
|
||||
TOKULOGGER logger = toku_txn_logger(txn);
|
||||
if (do_logging && logger &&
|
||||
brt->h->txnid_that_suppressed_recovery_logs == TXNID_NONE) {
|
||||
brt->ft->txnid_that_suppressed_recovery_logs == TXNID_NONE) {
|
||||
BYTESTRING keybs = {.len=key->size, .data=key->data};
|
||||
r = toku_log_enq_delete_any(logger, (LSN*)0, 0, toku_cachefile_filenum(brt->h->cf), xid, keybs);
|
||||
r = toku_log_enq_delete_any(logger, (LSN*)0, 0, toku_cachefile_filenum(brt->ft->cf), xid, keybs);
|
||||
if (r!=0) return r;
|
||||
}
|
||||
|
||||
LSN treelsn;
|
||||
if (oplsn_valid && oplsn.lsn <= (treelsn = toku_ft_checkpoint_lsn(brt->h)).lsn) {
|
||||
if (oplsn_valid && oplsn.lsn <= (treelsn = toku_ft_checkpoint_lsn(brt->ft)).lsn) {
|
||||
r = 0;
|
||||
} else {
|
||||
r = toku_ft_send_delete(brt, key, message_xids);
|
||||
|
@ -2934,7 +2934,7 @@ int
|
|||
toku_ft_send_delete(FT_HANDLE brt, DBT *key, XIDS xids) {
|
||||
DBT val; toku_init_dbt(&val);
|
||||
FT_MSG_S ftcmd = { FT_DELETE_ANY, ZERO_MSN, xids, .u.id = { key, &val }};
|
||||
int result = toku_ft_root_put_cmd(brt->h, &ftcmd);
|
||||
int result = toku_ft_root_put_cmd(brt->ft, &ftcmd);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -3102,11 +3102,11 @@ toku_ft_change_descriptor(
|
|||
// put information into rollback file
|
||||
r = toku_logger_save_rollback_change_fdescriptor(
|
||||
txn,
|
||||
toku_cachefile_filenum(t->h->cf),
|
||||
toku_cachefile_filenum(t->ft->cf),
|
||||
&old_desc_bs
|
||||
);
|
||||
if (r != 0) { goto cleanup; }
|
||||
r = toku_txn_note_ft(txn, t->h);
|
||||
r = toku_txn_note_ft(txn, t->ft);
|
||||
if (r != 0) { goto cleanup; }
|
||||
|
||||
if (do_log) {
|
||||
|
@ -3114,7 +3114,7 @@ toku_ft_change_descriptor(
|
|||
TXNID xid = toku_txn_get_txnid(txn);
|
||||
r = toku_log_change_fdescriptor(
|
||||
logger, NULL, 0,
|
||||
toku_cachefile_filenum(t->h->cf),
|
||||
toku_cachefile_filenum(t->ft->cf),
|
||||
xid,
|
||||
old_desc_bs,
|
||||
new_desc_bs,
|
||||
|
@ -3125,17 +3125,17 @@ toku_ft_change_descriptor(
|
|||
|
||||
// write new_descriptor to header
|
||||
new_d.dbt = *new_descriptor;
|
||||
fd = toku_cachefile_get_and_pin_fd (t->h->cf);
|
||||
r = toku_update_descriptor(t->h, &new_d, fd);
|
||||
fd = toku_cachefile_get_and_pin_fd (t->ft->cf);
|
||||
r = toku_update_descriptor(t->ft, &new_d, fd);
|
||||
// very infrequent operation, worth precise threadsafe count
|
||||
if (r == 0) {
|
||||
STATUS_VALUE(FT_DESCRIPTOR_SET)++;
|
||||
}
|
||||
toku_cachefile_unpin_fd(t->h->cf);
|
||||
toku_cachefile_unpin_fd(t->ft->cf);
|
||||
if (r!=0) goto cleanup;
|
||||
|
||||
if (update_cmp_descriptor) {
|
||||
toku_ft_update_cmp_descriptor(t->h);
|
||||
toku_ft_update_cmp_descriptor(t->ft);
|
||||
}
|
||||
cleanup:
|
||||
return r;
|
||||
|
@ -3358,7 +3358,7 @@ toku_ft_handle_open_with_dict_id(
|
|||
|
||||
DICTIONARY_ID
|
||||
toku_ft_get_dictionary_id(FT_HANDLE brt) {
|
||||
FT h = brt->h;
|
||||
FT h = brt->ft;
|
||||
DICTIONARY_ID dict_id = h->dict_id;
|
||||
return dict_id;
|
||||
}
|
||||
|
@ -3429,18 +3429,18 @@ toku_ft_handle_close (FT_HANDLE brt, bool oplsn_valid, LSN oplsn)
|
|||
// Effect: See ft-ops.h for the specification of this function.
|
||||
{
|
||||
int r = 0;
|
||||
FT h = brt->h;
|
||||
FT h = brt->ft;
|
||||
|
||||
// it is possible that a header was never opened
|
||||
// for the brt
|
||||
if (brt->h) {
|
||||
if (brt->ft) {
|
||||
// TODO: figure out the proper locking here
|
||||
// what really protects live_ft_handle_link?
|
||||
toku_ft_lock(h);
|
||||
toku_list_remove(&brt->live_ft_handle_link);
|
||||
toku_ft_unlock(h);
|
||||
|
||||
if (!toku_ft_needed(brt->h)) {
|
||||
if (!toku_ft_needed(brt->ft)) {
|
||||
// close header
|
||||
char *error_string = NULL;
|
||||
r = toku_remove_ft(h, &error_string, oplsn_valid, oplsn);
|
||||
|
@ -3548,7 +3548,7 @@ int toku_ft_cursor (
|
|||
{
|
||||
if (is_snapshot_read) {
|
||||
invariant(ttxn != NULL);
|
||||
int accepted = does_txn_read_entry(brt->h->root_xid_that_created, ttxn);
|
||||
int accepted = does_txn_read_entry(brt->ft->root_xid_that_created, ttxn);
|
||||
if (accepted!=TOKUDB_ACCEPT) {
|
||||
invariant(accepted==0);
|
||||
return TOKUDB_MVCC_DICTIONARY_TOO_NEW;
|
||||
|
@ -3738,7 +3738,7 @@ copy_to_stale(OMTVALUE v, u_int32_t UU(idx), void *extrap)
|
|||
entry->is_fresh = false;
|
||||
DBT keydbt;
|
||||
DBT *key = fill_dbt_for_fifo_entry(&keydbt, entry);
|
||||
struct toku_fifo_entry_key_msn_heaviside_extra heaviside_extra = { .desc = &extra->ft_handle->h->cmp_descriptor, .cmp = extra->ft_handle->h->compare_fun, .fifo = extra->bnc->buffer, .key = key, .msn = entry->msn };
|
||||
struct toku_fifo_entry_key_msn_heaviside_extra heaviside_extra = { .desc = &extra->ft_handle->ft->cmp_descriptor, .cmp = extra->ft_handle->ft->compare_fun, .fifo = extra->bnc->buffer, .key = key, .msn = entry->msn };
|
||||
int r = toku_omt_insert(extra->bnc->stale_message_tree, (OMTVALUE) offset, toku_fifo_entry_key_msn_heaviside, &heaviside_extra, NULL);
|
||||
assert_zero(r);
|
||||
return r;
|
||||
|
@ -3807,9 +3807,9 @@ do_bn_apply_cmd(FT_HANDLE t, BASEMENTNODE bn, FTNODE ancestor, int childnum, con
|
|||
DBT hv;
|
||||
FT_MSG_S ftcmd = { type, msn, xids, .u.id = { &hk, toku_fill_dbt(&hv, val, vallen) } };
|
||||
toku_ft_bn_apply_cmd(
|
||||
t->h->compare_fun,
|
||||
t->h->update_fun,
|
||||
&t->h->cmp_descriptor,
|
||||
t->ft->compare_fun,
|
||||
t->ft->update_fun,
|
||||
&t->ft->cmp_descriptor,
|
||||
bn,
|
||||
&ftcmd,
|
||||
&BP_WORKDONE(ancestor, childnum),
|
||||
|
@ -3965,13 +3965,13 @@ bnc_apply_messages_to_basement_node(
|
|||
STAT64INFO_S stats_delta = {0,0};
|
||||
u_int32_t stale_lbi, stale_ube;
|
||||
if (!bn->stale_ancestor_messages_applied) {
|
||||
find_bounds_within_message_tree(&t->h->cmp_descriptor, t->h->compare_fun, bnc->stale_message_tree, bnc->buffer, bounds, &stale_lbi, &stale_ube);
|
||||
find_bounds_within_message_tree(&t->ft->cmp_descriptor, t->ft->compare_fun, bnc->stale_message_tree, bnc->buffer, bounds, &stale_lbi, &stale_ube);
|
||||
} else {
|
||||
stale_lbi = 0;
|
||||
stale_ube = 0;
|
||||
}
|
||||
u_int32_t fresh_lbi, fresh_ube;
|
||||
find_bounds_within_message_tree(&t->h->cmp_descriptor, t->h->compare_fun, bnc->fresh_message_tree, bnc->buffer, bounds, &fresh_lbi, &fresh_ube);
|
||||
find_bounds_within_message_tree(&t->ft->cmp_descriptor, t->ft->compare_fun, bnc->fresh_message_tree, bnc->buffer, bounds, &fresh_lbi, &fresh_ube);
|
||||
|
||||
// We now know where all the messages we must apply are, so one of the
|
||||
// following 4 cases will do the application, depending on which of
|
||||
|
@ -4042,7 +4042,7 @@ bnc_apply_messages_to_basement_node(
|
|||
assert_zero(r);
|
||||
|
||||
// This comparison extra struct won't change during iteration.
|
||||
struct toku_fifo_entry_key_msn_cmp_extra extra = { .desc= &t->h->cmp_descriptor, .cmp = t->h->compare_fun, .fifo = bnc->buffer };
|
||||
struct toku_fifo_entry_key_msn_cmp_extra extra = { .desc= &t->ft->cmp_descriptor, .cmp = t->ft->compare_fun, .fifo = bnc->buffer };
|
||||
|
||||
// Iterate over both lists, applying the smaller (in (key, msn)
|
||||
// order) message at each step
|
||||
|
@ -4113,7 +4113,7 @@ bnc_apply_messages_to_basement_node(
|
|||
// update stats
|
||||
//
|
||||
if (stats_delta.numbytes || stats_delta.numrows) {
|
||||
toku_ft_update_stats(&t->h->in_memory_stats, stats_delta);
|
||||
toku_ft_update_stats(&t->ft->in_memory_stats, stats_delta);
|
||||
}
|
||||
// We can't delete things out of the fresh tree inside the above
|
||||
// procedures because we're still looking at the fresh tree. Instead
|
||||
|
@ -4344,15 +4344,15 @@ ft_node_maybe_prefetch(FT_HANDLE brt, FTNODE node, int childnum, FT_CURSOR ftcur
|
|||
int rc = ft_cursor_rightmost_child_wanted(ftcursor, brt, node);
|
||||
for (int i = childnum + 1; (i <= childnum + TOKU_DO_PREFETCH) && (i <= rc); i++) {
|
||||
BLOCKNUM nextchildblocknum = BP_BLOCKNUM(node, i);
|
||||
u_int32_t nextfullhash = compute_child_fullhash(brt->h->cf, node, i);
|
||||
u_int32_t nextfullhash = compute_child_fullhash(brt->ft->cf, node, i);
|
||||
struct ftnode_fetch_extra *MALLOC(bfe);
|
||||
fill_bfe_for_prefetch(bfe, brt->h, ftcursor);
|
||||
fill_bfe_for_prefetch(bfe, brt->ft, ftcursor);
|
||||
BOOL doing_prefetch = FALSE;
|
||||
toku_cachefile_prefetch(
|
||||
brt->h->cf,
|
||||
brt->ft->cf,
|
||||
nextchildblocknum,
|
||||
nextfullhash,
|
||||
get_write_callbacks_for_node(brt->h),
|
||||
get_write_callbacks_for_node(brt->ft),
|
||||
ftnode_fetch_callback_and_free_bfe,
|
||||
toku_ftnode_pf_req_callback,
|
||||
ftnode_pf_callback_and_free_bfe,
|
||||
|
@ -4383,7 +4383,7 @@ unlock_ftnode_fun (void *v) {
|
|||
FTNODE node = x->node;
|
||||
// CT lock is held
|
||||
int r = toku_cachetable_unpin_ct_prelocked_no_flush(
|
||||
brt->h->cf,
|
||||
brt->ft->cf,
|
||||
node->thisnodename,
|
||||
node->fullhash,
|
||||
(enum cachetable_dirty) node->dirty,
|
||||
|
@ -4401,13 +4401,13 @@ ft_search_child(FT_HANDLE brt, FTNODE node, int childnum, ft_search_t *search, F
|
|||
struct ancestors next_ancestors = {node, childnum, ancestors};
|
||||
|
||||
BLOCKNUM childblocknum = BP_BLOCKNUM(node,childnum);
|
||||
u_int32_t fullhash = compute_child_fullhash(brt->h->cf, node, childnum);
|
||||
u_int32_t fullhash = compute_child_fullhash(brt->ft->cf, node, childnum);
|
||||
FTNODE childnode;
|
||||
|
||||
struct ftnode_fetch_extra bfe;
|
||||
fill_bfe_for_subset_read(
|
||||
&bfe,
|
||||
brt->h,
|
||||
brt->ft,
|
||||
search,
|
||||
&ftcursor->range_lock_left_key,
|
||||
&ftcursor->range_lock_right_key,
|
||||
|
@ -4443,7 +4443,7 @@ ft_search_child(FT_HANDLE brt, FTNODE node, int childnum, ft_search_t *search, F
|
|||
|
||||
assert(next_unlockers.locked);
|
||||
if (msgs_applied) {
|
||||
toku_unpin_ftnode(brt->h, childnode);
|
||||
toku_unpin_ftnode(brt->ft, childnode);
|
||||
}
|
||||
else {
|
||||
toku_unpin_ftnode_read_only(brt, childnode);
|
||||
|
@ -4459,7 +4459,7 @@ ft_search_child(FT_HANDLE brt, FTNODE node, int childnum, ft_search_t *search, F
|
|||
// the node was not unpinned, so we unpin it here
|
||||
if (next_unlockers.locked) {
|
||||
if (msgs_applied) {
|
||||
toku_unpin_ftnode(brt->h, childnode);
|
||||
toku_unpin_ftnode(brt->ft, childnode);
|
||||
}
|
||||
else {
|
||||
toku_unpin_ftnode_read_only(brt, childnode);
|
||||
|
@ -4696,7 +4696,7 @@ toku_ft_search (FT_HANDLE brt, ft_search_t *search, FT_GET_CALLBACK_FUNCTION get
|
|||
try_again:
|
||||
|
||||
trycount++;
|
||||
assert(brt->h);
|
||||
assert(brt->ft);
|
||||
|
||||
//
|
||||
// Here is how searches work
|
||||
|
@ -4727,7 +4727,7 @@ try_again:
|
|||
struct ftnode_fetch_extra bfe;
|
||||
fill_bfe_for_subset_read(
|
||||
&bfe,
|
||||
brt->h,
|
||||
brt->ft,
|
||||
search,
|
||||
&ftcursor->range_lock_left_key,
|
||||
&ftcursor->range_lock_right_key,
|
||||
|
@ -4737,12 +4737,12 @@ try_again:
|
|||
);
|
||||
FTNODE node = NULL;
|
||||
{
|
||||
toku_ft_grab_treelock(brt->h);
|
||||
toku_ft_grab_treelock(brt->ft);
|
||||
u_int32_t fullhash;
|
||||
CACHEKEY root_key;
|
||||
toku_calculate_root_offset_pointer(brt->h, &root_key, &fullhash);
|
||||
toku_calculate_root_offset_pointer(brt->ft, &root_key, &fullhash);
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
brt->h,
|
||||
brt->ft,
|
||||
root_key,
|
||||
fullhash,
|
||||
&bfe,
|
||||
|
@ -4751,7 +4751,7 @@ try_again:
|
|||
NULL,
|
||||
&node
|
||||
);
|
||||
toku_ft_release_treelock(brt->h);
|
||||
toku_ft_release_treelock(brt->ft);
|
||||
}
|
||||
|
||||
uint tree_height = node->height + 1; // How high is the tree? This is the height of the root node plus one (leaf is at height 0).
|
||||
|
@ -4834,8 +4834,8 @@ ft_cursor_search(FT_CURSOR cursor, ft_search_t *search, FT_GET_CALLBACK_FUNCTION
|
|||
}
|
||||
|
||||
static inline int compare_k_x(FT_HANDLE brt, const DBT *k, const DBT *x) {
|
||||
FAKE_DB(db, &brt->h->cmp_descriptor);
|
||||
return brt->h->compare_fun(&db, k, x);
|
||||
FAKE_DB(db, &brt->ft->cmp_descriptor);
|
||||
return brt->ft->compare_fun(&db, k, x);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -5180,8 +5180,8 @@ keyrange_compare (OMTVALUE lev, void *extra) {
|
|||
toku_fill_dbt(&omt_dbt, key, keylen);
|
||||
struct keyrange_compare_s *s = extra;
|
||||
// TODO: maybe put a const fake_db in the header
|
||||
FAKE_DB(db, &s->ft_handle->h->cmp_descriptor);
|
||||
return s->ft_handle->h->compare_fun(&db, &omt_dbt, s->key);
|
||||
FAKE_DB(db, &s->ft_handle->ft->cmp_descriptor);
|
||||
return s->ft_handle->ft->compare_fun(&db, &omt_dbt, s->key);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -5226,7 +5226,7 @@ toku_ft_keyrange_internal (FT_HANDLE brt, FTNODE node,
|
|||
{
|
||||
int r = 0;
|
||||
// if KEY is NULL then use the leftmost key.
|
||||
int child_number = key ? toku_ftnode_which_child (node, key, &brt->h->cmp_descriptor, brt->h->compare_fun) : 0;
|
||||
int child_number = key ? toku_ftnode_which_child (node, key, &brt->ft->cmp_descriptor, brt->ft->compare_fun) : 0;
|
||||
uint64_t rows_per_child = estimated_num_rows / node->n_children;
|
||||
if (node->height == 0) {
|
||||
|
||||
|
@ -5239,7 +5239,7 @@ toku_ft_keyrange_internal (FT_HANDLE brt, FTNODE node,
|
|||
// do the child.
|
||||
struct ancestors next_ancestors = {node, child_number, ancestors};
|
||||
BLOCKNUM childblocknum = BP_BLOCKNUM(node, child_number);
|
||||
u_int32_t fullhash = compute_child_fullhash(brt->h->cf, node, child_number);
|
||||
u_int32_t fullhash = compute_child_fullhash(brt->ft->cf, node, child_number);
|
||||
FTNODE childnode;
|
||||
BOOL msgs_applied = FALSE;
|
||||
r = toku_pin_ftnode(
|
||||
|
@ -5289,21 +5289,21 @@ toku_ft_keyrange (FT_HANDLE brt, DBT *key, u_int64_t *less_p, u_int64_t *equal_p
|
|||
// TODO 4184: What to do with a NULL key?
|
||||
// If KEY is NULL then the system picks an arbitrary key and returns it.
|
||||
{
|
||||
assert(brt->h);
|
||||
assert(brt->ft);
|
||||
struct ftnode_fetch_extra bfe;
|
||||
fill_bfe_for_min_read(&bfe, brt->h); // read pivot keys but not message buffers
|
||||
fill_bfe_for_min_read(&bfe, brt->ft); // read pivot keys but not message buffers
|
||||
try_again:
|
||||
{
|
||||
u_int64_t less = 0, equal = 0, greater = 0;
|
||||
FTNODE node = NULL;
|
||||
{
|
||||
toku_ft_grab_treelock(brt->h);
|
||||
toku_ft_grab_treelock(brt->ft);
|
||||
|
||||
u_int32_t fullhash;
|
||||
CACHEKEY root_key;
|
||||
toku_calculate_root_offset_pointer(brt->h, &root_key, &fullhash);
|
||||
toku_calculate_root_offset_pointer(brt->ft, &root_key, &fullhash);
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
brt->h,
|
||||
brt->ft,
|
||||
root_key,
|
||||
fullhash,
|
||||
&bfe,
|
||||
|
@ -5312,14 +5312,14 @@ try_again:
|
|||
NULL,
|
||||
&node
|
||||
);
|
||||
toku_ft_release_treelock(brt->h);
|
||||
toku_ft_release_treelock(brt->ft);
|
||||
}
|
||||
|
||||
struct unlock_ftnode_extra unlock_extra = {brt,node,FALSE};
|
||||
struct unlockers unlockers = {TRUE, unlock_ftnode_fun, (void*)&unlock_extra, (UNLOCKERS)NULL};
|
||||
|
||||
{
|
||||
int64_t numrows = brt->h->in_memory_stats.numrows;
|
||||
int64_t numrows = brt->ft->in_memory_stats.numrows;
|
||||
if (numrows < 0)
|
||||
numrows = 0; // prevent appearance of a negative number
|
||||
int r = toku_ft_keyrange_internal (brt, node, key,
|
||||
|
@ -5343,8 +5343,8 @@ try_again:
|
|||
|
||||
int
|
||||
toku_ft_handle_stat64 (FT_HANDLE brt, TOKUTXN UU(txn), struct ftstat64_s *s) {
|
||||
assert(brt->h);
|
||||
toku_ft_stat64(brt->h, s);
|
||||
assert(brt->ft);
|
||||
toku_ft_stat64(brt->ft, s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -5356,16 +5356,16 @@ toku_dump_ftnode (FILE *file, FT_HANDLE brt, BLOCKNUM blocknum, int depth, const
|
|||
void* node_v;
|
||||
toku_get_node_for_verify(blocknum, brt, &node);
|
||||
result=toku_verify_ftnode(brt, ZERO_MSN, ZERO_MSN, node, -1, lorange, hirange, NULL, NULL, 0, 1, 0);
|
||||
u_int32_t fullhash = toku_cachetable_hash(brt->h->cf, blocknum);
|
||||
u_int32_t fullhash = toku_cachetable_hash(brt->ft->cf, blocknum);
|
||||
struct ftnode_fetch_extra bfe;
|
||||
fill_bfe_for_full_read(&bfe, brt->h);
|
||||
fill_bfe_for_full_read(&bfe, brt->ft);
|
||||
int r = toku_cachetable_get_and_pin(
|
||||
brt->h->cf,
|
||||
brt->ft->cf,
|
||||
blocknum,
|
||||
fullhash,
|
||||
&node_v,
|
||||
NULL,
|
||||
get_write_callbacks_for_node(brt->h),
|
||||
get_write_callbacks_for_node(brt->ft),
|
||||
toku_ftnode_fetch_callback,
|
||||
toku_ftnode_pf_req_callback,
|
||||
toku_ftnode_pf_callback,
|
||||
|
@ -5426,24 +5426,24 @@ toku_dump_ftnode (FILE *file, FT_HANDLE brt, BLOCKNUM blocknum, int depth, const
|
|||
}
|
||||
}
|
||||
}
|
||||
r = toku_cachetable_unpin(brt->h->cf, blocknum, fullhash, CACHETABLE_CLEAN, make_ftnode_pair_attr(node));
|
||||
r = toku_cachetable_unpin(brt->ft->cf, blocknum, fullhash, CACHETABLE_CLEAN, make_ftnode_pair_attr(node));
|
||||
assert_zero(r);
|
||||
return result;
|
||||
}
|
||||
|
||||
int toku_dump_ft (FILE *f, FT_HANDLE brt) {
|
||||
int r;
|
||||
assert(brt->h);
|
||||
toku_dump_translation_table(f, brt->h->blocktable);
|
||||
assert(brt->ft);
|
||||
toku_dump_translation_table(f, brt->ft->blocktable);
|
||||
{
|
||||
toku_ft_grab_treelock(brt->h);
|
||||
toku_ft_grab_treelock(brt->ft);
|
||||
|
||||
u_int32_t fullhash = 0;
|
||||
CACHEKEY root_key;
|
||||
toku_calculate_root_offset_pointer(brt->h, &root_key, &fullhash);
|
||||
toku_calculate_root_offset_pointer(brt->ft, &root_key, &fullhash);
|
||||
r = toku_dump_ftnode(f, brt, root_key, 0, 0, 0);
|
||||
|
||||
toku_ft_release_treelock(brt->h);
|
||||
toku_ft_release_treelock(brt->ft);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
@ -5476,14 +5476,14 @@ int toku_ft_layer_destroy(void) {
|
|||
//Suppress both rollback and recovery logs.
|
||||
void
|
||||
toku_ft_suppress_recovery_logs (FT_HANDLE brt, TOKUTXN txn) {
|
||||
assert(brt->h->txnid_that_created_or_locked_when_empty == toku_txn_get_txnid(txn));
|
||||
assert(brt->h->txnid_that_suppressed_recovery_logs == TXNID_NONE);
|
||||
brt->h->txnid_that_suppressed_recovery_logs = toku_txn_get_txnid(txn);
|
||||
assert(brt->ft->txnid_that_created_or_locked_when_empty == toku_txn_get_txnid(txn));
|
||||
assert(brt->ft->txnid_that_suppressed_recovery_logs == TXNID_NONE);
|
||||
brt->ft->txnid_that_suppressed_recovery_logs = toku_txn_get_txnid(txn);
|
||||
txn->checkpoint_needed_before_commit = TRUE;
|
||||
}
|
||||
|
||||
int toku_ft_handle_set_panic(FT_HANDLE brt, int panic, char *panic_string) {
|
||||
return toku_ft_set_panic(brt->h, panic, panic_string);
|
||||
return toku_ft_set_panic(brt->ft, panic, panic_string);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -5557,20 +5557,20 @@ int
|
|||
toku_ft_get_fragmentation(FT_HANDLE brt, TOKU_DB_FRAGMENTATION report) {
|
||||
int r;
|
||||
|
||||
int fd = toku_cachefile_get_and_pin_fd(brt->h->cf);
|
||||
toku_ft_lock(brt->h);
|
||||
int fd = toku_cachefile_get_and_pin_fd(brt->ft->cf);
|
||||
toku_ft_lock(brt->ft);
|
||||
|
||||
int64_t file_size;
|
||||
if (toku_cachefile_is_dev_null_unlocked(brt->h->cf))
|
||||
if (toku_cachefile_is_dev_null_unlocked(brt->ft->cf))
|
||||
r = EINVAL;
|
||||
else
|
||||
r = toku_os_get_file_size(fd, &file_size);
|
||||
if (r==0) {
|
||||
report->file_size_bytes = file_size;
|
||||
toku_block_table_get_fragmentation_unlocked(brt->h->blocktable, report);
|
||||
toku_block_table_get_fragmentation_unlocked(brt->ft->blocktable, report);
|
||||
}
|
||||
toku_ft_unlock(brt->h);
|
||||
toku_cachefile_unpin_fd(brt->h->cf);
|
||||
toku_ft_unlock(brt->ft);
|
||||
toku_cachefile_unpin_fd(brt->ft->cf);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -5583,13 +5583,13 @@ static BOOL is_empty_fast_iter (FT_HANDLE brt, FTNODE node) {
|
|||
FTNODE childnode;
|
||||
{
|
||||
BLOCKNUM childblocknum = BP_BLOCKNUM(node,childnum);
|
||||
u_int32_t fullhash = compute_child_fullhash(brt->h->cf, node, childnum);
|
||||
u_int32_t fullhash = compute_child_fullhash(brt->ft->cf, node, childnum);
|
||||
struct ftnode_fetch_extra bfe;
|
||||
fill_bfe_for_full_read(&bfe, brt->h);
|
||||
fill_bfe_for_full_read(&bfe, brt->ft);
|
||||
// don't need to pass in dependent nodes as we are not
|
||||
// modifying nodes we are pinning
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
brt->h,
|
||||
brt->ft,
|
||||
childblocknum,
|
||||
fullhash,
|
||||
&bfe,
|
||||
|
@ -5600,7 +5600,7 @@ static BOOL is_empty_fast_iter (FT_HANDLE brt, FTNODE node) {
|
|||
);
|
||||
}
|
||||
int child_is_empty = is_empty_fast_iter(brt, childnode);
|
||||
toku_unpin_ftnode(brt->h, childnode);
|
||||
toku_unpin_ftnode(brt->ft, childnode);
|
||||
if (!child_is_empty) return 0;
|
||||
}
|
||||
return 1;
|
||||
|
@ -5621,16 +5621,16 @@ BOOL toku_ft_is_empty_fast (FT_HANDLE brt)
|
|||
{
|
||||
u_int32_t fullhash;
|
||||
FTNODE node;
|
||||
//assert(fullhash == toku_cachetable_hash(brt->h->cf, *rootp));
|
||||
//assert(fullhash == toku_cachetable_hash(brt->ft->cf, *rootp));
|
||||
{
|
||||
toku_ft_grab_treelock(brt->h);
|
||||
toku_ft_grab_treelock(brt->ft);
|
||||
|
||||
CACHEKEY root_key;
|
||||
toku_calculate_root_offset_pointer(brt->h, &root_key, &fullhash);
|
||||
toku_calculate_root_offset_pointer(brt->ft, &root_key, &fullhash);
|
||||
struct ftnode_fetch_extra bfe;
|
||||
fill_bfe_for_full_read(&bfe, brt->h);
|
||||
fill_bfe_for_full_read(&bfe, brt->ft);
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
brt->h,
|
||||
brt->ft,
|
||||
root_key,
|
||||
fullhash,
|
||||
&bfe,
|
||||
|
@ -5640,10 +5640,10 @@ BOOL toku_ft_is_empty_fast (FT_HANDLE brt)
|
|||
&node
|
||||
);
|
||||
|
||||
toku_ft_release_treelock(brt->h);
|
||||
toku_ft_release_treelock(brt->ft);
|
||||
}
|
||||
BOOL r = is_empty_fast_iter(brt, node);
|
||||
toku_unpin_ftnode(brt->h, node);
|
||||
toku_unpin_ftnode(brt->ft, node);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ int toku_testsetup_leaf(FT_HANDLE brt, BLOCKNUM *blocknum, int n_children, char
|
|||
}
|
||||
|
||||
*blocknum = node->thisnodename;
|
||||
toku_unpin_ftnode(brt->h, node);
|
||||
toku_unpin_ftnode(brt->ft, node);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -68,13 +68,13 @@ int toku_testsetup_nonleaf (FT_HANDLE brt, int height, BLOCKNUM *blocknum, int n
|
|||
node->totalchildkeylens += keylens[i];
|
||||
}
|
||||
*blocknum = node->thisnodename;
|
||||
toku_unpin_ftnode(brt->h, node);
|
||||
toku_unpin_ftnode(brt->ft, node);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int toku_testsetup_root(FT_HANDLE brt, BLOCKNUM blocknum) {
|
||||
assert(testsetup_initialized);
|
||||
brt->h->root_blocknum = blocknum;
|
||||
brt->ft->root_blocknum = blocknum;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -83,13 +83,13 @@ int toku_testsetup_get_sersize(FT_HANDLE brt, BLOCKNUM diskoff) // Return the si
|
|||
assert(testsetup_initialized);
|
||||
void *node_v;
|
||||
struct ftnode_fetch_extra bfe;
|
||||
fill_bfe_for_full_read(&bfe, brt->h);
|
||||
fill_bfe_for_full_read(&bfe, brt->ft);
|
||||
int r = toku_cachetable_get_and_pin(
|
||||
brt->h->cf, diskoff,
|
||||
toku_cachetable_hash(brt->h->cf, diskoff),
|
||||
brt->ft->cf, diskoff,
|
||||
toku_cachetable_hash(brt->ft->cf, diskoff),
|
||||
&node_v,
|
||||
NULL,
|
||||
get_write_callbacks_for_node(brt->h),
|
||||
get_write_callbacks_for_node(brt->ft),
|
||||
toku_ftnode_fetch_callback,
|
||||
toku_ftnode_pf_req_callback,
|
||||
toku_ftnode_pf_callback,
|
||||
|
@ -98,7 +98,7 @@ int toku_testsetup_get_sersize(FT_HANDLE brt, BLOCKNUM diskoff) // Return the si
|
|||
);
|
||||
assert(r==0);
|
||||
int size = toku_serialize_ftnode_size(node_v);
|
||||
toku_unpin_ftnode(brt->h, node_v);
|
||||
toku_unpin_ftnode(brt->ft, node_v);
|
||||
return size;
|
||||
}
|
||||
|
||||
|
@ -109,14 +109,14 @@ int toku_testsetup_insert_to_leaf (FT_HANDLE brt, BLOCKNUM blocknum, char *key,
|
|||
assert(testsetup_initialized);
|
||||
|
||||
struct ftnode_fetch_extra bfe;
|
||||
fill_bfe_for_full_read(&bfe, brt->h);
|
||||
fill_bfe_for_full_read(&bfe, brt->ft);
|
||||
r = toku_cachetable_get_and_pin(
|
||||
brt->h->cf,
|
||||
brt->ft->cf,
|
||||
blocknum,
|
||||
toku_cachetable_hash(brt->h->cf, blocknum),
|
||||
toku_cachetable_hash(brt->ft->cf, blocknum),
|
||||
&node_v,
|
||||
NULL,
|
||||
get_write_callbacks_for_node(brt->h),
|
||||
get_write_callbacks_for_node(brt->ft),
|
||||
toku_ftnode_fetch_callback,
|
||||
toku_ftnode_pf_req_callback,
|
||||
toku_ftnode_pf_callback,
|
||||
|
@ -135,9 +135,9 @@ int toku_testsetup_insert_to_leaf (FT_HANDLE brt, BLOCKNUM blocknum, char *key,
|
|||
toku_fill_dbt(&valdbt, val, vallen)}};
|
||||
|
||||
toku_ft_node_put_cmd (
|
||||
brt->h->compare_fun,
|
||||
brt->h->update_fun,
|
||||
&brt->h->cmp_descriptor,
|
||||
brt->ft->compare_fun,
|
||||
brt->ft->update_fun,
|
||||
&brt->ft->cmp_descriptor,
|
||||
node,
|
||||
&cmd,
|
||||
true,
|
||||
|
@ -146,7 +146,7 @@ int toku_testsetup_insert_to_leaf (FT_HANDLE brt, BLOCKNUM blocknum, char *key,
|
|||
|
||||
toku_verify_or_set_counts(node);
|
||||
|
||||
toku_unpin_ftnode(brt->h, node_v);
|
||||
toku_unpin_ftnode(brt->ft, node_v);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -162,11 +162,11 @@ void
|
|||
toku_pin_node_with_min_bfe(FTNODE* node, BLOCKNUM b, FT_HANDLE t)
|
||||
{
|
||||
struct ftnode_fetch_extra bfe;
|
||||
fill_bfe_for_min_read(&bfe, t->h);
|
||||
fill_bfe_for_min_read(&bfe, t->ft);
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
t->h,
|
||||
t->ft,
|
||||
b,
|
||||
toku_cachetable_hash(t->h->cf, b),
|
||||
toku_cachetable_hash(t->ft->cf, b),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -182,14 +182,14 @@ int toku_testsetup_insert_to_nonleaf (FT_HANDLE brt, BLOCKNUM blocknum, enum ft_
|
|||
assert(testsetup_initialized);
|
||||
|
||||
struct ftnode_fetch_extra bfe;
|
||||
fill_bfe_for_full_read(&bfe, brt->h);
|
||||
fill_bfe_for_full_read(&bfe, brt->ft);
|
||||
r = toku_cachetable_get_and_pin(
|
||||
brt->h->cf,
|
||||
brt->ft->cf,
|
||||
blocknum,
|
||||
toku_cachetable_hash(brt->h->cf, blocknum),
|
||||
toku_cachetable_hash(brt->ft->cf, blocknum),
|
||||
&node_v,
|
||||
NULL,
|
||||
get_write_callbacks_for_node(brt->h),
|
||||
get_write_callbacks_for_node(brt->ft),
|
||||
toku_ftnode_fetch_callback,
|
||||
toku_ftnode_pf_req_callback,
|
||||
toku_ftnode_pf_callback,
|
||||
|
@ -203,7 +203,7 @@ int toku_testsetup_insert_to_nonleaf (FT_HANDLE brt, BLOCKNUM blocknum, enum ft_
|
|||
DBT k;
|
||||
int childnum = toku_ftnode_which_child(node,
|
||||
toku_fill_dbt(&k, key, keylen),
|
||||
&brt->h->cmp_descriptor, brt->h->compare_fun);
|
||||
&brt->ft->cmp_descriptor, brt->ft->compare_fun);
|
||||
|
||||
XIDS xids_0 = xids_get_root_xids();
|
||||
MSN msn = next_dummymsn();
|
||||
|
@ -215,6 +215,6 @@ int toku_testsetup_insert_to_nonleaf (FT_HANDLE brt, BLOCKNUM blocknum, enum ft_
|
|||
node->max_msn_applied_to_node_on_disk = msn;
|
||||
node->dirty = 1;
|
||||
|
||||
toku_unpin_ftnode(brt->h, node_v);
|
||||
toku_unpin_ftnode(brt->ft, node_v);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -18,16 +18,16 @@
|
|||
|
||||
static int
|
||||
compare_pairs (FT_HANDLE brt, const DBT *a, const DBT *b) {
|
||||
FAKE_DB(db, &brt->h->cmp_descriptor);
|
||||
int cmp = brt->h->compare_fun(&db, a, b);
|
||||
FAKE_DB(db, &brt->ft->cmp_descriptor);
|
||||
int cmp = brt->ft->compare_fun(&db, a, b);
|
||||
return cmp;
|
||||
}
|
||||
|
||||
static int
|
||||
compare_leafentries (FT_HANDLE brt, LEAFENTRY a, LEAFENTRY b) {
|
||||
DBT x,y;
|
||||
FAKE_DB(db, &brt->h->cmp_descriptor);
|
||||
int cmp = brt->h->compare_fun(&db,
|
||||
FAKE_DB(db, &brt->ft->cmp_descriptor);
|
||||
int cmp = brt->ft->compare_fun(&db,
|
||||
toku_fill_dbt(&x, le_key(a), le_keylen(a)),
|
||||
toku_fill_dbt(&y, le_key(b), le_keylen(b)));
|
||||
return cmp;
|
||||
|
@ -36,16 +36,16 @@ compare_leafentries (FT_HANDLE brt, LEAFENTRY a, LEAFENTRY b) {
|
|||
static int
|
||||
compare_pair_to_leafentry (FT_HANDLE brt, const DBT *a, LEAFENTRY b) {
|
||||
DBT y;
|
||||
FAKE_DB(db, &brt->h->cmp_descriptor);
|
||||
int cmp = brt->h->compare_fun(&db, a, toku_fill_dbt(&y, le_key(b), le_keylen(b)));
|
||||
FAKE_DB(db, &brt->ft->cmp_descriptor);
|
||||
int cmp = brt->ft->compare_fun(&db, a, toku_fill_dbt(&y, le_key(b), le_keylen(b)));
|
||||
return cmp;
|
||||
}
|
||||
|
||||
static int
|
||||
compare_pair_to_key (FT_HANDLE brt, const DBT *a, bytevec key, ITEMLEN keylen) {
|
||||
DBT y;
|
||||
FAKE_DB(db, &brt->h->cmp_descriptor);
|
||||
int cmp = brt->h->compare_fun(&db, a, toku_fill_dbt(&y, key, keylen));
|
||||
FAKE_DB(db, &brt->ft->cmp_descriptor);
|
||||
int cmp = brt->ft->compare_fun(&db, a, toku_fill_dbt(&y, key, keylen));
|
||||
return cmp;
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ verify_sorted_by_key_msn(FT_HANDLE brt, FIFO fifo, OMT mt) {
|
|||
assert_zero(r);
|
||||
size_t offset = (size_t) v;
|
||||
if (i > 0) {
|
||||
struct toku_fifo_entry_key_msn_cmp_extra extra = { .desc = &brt->h->cmp_descriptor, .cmp = brt->h->compare_fun, .fifo = fifo };
|
||||
struct toku_fifo_entry_key_msn_cmp_extra extra = { .desc = &brt->ft->cmp_descriptor, .cmp = brt->ft->compare_fun, .fifo = fifo };
|
||||
if (toku_fifo_entry_key_msn_cmp(&extra, &last_offset, &offset) >= 0) {
|
||||
result = TOKUDB_NEEDS_REPAIR;
|
||||
break;
|
||||
|
@ -185,7 +185,7 @@ verify_sorted_by_key_msn(FT_HANDLE brt, FIFO fifo, OMT mt) {
|
|||
static int
|
||||
count_eq_key_msn(FT_HANDLE brt, FIFO fifo, OMT mt, const DBT *key, MSN msn) {
|
||||
struct toku_fifo_entry_key_msn_heaviside_extra extra = {
|
||||
.desc = &brt->h->cmp_descriptor, .cmp = brt->h->compare_fun, .fifo = fifo, .key = key, .msn = msn
|
||||
.desc = &brt->ft->cmp_descriptor, .cmp = brt->ft->compare_fun, .fifo = fifo, .key = key, .msn = msn
|
||||
};
|
||||
OMTVALUE v; u_int32_t idx;
|
||||
int r = toku_omt_find_zero(mt, toku_fifo_entry_key_msn_heaviside, &extra, &v, &idx);
|
||||
|
@ -206,11 +206,11 @@ toku_get_node_for_verify(
|
|||
FTNODE* nodep
|
||||
)
|
||||
{
|
||||
u_int32_t fullhash = toku_cachetable_hash(brt->h->cf, blocknum);
|
||||
u_int32_t fullhash = toku_cachetable_hash(brt->ft->cf, blocknum);
|
||||
struct ftnode_fetch_extra bfe;
|
||||
fill_bfe_for_full_read(&bfe, brt->h);
|
||||
fill_bfe_for_full_read(&bfe, brt->ft);
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
brt->h,
|
||||
brt->ft,
|
||||
blocknum,
|
||||
fullhash,
|
||||
&bfe,
|
||||
|
@ -311,7 +311,7 @@ toku_verify_ftnode (FT_HANDLE brt,
|
|||
}
|
||||
struct count_msgs_extra extra = { .count = 0, .key = &keydbt,
|
||||
.msn = msn, .fifo = bnc->buffer,
|
||||
.desc = &brt->h->cmp_descriptor, .cmp = brt->h->compare_fun };
|
||||
.desc = &brt->ft->cmp_descriptor, .cmp = brt->ft->compare_fun };
|
||||
extra.count = 0;
|
||||
toku_omt_iterate(bnc->broadcast_list, count_msgs, &extra);
|
||||
if (ft_msg_type_applies_all(type) || ft_msg_type_does_nothing(type)) {
|
||||
|
@ -378,9 +378,9 @@ toku_verify_ftnode (FT_HANDLE brt,
|
|||
done:
|
||||
{
|
||||
int r = toku_cachetable_unpin(
|
||||
brt->h->cf,
|
||||
brt->ft->cf,
|
||||
node->thisnodename,
|
||||
toku_cachetable_hash(brt->h->cf, node->thisnodename),
|
||||
toku_cachetable_hash(brt->ft->cf, node->thisnodename),
|
||||
CACHETABLE_CLEAN,
|
||||
make_ftnode_pair_attr(node)
|
||||
);
|
||||
|
@ -395,24 +395,24 @@ done:
|
|||
|
||||
int
|
||||
toku_verify_ft_with_progress (FT_HANDLE brt, int (*progress_callback)(void *extra, float progress), void *progress_extra, int verbose, int keep_on_going) {
|
||||
assert(brt->h);
|
||||
assert(brt->ft);
|
||||
FTNODE root_node = NULL;
|
||||
{
|
||||
toku_ft_grab_treelock(brt->h);
|
||||
toku_ft_grab_treelock(brt->ft);
|
||||
|
||||
u_int32_t root_hash;
|
||||
CACHEKEY root_key;
|
||||
toku_calculate_root_offset_pointer(brt->h, &root_key, &root_hash);
|
||||
toku_calculate_root_offset_pointer(brt->ft, &root_key, &root_hash);
|
||||
toku_get_node_for_verify(root_key, brt, &root_node);
|
||||
|
||||
toku_ft_release_treelock(brt->h);
|
||||
toku_ft_release_treelock(brt->ft);
|
||||
}
|
||||
int r = toku_verify_ftnode(brt, ZERO_MSN, ZERO_MSN, root_node, -1, NULL, NULL, progress_callback, progress_extra, 1, verbose, keep_on_going);
|
||||
if (r == 0) {
|
||||
toku_ft_lock(brt->h);
|
||||
brt->h->time_of_last_verification = time(NULL);
|
||||
brt->h->dirty = 1;
|
||||
toku_ft_unlock(brt->h);
|
||||
toku_ft_lock(brt->ft);
|
||||
brt->ft->time_of_last_verification = time(NULL);
|
||||
brt->ft->dirty = 1;
|
||||
toku_ft_unlock(brt->ft);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
|
16
ft/ft.c
16
ft/ft.c
|
@ -408,7 +408,7 @@ exit:
|
|||
|
||||
|
||||
// allocate and initialize a brt header.
|
||||
// t->h->cf is not set to anything.
|
||||
// t->ft->cf is not set to anything.
|
||||
int
|
||||
toku_create_new_ft(FT *ftp, FT_OPTIONS options, CACHEFILE cf, TOKUTXN txn) {
|
||||
int r;
|
||||
|
@ -505,7 +505,7 @@ int toku_read_ft_and_store_in_cachefile (FT_HANDLE brt, CACHEFILE cf, LSN max_ac
|
|||
void
|
||||
toku_ft_note_ft_handle_open(FT ft, FT_HANDLE live) {
|
||||
toku_ft_lock(ft);
|
||||
live->h = ft;
|
||||
live->ft = ft;
|
||||
toku_list_push(&ft->live_ft_handles, &live->live_ft_handle_link);
|
||||
toku_ft_unlock(ft);
|
||||
}
|
||||
|
@ -548,7 +548,7 @@ FT_HANDLE toku_ft_get_some_existing_ft_handle(FT h) {
|
|||
// convenient here for keeping the HOT variables threadsafe.)
|
||||
void
|
||||
toku_ft_note_hot_begin(FT_HANDLE brt) {
|
||||
FT h = brt->h;
|
||||
FT h = brt->ft;
|
||||
time_t now = time(NULL);
|
||||
|
||||
// hold lock around setting and clearing of dirty bit
|
||||
|
@ -565,7 +565,7 @@ toku_ft_note_hot_begin(FT_HANDLE brt) {
|
|||
// Note: See note for toku_ft_note_hot_begin().
|
||||
void
|
||||
toku_ft_note_hot_complete(FT_HANDLE brt, BOOL success, MSN msn_at_start_of_hot) {
|
||||
FT h = brt->h;
|
||||
FT h = brt->ft;
|
||||
time_t now = time(NULL);
|
||||
|
||||
toku_ft_lock(h);
|
||||
|
@ -629,7 +629,7 @@ ft_handle_open_for_redirect(FT_HANDLE *new_ftp, const char *fname_in_env, TOKUTX
|
|||
CACHETABLE ct = toku_cachefile_get_cachetable(old_h->cf);
|
||||
r = toku_ft_handle_open_with_dict_id(t, fname_in_env, 0, 0, ct, txn, old_h->dict_id);
|
||||
assert_zero(r);
|
||||
assert(t->h->dict_id.dictid == old_h->dict_id.dictid);
|
||||
assert(t->ft->dict_id.dictid == old_h->dict_id.dictid);
|
||||
|
||||
*new_ftp = t;
|
||||
return r;
|
||||
|
@ -653,14 +653,14 @@ dictionary_redirect_internal(const char *dst_fname_in_env, FT src_h, TOKUTXN txn
|
|||
FT_HANDLE tmp_dst_ft = NULL;
|
||||
r = ft_handle_open_for_redirect(&tmp_dst_ft, dst_fname_in_env, txn, src_h);
|
||||
assert_zero(r);
|
||||
dst_h = tmp_dst_ft->h;
|
||||
dst_h = tmp_dst_ft->ft;
|
||||
|
||||
// some sanity checks on dst_filenum
|
||||
dst_filenum = toku_cachefile_filenum(dst_h->cf);
|
||||
assert(dst_filenum.fileid!=FILENUM_NONE.fileid);
|
||||
assert(dst_filenum.fileid!=src_filenum.fileid); //Cannot be same file.
|
||||
|
||||
// for each live brt, brt->h is currently src_h
|
||||
// for each live brt, brt->ft is currently src_h
|
||||
// we want to change it to dummy_dst
|
||||
while (!toku_list_empty(&src_h->live_ft_handles)) {
|
||||
list = src_h->live_ft_handles.next;
|
||||
|
@ -758,7 +758,7 @@ toku_dictionary_redirect (const char *dst_fname_in_env, FT_HANDLE old_ft, TOKUTX
|
|||
// If the txn aborts, then this operation will be undone
|
||||
int r;
|
||||
|
||||
FT old_h = old_ft->h;
|
||||
FT old_h = old_ft->ft;
|
||||
|
||||
// dst file should not be open. (implies that dst and src are different because src must be open.)
|
||||
{
|
||||
|
|
|
@ -507,11 +507,11 @@ int toku_ft_loader_internal_init (/* out */ FTLOADER *blp,
|
|||
#define SET_TO_MY_STRDUP(lval, s) do { char *v = toku_strdup(s); if (!v) { int r = errno; toku_ft_loader_internal_destroy(bl, TRUE); return r; } lval = v; } while (0)
|
||||
|
||||
MY_CALLOC_N(N, bl->root_xids_that_created);
|
||||
for (int i=0; i<N; i++) if (brts[i]) bl->root_xids_that_created[i]=brts[i]->h->root_xid_that_created;
|
||||
for (int i=0; i<N; i++) if (brts[i]) bl->root_xids_that_created[i]=brts[i]->ft->root_xid_that_created;
|
||||
MY_CALLOC_N(N, bl->dbs);
|
||||
for (int i=0; i<N; i++) if (brts[i]) bl->dbs[i]=dbs[i];
|
||||
MY_CALLOC_N(N, bl->descriptors);
|
||||
for (int i=0; i<N; i++) if (brts[i]) bl->descriptors[i]=&brts[i]->h->descriptor;
|
||||
for (int i=0; i<N; i++) if (brts[i]) bl->descriptors[i]=&brts[i]->ft->descriptor;
|
||||
MY_CALLOC_N(N, bl->new_fnames_in_env);
|
||||
for (int i=0; i<N; i++) SET_TO_MY_STRDUP(bl->new_fnames_in_env[i], new_fnames_in_env[i]);
|
||||
MY_CALLOC_N(N, bl->extracted_datasizes); // the calloc_n zeroed everything, which is what we want
|
||||
|
|
|
@ -193,11 +193,11 @@ toku_logger_open_rollback(TOKULOGGER logger, CACHETABLE cachetable, BOOL create)
|
|||
assert_zero(r);
|
||||
r = toku_ft_handle_open(t, ROLLBACK_CACHEFILE_NAME, create, create, cachetable, NULL_TXN);
|
||||
assert_zero(r);
|
||||
logger->rollback_cachefile = t->h->cf;
|
||||
logger->rollback_cachefile = t->ft->cf;
|
||||
//Verify it is empty
|
||||
assert(!t->h->panic);
|
||||
assert(!t->ft->panic);
|
||||
//Must have no data blocks (rollback logs or otherwise).
|
||||
toku_block_verify_no_data_blocks_except_root_unlocked(t->h->blocktable, t->h->root_blocknum);
|
||||
toku_block_verify_no_data_blocks_except_root_unlocked(t->ft->blocktable, t->ft->root_blocknum);
|
||||
BOOL is_empty;
|
||||
is_empty = toku_ft_is_empty_fast(t);
|
||||
assert(is_empty);
|
||||
|
|
14
ft/recover.c
14
ft/recover.c
|
@ -68,8 +68,8 @@ static void file_map_tuple_init(struct file_map_tuple *tuple, FILENUM filenum, F
|
|||
tuple->iname = iname;
|
||||
// use a fake DB for comparisons, using the ft's cmp descriptor
|
||||
memset(&tuple->fake_db, 0, sizeof(tuple->fake_db));
|
||||
tuple->fake_db.cmp_descriptor = &tuple->ft_handle->h->cmp_descriptor;
|
||||
tuple->fake_db.descriptor = &tuple->ft_handle->h->descriptor;
|
||||
tuple->fake_db.cmp_descriptor = &tuple->ft_handle->ft->cmp_descriptor;
|
||||
tuple->fake_db.descriptor = &tuple->ft_handle->ft->descriptor;
|
||||
}
|
||||
|
||||
static void file_map_tuple_destroy(struct file_map_tuple *tuple) {
|
||||
|
@ -432,7 +432,7 @@ static int toku_recover_fassociate (struct logtype_fassociate *l, RECOVER_ENV re
|
|||
r = toku_ft_handle_create(&t);
|
||||
assert(r==0);
|
||||
r = toku_ft_handle_open_recovery(t, ROLLBACK_CACHEFILE_NAME, false, false, renv->ct, (TOKUTXN)NULL, l->filenum, max_acceptable_lsn);
|
||||
renv->logger->rollback_cachefile = t->h->cf;
|
||||
renv->logger->rollback_cachefile = t->ft->cf;
|
||||
} else {
|
||||
r = internal_recover_fopen_or_fcreate(renv, FALSE, 0, &l->iname, l->filenum, l->treeflags, NULL, 0, 0, TOKU_DEFAULT_COMPRESSION_METHOD, max_acceptable_lsn);
|
||||
assert(r==0);
|
||||
|
@ -535,7 +535,7 @@ static int recover_xstillopen_internal (TOKUTXN *txnp,
|
|||
struct file_map_tuple *tuple = NULL;
|
||||
r = file_map_find(&renv->fmap, open_filenums.filenums[i], &tuple);
|
||||
if (r==0) {
|
||||
info.open_fts[info.num_fts++] = tuple->ft_handle->h;
|
||||
info.open_fts[info.num_fts++] = tuple->ft_handle->ft;
|
||||
}
|
||||
else {
|
||||
assert(r==DB_NOTFOUND);
|
||||
|
@ -622,9 +622,9 @@ static int toku_recover_suppress_rollback (struct logtype_suppress_rollback *UU(
|
|||
r = toku_txnid2txn(renv->logger, l->xid, &txn);
|
||||
assert(r == 0);
|
||||
assert(txn!=NULL);
|
||||
FT h = tuple->ft_handle->h;
|
||||
FT h = tuple->ft_handle->ft;
|
||||
toku_ft_suppress_rollbacks(h, txn);
|
||||
r = toku_txn_note_ft(txn, tuple->ft_handle->h);
|
||||
r = toku_txn_note_ft(txn, tuple->ft_handle->ft);
|
||||
assert(r==0);
|
||||
}
|
||||
return 0;
|
||||
|
@ -890,7 +890,7 @@ static int toku_recover_enq_insert (struct logtype_enq_insert *l, RECOVER_ENV re
|
|||
toku_fill_dbt(&valdbt, l->value.data, l->value.len);
|
||||
r = toku_ft_maybe_insert(tuple->ft_handle, &keydbt, &valdbt, txn, TRUE, l->lsn, FALSE, FT_INSERT);
|
||||
assert(r == 0);
|
||||
r = toku_txn_note_ft(txn, tuple->ft_handle->h);
|
||||
r = toku_txn_note_ft(txn, tuple->ft_handle->ft);
|
||||
assert(r == 0);
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -330,7 +330,7 @@ test_prefetching(void) {
|
|||
|
||||
FT_HANDLE XMALLOC(brt);
|
||||
FT XCALLOC(brt_h);
|
||||
brt->h = brt_h;
|
||||
brt->ft = brt_h;
|
||||
brt_h->type = FT_CURRENT;
|
||||
brt_h->panic = 0; brt_h->panic_string = 0;
|
||||
brt_h->basementnodesize = 128*1024;
|
||||
|
@ -355,7 +355,7 @@ test_prefetching(void) {
|
|||
assert(size == 100);
|
||||
}
|
||||
FTNODE_DISK_DATA ndd = NULL;
|
||||
r = toku_serialize_ftnode_to(fd, make_blocknum(20), &sn, &ndd, TRUE, brt->h, 1, 1, FALSE);
|
||||
r = toku_serialize_ftnode_to(fd, make_blocknum(20), &sn, &ndd, TRUE, brt->ft, 1, 1, FALSE);
|
||||
assert(r==0);
|
||||
|
||||
test_prefetch_read(fd, brt, brt_h);
|
||||
|
|
|
@ -273,7 +273,7 @@ test_serialize_nonleaf(void) {
|
|||
|
||||
FT_HANDLE XMALLOC(brt);
|
||||
FT XCALLOC(brt_h);
|
||||
brt->h = brt_h;
|
||||
brt->ft = brt_h;
|
||||
brt_h->type = FT_CURRENT;
|
||||
brt_h->panic = 0; brt_h->panic_string = 0;
|
||||
brt_h->basementnodesize = 128*1024;
|
||||
|
@ -298,7 +298,7 @@ test_serialize_nonleaf(void) {
|
|||
assert(size == 100);
|
||||
}
|
||||
FTNODE_DISK_DATA ndd = NULL;
|
||||
r = toku_serialize_ftnode_to(fd, make_blocknum(20), &sn, &ndd, TRUE, brt->h, 1, 1, FALSE);
|
||||
r = toku_serialize_ftnode_to(fd, make_blocknum(20), &sn, &ndd, TRUE, brt->ft, 1, 1, FALSE);
|
||||
assert(r==0);
|
||||
|
||||
test1(fd, brt_h, &dn);
|
||||
|
@ -359,7 +359,7 @@ test_serialize_leaf(void) {
|
|||
|
||||
FT_HANDLE XMALLOC(brt);
|
||||
FT XCALLOC(brt_h);
|
||||
brt->h = brt_h;
|
||||
brt->ft = brt_h;
|
||||
brt_h->type = FT_CURRENT;
|
||||
brt_h->panic = 0; brt_h->panic_string = 0;
|
||||
brt_h->basementnodesize = 128*1024;
|
||||
|
@ -384,7 +384,7 @@ test_serialize_leaf(void) {
|
|||
assert(size == 100);
|
||||
}
|
||||
FTNODE_DISK_DATA ndd = NULL;
|
||||
r = toku_serialize_ftnode_to(fd, make_blocknum(20), &sn, &ndd, TRUE, brt->h, 1, 1, FALSE);
|
||||
r = toku_serialize_ftnode_to(fd, make_blocknum(20), &sn, &ndd, TRUE, brt->ft, 1, 1, FALSE);
|
||||
assert(r==0);
|
||||
|
||||
test1(fd, brt_h, &dn);
|
||||
|
|
|
@ -104,7 +104,7 @@ test_serialize_leaf(int valsize, int nelts, double entropy) {
|
|||
|
||||
FT_HANDLE XMALLOC(brt);
|
||||
FT XCALLOC(brt_h);
|
||||
brt->h = brt_h;
|
||||
brt->ft = brt_h;
|
||||
brt_h->type = FT_CURRENT;
|
||||
brt_h->panic = 0; brt_h->panic_string = 0;
|
||||
brt_h->basementnodesize = 128*1024;
|
||||
|
@ -133,7 +133,7 @@ test_serialize_leaf(int valsize, int nelts, double entropy) {
|
|||
struct timeval t[2];
|
||||
gettimeofday(&t[0], NULL);
|
||||
FTNODE_DISK_DATA ndd = NULL;
|
||||
r = toku_serialize_ftnode_to(fd, make_blocknum(20), &sn, &ndd, TRUE, brt->h, 1, 1, FALSE);
|
||||
r = toku_serialize_ftnode_to(fd, make_blocknum(20), &sn, &ndd, TRUE, brt->ft, 1, 1, FALSE);
|
||||
assert(r==0);
|
||||
gettimeofday(&t[1], NULL);
|
||||
double dt;
|
||||
|
@ -237,7 +237,7 @@ test_serialize_nonleaf(int valsize, int nelts, double entropy) {
|
|||
|
||||
FT_HANDLE XMALLOC(brt);
|
||||
FT XCALLOC(brt_h);
|
||||
brt->h = brt_h;
|
||||
brt->ft = brt_h;
|
||||
brt_h->type = FT_CURRENT;
|
||||
brt_h->panic = 0; brt_h->panic_string = 0;
|
||||
brt_h->basementnodesize = 128*1024;
|
||||
|
@ -266,7 +266,7 @@ test_serialize_nonleaf(int valsize, int nelts, double entropy) {
|
|||
struct timeval t[2];
|
||||
gettimeofday(&t[0], NULL);
|
||||
FTNODE_DISK_DATA ndd = NULL;
|
||||
r = toku_serialize_ftnode_to(fd, make_blocknum(20), &sn, &ndd, TRUE, brt->h, 1, 1, FALSE);
|
||||
r = toku_serialize_ftnode_to(fd, make_blocknum(20), &sn, &ndd, TRUE, brt->ft, 1, 1, FALSE);
|
||||
assert(r==0);
|
||||
gettimeofday(&t[1], NULL);
|
||||
double dt;
|
||||
|
|
|
@ -186,14 +186,14 @@ static void write_sn_to_disk(int fd, FT_HANDLE brt, FTNODE sn, FTNODE_DISK_DATA*
|
|||
if (do_clone) {
|
||||
void* cloned_node_v = NULL;
|
||||
PAIR_ATTR attr;
|
||||
toku_ftnode_clone_callback(sn, &cloned_node_v, &attr, FALSE, brt->h);
|
||||
toku_ftnode_clone_callback(sn, &cloned_node_v, &attr, FALSE, brt->ft);
|
||||
FTNODE cloned_node = cloned_node_v;
|
||||
r = toku_serialize_ftnode_to(fd, make_blocknum(20), cloned_node, src_ndd, FALSE, brt->h, 1, 1, FALSE);
|
||||
r = toku_serialize_ftnode_to(fd, make_blocknum(20), cloned_node, src_ndd, FALSE, brt->ft, 1, 1, FALSE);
|
||||
assert(r==0);
|
||||
toku_ftnode_free(&cloned_node);
|
||||
}
|
||||
else {
|
||||
r = toku_serialize_ftnode_to(fd, make_blocknum(20), sn, src_ndd, TRUE, brt->h, 1, 1, FALSE);
|
||||
r = toku_serialize_ftnode_to(fd, make_blocknum(20), sn, src_ndd, TRUE, brt->ft, 1, 1, FALSE);
|
||||
assert(r==0);
|
||||
}
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ test_serialize_leaf_check_msn(enum ftnode_verify_type bft, BOOL do_clone) {
|
|||
|
||||
FT_HANDLE XMALLOC(brt);
|
||||
FT XCALLOC(brt_h);
|
||||
brt->h = brt_h;
|
||||
brt->ft = brt_h;
|
||||
brt_h->type = FT_CURRENT;
|
||||
brt_h->panic = 0; brt_h->panic_string = 0;
|
||||
brt_h->basementnodesize = 128*1024;
|
||||
|
@ -392,7 +392,7 @@ test_serialize_leaf_with_large_pivots(enum ftnode_verify_type bft, BOOL do_clone
|
|||
|
||||
FT_HANDLE XMALLOC(brt);
|
||||
FT XCALLOC(brt_h);
|
||||
brt->h = brt_h;
|
||||
brt->ft = brt_h;
|
||||
brt_h->type = FT_CURRENT;
|
||||
brt_h->panic = 0; brt_h->panic_string = 0;
|
||||
brt_h->basementnodesize = 128*1024;
|
||||
|
@ -531,7 +531,7 @@ test_serialize_leaf_with_many_rows(enum ftnode_verify_type bft, BOOL do_clone) {
|
|||
|
||||
FT_HANDLE XMALLOC(brt);
|
||||
FT XCALLOC(brt_h);
|
||||
brt->h = brt_h;
|
||||
brt->ft = brt_h;
|
||||
brt_h->type = FT_CURRENT;
|
||||
brt_h->panic = 0; brt_h->panic_string = 0;
|
||||
brt_h->basementnodesize = 128*1024;
|
||||
|
@ -675,7 +675,7 @@ test_serialize_leaf_with_large_rows(enum ftnode_verify_type bft, BOOL do_clone)
|
|||
|
||||
FT_HANDLE XMALLOC(brt);
|
||||
FT XCALLOC(brt_h);
|
||||
brt->h = brt_h;
|
||||
brt->ft = brt_h;
|
||||
brt_h->type = FT_CURRENT;
|
||||
brt_h->panic = 0; brt_h->panic_string = 0;
|
||||
brt_h->basementnodesize = 128*1024;
|
||||
|
@ -835,7 +835,7 @@ test_serialize_leaf_with_empty_basement_nodes(enum ftnode_verify_type bft, BOOL
|
|||
|
||||
FT_HANDLE XMALLOC(brt);
|
||||
FT XCALLOC(brt_h);
|
||||
brt->h = brt_h;
|
||||
brt->ft = brt_h;
|
||||
brt_h->type = FT_CURRENT;
|
||||
brt_h->panic = 0; brt_h->panic_string = 0;
|
||||
brt_h->basementnodesize = 128*1024;
|
||||
|
@ -959,7 +959,7 @@ test_serialize_leaf_with_multiple_empty_basement_nodes(enum ftnode_verify_type b
|
|||
|
||||
FT_HANDLE XMALLOC(brt);
|
||||
FT XCALLOC(brt_h);
|
||||
brt->h = brt_h;
|
||||
brt->ft = brt_h;
|
||||
brt_h->type = FT_CURRENT;
|
||||
brt_h->panic = 0; brt_h->panic_string = 0;
|
||||
brt_h->basementnodesize = 128*1024;
|
||||
|
@ -1088,7 +1088,7 @@ test_serialize_leaf(enum ftnode_verify_type bft, BOOL do_clone) {
|
|||
|
||||
FT_HANDLE XMALLOC(brt);
|
||||
FT XCALLOC(brt_h);
|
||||
brt->h = brt_h;
|
||||
brt->ft = brt_h;
|
||||
brt_h->type = FT_CURRENT;
|
||||
brt_h->panic = 0; brt_h->panic_string = 0;
|
||||
brt_h->basementnodesize = 128*1024;
|
||||
|
@ -1230,7 +1230,7 @@ test_serialize_nonleaf(enum ftnode_verify_type bft, BOOL do_clone) {
|
|||
|
||||
FT_HANDLE XMALLOC(brt);
|
||||
FT XCALLOC(brt_h);
|
||||
brt->h = brt_h;
|
||||
brt->ft = brt_h;
|
||||
brt_h->type = FT_CURRENT;
|
||||
brt_h->panic = 0; brt_h->panic_string = 0;
|
||||
brt_h->basementnodesize = 128*1024;
|
||||
|
|
|
@ -25,7 +25,7 @@ static void test_header (void) {
|
|||
r = toku_open_ft_handle(fname, 1, &t, 1024, 256, TOKU_DEFAULT_COMPRESSION_METHOD, ct, null_txn, toku_builtin_compare_fun);
|
||||
assert(r==0);
|
||||
// now insert some info into the header
|
||||
FT h = t->h;
|
||||
FT h = t->ft;
|
||||
h->dirty = 1;
|
||||
h->layout_version_original = 13;
|
||||
h->layout_version_read_from_disk = 14;
|
||||
|
@ -43,7 +43,7 @@ static void test_header (void) {
|
|||
r = toku_open_ft_handle(fname, 0, &t, 1024, 256, TOKU_DEFAULT_COMPRESSION_METHOD, ct, null_txn, toku_builtin_compare_fun);
|
||||
assert(r==0);
|
||||
|
||||
h = t->h;
|
||||
h = t->ft;
|
||||
STAT64INFO_S expected_stats = {20, 21}; // on checkpoint, on_disk_stats copied to checkpoint_staging_stats
|
||||
assert(h->layout_version == FT_LAYOUT_VERSION);
|
||||
assert(h->layout_version_original == 13);
|
||||
|
|
|
@ -66,7 +66,7 @@ insert_into_child_buffer(FT_HANDLE brt, FTNODE node, int childnum, int minkey, i
|
|||
unsigned int key = htonl(val);
|
||||
DBT thekey; toku_fill_dbt(&thekey, &key, sizeof key);
|
||||
DBT theval; toku_fill_dbt(&theval, &val, sizeof val);
|
||||
toku_ft_append_to_child_buffer(brt->h->compare_fun, NULL, node, childnum, FT_INSERT, msn, xids_get_root_xids(), true, &thekey, &theval);
|
||||
toku_ft_append_to_child_buffer(brt->ft->compare_fun, NULL, node, childnum, FT_INSERT, msn, xids_get_root_xids(), true, &thekey, &theval);
|
||||
node->max_msn_applied_to_node_on_disk = msn;
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ make_tree(FT_HANDLE brt, int height, int fanout, int nperleaf, int *seq, int *mi
|
|||
DBT pivotkey;
|
||||
toku_ft_nonleaf_append_child(node, child, toku_fill_dbt(&pivotkey, toku_xmemdup(&k, sizeof k), sizeof k));
|
||||
}
|
||||
toku_unpin_ftnode(brt->h, child);
|
||||
toku_unpin_ftnode(brt->ft, child);
|
||||
insert_into_child_buffer(brt, node, childnum, minkeys[childnum], maxkeys[childnum]);
|
||||
}
|
||||
*minkey = minkeys[0];
|
||||
|
@ -134,12 +134,12 @@ test_make_tree(int height, int fanout, int nperleaf, int do_verify) {
|
|||
FTNODE newroot = make_tree(brt, height, fanout, nperleaf, &seq, &minkey, &maxkey);
|
||||
|
||||
// set the new root to point to the new tree
|
||||
toku_ft_set_new_root_blocknum(brt->h, newroot->thisnodename);
|
||||
toku_ft_set_new_root_blocknum(brt->ft, newroot->thisnodename);
|
||||
|
||||
newroot->max_msn_applied_to_node_on_disk = last_dummymsn(); // capture msn of last message injected into tree
|
||||
|
||||
// unpin the new root
|
||||
toku_unpin_ftnode(brt->h, newroot);
|
||||
toku_unpin_ftnode(brt->ft, newroot);
|
||||
|
||||
if (do_verify) {
|
||||
r = toku_verify_ft(brt);
|
||||
|
|
|
@ -48,7 +48,7 @@ append_leaf(FT_HANDLE brt, FTNODE leafnode, void *key, size_t keylen, void *val,
|
|||
FT_MSG_S cmd = { FT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &theval } };
|
||||
|
||||
u_int64_t workdone=0;
|
||||
toku_ft_leaf_apply_cmd(brt->h->compare_fun, brt->h->update_fun, &brt->h->cmp_descriptor, leafnode, &cmd, &workdone, NULL);
|
||||
toku_ft_leaf_apply_cmd(brt->ft->compare_fun, brt->ft->update_fun, &brt->ft->cmp_descriptor, leafnode, &cmd, &workdone, NULL);
|
||||
{
|
||||
int r = toku_ft_lookup(brt, &thekey, lookup_checkf, &pair);
|
||||
assert(r==0);
|
||||
|
@ -56,7 +56,7 @@ append_leaf(FT_HANDLE brt, FTNODE leafnode, void *key, size_t keylen, void *val,
|
|||
}
|
||||
|
||||
FT_MSG_S badcmd = { FT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &badval } };
|
||||
toku_ft_leaf_apply_cmd(brt->h->compare_fun, brt->h->update_fun, &brt->h->cmp_descriptor, leafnode, &badcmd, &workdone, NULL);
|
||||
toku_ft_leaf_apply_cmd(brt->ft->compare_fun, brt->ft->update_fun, &brt->ft->cmp_descriptor, leafnode, &badcmd, &workdone, NULL);
|
||||
|
||||
|
||||
// message should be rejected for duplicate msn, row should still have original val
|
||||
|
@ -69,7 +69,7 @@ append_leaf(FT_HANDLE brt, FTNODE leafnode, void *key, size_t keylen, void *val,
|
|||
// now verify that message with proper msn gets through
|
||||
msn = next_dummymsn();
|
||||
FT_MSG_S cmd2 = { FT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &val2 } };
|
||||
toku_ft_leaf_apply_cmd(brt->h->compare_fun, brt->h->update_fun, &brt->h->cmp_descriptor, leafnode, &cmd2, &workdone, NULL);
|
||||
toku_ft_leaf_apply_cmd(brt->ft->compare_fun, brt->ft->update_fun, &brt->ft->cmp_descriptor, leafnode, &cmd2, &workdone, NULL);
|
||||
|
||||
// message should be accepted, val should have new value
|
||||
{
|
||||
|
@ -81,7 +81,7 @@ append_leaf(FT_HANDLE brt, FTNODE leafnode, void *key, size_t keylen, void *val,
|
|||
// now verify that message with lesser (older) msn is rejected
|
||||
msn.msn = msn.msn - 10;
|
||||
FT_MSG_S cmd3 = { FT_INSERT, msn, xids_get_root_xids(), .u.id = { &thekey, &badval } };
|
||||
toku_ft_leaf_apply_cmd(brt->h->compare_fun, brt->h->update_fun, &brt->h->cmp_descriptor, leafnode, &cmd3, &workdone, NULL);
|
||||
toku_ft_leaf_apply_cmd(brt->ft->compare_fun, brt->ft->update_fun, &brt->ft->cmp_descriptor, leafnode, &cmd3, &workdone, NULL);
|
||||
|
||||
// message should be rejected, val should still have value in pair2
|
||||
{
|
||||
|
@ -125,7 +125,7 @@ test_msnfilter(int do_verify) {
|
|||
FTNODE newroot = make_node(brt, 0);
|
||||
|
||||
// set the new root to point to the new tree
|
||||
toku_ft_set_new_root_blocknum(brt->h, newroot->thisnodename);
|
||||
toku_ft_set_new_root_blocknum(brt->ft, newroot->thisnodename);
|
||||
|
||||
// KLUDGE: Unpin the new root so toku_ft_lookup() can pin it. (Pin lock is no longer a recursive
|
||||
// mutex.) Just leaving it unpinned for this test program works because it is the only
|
||||
|
@ -133,7 +133,7 @@ test_msnfilter(int do_verify) {
|
|||
// node and unlock it again before and after each message injection, but that requires more
|
||||
// work than it's worth (setting up dummy callbacks, etc.)
|
||||
//
|
||||
toku_unpin_ftnode(brt->h, newroot);
|
||||
toku_unpin_ftnode(brt->ft, newroot);
|
||||
|
||||
populate_leaf(brt, newroot, htonl(2), 1);
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ insert_random_message_to_bn(FT_HANDLE t, BASEMENTNODE blb, LEAFENTRY *save, XIDS
|
|||
int64_t numbytes;
|
||||
int r = apply_msg_to_leafentry(&msg, NULL, &memsize, save, NULL, NULL, NULL, &numbytes);
|
||||
assert_zero(r);
|
||||
toku_ft_bn_apply_cmd(t->h->compare_fun, t->h->update_fun, NULL, blb, &msg, NULL, NULL);
|
||||
toku_ft_bn_apply_cmd(t->ft->compare_fun, t->ft->update_fun, NULL, blb, &msg, NULL, NULL);
|
||||
if (msn.msn > blb->max_msn_applied.msn) {
|
||||
blb->max_msn_applied = msn;
|
||||
}
|
||||
|
@ -167,11 +167,11 @@ insert_same_message_to_bns(FT_HANDLE t, BASEMENTNODE blb1, BASEMENTNODE blb2, LE
|
|||
int64_t numbytes;
|
||||
int r = apply_msg_to_leafentry(&msg, NULL, &memsize, save, NULL, NULL, NULL, &numbytes);
|
||||
assert_zero(r);
|
||||
toku_ft_bn_apply_cmd(t->h->compare_fun, t->h->update_fun, NULL, blb1, &msg, NULL, NULL);
|
||||
toku_ft_bn_apply_cmd(t->ft->compare_fun, t->ft->update_fun, NULL, blb1, &msg, NULL, NULL);
|
||||
if (msn.msn > blb1->max_msn_applied.msn) {
|
||||
blb1->max_msn_applied = msn;
|
||||
}
|
||||
toku_ft_bn_apply_cmd(t->h->compare_fun, t->h->update_fun, NULL, blb2, &msg, NULL, NULL);
|
||||
toku_ft_bn_apply_cmd(t->ft->compare_fun, t->ft->update_fun, NULL, blb2, &msg, NULL, NULL);
|
||||
if (msn.msn > blb2->max_msn_applied.msn) {
|
||||
blb2->max_msn_applied = msn;
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ flush_to_internal(FT_HANDLE t) {
|
|||
set_BNC(child, 0, child_bnc);
|
||||
BP_STATE(child, 0) = PT_AVAIL;
|
||||
|
||||
toku_bnc_flush_to_child(t->h, parent_bnc, child);
|
||||
toku_bnc_flush_to_child(t->ft, parent_bnc, child);
|
||||
|
||||
int parent_messages_present[num_parent_messages];
|
||||
int child_messages_present[num_child_messages];
|
||||
|
@ -412,7 +412,7 @@ flush_to_internal_multiple(FT_HANDLE t) {
|
|||
}
|
||||
}
|
||||
|
||||
toku_bnc_flush_to_child(t->h, parent_bnc, child);
|
||||
toku_bnc_flush_to_child(t->ft, parent_bnc, child);
|
||||
|
||||
int total_messages = 0;
|
||||
for (i = 0; i < 8; ++i) {
|
||||
|
@ -583,7 +583,7 @@ flush_to_leaf(FT_HANDLE 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_ft_leaf_apply_cmd(t->h->compare_fun, t->h->update_fun, &t->h->descriptor, child, parent_messages[i], NULL, NULL);
|
||||
toku_ft_leaf_apply_cmd(t->ft->compare_fun, t->ft->update_fun, &t->ft->descriptor, child, parent_messages[i], NULL, NULL);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 8; ++i) {
|
||||
|
@ -604,7 +604,7 @@ flush_to_leaf(FT_HANDLE t, bool make_leaf_up_to_date, bool use_flush) {
|
|||
}
|
||||
|
||||
if (use_flush) {
|
||||
toku_bnc_flush_to_child(t->h, parent_bnc, child);
|
||||
toku_bnc_flush_to_child(t->ft, parent_bnc, child);
|
||||
destroy_nonleaf_childinfo(parent_bnc);
|
||||
} else {
|
||||
FTNODE XMALLOC(parentnode);
|
||||
|
@ -807,7 +807,7 @@ flush_to_leaf_with_keyrange(FT_HANDLE 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_ft_leaf_apply_cmd(t->h->compare_fun, t->h->update_fun, &t->h->descriptor, child, parent_messages[i], NULL, NULL);
|
||||
toku_ft_leaf_apply_cmd(t->ft->compare_fun, t->ft->update_fun, &t->ft->descriptor, child, parent_messages[i], NULL, NULL);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 8; ++i) {
|
||||
|
@ -1000,8 +1000,8 @@ compare_apply_and_flush(FT_HANDLE 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_ft_leaf_apply_cmd(t->h->compare_fun, t->h->update_fun, &t->h->descriptor, child1, parent_messages[i], NULL, NULL);
|
||||
toku_ft_leaf_apply_cmd(t->h->compare_fun, t->h->update_fun, &t->h->descriptor, child2, parent_messages[i], NULL, NULL);
|
||||
toku_ft_leaf_apply_cmd(t->ft->compare_fun, t->ft->update_fun, &t->ft->descriptor, child1, parent_messages[i], NULL, NULL);
|
||||
toku_ft_leaf_apply_cmd(t->ft->compare_fun, t->ft->update_fun, &t->ft->descriptor, child2, parent_messages[i], NULL, NULL);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 8; ++i) {
|
||||
|
@ -1015,7 +1015,7 @@ compare_apply_and_flush(FT_HANDLE t, bool make_leaf_up_to_date) {
|
|||
}
|
||||
}
|
||||
|
||||
toku_bnc_flush_to_child(t->h, parent_bnc, child1);
|
||||
toku_bnc_flush_to_child(t->ft, parent_bnc, child1);
|
||||
|
||||
FTNODE XMALLOC(parentnode);
|
||||
BLOCKNUM parentblocknum = { 17 };
|
||||
|
@ -1130,7 +1130,7 @@ test_main (int argc, const char *argv[]) {
|
|||
r = toku_open_ft_handle(fname, 1, &t, 128*1024, 4096, TOKU_DEFAULT_COMPRESSION_METHOD, ct, null_txn, toku_builtin_compare_fun); assert(r==0);
|
||||
r = toku_ft_set_update(t, orthopush_flush_update_fun); assert(r==0);
|
||||
// HACK
|
||||
t->h->update_fun = orthopush_flush_update_fun;
|
||||
t->ft->update_fun = orthopush_flush_update_fun;
|
||||
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
flush_to_internal(t);
|
||||
|
|
|
@ -141,11 +141,11 @@ doit (BOOL after_child_pin) {
|
|||
|
||||
FTNODE node = NULL;
|
||||
struct ftnode_fetch_extra bfe;
|
||||
fill_bfe_for_min_read(&bfe, t->h);
|
||||
fill_bfe_for_min_read(&bfe, t->ft);
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
t->h,
|
||||
t->ft,
|
||||
node_root,
|
||||
toku_cachetable_hash(t->h->cf, node_root),
|
||||
toku_cachetable_hash(t->ft->cf, node_root),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -157,14 +157,14 @@ doit (BOOL after_child_pin) {
|
|||
assert(toku_bnc_nbytesinbuf(BNC(node, 0)) > 0);
|
||||
|
||||
// do the flush
|
||||
flush_some_child(t->h, node, &fa);
|
||||
flush_some_child(t->ft, node, &fa);
|
||||
assert(checkpoint_callback_called);
|
||||
|
||||
// now let's pin the root again and make sure it is flushed
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
t->h,
|
||||
t->ft,
|
||||
node_root,
|
||||
toku_cachetable_hash(t->h->cf, node_root),
|
||||
toku_cachetable_hash(t->ft->cf, node_root),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -174,7 +174,7 @@ doit (BOOL after_child_pin) {
|
|||
assert(node->height == 1);
|
||||
assert(node->n_children == 1);
|
||||
assert(toku_bnc_nbytesinbuf(BNC(node, 0)) == 0);
|
||||
toku_unpin_ftnode(t->h, node);
|
||||
toku_unpin_ftnode(t->ft, node);
|
||||
|
||||
void *ret;
|
||||
r = toku_pthread_join(checkpoint_tid, &ret);
|
||||
|
@ -197,11 +197,11 @@ doit (BOOL after_child_pin) {
|
|||
//
|
||||
// now pin the root, verify that we have a message in there, and that it is clean
|
||||
//
|
||||
fill_bfe_for_full_read(&bfe, c_ft->h);
|
||||
fill_bfe_for_full_read(&bfe, c_ft->ft);
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
c_ft->h,
|
||||
c_ft->ft,
|
||||
node_root,
|
||||
toku_cachetable_hash(c_ft->h->cf, node_root),
|
||||
toku_cachetable_hash(c_ft->ft->cf, node_root),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -217,12 +217,12 @@ doit (BOOL after_child_pin) {
|
|||
else {
|
||||
assert(toku_bnc_nbytesinbuf(BNC(node, 0)) > 0);
|
||||
}
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->h, node);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
|
||||
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
c_ft->h,
|
||||
c_ft->ft,
|
||||
node_leaf,
|
||||
toku_cachetable_hash(c_ft->h->cf, node_root),
|
||||
toku_cachetable_hash(c_ft->ft->cf, node_root),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -238,7 +238,7 @@ doit (BOOL after_child_pin) {
|
|||
else {
|
||||
assert(BLB_NBYTESINBUF(node,0) == 0);
|
||||
}
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->h, node);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
|
||||
|
||||
struct check_pair pair1 = {2, "a", 0, NULL, 0};
|
||||
DBT k;
|
||||
|
|
|
@ -152,18 +152,18 @@ doit (int state) {
|
|||
FTNODE node = NULL;
|
||||
toku_pin_node_with_min_bfe(&node, node_leaves[0], t);
|
||||
BLB_SEQINSERT(node, node->n_children-1) = FALSE;
|
||||
toku_unpin_ftnode(t->h, node);
|
||||
toku_unpin_ftnode(t->ft, node);
|
||||
toku_pin_node_with_min_bfe(&node, node_leaves[1], t);
|
||||
BLB_SEQINSERT(node, node->n_children-1) = FALSE;
|
||||
toku_unpin_ftnode(t->h, node);
|
||||
toku_unpin_ftnode(t->ft, node);
|
||||
|
||||
|
||||
struct ftnode_fetch_extra bfe;
|
||||
fill_bfe_for_min_read(&bfe, t->h);
|
||||
fill_bfe_for_min_read(&bfe, t->ft);
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
t->h,
|
||||
t->ft,
|
||||
node_root,
|
||||
toku_cachetable_hash(t->h->cf, node_root),
|
||||
toku_cachetable_hash(t->ft->cf, node_root),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -174,14 +174,14 @@ doit (int state) {
|
|||
assert(node->n_children == 2);
|
||||
|
||||
// do the flush
|
||||
flush_some_child(t->h, node, &fa);
|
||||
flush_some_child(t->ft, node, &fa);
|
||||
assert(checkpoint_callback_called);
|
||||
|
||||
// now let's pin the root again and make sure it is has merged
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
t->h,
|
||||
t->ft,
|
||||
node_root,
|
||||
toku_cachetable_hash(t->h->cf, node_root),
|
||||
toku_cachetable_hash(t->ft->cf, node_root),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -190,7 +190,7 @@ doit (int state) {
|
|||
);
|
||||
assert(node->height == 1);
|
||||
assert(node->n_children == 1);
|
||||
toku_unpin_ftnode(t->h, node);
|
||||
toku_unpin_ftnode(t->ft, node);
|
||||
|
||||
void *ret;
|
||||
r = toku_pthread_join(checkpoint_tid, &ret);
|
||||
|
@ -216,11 +216,11 @@ doit (int state) {
|
|||
//
|
||||
// now pin the root, verify that the state is what we expect
|
||||
//
|
||||
fill_bfe_for_full_read(&bfe, c_ft->h);
|
||||
fill_bfe_for_full_read(&bfe, c_ft->ft);
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
c_ft->h,
|
||||
c_ft->ft,
|
||||
node_root,
|
||||
toku_cachetable_hash(c_ft->h->cf, node_root),
|
||||
toku_cachetable_hash(c_ft->ft->cf, node_root),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -243,14 +243,14 @@ doit (int state) {
|
|||
else {
|
||||
assert(false);
|
||||
}
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->h, node);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
|
||||
|
||||
// now let's verify the leaves are what we expect
|
||||
if (state == flt_flush_before_merge || state == flt_flush_before_pin_second_node_for_merge) {
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
c_ft->h,
|
||||
c_ft->ft,
|
||||
left_child,
|
||||
toku_cachetable_hash(c_ft->h->cf, left_child),
|
||||
toku_cachetable_hash(c_ft->ft->cf, left_child),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -261,12 +261,12 @@ doit (int state) {
|
|||
assert(!node->dirty);
|
||||
assert(node->n_children == 1);
|
||||
assert(toku_omt_size(BLB_BUFFER(node,0)) == 1);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->h, node);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
|
||||
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
c_ft->h,
|
||||
c_ft->ft,
|
||||
right_child,
|
||||
toku_cachetable_hash(c_ft->h->cf, right_child),
|
||||
toku_cachetable_hash(c_ft->ft->cf, right_child),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -277,13 +277,13 @@ doit (int state) {
|
|||
assert(!node->dirty);
|
||||
assert(node->n_children == 1);
|
||||
assert(toku_omt_size(BLB_BUFFER(node,0)) == 1);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->h, node);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
|
||||
}
|
||||
else if (state == ft_flush_aflter_merge || state == flt_flush_before_unpin_remove) {
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
c_ft->h,
|
||||
c_ft->ft,
|
||||
left_child,
|
||||
toku_cachetable_hash(c_ft->h->cf, left_child),
|
||||
toku_cachetable_hash(c_ft->ft->cf, left_child),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -294,7 +294,7 @@ doit (int state) {
|
|||
assert(!node->dirty);
|
||||
assert(node->n_children == 1);
|
||||
assert(toku_omt_size(BLB_BUFFER(node,0)) == 2);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->h, node);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
|
||||
}
|
||||
else {
|
||||
assert(FALSE);
|
||||
|
|
|
@ -172,18 +172,18 @@ doit (int state) {
|
|||
FTNODE node = NULL;
|
||||
toku_pin_node_with_min_bfe(&node, node_leaves[0], t);
|
||||
BLB_SEQINSERT(node, node->n_children-1) = FALSE;
|
||||
toku_unpin_ftnode(t->h, node);
|
||||
toku_unpin_ftnode(t->ft, node);
|
||||
toku_pin_node_with_min_bfe(&node, node_leaves[1], t);
|
||||
BLB_SEQINSERT(node, node->n_children-1) = FALSE;
|
||||
toku_unpin_ftnode(t->h, node);
|
||||
toku_unpin_ftnode(t->ft, node);
|
||||
|
||||
|
||||
struct ftnode_fetch_extra bfe;
|
||||
fill_bfe_for_min_read(&bfe, t->h);
|
||||
fill_bfe_for_min_read(&bfe, t->ft);
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
t->h,
|
||||
t->ft,
|
||||
node_root,
|
||||
toku_cachetable_hash(t->h->cf, node_root),
|
||||
toku_cachetable_hash(t->ft->cf, node_root),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -194,14 +194,14 @@ doit (int state) {
|
|||
assert(node->n_children == 2);
|
||||
|
||||
// do the flush
|
||||
flush_some_child(t->h, node, &fa);
|
||||
flush_some_child(t->ft, node, &fa);
|
||||
assert(checkpoint_callback_called);
|
||||
|
||||
// now let's pin the root again and make sure it is has rebalanced
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
t->h,
|
||||
t->ft,
|
||||
node_root,
|
||||
toku_cachetable_hash(t->h->cf, node_root),
|
||||
toku_cachetable_hash(t->ft->cf, node_root),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -210,7 +210,7 @@ doit (int state) {
|
|||
);
|
||||
assert(node->height == 1);
|
||||
assert(node->n_children == 2);
|
||||
toku_unpin_ftnode(t->h, node);
|
||||
toku_unpin_ftnode(t->ft, node);
|
||||
|
||||
void *ret;
|
||||
r = toku_pthread_join(checkpoint_tid, &ret);
|
||||
|
@ -236,11 +236,11 @@ doit (int state) {
|
|||
//
|
||||
// now pin the root, verify that the state is what we expect
|
||||
//
|
||||
fill_bfe_for_full_read(&bfe, c_ft->h);
|
||||
fill_bfe_for_full_read(&bfe, c_ft->ft);
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
c_ft->h,
|
||||
c_ft->ft,
|
||||
node_root,
|
||||
toku_cachetable_hash(c_ft->h->cf, node_root),
|
||||
toku_cachetable_hash(c_ft->ft->cf, node_root),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -255,13 +255,13 @@ doit (int state) {
|
|||
left_child = BP_BLOCKNUM(node,0);
|
||||
right_child = BP_BLOCKNUM(node,1);
|
||||
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->h, node);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
|
||||
|
||||
// now let's verify the leaves are what we expect
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
c_ft->h,
|
||||
c_ft->ft,
|
||||
left_child,
|
||||
toku_cachetable_hash(c_ft->h->cf, left_child),
|
||||
toku_cachetable_hash(c_ft->ft->cf, left_child),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -272,12 +272,12 @@ doit (int state) {
|
|||
assert(!node->dirty);
|
||||
assert(node->n_children == 1);
|
||||
assert(toku_omt_size(BLB_BUFFER(node,0)) == 2);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->h, node);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
|
||||
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
c_ft->h,
|
||||
c_ft->ft,
|
||||
right_child,
|
||||
toku_cachetable_hash(c_ft->h->cf, right_child),
|
||||
toku_cachetable_hash(c_ft->ft->cf, right_child),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -288,7 +288,7 @@ doit (int state) {
|
|||
assert(!node->dirty);
|
||||
assert(node->n_children == 1);
|
||||
assert(toku_omt_size(BLB_BUFFER(node,0)) == 2);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->h, node);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
|
||||
|
||||
|
||||
DBT k;
|
||||
|
|
|
@ -155,11 +155,11 @@ doit (BOOL after_split) {
|
|||
|
||||
FTNODE node = NULL;
|
||||
struct ftnode_fetch_extra bfe;
|
||||
fill_bfe_for_min_read(&bfe, t->h);
|
||||
fill_bfe_for_min_read(&bfe, t->ft);
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
t->h,
|
||||
t->ft,
|
||||
node_root,
|
||||
toku_cachetable_hash(t->h->cf, node_root),
|
||||
toku_cachetable_hash(t->ft->cf, node_root),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -170,14 +170,14 @@ doit (BOOL after_split) {
|
|||
assert(node->n_children == 1);
|
||||
|
||||
// do the flush
|
||||
flush_some_child(t->h, node, &fa);
|
||||
flush_some_child(t->ft, node, &fa);
|
||||
assert(checkpoint_callback_called);
|
||||
|
||||
// now let's pin the root again and make sure it is has split
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
t->h,
|
||||
t->ft,
|
||||
node_root,
|
||||
toku_cachetable_hash(t->h->cf, node_root),
|
||||
toku_cachetable_hash(t->ft->cf, node_root),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -186,7 +186,7 @@ doit (BOOL after_split) {
|
|||
);
|
||||
assert(node->height == 1);
|
||||
assert(node->n_children == 2);
|
||||
toku_unpin_ftnode(t->h, node);
|
||||
toku_unpin_ftnode(t->ft, node);
|
||||
|
||||
void *ret;
|
||||
r = toku_pthread_join(checkpoint_tid, &ret);
|
||||
|
@ -212,11 +212,11 @@ doit (BOOL after_split) {
|
|||
//
|
||||
// now pin the root, verify that we have a message in there, and that it is clean
|
||||
//
|
||||
fill_bfe_for_full_read(&bfe, c_ft->h);
|
||||
fill_bfe_for_full_read(&bfe, c_ft->ft);
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
c_ft->h,
|
||||
c_ft->ft,
|
||||
node_root,
|
||||
toku_cachetable_hash(c_ft->h->cf, node_root),
|
||||
toku_cachetable_hash(c_ft->ft->cf, node_root),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -237,14 +237,14 @@ doit (BOOL after_split) {
|
|||
left_child = BP_BLOCKNUM(node,0);
|
||||
assert(left_child.b == node_leaf.b);
|
||||
}
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->h, node);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
|
||||
|
||||
// now let's verify the leaves are what we expect
|
||||
if (after_split) {
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
c_ft->h,
|
||||
c_ft->ft,
|
||||
left_child,
|
||||
toku_cachetable_hash(c_ft->h->cf, left_child),
|
||||
toku_cachetable_hash(c_ft->ft->cf, left_child),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -255,12 +255,12 @@ doit (BOOL after_split) {
|
|||
assert(!node->dirty);
|
||||
assert(node->n_children == 1);
|
||||
assert(toku_omt_size(BLB_BUFFER(node,0)) == 1);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->h, node);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
|
||||
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
c_ft->h,
|
||||
c_ft->ft,
|
||||
right_child,
|
||||
toku_cachetable_hash(c_ft->h->cf, right_child),
|
||||
toku_cachetable_hash(c_ft->ft->cf, right_child),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -271,13 +271,13 @@ doit (BOOL after_split) {
|
|||
assert(!node->dirty);
|
||||
assert(node->n_children == 1);
|
||||
assert(toku_omt_size(BLB_BUFFER(node,0)) == 1);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->h, node);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
|
||||
}
|
||||
else {
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
c_ft->h,
|
||||
c_ft->ft,
|
||||
left_child,
|
||||
toku_cachetable_hash(c_ft->h->cf, left_child),
|
||||
toku_cachetable_hash(c_ft->ft->cf, left_child),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -288,7 +288,7 @@ doit (BOOL after_split) {
|
|||
assert(!node->dirty);
|
||||
assert(node->n_children == 1);
|
||||
assert(toku_omt_size(BLB_BUFFER(node,0)) == 2);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->h, node);
|
||||
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -59,8 +59,8 @@ doit (void) {
|
|||
assert(r==0);
|
||||
toku_free(fname);
|
||||
|
||||
brt->h->update_fun = update_func;
|
||||
brt->h->update_fun = update_func;
|
||||
brt->ft->update_fun = update_func;
|
||||
brt->ft->update_fun = update_func;
|
||||
|
||||
toku_testsetup_initialize(); // must precede any other toku_testsetup calls
|
||||
|
||||
|
@ -161,11 +161,11 @@ doit (void) {
|
|||
// now lock and release the leaf node to make sure it is what we expect it to be.
|
||||
FTNODE node = NULL;
|
||||
struct ftnode_fetch_extra bfe;
|
||||
fill_bfe_for_min_read(&bfe, brt->h);
|
||||
fill_bfe_for_min_read(&bfe, brt->ft);
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
brt->h,
|
||||
brt->ft,
|
||||
node_leaf,
|
||||
toku_cachetable_hash(brt->h->cf, node_leaf),
|
||||
toku_cachetable_hash(brt->ft->cf, node_leaf),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -176,7 +176,7 @@ doit (void) {
|
|||
assert(node->n_children == 2);
|
||||
assert(BP_STATE(node,0) == PT_AVAIL);
|
||||
assert(BP_STATE(node,1) == PT_AVAIL);
|
||||
toku_unpin_ftnode_off_client_thread(brt->h, node);
|
||||
toku_unpin_ftnode_off_client_thread(brt->ft, node);
|
||||
|
||||
// now do a lookup on one of the keys, this should bring a leaf node up to date
|
||||
DBT k;
|
||||
|
@ -190,11 +190,11 @@ doit (void) {
|
|||
// node is in memory and another is
|
||||
// on disk
|
||||
//
|
||||
fill_bfe_for_min_read(&bfe, brt->h);
|
||||
fill_bfe_for_min_read(&bfe, brt->ft);
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
brt->h,
|
||||
brt->ft,
|
||||
node_leaf,
|
||||
toku_cachetable_hash(brt->h->cf, node_leaf),
|
||||
toku_cachetable_hash(brt->ft->cf, node_leaf),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -205,16 +205,16 @@ doit (void) {
|
|||
assert(node->n_children == 2);
|
||||
assert(BP_STATE(node,0) == PT_AVAIL);
|
||||
assert(BP_STATE(node,1) == PT_AVAIL);
|
||||
toku_unpin_ftnode_off_client_thread(brt->h, node);
|
||||
toku_unpin_ftnode_off_client_thread(brt->ft, node);
|
||||
|
||||
//
|
||||
// now let us induce a clean on the internal node
|
||||
//
|
||||
fill_bfe_for_min_read(&bfe, brt->h);
|
||||
fill_bfe_for_min_read(&bfe, brt->ft);
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
brt->h,
|
||||
brt->ft,
|
||||
node_internal,
|
||||
toku_cachetable_hash(brt->h->cf, node_internal),
|
||||
toku_cachetable_hash(brt->ft->cf, node_internal),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -229,16 +229,16 @@ doit (void) {
|
|||
r = toku_ftnode_cleaner_callback(
|
||||
node,
|
||||
node_internal,
|
||||
toku_cachetable_hash(brt->h->cf, node_internal),
|
||||
brt->h
|
||||
toku_cachetable_hash(brt->ft->cf, node_internal),
|
||||
brt->ft
|
||||
);
|
||||
|
||||
// verify that node_internal's buffer is empty
|
||||
fill_bfe_for_min_read(&bfe, brt->h);
|
||||
fill_bfe_for_min_read(&bfe, brt->ft);
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
brt->h,
|
||||
brt->ft,
|
||||
node_internal,
|
||||
toku_cachetable_hash(brt->h->cf, node_internal),
|
||||
toku_cachetable_hash(brt->ft->cf, node_internal),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -247,7 +247,7 @@ doit (void) {
|
|||
);
|
||||
// check that buffers are empty
|
||||
assert(toku_bnc_nbytesinbuf(BNC(node, 0)) == 0);
|
||||
toku_unpin_ftnode_off_client_thread(brt->h, node);
|
||||
toku_unpin_ftnode_off_client_thread(brt->ft, node);
|
||||
|
||||
//
|
||||
// now run a checkpoint to get everything clean,
|
||||
|
|
|
@ -60,7 +60,7 @@ doit (BOOL keep_other_bn_in_memory) {
|
|||
toku_free(fname);
|
||||
|
||||
brt->options.update_fun = update_func;
|
||||
brt->h->update_fun = update_func;
|
||||
brt->ft->update_fun = update_func;
|
||||
|
||||
toku_testsetup_initialize(); // must precede any other toku_testsetup calls
|
||||
|
||||
|
@ -166,11 +166,11 @@ doit (BOOL keep_other_bn_in_memory) {
|
|||
// now lock and release the leaf node to make sure it is what we expect it to be.
|
||||
FTNODE node = NULL;
|
||||
struct ftnode_fetch_extra bfe;
|
||||
fill_bfe_for_min_read(&bfe, brt->h);
|
||||
fill_bfe_for_min_read(&bfe, brt->ft);
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
brt->h,
|
||||
brt->ft,
|
||||
node_leaf,
|
||||
toku_cachetable_hash(brt->h->cf, node_leaf),
|
||||
toku_cachetable_hash(brt->ft->cf, node_leaf),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -182,13 +182,13 @@ doit (BOOL keep_other_bn_in_memory) {
|
|||
// a hack to get the basement nodes evicted
|
||||
for (int i = 0; i < 20; i++) {
|
||||
PAIR_ATTR attr;
|
||||
toku_ftnode_pe_callback(node, make_pair_attr(0xffffffff), &attr, brt->h);
|
||||
toku_ftnode_pe_callback(node, make_pair_attr(0xffffffff), &attr, brt->ft);
|
||||
}
|
||||
// this ensures that when we do the lookups below,
|
||||
// that the data is read off disk
|
||||
assert(BP_STATE(node,0) == PT_ON_DISK);
|
||||
assert(BP_STATE(node,1) == PT_ON_DISK);
|
||||
toku_unpin_ftnode_off_client_thread(brt->h, node);
|
||||
toku_unpin_ftnode_off_client_thread(brt->ft, node);
|
||||
|
||||
// now do a lookup on one of the keys, this should bring a leaf node up to date
|
||||
DBT k;
|
||||
|
@ -204,7 +204,7 @@ doit (BOOL keep_other_bn_in_memory) {
|
|||
// but only one should have broadcast message
|
||||
// applied.
|
||||
//
|
||||
fill_bfe_for_full_read(&bfe, brt->h);
|
||||
fill_bfe_for_full_read(&bfe, brt->ft);
|
||||
}
|
||||
else {
|
||||
//
|
||||
|
@ -213,12 +213,12 @@ doit (BOOL keep_other_bn_in_memory) {
|
|||
// node is in memory and another is
|
||||
// on disk
|
||||
//
|
||||
fill_bfe_for_min_read(&bfe, brt->h);
|
||||
fill_bfe_for_min_read(&bfe, brt->ft);
|
||||
}
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
brt->h,
|
||||
brt->ft,
|
||||
node_leaf,
|
||||
toku_cachetable_hash(brt->h->cf, node_leaf),
|
||||
toku_cachetable_hash(brt->ft->cf, node_leaf),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -234,16 +234,16 @@ doit (BOOL keep_other_bn_in_memory) {
|
|||
else {
|
||||
assert(BP_STATE(node,1) == PT_ON_DISK);
|
||||
}
|
||||
toku_unpin_ftnode_off_client_thread(brt->h, node);
|
||||
toku_unpin_ftnode_off_client_thread(brt->ft, node);
|
||||
|
||||
//
|
||||
// now let us induce a clean on the internal node
|
||||
//
|
||||
fill_bfe_for_min_read(&bfe, brt->h);
|
||||
fill_bfe_for_min_read(&bfe, brt->ft);
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
brt->h,
|
||||
brt->ft,
|
||||
node_internal,
|
||||
toku_cachetable_hash(brt->h->cf, node_internal),
|
||||
toku_cachetable_hash(brt->ft->cf, node_internal),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -258,16 +258,16 @@ doit (BOOL keep_other_bn_in_memory) {
|
|||
r = toku_ftnode_cleaner_callback(
|
||||
node,
|
||||
node_internal,
|
||||
toku_cachetable_hash(brt->h->cf, node_internal),
|
||||
brt->h
|
||||
toku_cachetable_hash(brt->ft->cf, node_internal),
|
||||
brt->ft
|
||||
);
|
||||
|
||||
// verify that node_internal's buffer is empty
|
||||
fill_bfe_for_min_read(&bfe, brt->h);
|
||||
fill_bfe_for_min_read(&bfe, brt->ft);
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
brt->h,
|
||||
brt->ft,
|
||||
node_internal,
|
||||
toku_cachetable_hash(brt->h->cf, node_internal),
|
||||
toku_cachetable_hash(brt->ft->cf, node_internal),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -276,7 +276,7 @@ doit (BOOL keep_other_bn_in_memory) {
|
|||
);
|
||||
// check that buffers are empty
|
||||
assert(toku_bnc_nbytesinbuf(BNC(node, 0)) == 0);
|
||||
toku_unpin_ftnode_off_client_thread(brt->h, node);
|
||||
toku_unpin_ftnode_off_client_thread(brt->ft, node);
|
||||
|
||||
//
|
||||
// now run a checkpoint to get everything clean,
|
||||
|
|
|
@ -59,7 +59,7 @@ doit (void) {
|
|||
toku_free(fname);
|
||||
|
||||
brt->options.update_fun = update_func;
|
||||
brt->h->update_fun = update_func;
|
||||
brt->ft->update_fun = update_func;
|
||||
|
||||
toku_testsetup_initialize(); // must precede any other toku_testsetup calls
|
||||
|
||||
|
@ -144,7 +144,7 @@ doit (void) {
|
|||
toku_pin_node_with_min_bfe(&node, node_leaf[1], brt);
|
||||
// hack to get merge going
|
||||
BLB_SEQINSERT(node, node->n_children-1) = FALSE;
|
||||
toku_unpin_ftnode(brt->h, node);
|
||||
toku_unpin_ftnode(brt->ft, node);
|
||||
|
||||
// now do a lookup on one of the keys, this should bring a leaf node up to date
|
||||
DBT k;
|
||||
|
@ -153,11 +153,11 @@ doit (void) {
|
|||
assert(r==0);
|
||||
|
||||
struct ftnode_fetch_extra bfe;
|
||||
fill_bfe_for_min_read(&bfe, brt->h);
|
||||
fill_bfe_for_min_read(&bfe, brt->ft);
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
brt->h,
|
||||
brt->ft,
|
||||
node_internal,
|
||||
toku_cachetable_hash(brt->h->cf, node_internal),
|
||||
toku_cachetable_hash(brt->ft->cf, node_internal),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -171,16 +171,16 @@ doit (void) {
|
|||
r = toku_ftnode_cleaner_callback(
|
||||
node,
|
||||
node_internal,
|
||||
toku_cachetable_hash(brt->h->cf, node_internal),
|
||||
brt->h
|
||||
toku_cachetable_hash(brt->ft->cf, node_internal),
|
||||
brt->ft
|
||||
);
|
||||
|
||||
// verify that node_internal's buffer is empty
|
||||
fill_bfe_for_min_read(&bfe, brt->h);
|
||||
fill_bfe_for_min_read(&bfe, brt->ft);
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
brt->h,
|
||||
brt->ft,
|
||||
node_internal,
|
||||
toku_cachetable_hash(brt->h->cf, node_internal),
|
||||
toku_cachetable_hash(brt->ft->cf, node_internal),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -191,7 +191,7 @@ doit (void) {
|
|||
assert(node->n_children == 1);
|
||||
// check that buffers are empty
|
||||
assert(toku_bnc_nbytesinbuf(BNC(node, 0)) == 0);
|
||||
toku_unpin_ftnode_off_client_thread(brt->h, node);
|
||||
toku_unpin_ftnode_off_client_thread(brt->ft, node);
|
||||
|
||||
//
|
||||
// now run a checkpoint to get everything clean,
|
||||
|
|
|
@ -185,7 +185,7 @@ doit (void) {
|
|||
);
|
||||
curr_child_to_flush = 0;
|
||||
num_flushes_called = 0;
|
||||
flush_some_child(t->h, node, &fa);
|
||||
flush_some_child(t->ft, node, &fa);
|
||||
assert(num_flushes_called == 1);
|
||||
|
||||
toku_pin_node_with_min_bfe(&node, node_internal, t);
|
||||
|
@ -196,14 +196,14 @@ doit (void) {
|
|||
// child 1 should still have message in buffer
|
||||
assert(toku_bnc_n_entries(node->bp[0].ptr.u.nonleaf) == 0);
|
||||
assert(toku_bnc_n_entries(node->bp[1].ptr.u.nonleaf) > 0);
|
||||
toku_unpin_ftnode(t->h, node);
|
||||
toku_unpin_ftnode(t->ft, node);
|
||||
r = toku_checkpoint(ct, NULL, NULL, NULL, NULL, NULL, CLIENT_CHECKPOINT);
|
||||
assert_zero(r);
|
||||
toku_pin_node_with_min_bfe(&node, node_internal, t);
|
||||
assert(!node->dirty);
|
||||
curr_child_to_flush = 1;
|
||||
num_flushes_called = 0;
|
||||
flush_some_child(t->h, node, &fa);
|
||||
flush_some_child(t->ft, node, &fa);
|
||||
assert(num_flushes_called == 1);
|
||||
|
||||
toku_pin_node_with_min_bfe(&node, node_internal, t);
|
||||
|
@ -214,14 +214,14 @@ doit (void) {
|
|||
assert(toku_bnc_n_entries(node->bp[0].ptr.u.nonleaf) == 0);
|
||||
assert(toku_bnc_n_entries(node->bp[1].ptr.u.nonleaf) == 0);
|
||||
// now let's do a flush with an empty buffer, make sure it is ok
|
||||
toku_unpin_ftnode(t->h, node);
|
||||
toku_unpin_ftnode(t->ft, node);
|
||||
r = toku_checkpoint(ct, NULL, NULL, NULL, NULL, NULL, CLIENT_CHECKPOINT);
|
||||
assert_zero(r);
|
||||
toku_pin_node_with_min_bfe(&node, node_internal, t);
|
||||
assert(!node->dirty);
|
||||
curr_child_to_flush = 0;
|
||||
num_flushes_called = 0;
|
||||
flush_some_child(t->h, node, &fa);
|
||||
flush_some_child(t->ft, node, &fa);
|
||||
assert(num_flushes_called == 1);
|
||||
|
||||
toku_pin_node_with_min_bfe(&node, node_internal, t);
|
||||
|
@ -231,7 +231,7 @@ doit (void) {
|
|||
// both buffers should be empty now
|
||||
assert(toku_bnc_n_entries(node->bp[0].ptr.u.nonleaf) == 0);
|
||||
assert(toku_bnc_n_entries(node->bp[1].ptr.u.nonleaf) == 0);
|
||||
toku_unpin_ftnode(t->h, node);
|
||||
toku_unpin_ftnode(t->ft, node);
|
||||
|
||||
// now let's start a flush from the root, that always recursively flushes
|
||||
flusher_advice_init(
|
||||
|
@ -250,18 +250,18 @@ doit (void) {
|
|||
toku_assert_entire_node_in_memory(node); // entire root is in memory
|
||||
curr_child_to_flush = i;
|
||||
num_flushes_called = 0;
|
||||
flush_some_child(t->h, node, &fa);
|
||||
flush_some_child(t->ft, node, &fa);
|
||||
assert(num_flushes_called == 2);
|
||||
|
||||
toku_pin_node_with_min_bfe(&node, node_internal, t);
|
||||
assert(!node->dirty); // nothing was flushed, so node better not be dirty
|
||||
toku_unpin_ftnode(t->h, node);
|
||||
toku_unpin_ftnode(t->ft, node);
|
||||
toku_pin_node_with_min_bfe(&node, node_leaf[0], t);
|
||||
assert(!node->dirty); // nothing was flushed, so node better not be dirty
|
||||
toku_unpin_ftnode(t->h, node);
|
||||
toku_unpin_ftnode(t->ft, node);
|
||||
toku_pin_node_with_min_bfe(&node, node_leaf[1], t);
|
||||
assert(!node->dirty); // nothing was flushed, so node better not be dirty
|
||||
toku_unpin_ftnode(t->h, node);
|
||||
toku_unpin_ftnode(t->ft, node);
|
||||
}
|
||||
|
||||
// now one more test to show a bug was fixed
|
||||
|
@ -286,17 +286,17 @@ doit (void) {
|
|||
toku_pin_node_with_min_bfe(&node, node_internal, t);
|
||||
for (int i = 0; i < 20; i++) {
|
||||
PAIR_ATTR attr;
|
||||
toku_ftnode_pe_callback(node, make_pair_attr(0xffffffff), &attr, t->h);
|
||||
toku_ftnode_pe_callback(node, make_pair_attr(0xffffffff), &attr, t->ft);
|
||||
}
|
||||
assert(BP_STATE(node,0) == PT_COMPRESSED);
|
||||
toku_unpin_ftnode(t->h, node);
|
||||
toku_unpin_ftnode(t->ft, node);
|
||||
|
||||
//now let's do the same test as above
|
||||
toku_pin_node_with_min_bfe(&node, node_root, t);
|
||||
toku_assert_entire_node_in_memory(node); // entire root is in memory
|
||||
curr_child_to_flush = 0;
|
||||
num_flushes_called = 0;
|
||||
flush_some_child(t->h, node, &fa);
|
||||
flush_some_child(t->ft, node, &fa);
|
||||
assert(num_flushes_called == 2);
|
||||
|
||||
r = toku_close_ft_handle_nolsn(t, 0); assert(r==0);
|
||||
|
|
|
@ -171,12 +171,12 @@ test_split_on_boundary(void)
|
|||
FTNODE nodea, nodeb;
|
||||
DBT splitk;
|
||||
// if we haven't done it right, we should hit the assert in the top of move_leafentries
|
||||
ftleaf_split(brt->h, &sn, &nodea, &nodeb, &splitk, TRUE, 0, NULL);
|
||||
ftleaf_split(brt->ft, &sn, &nodea, &nodeb, &splitk, TRUE, 0, NULL);
|
||||
|
||||
verify_basement_node_msns(nodea, dummy_msn_3884);
|
||||
verify_basement_node_msns(nodeb, dummy_msn_3884);
|
||||
|
||||
toku_unpin_ftnode(brt->h, nodeb);
|
||||
toku_unpin_ftnode(brt->ft, nodeb);
|
||||
r = toku_close_ft_handle_nolsn(brt, NULL); assert(r == 0);
|
||||
r = toku_cachetable_close(&ct); assert(r == 0);
|
||||
|
||||
|
@ -244,9 +244,9 @@ test_split_with_everything_on_the_left(void)
|
|||
FTNODE nodea, nodeb;
|
||||
DBT splitk;
|
||||
// if we haven't done it right, we should hit the assert in the top of move_leafentries
|
||||
ftleaf_split(brt->h, &sn, &nodea, &nodeb, &splitk, TRUE, 0, NULL);
|
||||
ftleaf_split(brt->ft, &sn, &nodea, &nodeb, &splitk, TRUE, 0, NULL);
|
||||
|
||||
toku_unpin_ftnode(brt->h, nodeb);
|
||||
toku_unpin_ftnode(brt->ft, nodeb);
|
||||
r = toku_close_ft_handle_nolsn(brt, NULL); assert(r == 0);
|
||||
r = toku_cachetable_close(&ct); assert(r == 0);
|
||||
|
||||
|
@ -319,9 +319,9 @@ test_split_on_boundary_of_last_node(void)
|
|||
FTNODE nodea, nodeb;
|
||||
DBT splitk;
|
||||
// if we haven't done it right, we should hit the assert in the top of move_leafentries
|
||||
ftleaf_split(brt->h, &sn, &nodea, &nodeb, &splitk, TRUE, 0, NULL);
|
||||
ftleaf_split(brt->ft, &sn, &nodea, &nodeb, &splitk, TRUE, 0, NULL);
|
||||
|
||||
toku_unpin_ftnode(brt->h, nodeb);
|
||||
toku_unpin_ftnode(brt->ft, nodeb);
|
||||
r = toku_close_ft_handle_nolsn(brt, NULL); assert(r == 0);
|
||||
r = toku_cachetable_close(&ct); assert(r == 0);
|
||||
|
||||
|
@ -387,9 +387,9 @@ test_split_at_begin(void)
|
|||
FTNODE nodea, nodeb;
|
||||
DBT splitk;
|
||||
// if we haven't done it right, we should hit the assert in the top of move_leafentries
|
||||
ftleaf_split(brt->h, &sn, &nodea, &nodeb, &splitk, TRUE, 0, NULL);
|
||||
ftleaf_split(brt->ft, &sn, &nodea, &nodeb, &splitk, TRUE, 0, NULL);
|
||||
|
||||
toku_unpin_ftnode(brt->h, nodeb);
|
||||
toku_unpin_ftnode(brt->ft, nodeb);
|
||||
r = toku_close_ft_handle_nolsn(brt, NULL); assert(r == 0);
|
||||
r = toku_cachetable_close(&ct); assert(r == 0);
|
||||
|
||||
|
@ -451,9 +451,9 @@ test_split_at_end(void)
|
|||
FTNODE nodea, nodeb;
|
||||
DBT splitk;
|
||||
// if we haven't done it right, we should hit the assert in the top of move_leafentries
|
||||
ftleaf_split(brt->h, &sn, &nodea, &nodeb, &splitk, TRUE, 0, NULL);
|
||||
ftleaf_split(brt->ft, &sn, &nodea, &nodeb, &splitk, TRUE, 0, NULL);
|
||||
|
||||
toku_unpin_ftnode(brt->h, nodeb);
|
||||
toku_unpin_ftnode(brt->ft, nodeb);
|
||||
r = toku_close_ft_handle_nolsn(brt, NULL); assert(r == 0);
|
||||
r = toku_cachetable_close(&ct); assert(r == 0);
|
||||
|
||||
|
@ -505,12 +505,12 @@ test_split_odd_nodes(void)
|
|||
FTNODE nodea, nodeb;
|
||||
DBT splitk;
|
||||
// if we haven't done it right, we should hit the assert in the top of move_leafentries
|
||||
ftleaf_split(brt->h, &sn, &nodea, &nodeb, &splitk, TRUE, 0, NULL);
|
||||
ftleaf_split(brt->ft, &sn, &nodea, &nodeb, &splitk, TRUE, 0, NULL);
|
||||
|
||||
verify_basement_node_msns(nodea, dummy_msn_3884);
|
||||
verify_basement_node_msns(nodeb, dummy_msn_3884);
|
||||
|
||||
toku_unpin_ftnode(brt->h, nodeb);
|
||||
toku_unpin_ftnode(brt->ft, nodeb);
|
||||
r = toku_close_ft_handle_nolsn(brt, NULL); assert(r == 0);
|
||||
r = toku_cachetable_close(&ct); assert(r == 0);
|
||||
|
||||
|
|
|
@ -71,11 +71,11 @@ doit (void) {
|
|||
// we pin it and verify that it is not
|
||||
FTNODE node;
|
||||
struct ftnode_fetch_extra bfe;
|
||||
fill_bfe_for_full_read(&bfe, t->h);
|
||||
fill_bfe_for_full_read(&bfe, t->ft);
|
||||
toku_pin_ftnode_off_client_thread(
|
||||
t->h,
|
||||
t->ft,
|
||||
node_internal,
|
||||
toku_cachetable_hash(t->h->cf, node_internal),
|
||||
toku_cachetable_hash(t->ft->cf, node_internal),
|
||||
&bfe,
|
||||
TRUE,
|
||||
0,
|
||||
|
@ -86,7 +86,7 @@ doit (void) {
|
|||
// simply assert that the buffer is less than 50MB,
|
||||
// we inserted 100MB of data in there.
|
||||
assert(toku_bnc_nbytesinbuf(BNC(node, 0)) < 50*1000*1000);
|
||||
toku_unpin_ftnode_off_client_thread(t->h, node);
|
||||
toku_unpin_ftnode_off_client_thread(t->ft, node);
|
||||
|
||||
r = toku_close_ft_handle_nolsn(t, 0); assert(r==0);
|
||||
r = toku_cachetable_close(&ct); assert(r==0);
|
||||
|
|
|
@ -70,7 +70,7 @@ insert_into_child_buffer(FT_HANDLE brt, FTNODE node, int childnum, int minkey, i
|
|||
unsigned int key = htonl(val);
|
||||
DBT thekey; toku_fill_dbt(&thekey, &key, sizeof key);
|
||||
DBT theval; toku_fill_dbt(&theval, &val, sizeof val);
|
||||
toku_ft_append_to_child_buffer(brt->h->compare_fun, NULL, node, childnum, FT_INSERT, msn, xids_get_root_xids(), true, &thekey, &theval);
|
||||
toku_ft_append_to_child_buffer(brt->ft->compare_fun, NULL, node, childnum, FT_INSERT, msn, xids_get_root_xids(), true, &thekey, &theval);
|
||||
|
||||
// Create bad tree (don't do following):
|
||||
// node->max_msn_applied_to_node = msn;
|
||||
|
@ -96,7 +96,7 @@ make_tree(FT_HANDLE brt, int height, int fanout, int nperleaf, int *seq, int *mi
|
|||
DBT pivotkey;
|
||||
toku_ft_nonleaf_append_child(node, child, toku_fill_dbt(&pivotkey, toku_xmemdup(&k, sizeof k), sizeof k));
|
||||
}
|
||||
toku_unpin_ftnode(brt->h, child);
|
||||
toku_unpin_ftnode(brt->ft, child);
|
||||
insert_into_child_buffer(brt, node, childnum, minkeys[childnum], maxkeys[childnum]);
|
||||
}
|
||||
*minkey = minkeys[0];
|
||||
|
@ -140,13 +140,13 @@ test_make_tree(int height, int fanout, int nperleaf, int do_verify) {
|
|||
FTNODE newroot = make_tree(brt, height, fanout, nperleaf, &seq, &minkey, &maxkey);
|
||||
|
||||
// set the new root to point to the new tree
|
||||
toku_ft_set_new_root_blocknum(brt->h, newroot->thisnodename);
|
||||
toku_ft_set_new_root_blocknum(brt->ft, newroot->thisnodename);
|
||||
|
||||
// Create bad tree (don't do following):
|
||||
// newroot->max_msn_applied_to_node = last_dummymsn(); // capture msn of last message injected into tree
|
||||
|
||||
// unpin the new root
|
||||
toku_unpin_ftnode(brt->h, newroot);
|
||||
toku_unpin_ftnode(brt->ft, newroot);
|
||||
|
||||
if (do_verify) {
|
||||
r = toku_verify_ft(brt);
|
||||
|
|
|
@ -67,7 +67,7 @@ make_tree(FT_HANDLE brt, int height, int fanout, int nperleaf, int *seq, int *mi
|
|||
DBT pivotkey;
|
||||
toku_ft_nonleaf_append_child(node, child, toku_fill_dbt(&pivotkey, toku_xmemdup(&k, sizeof k), sizeof k));
|
||||
}
|
||||
toku_unpin_ftnode(brt->h, child);
|
||||
toku_unpin_ftnode(brt->ft, child);
|
||||
}
|
||||
*minkey = minkeys[0];
|
||||
*maxkey = maxkeys[0];
|
||||
|
@ -110,10 +110,10 @@ test_make_tree(int height, int fanout, int nperleaf, int do_verify) {
|
|||
FTNODE newroot = make_tree(brt, height, fanout, nperleaf, &seq, &minkey, &maxkey);
|
||||
|
||||
// discard the old root block
|
||||
toku_ft_set_new_root_blocknum(brt->h, newroot->thisnodename);
|
||||
toku_ft_set_new_root_blocknum(brt->ft, newroot->thisnodename);
|
||||
|
||||
// unpin the new root
|
||||
toku_unpin_ftnode(brt->h, newroot);
|
||||
toku_unpin_ftnode(brt->ft, newroot);
|
||||
|
||||
if (do_verify) {
|
||||
r = toku_verify_ft(brt);
|
||||
|
|
|
@ -70,10 +70,10 @@ test_dup_in_leaf(int do_verify) {
|
|||
populate_leaf(newroot, htonl(2), 2);
|
||||
|
||||
// set the new root to point to the new tree
|
||||
toku_ft_set_new_root_blocknum(brt->h, newroot->thisnodename);
|
||||
toku_ft_set_new_root_blocknum(brt->ft, newroot->thisnodename);
|
||||
|
||||
// unpin the new root
|
||||
toku_unpin_ftnode(brt->h, newroot);
|
||||
toku_unpin_ftnode(brt->ft, newroot);
|
||||
|
||||
if (do_verify) {
|
||||
r = toku_verify_ft(brt);
|
||||
|
|
|
@ -67,7 +67,7 @@ make_tree(FT_HANDLE brt, int height, int fanout, int nperleaf, int *seq, int *mi
|
|||
DBT pivotkey;
|
||||
toku_ft_nonleaf_append_child(node, child, toku_fill_dbt(&pivotkey, toku_xmemdup(&k, sizeof k), sizeof k));
|
||||
}
|
||||
toku_unpin_ftnode(brt->h, child);
|
||||
toku_unpin_ftnode(brt->ft, child);
|
||||
}
|
||||
*minkey = minkeys[0];
|
||||
*maxkey = maxkeys[0];
|
||||
|
@ -111,10 +111,10 @@ test_make_tree(int height, int fanout, int nperleaf, int do_verify) {
|
|||
|
||||
// discard the old root block
|
||||
// set the new root to point to the new tree
|
||||
toku_ft_set_new_root_blocknum(brt->h, newroot->thisnodename);
|
||||
toku_ft_set_new_root_blocknum(brt->ft, newroot->thisnodename);
|
||||
|
||||
// unpin the new root
|
||||
toku_unpin_ftnode(brt->h, newroot);
|
||||
toku_unpin_ftnode(brt->ft, newroot);
|
||||
|
||||
if (do_verify) {
|
||||
r = toku_verify_ft(brt);
|
||||
|
|
|
@ -58,7 +58,7 @@ insert_into_child_buffer(FT_HANDLE brt, FTNODE node, int childnum, int minkey, i
|
|||
DBT thekey; toku_fill_dbt(&thekey, &key, sizeof key);
|
||||
DBT theval; toku_fill_dbt(&theval, &val, sizeof val);
|
||||
MSN msn = next_dummymsn();
|
||||
toku_ft_append_to_child_buffer(brt->h->compare_fun, NULL, node, childnum, FT_INSERT, msn, xids_get_root_xids(), true, &thekey, &theval);
|
||||
toku_ft_append_to_child_buffer(brt->ft->compare_fun, NULL, node, childnum, FT_INSERT, msn, xids_get_root_xids(), true, &thekey, &theval);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ make_tree(FT_HANDLE brt, int height, int fanout, int nperleaf, int *seq, int *mi
|
|||
DBT pivotkey;
|
||||
toku_ft_nonleaf_append_child(node, child, toku_fill_dbt(&pivotkey, toku_xmemdup(&k, sizeof k), sizeof k));
|
||||
}
|
||||
toku_unpin_ftnode(brt->h, child);
|
||||
toku_unpin_ftnode(brt->ft, child);
|
||||
insert_into_child_buffer(brt, node, childnum, minkeys[childnum], maxkeys[childnum]);
|
||||
}
|
||||
*minkey = minkeys[0];
|
||||
|
@ -126,10 +126,10 @@ test_make_tree(int height, int fanout, int nperleaf, int do_verify) {
|
|||
|
||||
// discard the old root block
|
||||
// set the new root to point to the new tree
|
||||
toku_ft_set_new_root_blocknum(brt->h, newroot->thisnodename);
|
||||
toku_ft_set_new_root_blocknum(brt->ft, newroot->thisnodename);
|
||||
|
||||
// unpin the new root
|
||||
toku_unpin_ftnode(brt->h, newroot);
|
||||
toku_unpin_ftnode(brt->ft, newroot);
|
||||
|
||||
if (do_verify) {
|
||||
r = toku_verify_ft(brt);
|
||||
|
|
|
@ -69,10 +69,10 @@ test_dup_in_leaf(int do_verify) {
|
|||
populate_leaf(newroot, htonl(1), 2);
|
||||
|
||||
// set the new root to point to the new tree
|
||||
toku_ft_set_new_root_blocknum(brt->h, newroot->thisnodename);
|
||||
toku_ft_set_new_root_blocknum(brt->ft, newroot->thisnodename);
|
||||
|
||||
// unpin the new root
|
||||
toku_unpin_ftnode(brt->h, newroot);
|
||||
toku_unpin_ftnode(brt->ft, newroot);
|
||||
|
||||
if (do_verify) {
|
||||
r = toku_verify_ft(brt);
|
||||
|
|
|
@ -67,7 +67,7 @@ make_tree(FT_HANDLE brt, int height, int fanout, int nperleaf, int *seq, int *mi
|
|||
DBT pivotkey;
|
||||
toku_ft_nonleaf_append_child(node, child, toku_fill_dbt(&pivotkey, toku_xmemdup(&k, sizeof k), sizeof k));
|
||||
}
|
||||
toku_unpin_ftnode(brt->h, child);
|
||||
toku_unpin_ftnode(brt->ft, child);
|
||||
}
|
||||
*minkey = minkeys[0];
|
||||
*maxkey = maxkeys[0];
|
||||
|
@ -110,10 +110,10 @@ test_make_tree(int height, int fanout, int nperleaf, int do_verify) {
|
|||
FTNODE newroot = make_tree(brt, height, fanout, nperleaf, &seq, &minkey, &maxkey);
|
||||
|
||||
// discard the old root block
|
||||
toku_ft_set_new_root_blocknum(brt->h, newroot->thisnodename);
|
||||
toku_ft_set_new_root_blocknum(brt->ft, newroot->thisnodename);
|
||||
|
||||
// unpin the new root
|
||||
toku_unpin_ftnode(brt->h, newroot);
|
||||
toku_unpin_ftnode(brt->ft, newroot);
|
||||
|
||||
if (do_verify) {
|
||||
r = toku_verify_ft(brt);
|
||||
|
|
|
@ -182,7 +182,7 @@ toku_indexer_create_indexer(DB_ENV *env,
|
|||
XCALLOC_N(N, indexer->i->fnums);
|
||||
if ( !indexer->i->fnums ) { rval = ENOMEM; goto create_exit; }
|
||||
for(int i=0;i<indexer->i->N;i++) {
|
||||
indexer->i->fnums[i] = toku_cachefile_filenum(db_struct_i(dest_dbs[i])->ft_handle->h->cf);
|
||||
indexer->i->fnums[i] = toku_cachefile_filenum(db_struct_i(dest_dbs[i])->ft_handle->ft->cf);
|
||||
}
|
||||
indexer->i->filenums.num = N;
|
||||
indexer->i->filenums.filenums = indexer->i->fnums;
|
||||
|
|
|
@ -362,8 +362,8 @@ toku_db_open(DB * db, DB_TXN * txn, const char *fname, const char *dbname, DBTYP
|
|||
// Need to investigate further.
|
||||
static void db_on_redirect_callback(FT_HANDLE brt, void* extra) {
|
||||
DB* db = extra;
|
||||
db->descriptor = &brt->h->descriptor;
|
||||
db->cmp_descriptor = &brt->h->cmp_descriptor;
|
||||
db->descriptor = &brt->ft->descriptor;
|
||||
db->cmp_descriptor = &brt->ft->cmp_descriptor;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -425,8 +425,8 @@ db_open_iname(DB * db, DB_TXN * txn, const char *iname_in_env, u_int32_t flags,
|
|||
// is in the brt header. we need a copy of the pointer in the DB.
|
||||
// TODO: there may be a cleaner way to do this.
|
||||
// toku_ft_get_descriptor(db, &cmp_desc, &desc); ??
|
||||
db->descriptor = &brt->h->descriptor;
|
||||
db->cmp_descriptor = &brt->h->cmp_descriptor;
|
||||
db->descriptor = &brt->ft->descriptor;
|
||||
db->cmp_descriptor = &brt->ft->cmp_descriptor;
|
||||
|
||||
if (need_locktree) {
|
||||
db->i->dict_id = toku_ft_get_dictionary_id(db->i->ft_handle);
|
||||
|
|
|
@ -34,7 +34,7 @@ static inline int db_opened(DB *db) {
|
|||
|
||||
static inline toku_dbt_cmp
|
||||
toku_db_get_compare_fun(DB* db) {
|
||||
return db->i->ft_handle->h->compare_fun;
|
||||
return db->i->ft_handle->ft->compare_fun;
|
||||
}
|
||||
|
||||
int toku_db_pre_acquire_fileops_lock(DB *db, DB_TXN *txn);
|
||||
|
|
Loading…
Add table
Reference in a new issue