Commit 1e96a054 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:4512], remove brt_header->checkpoint_before_commit_link and...

[t:4512], remove brt_header->checkpoint_before_commit_link and txn->checkpoint_before_commit, and replace it with a BOOL that states if a checkpoint is needed or not

git-svn-id: file:///svn/toku/tokudb@42758 c7de825b-a66e-492c-adef-691d508d4ae1
parent a95207a7
......@@ -390,7 +390,6 @@ struct brt_header {
TXNID root_xid_that_created;
struct toku_list live_brts;
struct toku_list zombie_brts;
struct toku_list checkpoint_before_commit_link;
brt_compare_func compare_fun;
brt_update_func update_fun;
......
......@@ -2893,7 +2893,6 @@ deserialize_brtheader_versioned(int fd, struct rbuf *rb, struct brt_header **brt
h->panic_string = 0;
toku_list_init(&h->live_brts);
toku_list_init(&h->zombie_brts);
toku_list_init(&h->checkpoint_before_commit_link);
//version MUST be in network order on disk regardless of disk order
h->layout_version_read_from_disk = rbuf_network_int(rb);
......
......@@ -3352,7 +3352,6 @@ brt_init_header (BRT t, TOKUTXN txn) {
toku_list_init(&t->h->live_brts);
toku_list_init(&t->h->zombie_brts);
toku_list_init(&t->h->checkpoint_before_commit_link);
int r = brt_init_header_partial(t, txn);
if (r==0) toku_block_verify_no_free_blocknums(t->h->blocktable);
return r;
......@@ -6534,25 +6533,13 @@ int toku_brt_destroy(void) {
return r;
}
// Require that dictionary specified by brt is fully written to disk before
// transaction txn is committed.
void
toku_brt_require_local_checkpoint (BRT brt, TOKUTXN txn) {
toku_brtheader_lock(brt->h);
toku_list_push(&txn->checkpoint_before_commit,
&brt->h->checkpoint_before_commit_link);
toku_brtheader_unlock(brt->h);
}
//Suppress both rollback and recovery logs.
void
toku_brt_suppress_recovery_logs (BRT 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);
toku_list_push(&txn->checkpoint_before_commit, &brt->h->checkpoint_before_commit_link);
txn->checkpoint_needed_before_commit = TRUE;
}
BOOL
......
......@@ -176,7 +176,7 @@ struct tokutxn {
uint32_t current_rollback_hash;
BOOL recovered_from_checkpoint;
struct toku_list checkpoint_before_commit;
BOOL checkpoint_needed_before_commit;
TXN_IGNORE_S ignore_errors; // 2954
TOKUTXN_STATE state;
LSN do_fsync_lsn;
......
......@@ -456,9 +456,8 @@ int toku_rollback_commit(TOKUTXN txn, YIELDF yield, void*yieldv, LSN lsn) {
assert(r==0);
// Merge the list of headers that must be checkpointed before commit
while (!toku_list_empty(&txn->checkpoint_before_commit)) {
struct toku_list *list = toku_list_pop(&txn->checkpoint_before_commit);
toku_list_push(&txn->parent->checkpoint_before_commit, list);
if (txn->checkpoint_needed_before_commit) {
txn->parent->checkpoint_needed_before_commit = TRUE;
}
//If this transaction needs an fsync (if it commits)
......@@ -475,11 +474,6 @@ int toku_rollback_commit(TOKUTXN txn, YIELDF yield, void*yieldv, LSN lsn) {
int toku_rollback_abort(TOKUTXN txn, YIELDF yield, void*yieldv, LSN lsn) {
int r;
//Empty the list
while (!toku_list_empty(&txn->checkpoint_before_commit)) {
toku_list_pop(&txn->checkpoint_before_commit);
}
r = apply_txn(txn, yield, yieldv, lsn, toku_abort_rollback_item);
assert(r==0);
return r;
......
......@@ -216,7 +216,7 @@ toku_txn_create_txn (
result->rollentry_raw_count = 0;
result->force_fsync_on_commit = FALSE;
result->recovered_from_checkpoint = FALSE;
toku_list_init(&result->checkpoint_before_commit);
result->checkpoint_needed_before_commit = FALSE;
result->state = TOKUTXN_LIVE;
invalidate_xa_xid(&result->xa_xid);
result->do_fsync = FALSE;
......@@ -378,13 +378,19 @@ int toku_txn_commit_txn(TOKUTXN txn, int nosync, YIELDF yield, void *yieldv,
release_multi_operation_client_lock);
}
void
toku_txn_require_checkpoint_on_commit(TOKUTXN txn) {
txn->checkpoint_needed_before_commit = TRUE;
}
struct xcommit_info {
int r;
TOKUTXN txn;
};
BOOL toku_txn_requires_checkpoint(TOKUTXN txn) {
return (!txn->parent && !toku_list_empty(&txn->checkpoint_before_commit));
return (!txn->parent && txn->checkpoint_needed_before_commit);
}
//Called during a yield (ydb lock NOT held).
......@@ -392,12 +398,6 @@ static void
log_xcommit(void *thunk) {
struct xcommit_info *info = thunk;
TOKUTXN txn = info->txn;
// not sure how the elements in the list are getting freed, so I am doing this
if (!txn->parent && !toku_list_empty(&txn->checkpoint_before_commit)) {
while (!toku_list_empty(&txn->checkpoint_before_commit)) {
toku_list_pop(&txn->checkpoint_before_commit);
}
}
info->r = toku_log_xcommit(txn->logger, &txn->do_fsync_lsn, 0, txn->txnid64); // exits holding neither of the tokulogger locks.
}
......
......@@ -67,6 +67,9 @@ void toku_txn_get_fsync_info(TOKUTXN ttxn, BOOL* do_fsync, LSN* do_fsync_lsn);
// Complete and destroy a txn
void toku_txn_close_txn(TOKUTXN txn);
// Require a checkpoint upon commit
void toku_txn_require_checkpoint_on_commit(TOKUTXN txn);
// Remove a txn from any live txn lists
void toku_txn_complete_txn(TOKUTXN txn);
......
......@@ -325,7 +325,7 @@ close_indexer(DB_INDEXER *indexer) {
toku_ydb_lock();
{
// Add all created dbs to the transaction's checkpoint_before_commit list.
// Mark txn as needing a checkpoint.
// (This will cause a local checkpoint of created index files, which is necessary
// because these files are not necessarily on disk and all the operations
// to create them are not in the recovery log.)
......@@ -336,7 +336,7 @@ close_indexer(DB_INDEXER *indexer) {
for (int which_db = 0; which_db < indexer->i->N ; which_db++) {
db = indexer->i->dest_dbs[which_db];
brt = db_struct_i(db)->brt;
toku_brt_require_local_checkpoint(brt, tokutxn);
toku_txn_require_checkpoint_on_commit(tokutxn);
}
// Disassociate the indexer from the hot db and free_indexer
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment