[SERVER-31532] Change error message to start with "not master" rather than "not primary" Created: 12/Oct/17  Updated: 29/Jan/18  Resolved: 13/Oct/17

Status: Closed
Project: Core Server
Component/s: Replication, Testing Infrastructure
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Ian Boros Assignee: Ian Boros
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-31461 Resmoke stepdown hook should deal wit... Closed
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: TIG 2017-10-23
Participants:

 Description   

Some drivers parse error messages returned by the server, looking for strings like "not master." We should change this error message to start with "not master" rather than "not primary."

The result of the error message starting with "not primary" instead of "not master" is that pymongo raises a generic OperationFailure exception rather than a NotMaster exception after processing the error message. This is causing problems in TIG's continuous stepdown hook.



 Comments   
Comment by Ian Boros [ 13/Oct/17 ]

I'm going to close this ticket and make this change under SERVER-31461.

Comment by Spencer Brody (Inactive) [ 12/Oct/17 ]

I think using codes instead of string parsing of error messages is definitely the right way to go, though I'm don't think WriteConcernFailed should be considered a NotMaster error here (since write concern can fail even when the primary is healthy). We should basically just stay in line with the NotMasterErrors error class defined here: https://github.com/mongodb/mongo/blob/ba0ee77c61c39b077d0975b7487099c5985c7b18/src/mongo/base/error_codes.err#L262

Comment by Max Hirschhorn [ 12/Oct/17 ]

ian.boros, rather than your change to modify the server's error message, I think we should change the StepdownThread in resmoke.py getting an OperationFailed exception as any of the following as the error code returned in the server's response.

  • ErrorCodes::NotMaster
  • ErrorCodes::NotMasterNoSlaveOk
  • ErrorCodes::NotMasterOrSecondary
  • ErrorCodes::WriteConcernFailed
  • ErrorCodes::PrimarySteppedDown
  • ErrorCodes::InterruptedDueToReplStateChange
Comment by Kaloian Manassiev [ 12/Oct/17 ]

The outcome was that all the codes listed here can be returned and not all of them have "not master" in the message.

For example all of the instances of PrimarySteppedDown:
https://github.com/mongodb/mongo/blob/254a60a637ae4ea70bf9b0713efd3a7d207ff730/src/mongo/db/ops/update.cpp#L84
https://github.com/mongodb/mongo/blob/254a60a637ae4ea70bf9b0713efd3a7d207ff730/src/mongo/db/exec/update.cpp#L728

Generated at Thu Feb 08 04:27:22 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.