diff options
author | Luke Chen <luke.chen@mongodb.com> | 2018-05-18 13:38:23 +1000 |
---|---|---|
committer | Luke Chen <luke.chen@mongodb.com> | 2018-05-18 13:38:23 +1000 |
commit | 024f0a60461bc49f9627447490acd37b76c6a724 (patch) | |
tree | 423a6ef229109f0e84f5ab3243e9a2ec8b7cd7db /src/third_party/wiredtiger/src/log/log.c | |
parent | 25b0e6f7d22de88faaa7e223195992e995acdff4 (diff) | |
download | mongo-024f0a60461bc49f9627447490acd37b76c6a724.tar.gz |
Import wiredtiger: fe04ad07ab7608718bc24aa5f9e0103aaec26b02 from branch mongodb-3.8
ref: ba76f72622..fe04ad07ab
for: 4.0.0-rc0
WT-3698 Threads doing eviction can stall indefinitely when timestamps fail to advance
WT-4000 Avoid getting two snapshots when setting a read_timestamp
WT-4004 format snapshot-isolation search mismatch failure
WT-4016 Measure and improve lookaside performance with stable_timestamp set
WT-4029 Bump the log file version
WT-4056 New API to configure a minimum compatibility version on open
WT-4060 Clean up __wt_getenv() error handling.
WT-4074 Lint fixes
WT-4078 Splits can leak a page lock if memory allocation fails.
WT-4080 gcc8 -Wparentheses complains about WiredTiger's __F() macro.
WT-4081 Improve errors and documentation for syscall.py
WT-4086 Verify log file versions before opening logging subsystem
Diffstat (limited to 'src/third_party/wiredtiger/src/log/log.c')
-rw-r--r-- | src/third_party/wiredtiger/src/log/log.c | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/src/third_party/wiredtiger/src/log/log.c b/src/third_party/wiredtiger/src/log/log.c index 87ed32d80de..fb39257fe4c 100644 --- a/src/third_party/wiredtiger/src/log/log.c +++ b/src/third_party/wiredtiger/src/log/log.c @@ -165,7 +165,12 @@ __log_wait_for_earlier_slot(WT_SESSION_IMPL *session, WT_LOGSLOT *slot) */ if (F_ISSET(session, WT_SESSION_LOCKED_SLOT)) __wt_spin_unlock(session, &log->log_slot_lock); - __wt_cond_signal(session, conn->log_wrlsn_cond); + /* + * This may not be initialized if we are starting at an + * older log file version. So only signal if valid. + */ + if (conn->log_wrlsn_cond != NULL) + __wt_cond_signal(session, conn->log_wrlsn_cond); if (++yield_count < WT_THOUSAND) __wt_yield(); else @@ -191,8 +196,12 @@ __log_fs_write(WT_SESSION_IMPL *session, * compatibility mode to an older release, we have to wait for all * writes to the previous log file to complete otherwise there could * be a hole at the end of the previous log file that we cannot detect. + * + * NOTE: Check for a version less than the one writing the system + * record since we've had a log version change without any actual + * file format changes. */ - if (S2C(session)->log->log_version != WT_LOG_VERSION && + if (S2C(session)->log->log_version < WT_LOG_VERSION_SYSTEM && slot->slot_release_lsn.l.file < slot->slot_start_lsn.l.file) { __log_wait_for_earlier_slot(session, slot); WT_RET(__wt_log_force_sync(session, &slot->slot_release_lsn)); @@ -960,12 +969,23 @@ __log_open_verify(WT_SESSION_IMPL *session, uint32_t id, WT_FH **fhp, */ if (desc->version > WT_LOG_VERSION) WT_ERR_MSG(session, WT_ERROR, - "unsupported WiredTiger file version: this build " + "unsupported WiredTiger file version: this build" " only supports versions up to %d," " and the file is version %" PRIu16, WT_LOG_VERSION, desc->version); /* + * We error if the log version is less than the required minimum. + */ + if (conn->compat_req_major != WT_CONN_COMPAT_NONE && + desc->version < conn->log_req_version) + WT_ERR_MSG(session, WT_ERROR, + "unsupported WiredTiger file version: this build" + " requires a minimum version of %" PRIu16 "," + " and the file is version %" PRIu16, + conn->log_req_version, desc->version); + + /* * Set up the return values if the magic number is valid. */ if (versionp != NULL) @@ -1187,7 +1207,7 @@ __log_newfile(WT_SESSION_IMPL *session, bool conn_open, bool *created) * If we're running the version where we write a system record * do so now and update the alloc_lsn. */ - if (log->log_version == WT_LOG_VERSION) { + if (log->log_version >= WT_LOG_VERSION_SYSTEM) { WT_RET(__wt_log_system_record(session, log_fh, &logrec_lsn)); WT_SET_LSN(&log->alloc_lsn, log->fileid, log->first_record); @@ -1572,8 +1592,16 @@ __wt_log_open(WT_SESSION_IMPL *session) if (firstlog == UINT32_MAX) { WT_ASSERT(session, logcount == 0); WT_INIT_LSN(&log->first_lsn); - } else + } else { WT_SET_LSN(&log->first_lsn, firstlog, 0); + /* + * If we have existing log files, check the last log now before + * we create a new log file so that we can detect an unsupported + * version before modifying the file space. + */ + WT_ERR(__log_open_verify(session, + lastlog, NULL, NULL, &version)); + } /* * Start logging at the beginning of the next log file, no matter |