summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/bgsync.cpp
diff options
context:
space:
mode:
authorVishnu Kaushik <vishnu.kaushik@mongodb.com>2021-06-22 21:52:00 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-10-14 21:03:23 +0000
commitdb0a9bfd85178648b9a3ded39d999e25d8455e7d (patch)
tree554ad0281ce66b646a0c31725235ba42ec60e481 /src/mongo/db/repl/bgsync.cpp
parent30dc4f5d4bd98c4d2eb3d37644169b83dfcb5ede (diff)
downloadmongo-db0a9bfd85178648b9a3ded39d999e25d8455e7d.tar.gz
SERVER-55589 setMaintenanceMode should take RSTL in X mode
Diffstat (limited to 'src/mongo/db/repl/bgsync.cpp')
-rw-r--r--src/mongo/db/repl/bgsync.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mongo/db/repl/bgsync.cpp b/src/mongo/db/repl/bgsync.cpp
index 9555db6f95b..93cd829c620 100644
--- a/src/mongo/db/repl/bgsync.cpp
+++ b/src/mongo/db/repl/bgsync.cpp
@@ -359,7 +359,7 @@ void BackgroundSync::_produce() {
log() << "See http://dochub.mongodb.org/core/resyncingaverystalereplicasetmember";
// Activate maintenance mode and transition to RECOVERING.
- auto status = _replCoord->setMaintenanceMode(true);
+ auto status = _replCoord->setMaintenanceMode(opCtx.get(), true);
if (!status.isOK()) {
warning() << "Failed to transition into maintenance mode: " << status;
// Do not mark ourselves too stale on errors so we can try again next time.
@@ -413,11 +413,13 @@ void BackgroundSync::_produce() {
// transition to SECONDARY.
if (_tooStale) {
+
_tooStale = false;
log() << "No longer too stale. Able to sync from " << source;
- auto status = _replCoord->setMaintenanceMode(false);
+ auto opCtx = cc().makeOperationContext();
+ auto status = _replCoord->setMaintenanceMode(opCtx.get(), false);
if (!status.isOK()) {
warning() << "Failed to leave maintenance mode: " << status;
}