-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 2.2.3
-
Component/s: Replication, Shell
-
Environment:GNU/Linux
-
ALL
-
We have a replica set with 3 members running MongoDB 2.2.3. After running db.runCommand(
{ compact: '<collection>' }) twice on the primary (first without force: true to see the expected error message, and then again with it to actually compact the collection), rs.status() showed maintenanceMode: -2 for the primary member. After some investigation, I ran the command again (without force: true) and confirmed that it decremented again to -3:
{ "_id" : 0, "name" : "ec2-xxx.compute-1.amazonaws.com:27017", "health" : 1, "state" : 1, "stateStr" : "PRIMARY", "uptime" : 2833099, "optime" : Timestamp(1365604059000, 1), "optimeDate" : ISODate("2013-04-10T14:27:39Z"), "maintenanceMode" : -3, "self" : true },
After stepping down the primary, maintenanceMode was not shown in rs.status() on the new primary, but on stepping that one down and the original primary taking over again, it was still -3 there. Restarting mongod appears to have reset maintenanceMode now and it no longer appears in rs.status().
I couldn't find any mention of this in the documentation or anywhere online. I'm not familiar with C++ so could easily have missed something, but it looks to me as if the problem might be that there is no check on theReplSet->isSecondary() when decrementing maintenanceMode in Command::execCommand, to correspond with that check when incrementing it earlier in the method. I have created a commit with this possible fix:
https://github.com/jennyd/mongo/commit/83a4b60e72d67bde124fed8072994da40945f297
- is duplicated by
-
SERVER-9326 Node became SECONDARY in the middle of compact command.
- Closed
- is related to
-
SERVER-6643 Maintenance mode should be unset when a command exits with an assertion
- Closed
- related to
-
SERVER-9800 Maintenance mode commands should unset maintenance mode on failure
- Closed