Commit 492ee2b9 authored by Yoni Fogel's avatar Yoni Fogel

closes[t:2692] Fix two races that helgrind reports.

Technically neither one causes any problems.

git-svn-id: file:///svn/toku/tokudb@20881 c7de825b-a66e-492c-adef-691d508d4ae1
parent 824e20e7
...@@ -2758,8 +2758,8 @@ int toku_brt_maybe_insert (BRT brt, DBT *key, DBT *val, TOKUTXN txn, BOOL oplsn_ ...@@ -2758,8 +2758,8 @@ int toku_brt_maybe_insert (BRT brt, DBT *key, DBT *val, TOKUTXN txn, BOOL oplsn_
if (r!=0) return r; if (r!=0) return r;
} }
LSN treelsn = toku_brt_checkpoint_lsn(brt); LSN treelsn;
if (oplsn_valid && oplsn.lsn <= treelsn.lsn) { if (oplsn_valid && oplsn.lsn <= (treelsn = toku_brt_checkpoint_lsn(brt)).lsn) {
r = 0; r = 0;
} else { } else {
BRT_MSG_S brtcmd = { type, message_xids, .u.id={key,val}}; BRT_MSG_S brtcmd = { type, message_xids, .u.id={key,val}};
...@@ -2825,8 +2825,8 @@ int toku_brt_maybe_delete(BRT brt, DBT *key, TOKUTXN txn, BOOL oplsn_valid, LSN ...@@ -2825,8 +2825,8 @@ int toku_brt_maybe_delete(BRT brt, DBT *key, TOKUTXN txn, BOOL oplsn_valid, LSN
if (r!=0) return r; if (r!=0) return r;
} }
LSN treelsn = toku_brt_checkpoint_lsn(brt); LSN treelsn;
if (oplsn_valid && oplsn.lsn <= treelsn.lsn) { if (oplsn_valid && oplsn.lsn <= (treelsn = toku_brt_checkpoint_lsn(brt)).lsn) {
r = 0; r = 0;
} else { } else {
DBT val; DBT val;
...@@ -5377,8 +5377,8 @@ int toku_brt_maybe_delete_both(BRT brt, DBT *key, DBT *val, TOKUTXN txn, BOOL op ...@@ -5377,8 +5377,8 @@ int toku_brt_maybe_delete_both(BRT brt, DBT *key, DBT *val, TOKUTXN txn, BOOL op
if (r!=0) return r; if (r!=0) return r;
} }
LSN treelsn = toku_brt_checkpoint_lsn(brt); LSN treelsn;
if (oplsn_valid && oplsn.lsn <= treelsn.lsn) { if (oplsn_valid && oplsn.lsn <= (treelsn = toku_brt_checkpoint_lsn(brt)).lsn) {
r = 0; r = 0;
} else { } else {
BRT_MSG_S brtcmd = { BRT_DELETE_BOTH, message_xids, .u.id={key,val}}; BRT_MSG_S brtcmd = { BRT_DELETE_BOTH, message_xids, .u.id={key,val}};
......
...@@ -475,19 +475,14 @@ int toku_logger_fsync (TOKULOGGER logger) ...@@ -475,19 +475,14 @@ int toku_logger_fsync (TOKULOGGER logger)
int int
toku_logger_fsync_if_lsn_not_fsynced (TOKULOGGER logger, LSN lsn) { toku_logger_fsync_if_lsn_not_fsynced (TOKULOGGER logger, LSN lsn) {
int r = 0; int r;
if (logger->is_panicked) r = EINVAL; if (logger->is_panicked) return EINVAL;
else if (logger->write_log_files && logger->fsynced_lsn.lsn < lsn.lsn) {
r = ml_lock(&logger->input_lock); assert(r==0); r = ml_lock(&logger->input_lock); assert(r==0);
logger->input_lock_ctr++; logger->input_lock_ctr++;
r = toku_logger_maybe_fsync(logger, lsn, TRUE); r = toku_logger_maybe_fsync(logger, lsn, TRUE);
if (r!=0) { if (r!=0) {
toku_logger_panic(logger, r); toku_logger_panic(logger, r);
} }
else {
assert(logger->fsynced_lsn.lsn >= lsn.lsn);
}
}
return r; return r;
} }
......
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