[SERVER-42004] localhost{1,2,3}.js tests should wait for a primary to be elected before shutting down the test Created: 28/Jun/19  Updated: 29/Oct/23  Resolved: 17/Jul/19

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 4.2.0-rc3, 4.3.1, 4.0.20

Type: Bug Priority: Major - P3
Reporter: William Schultz (Inactive) Assignee: William Schultz (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.2, v4.0
Participants:
Linked BF Score: 15

 Description   

The replsets/localhost{1,2,3}.js tests start a replica set using ReplSetTest and then call the replSetInitiate command directly on the first node. They then immediately stop the ReplSetTest. Since they don't wait for a primary to actually complete its first election, it's possible that the work done inside stopSet ends up running alongside the election, which can cause things like collection validation to fail when we run consistency checks. We should wait for a primary to finish its election before shutting down the test to avoid these issues.



 Comments   
Comment by Githook User [ 24/Jun/20 ]

Author:

{'name': 'William Schultz', 'email': 'william.schultz@mongodb.com', 'username': 'will62794'}

Message: SERVER-42004 localhost JS tests should wait for an election to complete before shutting down

(cherry picked from commit 19d0d47fb83d01edb18e0bcb235d6c39bbe16bbd)
Branch: v4.0
https://github.com/mongodb/mongo/commit/c952e2305daba32a0e72ac452bb552a69c24204a

Comment by Githook User [ 17/Jul/19 ]

Author:

{'name': 'William Schultz', 'username': 'will62794', 'email': 'william.schultz@mongodb.com'}

Message: SERVER-42004 localhost JS tests should wait for an election to complete before shutting down

(cherry picked from commit 19d0d47fb83d01edb18e0bcb235d6c39bbe16bbd)
Branch: v4.2
https://github.com/mongodb/mongo/commit/998640bbece98f31a92bba8c02785c818545ba84

Comment by Githook User [ 17/Jul/19 ]

Author:

{'name': 'William Schultz', 'email': 'william.schultz@mongodb.com', 'username': 'will62794'}

Message: SERVER-42004 localhost JS tests should wait for an election to complete before shutting down
Branch: master
https://github.com/mongodb/mongo/commit/19d0d47fb83d01edb18e0bcb235d6c39bbe16bbd

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