Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-66912

Make resharding_update_shard_key_in_retryable_write.js not depend on JavaScript exceptions for flow control

    XMLWordPrintableJSON

Details

    • Fully Compatible
    • Sharding 2022-08-08
    • 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;
          }
      });
      

      Attachments

        Activity

          People

            cheahuychou.mao@mongodb.com Cheahuychou Mao
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: