summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/log/log.c
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2018-11-02 16:36:36 +1100
committerLuke Chen <luke.chen@mongodb.com>2018-11-02 16:36:36 +1100
commita19da30a1bf7462c9a8a0533c43f98bd13fbb190 (patch)
tree090e8225ea84e4971a077dd26dadf3c61068bf33 /src/third_party/wiredtiger/src/log/log.c
parent1559bd33d108e58ffdc0df5fa2af4cc163ae9721 (diff)
downloadmongo-a19da30a1bf7462c9a8a0533c43f98bd13fbb190.tar.gz
Import wiredtiger: e8cf194d813096cc2b30c0dd2d9d9c93ade79756 from branch mongodb-4.2
ref: 22b1224ee0..e8cf194d81 for: 4.1.5 WT-4298 Fix workgen to retry on WT_ROLLBACK and clear ops after warmup WT-4343 Unlock when sleeping to allow other log threads to make progress WT-4371 Workgen improvements to create a MongoDB-like workload WT-4376 Fix a bug where table index open can race WT-4385 Prepare-conflict during a cursor scan can return the wrong key WT-4392 A large lint change WT-4395 Seg fault walking corrupted log with log cursor WT-4396 When retrying after prepare-conflict, cursor unable to find a valid update WT-4400 Fix workgen use of PRIxxx macros, needed for old C++ compilers
Diffstat (limited to 'src/third_party/wiredtiger/src/log/log.c')
-rw-r--r--src/third_party/wiredtiger/src/log/log.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/third_party/wiredtiger/src/log/log.c b/src/third_party/wiredtiger/src/log/log.c
index 9a5854c8195..690c5841ac8 100644
--- a/src/third_party/wiredtiger/src/log/log.c
+++ b/src/third_party/wiredtiger/src/log/log.c
@@ -1230,8 +1230,18 @@ __log_newfile(WT_SESSION_IMPL *session, bool conn_open, bool *created)
WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_SLOT));
for (yield_cnt = 0; log->log_close_fh != NULL;) {
WT_STAT_CONN_INCR(session, log_close_yields);
+ /*
+ * Processing slots will conditionally signal the file close
+ * server thread. But if we've tried a while, signal the
+ * thread directly here.
+ */
__wt_log_wrlsn(session, NULL);
- if (++yield_cnt > 10000)
+ if (++yield_cnt % WT_THOUSAND == 0) {
+ __wt_spin_unlock(session, &log->log_slot_lock);
+ __wt_cond_signal(session, conn->log_file_cond);
+ __wt_spin_lock(session, &log->log_slot_lock);
+ }
+ if (++yield_cnt > WT_THOUSAND * 10)
return (__wt_set_return(session, EBUSY));
__wt_yield();
}
@@ -2501,6 +2511,8 @@ advance:
* the first pass through recovery. In the second pass
* where we truncate the log, this is where it should
* end.
+ * Continue processing where possible, so remember any
+ * error returns, but don't skip to the error handler.
*/
if (log != NULL)
log->trunc_lsn = rd_lsn;
@@ -2537,7 +2549,7 @@ advance:
* must be salvaged.
*/
need_salvage = true;
- WT_ERR(__log_salvage_message(session,
+ WT_TRET(__log_salvage_message(session,
log_fh->name, ", bad checksum",
rd_lsn.l.offset));
} else {
@@ -2546,11 +2558,11 @@ advance:
* that the header is corrupt. Make a sanity
* check of the log record header.
*/
- WT_ERR(__log_record_verify(session, log_fh,
+ WT_TRET(__log_record_verify(session, log_fh,
rd_lsn.l.offset, logrec, &corrupt));
if (corrupt) {
need_salvage = true;
- WT_ERR(__log_salvage_message(session,
+ WT_TRET(__log_salvage_message(session,
log_fh->name, "", rd_lsn.l.offset));
}
}
@@ -2603,7 +2615,8 @@ advance:
__wt_verbose(session, WT_VERB_LOG,
"End of recovery truncate end of log %" PRIu32 "/%" PRIu32,
rd_lsn.l.file, rd_lsn.l.offset);
- WT_ERR(__log_truncate(session, &rd_lsn, false, false));
+ /* Preserve prior error and fall through to error handling. */
+ WT_TRET(__log_truncate(session, &rd_lsn, false, false));
}
err: WT_STAT_CONN_INCR(session, log_scans);
@@ -2623,7 +2636,7 @@ err: WT_STAT_CONN_INCR(session, log_scans);
* an error recovery is likely going to fail. Try to provide
* a helpful failure message.
*/
- if (ret != 0 && firstrecord) {
+ if (ret != 0 && firstrecord && LF_ISSET(WT_LOGSCAN_RECOVER)) {
__wt_errx(session,
"WiredTiger is unable to read the recovery log.");
__wt_errx(session, "This may be due to the log"