[SERVER-56987] Coverity analysis defect 120085: Redundant test Created: 15/May/21  Updated: 27/Oct/23  Resolved: 07/Jun/21

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

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: Samyukta Lanka
Resolution: Gone away Votes: 0
Labels: coverity
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Sprint: Repl 2021-05-31, Repl 2021-06-14
Participants:

 Description   

Redundant test

By the time the program execution reaches the test of this condition there is only one possible outcome for the test. The code at the destination of this branch is not dead, either because this condition is always true or because there is at least one other branch that reaches it. Test always evaluates the same
/src/mongo/db/read_write_concern_defaults.cpp:251: DEADCODE 120085 At condition "isDefaultWCMajorityFeatureFlagEnabled", the value of "isDefaultWCMajorityFeatureFlagEnabled" must be equal to 1.
/src/mongo/db/read_write_concern_defaults.cpp:242: DEADCODE 120085 Condition "isDefaultWCMajorityFeatureFlagEnabled", taking true branch. Now the value of "isDefaultWCMajorityFeatureFlagEnabled" is equal to 1.
/src/mongo/db/read_write_concern_defaults.cpp:232: DEADCODE 120085 Condition "isDefaultWCMajorityFeatureFlagEnabled", taking true branch. Now the value of "isDefaultWCMajorityFeatureFlagEnabled" is equal to 1.
/src/mongo/db/read_write_concern_defaults.cpp:229: DEADCODE 120085 Assigning: "isDefaultWCMajorityFeatureFlagEnabled" = "mongo::serverGlobalParams.featureCompatibility->isVersionInitialized() && mongo::repl::feature_flags::gDefaultWCMajority.isEnabled(mongo::serverGlobalParams.featureCompatibility)".
/src/mongo/db/read_write_concern_defaults.cpp:251: DEADCODE 120085 The condition "isDefaultWCMajorityFeatureFlagEnabled" must be true.



 Comments   
Comment by Samyukta Lanka [ 08/Jun/21 ]

My mistake, I put the wrong ticket number to the above commit. It actually corresponds to SERVER-57142.

Comment by Githook User [ 08/Jun/21 ]

Author:

{'name': 'Samy Lanka', 'email': 'samy.lanka@mongodb.com', 'username': 'lankas'}

Message: SERVER-56987 Fix type qualifiers on return types in read_write_concern_provenance.h
Branch: master
https://github.com/mongodb/mongo/commit/3f00b0cd01d4231fd22820fe63bdae2511489eda

Comment by Samyukta Lanka [ 07/Jun/21 ]

Coverity says that the issue has been fixed, maybe it happened during one of the recent refactors that we did of the code.

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