From 4fb157d0cf12cd6e9f331b6d8636f845afbe8328 Mon Sep 17 00:00:00 2001 From: "3058078489@qq.com" <3058078489@qq.com> Date: Mon, 17 Jul 2023 20:36:08 +0800 Subject: [PATCH] after we re_wiredtiger_open, we shold close the old connection --- src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp index d71c49eea0703..bedece382463a 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp @@ -674,6 +674,7 @@ void WiredTigerKVEngine::_openWiredTiger(const std::string& path, const std::str "This version of MongoDB is too recent to start up on the existing data files. " "Try MongoDB 4.2 or earlier."); } + invariantWTOK(_conn->close(_conn, nullptr), nullptr); // MongoDB 4.4 doing clean shutdown in FCV 4.2 will use compatibility version 3.3. configStr = wtOpenConfig + ",compatibility=(require_min=\"3.3.0\")"; @@ -682,6 +683,7 @@ void WiredTigerKVEngine::_openWiredTiger(const std::string& path, const std::str _fileVersion = {WiredTigerFileVersion::StartupVersion::IS_44_FCV_42}; return; } + invariantWTOK(_conn->close(_conn, nullptr), nullptr); // MongoDB 4.2 uses compatibility version 3.2. configStr = wtOpenConfig + ",compatibility=(require_min=\"3.2.0\")"; @@ -709,6 +711,7 @@ void WiredTigerKVEngine::_openWiredTiger(const std::string& path, const std::str LOGV2_FATAL_NOTRACE( 28595, "Terminating.", "reason"_attr = wtRCToStatus(ret, nullptr).reason()); } + invariantWTOK(_conn->close(_conn, nullptr), nullptr); // Always attempt to salvage metadata regardless of error code when in repair mode. LOGV2_WARNING(22349, "Attempting to salvage WiredTiger metadata");