[SERVER-77746] cleanupOrphanedWhileMigrating.js does not retarget after replica set state change Created: 02/Jun/23  Updated: 29/Oct/23  Resolved: 11/Jul/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.1.0-rc0, 7.0.0-rc8

Type: Bug Priority: Major - P3
Reporter: Jordi Serra Torrens Assignee: Enrico Golfieri
Resolution: Fixed Votes: 0
Labels: shardingemea-qw
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Assigned Teams:
Sharding EMEA
Backwards Compatibility: Fully Compatible
Backport Requested:
v7.0
Sprint: Sharding EMEA 2023-07-10, Sharding EMEA 2023-07-24
Participants:
Linked BF Score: 5
Story Points: 2

 Description   

The cleanupOrphanedWhileMigrating.js test takes a connection to the primary node of a random shard and then sends the `cleanupOrphaned` command repeatedly to that node until success. If that node happens to no longer be the primary, the assert.soon loop keeps targetting it. This makes the test unnecessarily slow and may exceed the assert.soon timeout. Instead, it should retarget to the new primary.



 Comments   
Comment by Githook User [ 13/Jul/23 ]

Author:

{'name': 'Enrico', 'email': 'enrico.golfieri@mongodb.com', 'username': 'enricogolfieri'}

Message: SERVER-77746 cleanupOrphanedWhileMigrating.js does not retarget after replica set state change

(cherry-picked from commit 3b6ae001db2b9bcbaa9f60a95b6c44a2a89ee3c5)
Branch: v7.0
https://github.com/mongodb/mongo/commit/899bb482f48fae6342c9eb72a79694608b86f00d

Comment by Githook User [ 10/Jul/23 ]

Author:

{'name': 'Enrico', 'email': 'enrico.golfieri@mongodb.com', 'username': 'enricogolfieri'}

Message: SERVER-77746 cleanupOrphanedWhileMigrating.js does not retarget after replica set state change
Branch: master
https://github.com/mongodb/mongo/commit/3b6ae001db2b9bcbaa9f60a95b6c44a2a89ee3c5

Comment by Jordi Serra Torrens [ 02/Jun/23 ]

A possible solution could be:

const shardConn = connCache.rsConns.shards[shardNames[randomIndex]];
[...]
 assert.soonNoExcept(() => {
            assert.commandWorked(shardConn.adminCommand({cleanupOrphaned: ns}));
            return true;
 }, undefined, 10 * 1000, 100);

Generated at Thu Feb 08 06:36:28 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.