diff options
author | Paolo Polato <paolo.polato@mongodb.com> | 2021-05-12 10:52:55 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-05-12 13:01:02 +0000 |
commit | 7d0aee4c7dec9380c3ef8be20c31b1334b27cd20 (patch) | |
tree | 53984071023d1330a420e2d5d427d6b819312b6d | |
parent | 7b9eb05ea26dd0adba9c097ba1fe68dc3c2e1ba1 (diff) | |
download | mongo-7d0aee4c7dec9380c3ef8be20c31b1334b27cd20.tar.gz |
SERVER-56307 Ensure that the estimated size of an object id is always bigger than zero.
-rw-r--r-- | src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp | 7 |
1 files changed, 4 insertions, 3 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 6b65ecd7a50..1d13f3728fd 100644 --- a/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp +++ b/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp @@ -898,7 +898,8 @@ Status MigrationChunkClonerSourceLegacy::_storeCurrentLocs(OperationContext* opC const uint64_t collectionAverageObjectSize = collection->averageObjectSize(opCtx); - uint64_t averageObjectIdSize = OID::kOIDSize; + uint64_t averageObjectIdSize = 0; + const uint64_t defaultObjectIdSize = OID::kOIDSize; if (totalRecs > 0) { const auto idIdx = collection->getIndexCatalog()->findIdIndex(opCtx)->getEntry(); if (!idIdx) { @@ -921,8 +922,8 @@ Status MigrationChunkClonerSourceLegacy::_storeCurrentLocs(OperationContext* opC } stdx::lock_guard<Latch> lk(_mutex); - _averageObjectSizeForCloneLocs = collectionAverageObjectSize + 12; - _averageObjectIdSize = averageObjectIdSize; + _averageObjectSizeForCloneLocs = collectionAverageObjectSize + defaultObjectIdSize; + _averageObjectIdSize = std::max(averageObjectIdSize, defaultObjectIdSize); return Status::OK(); } |