Commit 8f4b41fe authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

#3590 back out the fsync optimization (group commit test fails) refs[t:3590]

git-svn-id: file:///svn/toku/tokudb@33055 c7de825b-a66e-492c-adef-691d508d4ae1
parent 1bd7a459
...@@ -156,8 +156,6 @@ struct tokutxn { ...@@ -156,8 +156,6 @@ struct tokutxn {
struct toku_list checkpoint_before_commit; struct toku_list checkpoint_before_commit;
TXN_IGNORE_S ignore_errors; // 2954 TXN_IGNORE_S ignore_errors; // 2954
TOKUTXN_STATE state; TOKUTXN_STATE state;
LSN do_fsync_lsn;
BOOL do_fsync;
}; };
struct txninfo { struct txninfo {
......
...@@ -270,7 +270,6 @@ int toku_txn_begin_with_xid ( ...@@ -270,7 +270,6 @@ int toku_txn_begin_with_xid (
result->recovered_from_checkpoint = FALSE; result->recovered_from_checkpoint = FALSE;
toku_list_init(&result->checkpoint_before_commit); toku_list_init(&result->checkpoint_before_commit);
result->state = TOKUTXN_LIVE; result->state = TOKUTXN_LIVE;
result->do_fsync = FALSE;
// 2954 // 2954
r = toku_txn_ignore_init(result); r = toku_txn_ignore_init(result);
...@@ -330,6 +329,7 @@ int toku_txn_commit_txn(TOKUTXN txn, int nosync, YIELDF yield, void *yieldv, ...@@ -330,6 +329,7 @@ int toku_txn_commit_txn(TOKUTXN txn, int nosync, YIELDF yield, void *yieldv,
struct xcommit_info { struct xcommit_info {
int r; int r;
TOKUTXN txn; TOKUTXN txn;
bool do_fsync;
}; };
//Called during a yield (ydb lock NOT held). //Called during a yield (ydb lock NOT held).
...@@ -365,7 +365,7 @@ local_checkpoints_and_log_xcommit(void *thunk) { ...@@ -365,7 +365,7 @@ local_checkpoints_and_log_xcommit(void *thunk) {
toku_poll_txn_progress_function(txn, TRUE, FALSE); toku_poll_txn_progress_function(txn, TRUE, FALSE);
} }
info->r = toku_log_xcommit(txn->logger, &txn->do_fsync_lsn, 0, txn->txnid64); // exits holding neither of the tokulogger locks. info->r = toku_log_xcommit(txn->logger, (LSN *)0, info->do_fsync, txn->txnid64); // exits holding neither of the tokulogger locks.
} }
int toku_txn_commit_with_lsn(TOKUTXN txn, int nosync, YIELDF yield, void *yieldv, LSN oplsn, int toku_txn_commit_with_lsn(TOKUTXN txn, int nosync, YIELDF yield, void *yieldv, LSN oplsn,
...@@ -379,7 +379,7 @@ int toku_txn_commit_with_lsn(TOKUTXN txn, int nosync, YIELDF yield, void *yieldv ...@@ -379,7 +379,7 @@ int toku_txn_commit_with_lsn(TOKUTXN txn, int nosync, YIELDF yield, void *yieldv
// Child transactions do not actually 'commit'. They promote their changes to parent, so no need to fsync if this txn has a parent. // Child transactions do not actually 'commit'. They promote their changes to parent, so no need to fsync if this txn has a parent.
// the do_sync state is captured in the txn for txn_close_txn later // the do_sync state is captured in the txn for txn_close_txn later
txn->do_fsync = !txn->parent && (txn->force_fsync_on_commit || (!nosync && txn->num_rollentries>0)); bool do_fsync = !txn->parent && (txn->force_fsync_on_commit || (!nosync && txn->num_rollentries>0));
txn->progress_poll_fun = poll; txn->progress_poll_fun = poll;
txn->progress_poll_fun_extra = poll_extra; txn->progress_poll_fun_extra = poll_extra;
...@@ -388,6 +388,7 @@ int toku_txn_commit_with_lsn(TOKUTXN txn, int nosync, YIELDF yield, void *yieldv ...@@ -388,6 +388,7 @@ int toku_txn_commit_with_lsn(TOKUTXN txn, int nosync, YIELDF yield, void *yieldv
struct xcommit_info info = { struct xcommit_info info = {
.r = 0, .r = 0,
.txn = txn, .txn = txn,
.do_fsync = do_fsync,
}; };
yield(local_checkpoints_and_log_xcommit, &info, yieldv); yield(local_checkpoints_and_log_xcommit, &info, yieldv);
r = info.r; r = info.r;
...@@ -419,7 +420,7 @@ int toku_txn_abort_with_lsn(TOKUTXN txn, YIELDF yield, void *yieldv, LSN oplsn, ...@@ -419,7 +420,7 @@ int toku_txn_abort_with_lsn(TOKUTXN txn, YIELDF yield, void *yieldv, LSN oplsn,
txn->progress_poll_fun = poll; txn->progress_poll_fun = poll;
txn->progress_poll_fun_extra = poll_extra; txn->progress_poll_fun_extra = poll_extra;
int r=0; int r=0;
r = toku_log_xabort(txn->logger, &txn->do_fsync_lsn, 0, txn->txnid64); r = toku_log_xabort(txn->logger, (LSN *)0, 0, txn->txnid64);
if (r!=0) if (r!=0)
return r; return r;
r = toku_rollback_abort(txn, yield, yieldv, oplsn); r = toku_rollback_abort(txn, yield, yieldv, oplsn);
...@@ -429,18 +430,13 @@ int toku_txn_abort_with_lsn(TOKUTXN txn, YIELDF yield, void *yieldv, LSN oplsn, ...@@ -429,18 +430,13 @@ int toku_txn_abort_with_lsn(TOKUTXN txn, YIELDF yield, void *yieldv, LSN oplsn,
void toku_txn_close_txn(TOKUTXN txn) { void toku_txn_close_txn(TOKUTXN txn) {
TOKULOGGER logger = txn->logger; // capture these for the fsync after the txn is deleted TOKULOGGER logger = txn->logger; // capture these for the fsync after the txn is deleted
bool do_fsync = txn->do_fsync;
LSN lsn = txn->do_fsync_lsn;
toku_rollback_txn_close(txn); toku_rollback_txn_close(txn);
txn = NULL; // txn is no longer valid txn = NULL; // txn is no longer valid
if (garbage_collection_debug) if (garbage_collection_debug)
verify_snapshot_system(logger); verify_snapshot_system(logger);
if (do_fsync) { // #3590
int r = toku_logger_fsync_if_lsn_not_fsynced(logger, lsn);
assert_zero(r);
}
status.close++; status.close++;
return; return;
} }
......
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