[SERVER-66912] Make resharding_update_shard_key_in_retryable_write.js not depend on JavaScript exceptions for flow control Created: 31/May/22  Updated: 29/Oct/23  Resolved: 08/Aug/22

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

Type: Task Priority: Major - P3
Reporter: Max Hirschhorn Assignee: Cheahuychou Mao
Resolution: Fixed Votes: 0
Labels: neweng, sharding-nyc-subteam3
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Sprint: Sharding 2022-08-08
Participants:
Linked BF Score: 9

 Description   

The resharding_update_shard_key_in_retryable_write.js test uses assert.commandWorked() to throw an exception only to catch it again and ignore certain error responses. This is problematic in the context of SERVER-47764 because a LockTimeout error response which is sometimes expected here will immediately trigger the hang analyzer and almost surely cause the assert.soon() to time out and fail.

The runCommandRetryOnTransientErrors() function should probably be changed to check res.code explicitly.

assert.soon(() => {
    res = db.runCommand(cmdObj);
    try {
        assert.commandWorked(res);
        return true;
    } catch (error) {
        assert.commandFailedWithCode(res, [
            ErrorCodes.StaleConfig,
            ErrorCodes.NoSuchTransaction,
            ErrorCodes.ShardCannotRefreshDueToLocksHeld,
            ErrorCodes.LockTimeout,
            ErrorCodes.IncompleteTransactionHistory
        ]);
        cmdObj.txnNumber = NumberLong(cmdObj.txnNumber + 1);
        return false;
    }
});



 Comments   
Comment by Githook User [ 08/Aug/22 ]

Author:

{'name': 'Cheahuychou Mao', 'email': 'mao.cheahuychou@gmail.com', 'username': 'cheahuychou'}

Message: SERVER-66912 Make resharding_update_shard_key_in_retryable_write.js not depend on JavaScript exceptions for flow control
Branch: master
https://github.com/mongodb/mongo/commit/400c4df624a99a696a63679a22984b18d266a3ca

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