[SERVER-20473] calling setMaintenanceMode(true) while running for election crashes server Created: 17/Sep/15  Updated: 25/Jan/17  Resolved: 18/Sep/15

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 3.0.7, 3.1.9

Type: Bug Priority: Major - P3
Reporter: Benety Goh Assignee: Benety Goh
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Completed:
Sprint: Repl B (10/30/15)
Participants:

 Comments   
Comment by Githook User [ 21/Sep/15 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-20473 ReplicationCoordinator::setMaintenanceMode() should fail if the node is currently running for election

(cherry picked from commit 46e6c6be50a33c54127ea4f6364efdd23f738c02)

Conflicts:
src/mongo/db/repl/replication_coordinator_impl.cpp
Branch: v3.0
https://github.com/mongodb/mongo/commit/c164b84736f186c3d5e82d6845df89db1e9360f1

Comment by Githook User [ 18/Sep/15 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-20473 ReplicationCoordinator::setMaintenanceMode should return NotSecondary (instead of NotMaster) when invoked as a candidate
Branch: master
https://github.com/mongodb/mongo/commit/26192ab0ea2d44e68c7506d38515b6f7eb478021

Comment by Benety Goh [ 18/Sep/15 ]

For backport, this is the commit to cherry-pick into 3.0:

commit 46e6c6be50a33c54127ea4f6364efdd23f738c02
Author: Benety Goh <benety@mongodb.com>
Date: Thu Sep 17 15:59:34 2015 -0400

SERVER-20473 ReplicationCoordinator::setMaintenanceMode() should fail if the node is currently running for election

diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp
index 291b591..a1b9e55 100644
— a/src/mongo/db/repl/replication_coordinator_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl.cpp
@@ -1677,6 +1677,11 @@ void ReplicationCoordinatorImpl::_setMaintenanceMode_helper(
return;
}

+ if (_topCoord->getRole() == TopologyCoordinator::Role::candidate)

{ + *result = Status(ErrorCodes::NotMaster, "currently running for election"); + return; + }

+
stdx::unique_lock<stdx::mutex> lk(_mutex);
if (_getMemberState_inlock().primary()) {
*result = Status(ErrorCodes::NotSecondary, "primaries can't modify maintenance mode");

Comment by Benety Goh [ 18/Sep/15 ]

commit 2e7162c79274ba4708a307cda38e5d2ea90525f3
Author: Benety Goh <benety@mongodb.com>
AuthorDate: Thu Sep 17 16:02:10 2015 -0400
Commit: Benety Goh <benety@mongodb.com>
CommitDate: Fri Sep 18 11:32:39 2015 -0400

SERVER-20473 removed unused test function ReplCoordTest::simulateStepDownOnIsolation()

commit 756addb3f1f7d92189c398ef844d158b4e0065a9
Author: Benety Goh <benety@mongodb.com>
AuthorDate: Thu Sep 17 16:00:02 2015 -0400
Commit: Benety Goh <benety@mongodb.com>
CommitDate: Fri Sep 18 11:32:39 2015 -0400

SERVER-20473 added test for calling ReplicationCoordinator::setMaintenanceMode() as candidate

commit 46e6c6be50a33c54127ea4f6364efdd23f738c02
Author: Benety Goh <benety@mongodb.com>
AuthorDate: Thu Sep 17 15:59:34 2015 -0400
Commit: Benety Goh <benety@mongodb.com>
CommitDate: Fri Sep 18 11:32:39 2015 -0400

SERVER-20473 ReplicationCoordinator::setMaintenanceMode() should fail if the node is currently running for election

commit 934fd877b3499ea8b5cf06b1345e4e5cb31488d6
Author: Benety Goh <benety@mongodb.com>
AuthorDate: Thu Sep 17 15:01:33 2015 -0400
Commit: Benety Goh <benety@mongodb.com>
CommitDate: Fri Sep 18 11:32:39 2015 -0400

SERVER-20473 moved ReplCoordElectV1Test::simulateSuccessfulDryRun() to ReplCoordTest

Generated at Thu Feb 08 03:54:19 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.