diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/server_recovery.h | 3 | ||||
-rw-r--r-- | src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp | 9 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/mongo/db/server_recovery.h b/src/mongo/db/server_recovery.h index 3b9d87a8065..e78653d768a 100644 --- a/src/mongo/db/server_recovery.h +++ b/src/mongo/db/server_recovery.h @@ -34,6 +34,7 @@ #include "mongo/db/service_context.h" #include "mongo/platform/mutex.h" +#include "mongo/util/string_map.h" namespace mongo { /** @@ -82,7 +83,7 @@ public: private: mutable Mutex _mutex = MONGO_MAKE_LATCH("SizeRecoveryState::_mutex"); - std::set<std::string> _collectionsAlwaysNeedingSizeAdjustment; + StringSet _collectionsAlwaysNeedingSizeAdjustment; }; /** diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp index f5873ff5249..eed04767a6e 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp @@ -1731,6 +1731,15 @@ void WiredTigerRecordStore::_initNextIdIfNeeded(OperationContext* opCtx) { return; } + // During startup recovery, the collectionAlwaysNeedsSizeAdjustment flag is not set by default + // for the sake of efficiency. However, if we reach this point, we may need to set it in order + // to ensure that capped deletes can occur on documents inserted earlier in startup recovery. + if (inReplicationRecovery(getGlobalServiceContext()) && + !sizeRecoveryState(getGlobalServiceContext()) + .collectionAlwaysNeedsSizeAdjustment(getIdent())) { + checkSize(opCtx); + } + // Need to start at 1 so we are always higher than RecordId::min() int64_t nextId = 1; |