summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Polato <paolo.polato@mongodb.com>2021-10-26 10:34:09 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-08-12 10:46:55 +0000
commit3ef1f617c9a91c14e03056f3c83281bc5d892819 (patch)
tree88442f7b55e6dd20d9b5d2647399cd230d45dde6
parent92d24c1d5d7d092638445651db44d1be9bf0e32c (diff)
downloadmongo-3ef1f617c9a91c14e03056f3c83281bc5d892819.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.cpp13
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 ee26d0d0edf..84c4fe4f8c3 100644
--- a/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp
+++ b/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp
@@ -1110,6 +1110,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();
@@ -1132,8 +1137,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)) {
@@ -1159,15 +1164,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 &&