diff options
author | Daniel Gottlieb <daniel.gottlieb@mongodb.com> | 2018-06-14 15:59:01 -0400 |
---|---|---|
committer | Daniel Gottlieb <daniel.gottlieb@mongodb.com> | 2018-06-14 15:59:01 -0400 |
commit | efcf4332fd26af56452807d69d40ca78ccaf072d (patch) | |
tree | e3b64e812aa036fa27f8fbe2a79a840d6fd2abf5 | |
parent | e730f7c6abee87b6f521b15d730e1044635eb7c6 (diff) | |
download | mongo-efcf4332fd26af56452807d69d40ca78ccaf072d.tar.gz |
Revert "SERVER-35271: Suppress WT compatibility error messages on startup."
This reverts commit 41954217c7c132bb7ad49dff49bdba20681ab36a.
4 files changed, 19 insertions, 78 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp index 493befbfddb..9c148434c76 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp @@ -75,6 +75,7 @@ #include "mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h" #include "mongo/db/storage/wiredtiger/wiredtiger_session_cache.h" #include "mongo/db/storage/wiredtiger/wiredtiger_size_storer.h" +#include "mongo/db/storage/wiredtiger/wiredtiger_util.h" #include "mongo/platform/atomic_word.h" #include "mongo/stdx/memory.h" #include "mongo/util/background.h" @@ -185,7 +186,6 @@ void openWiredTiger(const std::string& path, return; } - severe() << "Failed to start up WiredTiger under any compatibility version."; if (ret == EINVAL) { fassertFailedNoTrace(28561); } @@ -448,7 +448,8 @@ WiredTigerKVEngine::WiredTigerKVEngine(const std::string& canonicalName, bool ephemeral, bool repair, bool readOnly) - : _clockSource(cs), + : _eventHandler(WiredTigerUtil::defaultEventHandlers()), + _clockSource(cs), _oplogManager(stdx::make_unique<WiredTigerOplogManager>()), _canonicalName(canonicalName), _path(path), @@ -516,8 +517,7 @@ WiredTigerKVEngine::WiredTigerKVEngine(const std::string& canonicalName, 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.getWtEventHandler(), config.c_str(), &_conn); + int ret = wiredtiger_open(path.c_str(), &_eventHandler, config.c_str(), &_conn); if (ret == EINVAL) { fassertFailedNoTrace(28717); } else if (ret != 0) { @@ -539,8 +539,7 @@ WiredTigerKVEngine::WiredTigerKVEngine(const std::string& canonicalName, string config = ss.str(); log() << "wiredtiger_open config: " << config; - openWiredTiger(path, _eventHandler.getWtEventHandler(), config, &_conn, &_fileVersion); - _eventHandler.setStartupSuccessful(); + openWiredTiger(path, &_eventHandler, config, &_conn, &_fileVersion); _wtOpenConfig = config; { @@ -669,8 +668,7 @@ void WiredTigerKVEngine::cleanShutdown() { WT_CONNECTION* conn; std::stringstream openConfig; openConfig << _wtOpenConfig << ",log=(archive=false)"; - invariantWTOK(wiredtiger_open( - _path.c_str(), _eventHandler.getWtEventHandler(), openConfig.str().c_str(), &conn)); + invariantWTOK(wiredtiger_open(_path.c_str(), &_eventHandler, openConfig.str().c_str(), &conn)); WT_SESSION* session; conn->open_session(conn, nullptr, "", &session); diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h index e0f9e46e59a..98806dd4222 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h @@ -42,7 +42,6 @@ #include "mongo/db/storage/kv/kv_engine.h" #include "mongo/db/storage/wiredtiger/wiredtiger_oplog_manager.h" #include "mongo/db/storage/wiredtiger/wiredtiger_session_cache.h" -#include "mongo/db/storage/wiredtiger/wiredtiger_util.h" #include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/util/elapsed_tracker.h" @@ -284,7 +283,7 @@ private: void _setOldestTimestamp(Timestamp oldestTimestamp, bool force = false); WT_CONNECTION* _conn; - WiredTigerEventHandler _eventHandler; + WT_EVENT_HANDLER _eventHandler; std::unique_ptr<WiredTigerSessionCache> _sessionCache; ClockSource* const _clockSource; diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp index d6dda1ba857..bfa26ed8772 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp @@ -381,32 +381,6 @@ size_t WiredTigerUtil::getCacheSizeMB(double requestedCacheSizeGB) { } namespace { -int mdb_handle_error_with_startup_suppression(WT_EVENT_HANDLER* handler, - WT_SESSION* session, - int errorCode, - const char* message) { - WiredTigerEventHandler* wtHandler = reinterpret_cast<WiredTigerEventHandler*>(handler); - - try { - StringData sd(message); - if (!wtHandler->wasStartupSuccessful()) { - // During startup, storage tries different WiredTiger compatibility modes to determine - // the state of the data files before FCV can be read. Suppress the error messages - // regarding expected version compatibility requirements. - if (sd.find("Version incompatibility detected:") != std::string::npos) { - return 0; - } - } - - error() << "WiredTiger error (" << errorCode << ") " << redact(message) - << " Raw: " << message; - fassert(50853, errorCode != WT_PANIC); - } catch (...) { - std::terminate(); - } - return 0; -} - int mdb_handle_error(WT_EVENT_HANDLER* handler, WT_SESSION* session, int errorCode, @@ -441,26 +415,15 @@ int mdb_handle_progress(WT_EVENT_HANDLER* handler, return 0; } +} -WT_EVENT_HANDLER defaultEventHandlers() { +WT_EVENT_HANDLER WiredTigerUtil::defaultEventHandlers() { WT_EVENT_HANDLER handlers = {}; handlers.handle_error = mdb_handle_error; handlers.handle_message = mdb_handle_message; handlers.handle_progress = mdb_handle_progress; return handlers; } -} - -WT_EVENT_HANDLER* WiredTigerEventHandler::getWtEventHandler() { - WT_EVENT_HANDLER* ret = static_cast<WT_EVENT_HANDLER*>(this); - invariant((void*)this == (void*)ret); - - ret->handle_error = mdb_handle_error_with_startup_suppression; - ret->handle_message = mdb_handle_message; - ret->handle_progress = mdb_handle_progress; - - return ret; -} WiredTigerUtil::ErrorAccumulator::ErrorAccumulator(std::vector<std::string>* errors) : WT_EVENT_HANDLER(defaultEventHandlers()), diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_util.h b/src/mongo/db/storage/wiredtiger/wiredtiger_util.h index a3c1b9deae0..5817a5855f6 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_util.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_util.h @@ -90,35 +90,6 @@ struct WiredTigerItem : public WT_ITEM { } }; -/** - * Returns a WT_EVENT_HANDLER with MongoDB's default handlers. - * The default handlers just log so it is recommended that you consider calling them even if - * you are capturing the output. - * - * There is no default "close" handler. You only need to provide one if you need to call a - * destructor. - */ -class WiredTigerEventHandler : private WT_EVENT_HANDLER { -public: - WT_EVENT_HANDLER* getWtEventHandler(); - - bool wasStartupSuccessful() { - return _startupSuccessful; - } - - void setStartupSuccessful() { - _startupSuccessful = true; - } - -private: - int suppressibleStartupErrorLog(WT_EVENT_HANDLER* handler, - WT_SESSION* sesion, - int errorCode, - const char* message); - - bool _startupSuccessful = false; -}; - class WiredTigerUtil { MONGO_DISALLOW_COPYING(WiredTigerUtil); @@ -212,6 +183,16 @@ public: */ static size_t getCacheSizeMB(double requestedCacheSizeGB); + /** + * Returns a WT_EVENT_HANDER with MongoDB's default handlers. + * The default handlers just log so it is recommended that you consider calling them even if + * you are capturing the output. + * + * There is no default "close" handler. You only need to provide one if you need to call a + * destructor. + */ + static WT_EVENT_HANDLER defaultEventHandlers(); + class ErrorAccumulator : public WT_EVENT_HANDLER { public: ErrorAccumulator(std::vector<std::string>* errors); |