diff options
author | Jason Zhang <jason.zhang@mongodb.com> | 2021-05-03 17:21:00 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-05-07 14:27:41 +0000 |
commit | 97200c5925a007f02c952166a68bc870e1e9ff85 (patch) | |
tree | 2f329e4dd57b6d573a141bae163ad1deebe6df48 | |
parent | c4682b4161241d6829b38a397d8c3f263ae39d01 (diff) | |
download | mongo-97200c5925a007f02c952166a68bc870e1e9ff85.tar.gz |
SERVER-54926 Convert HostUnreachable error in _fetchAndStoreRecipientClusterTimeKeyDocs to specific error
(cherry picked from commit 1814c0324af4fb1421ffa46d90528d2053dcac2c)
-rw-r--r-- | jstests/replsets/tenant_migration_ssl_configuration.js | 42 | ||||
-rw-r--r-- | src/mongo/db/repl/tenant_migration_donor_service.cpp | 6 |
2 files changed, 4 insertions, 44 deletions
diff --git a/jstests/replsets/tenant_migration_ssl_configuration.js b/jstests/replsets/tenant_migration_ssl_configuration.js index 2ff4d938779..6184d5ede0a 100644 --- a/jstests/replsets/tenant_migration_ssl_configuration.js +++ b/jstests/replsets/tenant_migration_ssl_configuration.js @@ -1,6 +1,8 @@ /** * Test that tenant migration commands only require and use certificate fields, and require SSL to * to be enabled when 'tenantMigrationDisableX509Auth' server parameter is false (default). + * Note: If a migration is started and SSL is not enabled on the recipient, we will repeatedly get + * back HostUnreachable on the donor side. * * @tags: [requires_fcv_47, requires_majority_read_concern, incompatible_with_eft, * incompatible_with_macos, requires_persistence] @@ -149,46 +151,6 @@ const kExpiredMigrationCertificates = { })(); (() => { - jsTest.log("Test that donorStartMigration fails if SSL is not enabled on the recipient and " + - "tenantMigrationDisableX509Auth=false"); - const recipientRst = new ReplSetTest({nodes: 1, name: "recipient"}); - recipientRst.startSet(); - recipientRst.initiate(); - - const tenantMigrationTest = new TenantMigrationTest({name: jsTestName(), recipientRst}); - if (!tenantMigrationTest.isFeatureFlagEnabled()) { - jsTestLog("Skipping test because the tenant migrations feature flag is disabled"); - recipientRst.stopSet(); - return; - } - - const donorRst = tenantMigrationTest.getDonorRst(); - - const donorStartMigrationCmdObj = { - donorStartMigration: 1, - migrationId: UUID(), - recipientConnectionString: tenantMigrationTest.getRecipientRst().getURL(), - tenantId: kTenantId, - readPreference: kReadPreference, - donorCertificateForRecipient: kValidMigrationCertificates.donorCertificateForRecipient, - recipientCertificateForDonor: kValidMigrationCertificates.recipientCertificateForDonor, - }; - - const stateRes = assert.commandWorked(TenantMigrationUtil.runTenantMigrationCommand( - donorStartMigrationCmdObj, - donorRst, - false /* retryOnRetryableErrors */, - TenantMigrationUtil.isMigrationCompleted /* shouldStopFunc */)); - assert.eq(stateRes.state, TenantMigrationTest.DonorState.kAborted); - // The command should fail with HostUnreachable since the donor was unable to establish an SSL - // connection with the recipient. - assert.eq(stateRes.abortReason.code, ErrorCodes.HostUnreachable); - - recipientRst.stopSet(); - tenantMigrationTest.stop(); -})(); - -(() => { jsTest.log("Test that recipientSyncData doesn't require 'recipientCertificateForDonor' when " + "tenantMigrationDisableX509Auth=true"); const migrationX509Options = TenantMigrationUtil.makeX509OptionsForTest(); diff --git a/src/mongo/db/repl/tenant_migration_donor_service.cpp b/src/mongo/db/repl/tenant_migration_donor_service.cpp index a4da1f14ebc..c20985ec1d9 100644 --- a/src/mongo/db/repl/tenant_migration_donor_service.cpp +++ b/src/mongo/db/repl/tenant_migration_donor_service.cpp @@ -98,12 +98,10 @@ bool shouldStopSendingRecipientCommand(Status status) { } bool shouldStopFetchingRecipientClusterTimeKeyDocs(Status status) { - // TODO (SERVER-54926): Convert HostUnreachable error in - // _fetchAndStoreRecipientClusterTimeKeyDocs to specific error. return status.isOK() || - !(ErrorCodes::isRetriableError(status) || ErrorCodes::isInterruption(status)) || - status.code() == ErrorCodes::HostUnreachable; + !(ErrorCodes::isRetriableError(status) || ErrorCodes::isInterruption(status)); } + void checkForTokenInterrupt(const CancelationToken& token) { uassert(ErrorCodes::CallbackCanceled, "Donor service interrupted", !token.isCanceled()); } |