[SERVER-57157] assert serverStatus command works in getBinVersion() jstest helper Created: 24/May/21  Updated: 29/Oct/23  Resolved: 01/Jun/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.2.15, 4.4.7, 4.0.26, 5.0.0-rc2, 5.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: Ali Mir Assignee: Ali Mir
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.0, v4.4, v4.2, v4.0
Sprint: Repl 2021-05-31, Repl 2021-06-14
Participants:

 Description   

In the verify_versions.js helper file, we have a function getBinVersion() that will run the serverStatus command on the calling node and return the binary version field from the result object. However, if this command fails, the function will return null, as the result object won't contain a version field on failure. We should wrap the serverStatus in an assert.commandWorked() call so that we catch this failure before the function returns.

 

The function returning null can have larger downstream impacts. For example, we sometimes pass the result of getBinVersion() to another jstest helper getBinVersionFor(). Here is an example. In the getBinVersionFor() implementation, if null is passed in as the version, we automatically default the version to latest. 

 

The following scenario can occur: if we have two nodes, one in last-lts and one in latest, and we call getBinVersion() on the the last-lts and the serverStatus command fails, we will return null. If this null result is passed in to the getBinVersionFor() function, it will return the bin version of the node as latest. Thus, if we are checking for binary version equality using a function like areBinVersionsTheSame(), we will get true for the last-lts and latest node.



 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 [ 29/Jun/21 ]

Author:

{'name': 'Ali Mir', 'email': 'ali.mir@mongodb.com', 'username': 'ali-mir'}

Message: SERVER-57157 Assert serverStatus command works in getBinVersion() jstest helper

(cherry picked from commit abda02c1aa43b6ce053eb8857d1724dceee43fd2)
Branch: v4.2
https://github.com/mongodb/mongo/commit/733c5b0d8171e43a29a759739b5c76cd92dcea69

Comment by Githook User [ 29/Jun/21 ]

Author:

{'name': 'Ali Mir', 'email': 'ali.mir@mongodb.com', 'username': 'ali-mir'}

Message: SERVER-57157 Assert serverStatus command works in getBinVersion() jstest helper

(cherry picked from commit abda02c1aa43b6ce053eb8857d1724dceee43fd2)
Branch: v4.0
https://github.com/mongodb/mongo/commit/07726214c77fc4f1bafcb9ab68cb44cf488c235c

Comment by Githook User [ 29/Jun/21 ]

Author:

{'name': 'Ali Mir', 'email': 'ali.mir@mongodb.com', 'username': 'ali-mir'}

Message: SERVER-57157 Assert serverStatus command works in getBinVersion() jstest helper

(cherry picked from commit abda02c1aa43b6ce053eb8857d1724dceee43fd2)
Branch: v4.4
https://github.com/mongodb/mongo/commit/8433bb389c0e9911fa47395bcc5daebbabefcd87

Comment by Githook User [ 15/Jun/21 ]

Author:

{'name': 'Ali Mir', 'email': 'ali.mir@mongodb.com', 'username': 'ali-mir'}

Message: SERVER-57157 Assert serverStatus command works in getBinVersion() jstest helper

(cherry picked from commit abda02c1aa43b6ce053eb8857d1724dceee43fd2)
Branch: v5.0
https://github.com/mongodb/mongo/commit/513defe48793dd76ea9df9277020fffa53e3af38

Comment by Githook User [ 01/Jun/21 ]

Author:

{'name': 'Ali Mir', 'email': 'ali.mir@mongodb.com', 'username': 'ali-mir'}

Message: SERVER-57157 Assert serverStatus command works in getBinVersion() jstest helper
Branch: master
https://github.com/mongodb/mongo/commit/abda02c1aa43b6ce053eb8857d1724dceee43fd2

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