diff options
author | Paolo Polato <paolo.polato@mongodb.com> | 2021-10-26 10:34:09 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-08-12 09:23:01 +0000 |
commit | 6a1a5e6e1a74ee330c8334508e3e21592454b5b8 (patch) | |
tree | 7e0fe877c34e7bd5f3edf66b872eb839e9769114 | |
parent | 45b0de247015e40738b886aefd3b2204b66b463d (diff) | |
download | mongo-6a1a5e6e1a74ee330c8334508e3e21592454b5b8.tar.gz |
SERVER-60958 Access info on SessionCatalogMigrationSource outside of the Cloner protected section
(cherry picked from commit dc5de6843f2e9c5ef2f351bbd85d61251f4b7848)
-rw-r--r-- | src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp b/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp index 58871e2759c..1da7e80b7b2 100644 --- a/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp +++ b/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp @@ -1026,6 +1026,11 @@ Status MigrationChunkClonerSourceLegacy::_checkRecipientCloningStatus(OperationC } iteration++; + const auto sessionCatalogSourceInCatchupPhase = _sessionCatalogSource->inCatchupPhase(); + const auto estimateUntransferredSessionsSize = sessionCatalogSourceInCatchupPhase + ? _sessionCatalogSource->untransferredCatchUpDataSize() + : std::numeric_limits<int64_t>::max(); + stdx::lock_guard<Latch> sl(_mutex); const std::size_t cloneLocsRemaining = _cloneLocs.size(); @@ -1048,8 +1053,8 @@ Status MigrationChunkClonerSourceLegacy::_checkRecipientCloningStatus(OperationC "docsRemainingToClone"_attr = cloneLocsRemaining); } - if (res["state"].String() == "steady" && _sessionCatalogSource->inCatchupPhase() && - _sessionCatalogSource->untransferredCatchUpDataSize() == 0) { + if (res["state"].String() == "steady" && sessionCatalogSourceInCatchupPhase && + estimateUntransferredSessionsSize == 0) { if (cloneLocsRemaining != 0 || (_jumboChunkCloneState && _forceJumbo && PlanExecutor::IS_EOF != _jumboChunkCloneState->clonerState)) { @@ -1075,15 +1080,13 @@ Status MigrationChunkClonerSourceLegacy::_checkRecipientCloningStatus(OperationC } if ((res["state"].String() == "steady" || res["state"].String() == "catchup") && - _sessionCatalogSource->inCatchupPhase() && supportsCriticalSectionDuringCatchUp) { + sessionCatalogSourceInCatchupPhase && supportsCriticalSectionDuringCatchUp) { int64_t estimatedUntransferredModsSize = _untransferredDeletesCounter * _averageObjectIdSize + _untransferredUpsertsCounter * _averageObjectSizeForCloneLocs; auto estimatedUntransferredChunkPercentage = (std::min(_args.getMaxChunkSizeBytes(), estimatedUntransferredModsSize) * 100) / _args.getMaxChunkSizeBytes(); - int64_t estimateUntransferredSessionsSize = - _sessionCatalogSource->untransferredCatchUpDataSize(); int64_t maxUntransferredSessionsSize = BSONObjMaxUserSize * _args.getMaxChunkSizeBytes() / ChunkSizeSettingsType::kDefaultMaxChunkSizeBytes; if (estimatedUntransferredChunkPercentage < maxCatchUpPercentageBeforeBlockingWrites && |