summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp
diff options
context:
space:
mode:
authorDianna Hohensee <dianna.hohensee@mongodb.com>2019-10-07 13:17:41 +0000
committerevergreen <evergreen@mongodb.com>2019-10-07 13:17:41 +0000
commit715b58332fb92273af1e0ec2c3e7b3ae1f59b119 (patch)
tree1eba098e581d9c2289a93130bb824d4642725197 /src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp
parent21d8699ed6c517b45e1613e20231cd8eba894985 (diff)
downloadmongo-715b58332fb92273af1e0ec2c3e7b3ae1f59b119.tar.gz
SERVER-43828 We must hold the CheckpointLock around calls to WT compact() because WT does checkpoint'ing during compact operations
Diffstat (limited to 'src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp')
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp
index e8b74cb5193..549475c368e 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp
@@ -481,6 +481,10 @@ Status WiredTigerIndex::compact(OperationContext* opCtx) {
if (!cache->isEphemeral()) {
WT_SESSION* s = WiredTigerRecoveryUnit::get(opCtx)->getSession()->getSession();
opCtx->recoveryUnit()->abandonSnapshot();
+ // WT compact prompts WT to take checkpoints, so we need to take the checkpoint lock around
+ // WT compact calls.
+ auto checkpointLock =
+ opCtx->getServiceContext()->getStorageEngine()->getCheckpointLock(opCtx);
int ret = s->compact(s, uri().c_str(), "timeout=0");
invariantWTOK(ret);
}