diff options
Diffstat (limited to 'src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp')
-rw-r--r-- | src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp index aadd47ce543..f5873ff5249 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp @@ -91,6 +91,7 @@ void checkOplogFormatVersion(OperationContext* opCtx, const std::string& uri) { } } // namespace +MONGO_FAIL_POINT_DEFINE(WTCompactRecordStoreEBUSY); MONGO_FAIL_POINT_DEFINE(WTWriteConflictException); MONGO_FAIL_POINT_DEFINE(WTWriteConflictExceptionForReads); @@ -1554,6 +1555,15 @@ Status WiredTigerRecordStore::compact(OperationContext* opCtx) { WT_SESSION* s = WiredTigerRecoveryUnit::get(opCtx)->getSession()->getSession(); opCtx->recoveryUnit()->abandonSnapshot(); int ret = s->compact(s, getURI().c_str(), "timeout=0"); + if (MONGO_unlikely(WTCompactRecordStoreEBUSY.shouldFail())) { + ret = EBUSY; + } + + if (ret == EBUSY) { + return Status(ErrorCodes::Interrupted, + str::stream() << "Compaction interrupted on " << getURI().c_str() + << " due to cache eviction pressure"); + } invariantWTOK(ret); } return Status::OK(); |