Skip to content

Commit

Permalink
WT-1975 Wait for sync_lsn of earlier log files to complete for forced
Browse files Browse the repository at this point in the history
sync.
  • Loading branch information
sueloverso committed Jun 24, 2015
1 parent 0efd205 commit 97b9e03
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/conn/conn_log.c
Expand Up @@ -318,6 +318,8 @@ __log_file_server(void *arg)
__wt_spin_lock(session, &log->log_sync_lock);
locked = 1;
WT_ERR(__wt_close(session, &close_fh));
WT_ASSERT(session,
WT_LOG_CMP(&close_end_lsn, &log->sync_lsn) >= 0);
log->sync_lsn = close_end_lsn;
WT_ERR(__wt_cond_signal(session, log->log_sync_cond));
locked = 0;
Expand Down
13 changes: 13 additions & 0 deletions src/log/log.c
Expand Up @@ -71,6 +71,19 @@ __wt_log_force_sync(WT_SESSION_IMPL *session, WT_LSN *min_lsn)

log = S2C(session)->log;

/*
* We need to wait for the previous log file to get written
* to disk before we sync out the current one and advance
* the LSN. Signal the worker thread because we know the
* LSN has moved into a later log file and there should be a
* log file ready to close.
*/
while (log->sync_lsn.file < min_lsn->file) {
WT_ERR(__wt_cond_signal(session,
S2C(session)->log_file_cond));
WT_ERR(__wt_cond_wait(
session, log->log_sync_cond, 10000));
}
__wt_spin_lock(session, &log->log_sync_lock);
WT_ASSERT(session, log->log_dir_fh != NULL);
/*
Expand Down

0 comments on commit 97b9e03

Please sign in to comment.