[SERVER-44170] Fix inconsistent state format in logging Created: 23/Oct/19  Updated: 29/Oct/23  Resolved: 01/Jul/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.1.0-rc0

Type: Improvement Priority: Minor - P4
Reporter: Nic Cottrell Assignee: Mina Mahmood (Inactive)
Resolution: Fixed Votes: 1
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Repl 2021-06-28, Repl 2021-07-12
Participants:

 Description   

In parts of the code:

 
 if (_lastResponse.getState() != MemberState::RS_DOWN)
    { log() << "Member " << _hostAndPort.toString() << " is now in state RS_DOWN - " << redact(heartbeatMessage) << rsLog; 
}

In others we use toString:

// Log if the state changes
 if (_lastResponse.getState() != hbResponse.getState())
     { log() << "Member " << _hostAndPort.toString() << " is now in state " << hbResponse.getState().toString() << rsLog; 
}

The second example will display the official state name from the docs wheras the first uses RS_DOWN. Other part in the same file says RS_UNKNOWN which should be UNKNOWN. The RS_ prefix is the enum label.

Since this is already inconsistent I don't see any major compatibility risks in fixing this.



 Comments   
Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Githook User [ 25/Jun/21 ]

Author:

{'name': 'Mina Mahmood', 'email': 'mina.mahmood@mongodb.com'}

Message: SERVER-44170 Fixed inconsistent state format in logging
Branch: master
https://github.com/mongodb/mongo/commit/b13cd8a982b9f2598ba34a1e40cfe78738ef1c90

Comment by Mina Mahmood (Inactive) [ 17/Jun/21 ]

https://mongodbcr.appspot.com/787380015/

Comment by Carl Champain (Inactive) [ 23/Oct/19 ]

Hi nicholas.cottrell,

Thanks for the report.
I'll pass this ticket along to the Replication team for review.

Kind regards,
Carl

Generated at Thu Feb 08 05:05:13 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.