diff options
| author | Alex Li <98560274+lia394126@users.noreply.github.com> | 2024-07-29 11:57:46 -0400 |
|---|---|---|
| committer | MongoDB Bot <mongo-bot@mongodb.com> | 2024-07-29 16:16:25 +0000 |
| commit | a3959df86fa97d243376ef94fd511fa8688186c4 (patch) | |
| tree | bc1b1c882fe4834ddb7b9c8c6c7b54ace09095d2 | |
| parent | 1c871d5b683ff5851abfe2a2335224dcc3cec57c (diff) | |
SERVER-91758 mongos_rs_shard_failure_tolerance.js retries NetworkInte… (#25188)
GitOrigin-RevId: 9e8b0f6fb527a9513eaa7dd336e9685f58d88cb5
| -rw-r--r-- | jstests/sharding/mongos_rs_shard_failure_tolerance.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/jstests/sharding/mongos_rs_shard_failure_tolerance.js b/jstests/sharding/mongos_rs_shard_failure_tolerance.js index e06c6d78d28..f36382bedfd 100644 --- a/jstests/sharding/mongos_rs_shard_failure_tolerance.js +++ b/jstests/sharding/mongos_rs_shard_failure_tolerance.js @@ -139,7 +139,19 @@ jsTest.log("Testing active connection with second primary down..."); // Reads with read prefs mongosConnActive.setSecondaryOk(); assert.neq(null, mongosConnActive.getCollection(collSharded.toString()).findOne({_id: -1})); -assert.neq(null, mongosConnActive.getCollection(collSharded.toString()).findOne({_id: 1})); +// This special retry logic is to mimic connection pool timeout in v8.0 and later. In earlier +// versions, the connection pool may time out with NetworkInterfaceExceededTimeLimit, which +// is not a retryable error. This is necessary because the now downed primary may time out +// with NetworkInterfaceExceededTimeLimit instead of HostUnreachable. +var res = null; +try { + res = mongosConnActive.getCollection(collSharded.toString()).findOne({_id: 1}); +} catch (e) { + // RSM marks failed host. + assert.commandFailedWithCode(e, ErrorCodes.NetworkInterfaceExceededTimeLimit); + res = mongosConnActive.getCollection(collSharded.toString()).findOne({_id: 1}); +} +assert.neq(null, res); assert.neq(null, mongosConnActive.getCollection(collUnsharded.toString()).findOne({_id: 1})); mongosConnActive.setSecondaryOk(false); |
