summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorMax Hirschhorn <max.hirschhorn@mongodb.com>2022-09-10 15:55:51 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-09-10 16:34:21 +0000
commit27c853347660310304d6fe2a3870a9a083aba953 (patch)
treec1e2ac60d74910769440dffb0c690a9e1d7c6199 /src/mongo/db
parent9fb29bd06a20abd76b956025757d64bafffec0d1 (diff)
downloadmongo-27c853347660310304d6fe2a3870a9a083aba953.tar.gz
Revert "SERVER-69552 Handle range deleter service `onStepDown` race conditions"
This reverts commit 289aeb5651069bf176a3310c2d0157ce80809268.
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/repl/replica_set_aware_service.h3
-rw-r--r--src/mongo/db/s/range_deleter_service.cpp14
2 files changed, 3 insertions, 14 deletions
diff --git a/src/mongo/db/repl/replica_set_aware_service.h b/src/mongo/db/repl/replica_set_aware_service.h
index a6b723163c3..3f099610a5c 100644
--- a/src/mongo/db/repl/replica_set_aware_service.h
+++ b/src/mongo/db/repl/replica_set_aware_service.h
@@ -148,9 +148,6 @@ public:
/**
* Called after the node has transitioned out of PRIMARY. Usually this is into SECONDARY, but it
* could also be into ROLLBACK or REMOVED.
- *
- * NB: also called when SECONDARY nodes transition to ROLLBACK, hence it should never be assumed
- * that `onStepUp` hooks have been invoked at least once before this method is invoked.
*/
virtual void onStepDown() = 0;
diff --git a/src/mongo/db/s/range_deleter_service.cpp b/src/mongo/db/s/range_deleter_service.cpp
index 5c111641345..acc97caeea9 100644
--- a/src/mongo/db/s/range_deleter_service.cpp
+++ b/src/mongo/db/s/range_deleter_service.cpp
@@ -165,12 +165,7 @@ void RangeDeleterService::_recoverRangeDeletionsOnStepUp(OperationContext* opCtx
"Finished resubmitting range deletion tasks",
"nRescheduledTasks"_attr = nRescheduledTasks);
- auto lock = _acquireMutexUnconditionally();
- // Since the recovery is only spawned on step-up but may complete later, it's not
- // assumable that the node is still primary when the all resubmissions finish
- if (_state.load() != kDown) {
- this->_state.store(kUp);
- }
+ this->_state.store(kUp);
})
.getAsync([](auto) {});
}
@@ -181,12 +176,9 @@ void RangeDeleterService::onStepDown() {
}
auto lock = _acquireMutexUnconditionally();
+ dassert(_state.load() != kDown, "Service expected to be initializing/up before stepping down");
- // It may happen for the `onStepDown` hook to be invoked on a SECONDARY node transitioning
- // to ROLLBACK, hence the executor may have never been initialized
- if (_executor) {
- _executor->shutdown();
- }
+ _executor->shutdown();
_state.store(kDown);
}