summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSusan LoVerso <sue@wiredtiger.com>2015-07-07 11:37:58 -0400
committerRamon Fernandez <ramon.fernandez@mongodb.com>2015-09-25 11:29:27 -0400
commit6bb726540cde2cd0942bf3c9b08bea52355afbef (patch)
tree08ca973b91a2b40f61ff4e3c11175807196eb4b5
parent244f68815ecaf29d136992640390ec2d4a97c1b4 (diff)
downloadmongo-6bb726540cde2cd0942bf3c9b08bea52355afbef.tar.gz
SERVER-18250 On transition from journal to no-journal, run WT recovery.
(cherry picked from commit 8195bb49284a112b9fe620586f2986546c2b0390)
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
index ccf58090be6..c0cd1c76fdd 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
@@ -81,9 +81,9 @@ WiredTigerKVEngine::WiredTigerKVEngine(const std::string& path,
}
}
+ boost::filesystem::path journalPath = path;
+ journalPath /= "journal";
if (_durable) {
- boost::filesystem::path journalPath = path;
- journalPath /= "journal";
if (!boost::filesystem::exists(journalPath)) {
try {
boost::filesystem::create_directory(journalPath);
@@ -102,15 +102,36 @@ WiredTigerKVEngine::WiredTigerKVEngine(const std::string& path,
ss << "session_max=20000,";
ss << "eviction=(threads_max=4),";
ss << "statistics=(fast),";
- if (_durable) {
- ss << "log=(enabled=true,archive=true,path=journal,compressor=";
- ss << wiredTigerGlobalOptions.journalCompressor << "),";
- }
+ // The setting may have a later setting override it if not using the journal. We make it
+ // unconditional here because even nojournal may need this setting if it is a transition
+ // from using the journal.
+ ss << "log=(enabled=true,archive=true,path=journal,compressor=";
+ ss << wiredTigerGlobalOptions.journalCompressor << "),";
ss << "file_manager=(close_idle_time=100000),"; //~28 hours, will put better fix in 3.1.x
ss << "checkpoint=(wait=" << wiredTigerGlobalOptions.checkpointDelaySecs;
ss << ",log_size=2GB),";
ss << "statistics_log=(wait=" << wiredTigerGlobalOptions.statisticsLogDelaySecs << "),";
ss << extraOpenOptions;
+ if (!_durable) {
+ // If we started without the journal, but previously used the journal then open with the
+ // WT log enabled to perform any unclean shutdown recovery and then close and reopen in
+ // the normal path without the journal.
+ if (boost::filesystem::exists(journalPath)) {
+ string config = ss.str();
+ log() << "Detected WT journal files. Running recovery from last checkpoint.";
+ log() << "journal to nojournal transition config: " << config;
+ int ret = wiredtiger_open(path.c_str(), &_eventHandler, config.c_str(), &_conn);
+ if (ret == EINVAL) {
+ fassertFailedNoTrace(28717);
+ } else if (ret != 0) {
+ Status s(wtRCToStatus(ret));
+ msgassertedNoTrace(28718, s.reason());
+ }
+ invariantWTOK(_conn->close(_conn, NULL));
+ }
+ // This setting overrides the earlier setting because it is later in the config string.
+ ss << ",log=(enabled=false),";
+ }
string config = ss.str();
log() << "wiredtiger_open config: " << config;
int ret = wiredtiger_open(path.c_str(), &_eventHandler, config.c_str(), &_conn);