[SERVER-49735] Coverity analysis defect 115277: Redundant test Created: 20/Jul/20  Updated: 29/Oct/23  Resolved: 13/Jun/22

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

Type: Improvement Priority: Major - P3
Reporter: Coverity Collector User Assignee: Evelyn Wu
Resolution: Fixed Votes: 0
Labels: coverity, coverity-pm-1854-tracking, neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Repl 2022-06-13, Repl 2022-06-27
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/repl/replication_coordinator_impl.cpp:3952: DEADCODE 115277 At condition "newIndex >= 0", the value of "newIndex" must be at least 0.
/src/mongo/db/repl/replication_coordinator_impl.cpp:3933: DEADCODE 115277 Condition "newIndex < 0", taking false branch. Now the value of "newIndex" is at least 0.
/src/mongo/db/repl/replication_coordinator_impl.cpp:3952: DEADCODE 115277 The condition "newIndex >= 0" must be true.



 Comments   
Comment by Githook User [ 13/Jun/22 ]

Author:

{'name': 'Evelyn Wu', 'email': 'evelyn.wu@mongodb.com', 'username': 'evelynwumongo'}

Message: SERVER-49735 Get rid of redundant condition that is always true
Branch: master
https://github.com/mongodb/mongo/commit/35eb6deef0f47505104e8ff066c695369776c070

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