diff options
author | Michael Cahill <michael.cahill@mongodb.com> | 2016-05-31 23:31:47 +1000 |
---|---|---|
committer | Michael Cahill <michael.cahill@mongodb.com> | 2016-06-01 12:44:46 +1000 |
commit | 5d215904c395bc47376ce4194e9a0a67a44f722b (patch) | |
tree | 24c6b897e7f3e660652e85d3f9540deeedf6875c | |
parent | 18879587afa9fe5fc2ebf9e5f86236b7ac50c082 (diff) | |
download | mongo-5d215904c395bc47376ce4194e9a0a67a44f722b.tar.gz |
SERVER-24306 Fix stall in log_flush switching to new files. (#2761)
* SERVER-24306 Fix stall in log_flush switching to new files.
* Pass boolean false rather than 0.
(cherry picked from commit b89aaece7b2a58d183a0a2b33e20157ad7f02258)
-rw-r--r-- | src/log/log.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/log/log.c b/src/log/log.c index b43cc56a908..b11cd55844d 100644 --- a/src/log/log.c +++ b/src/log/log.c @@ -2140,10 +2140,19 @@ __wt_log_flush(WT_SESSION_IMPL *session, uint32_t flags) * We need to flush out the current slot first to get the real * end of log LSN in log->alloc_lsn. */ - WT_RET(__wt_log_flush_lsn(session, &lsn, 0)); + WT_RET(__wt_log_flush_lsn(session, &lsn, false)); last_lsn = log->alloc_lsn; /* + * If the last write caused a switch to a new log file, we should only + * wait for the last write to be flushed. Otherwise, if the workload + * is single-threaded we could wait here forever because the write LSN + * doesn't switch into the new file until it contains a record. + */ + if (last_lsn.l.offset == WT_LOG_FIRST_RECORD) + last_lsn = log->log_close_lsn; + + /* * Wait until all current outstanding writes have been written * to the file system. */ |