diff options
author | Josef Ahmad <josef.ahmad@mongodb.com> | 2022-05-06 12:44:49 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-05-06 13:35:54 +0000 |
commit | cbf1bfcb04a0e4c9301d787df99b5810bcbce075 (patch) | |
tree | 489cc246b3364f6a63b2a7d5f815935174175923 /src/mongo | |
parent | fdd443b5525b4f520852dba6991c4071021a1629 (diff) | |
download | mongo-cbf1bfcb04a0e4c9301d787df99b5810bcbce075.tar.gz |
SERVER-66105 Lower the batched deleter staging target to 2MB
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/db/exec/batched_delete_stage.cpp | 20 | ||||
-rw-r--r-- | src/mongo/db/exec/batched_delete_stage.idl | 4 |
2 files changed, 20 insertions, 4 deletions
diff --git a/src/mongo/db/exec/batched_delete_stage.cpp b/src/mongo/db/exec/batched_delete_stage.cpp index c993157ba44..79a12600418 100644 --- a/src/mongo/db/exec/batched_delete_stage.cpp +++ b/src/mongo/db/exec/batched_delete_stage.cpp @@ -99,6 +99,7 @@ struct BatchedDeletesSSS : ServerStatusSection { bob.appendNumber("docs", docs.loadRelaxed()); bob.appendNumber("stagedSizeBytes", stagedSizeBytes.loadRelaxed()); bob.appendNumber("timeInBatchMillis", timeInBatchMillis.loadRelaxed()); + bob.appendNumber("refetchesDueToYield", refetchesDueToYield.loadRelaxed()); return bob.obj(); } @@ -107,8 +108,23 @@ struct BatchedDeletesSSS : ServerStatusSection { AtomicWord<long long> docs; AtomicWord<long long> stagedSizeBytes; AtomicWord<long long> timeInBatchMillis; + AtomicWord<long long> refetchesDueToYield; } batchedDeletesSSS; +// Wrapper for write_stage_common::ensureStillMatches() which also updates the 'refetchesDueToYield' +// serverStatus metric. +bool ensureStillMatchesAndUpdateStats(const CollectionPtr& collection, + OperationContext* opCtx, + WorkingSet* ws, + WorkingSetID id, + const CanonicalQuery* cq) { + WorkingSetMember* member = ws->get(id); + if (opCtx->recoveryUnit()->getSnapshotId() != member->doc.snapshotId()) { + incrementSSSMetricNoOverflow(batchedDeletesSSS.refetchesDueToYield, 1); + } + return write_stage_common::ensureStillMatches(collection, opCtx, ws, id, cq); +} + BatchedDeleteStage::BatchedDeleteStage(ExpressionContext* expCtx, std::unique_ptr<DeleteStageParams> params, std::unique_ptr<BatchedDeleteStageBatchParams> batchParams, @@ -248,7 +264,7 @@ PlanStage::StageState BatchedDeleteStage::_deleteBatch(WorkingSetID* out) { // The PlanExecutor YieldPolicy may change snapshots between calls to 'doWork()'. // Different documents may have different snapshots. - bool docStillMatches = write_stage_common::ensureStillMatches( + bool docStillMatches = ensureStillMatchesAndUpdateStats( collection(), opCtx(), _ws, workingSetMemberID, _params->canonicalQuery); WorkingSetMember* member = _ws->get(workingSetMemberID); @@ -271,7 +287,7 @@ PlanStage::StageState BatchedDeleteStage::_deleteBatch(WorkingSetID* out) { // Committing the original WUOW and creating a new WUOW has the side effect of // allocating a new snapshot, so we have to re-check whether the staged document // still matches the query predicate. - if (!write_stage_common::ensureStillMatches( + if (!ensureStillMatchesAndUpdateStats( collection(), opCtx(), _ws, workingSetMemberID, _params->canonicalQuery)) { recordsToSkip.insert(workingSetMemberID); break; diff --git a/src/mongo/db/exec/batched_delete_stage.idl b/src/mongo/db/exec/batched_delete_stage.idl index 73b0918f9ec..d4f7dc6a6be 100644 --- a/src/mongo/db/exec/batched_delete_stage.idl +++ b/src/mongo/db/exec/batched_delete_stage.idl @@ -38,7 +38,7 @@ server_parameters: set_at: [startup, runtime] cpp_vartype: 'AtomicWord<long long>' cpp_varname: gBatchedDeletesTargetStagedDocBytes - default: 31457280 # 30MB + default: 2097152 # 2MB validator: gte: 0 batchedDeletesTargetBatchDocs: @@ -46,7 +46,7 @@ server_parameters: set_at: [startup, runtime] cpp_vartype: 'AtomicWord<long long>' cpp_varname: "gBatchedDeletesTargetBatchDocs" - default: 10 # TODO (SERVER-64547): re-evaluate this default. + default: 10 validator: gte: 0 batchedDeletesTargetBatchTimeMS: |