summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2016-05-31 23:31:47 +1000
committersueloverso <sue@mongodb.com>2016-05-31 09:31:47 -0400
commitb89aaece7b2a58d183a0a2b33e20157ad7f02258 (patch)
tree4b1bebf0bcb89353507f6fb9b53beca4f98ce6e5
parent564f8703ad2633370767fa632c4eba5e4147469b (diff)
downloadmongo-b89aaece7b2a58d183a0a2b33e20157ad7f02258.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.
-rw-r--r--src/log/log.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/log/log.c b/src/log/log.c
index 1c4298b73e5..01bfb97718f 100644
--- a/src/log/log.c
+++ b/src/log/log.c
@@ -2137,10 +2137,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.
*/