summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2021-11-08 13:51:43 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-09-16 21:05:07 +0000
commit8e000f28edfff5f140351b330ba007345fff736d (patch)
treefe6255080d2042820cdcf641db9c9310272bb112 /src
parent3bbbb44559e851e2fbc962a644dbf1d53acd1228 (diff)
downloadmongo-8e000f28edfff5f140351b330ba007345fff736d.tar.gz
SERVER-61275 Destruct the size storer after the session cache has shutdown
(cherry picked from commit 81569b78ee627263a8e2240e87d46946971aadde)
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
index ec2f78429c9..3cbfc15875a 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
@@ -946,8 +946,6 @@ void WiredTigerKVEngine::_openWiredTiger(const std::string& path, const std::str
void WiredTigerKVEngine::cleanShutdown() {
log() << "WiredTigerKVEngine shutting down";
- if (!_readOnly)
- syncSizeInfo(true);
if (!_conn) {
return;
}
@@ -971,7 +969,6 @@ void WiredTigerKVEngine::cleanShutdown() {
LOG_FOR_RECOVERY(2) << "Shutdown timestamps. StableTimestamp: " << _stableTimestamp.load()
<< " Initial data timestamp: " << _initialDataTimestamp.load();
- _sizeStorer.reset();
_sessionCache->shuttingDown();
// We want WiredTiger to leak memory for faster shutdown except when we are running tools to look
@@ -981,6 +978,16 @@ void WiredTigerKVEngine::cleanShutdown() {
#else
bool leak_memory = false;
#endif
+ if (!_readOnly) {
+ syncSizeInfo(/*syncToDisk=*/true);
+ }
+
+ // The size storer has to be destructed after the session cache has shut down. This sets the
+ // shutdown flag internally in the session cache. As operations get interrupted during shutdown,
+ // they release their session back to the session cache. If the shutdown flag has been set,
+ // released sessions will skip flushing the size storer.
+ _sizeStorer.reset();
+
std::string closeConfig = "";
if (RUNNING_ON_VALGRIND) {