diff options
author | Matt Broadstone <mbroadst@mongodb.com> | 2022-11-07 15:54:21 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-11-07 16:37:13 +0000 |
commit | bb5aca605f73cc6842a9dc0a30bca07f185f6931 (patch) | |
tree | dfb7d04b791df102dadd53dfd8ced54a736cc99c /jstests/replsets | |
parent | 6db24d9e5986f423bc20a0abc9e444f4742ec68f (diff) | |
download | mongo-bb5aca605f73cc6842a9dc0a30bca07f185f6931.tar.gz |
SERVER-70939 Refactor split writes-during-aborted test
Diffstat (limited to 'jstests/replsets')
-rw-r--r-- | jstests/replsets/libs/tenant_migration_util.js | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/jstests/replsets/libs/tenant_migration_util.js b/jstests/replsets/libs/tenant_migration_util.js index d6cd9f8bf70..acd11758349 100644 --- a/jstests/replsets/libs/tenant_migration_util.js +++ b/jstests/replsets/libs/tenant_migration_util.js @@ -265,33 +265,18 @@ var TenantMigrationUtil = (function() { * or shard merge for the given node. */ function getTenantMigrationAccessBlocker({donorNode, recipientNode, tenantId}) { + assert(donorNode || recipientNode, "missing required parameter donorNode or recipientNode"); if (donorNode && recipientNode) { throw new Error("please specify either 'donorNode' or 'recipientNode' but not both"); } - const node = donorNode || recipientNode; - const res = node.adminCommand({serverStatus: 1}); - assert.commandWorked(res); - - const isShardMergeEnabled = TenantMigrationUtil.isShardMergeEnabled( - typeof node.getDB === "function" ? node.getDB("admin") : node); - const {tenantMigrationAccessBlocker} = res; - if (!tenantMigrationAccessBlocker) { - return undefined; - } - if (isShardMergeEnabled && tenantId) { - tenantMigrationAccessBlocker.recipient = tenantMigrationAccessBlocker[tenantId] && - tenantMigrationAccessBlocker[tenantId].recipient; - return tenantMigrationAccessBlocker; - } - - if (tenantId) { - tenantMigrationAccessBlocker.donor = tenantMigrationAccessBlocker[tenantId] && - tenantMigrationAccessBlocker[tenantId].donor; - tenantMigrationAccessBlocker.recipient = tenantMigrationAccessBlocker[tenantId] && - tenantMigrationAccessBlocker[tenantId].recipient; + const node = donorNode || recipientNode; + const {tenantMigrationAccessBlocker} = + assert.commandWorked(node.adminCommand({serverStatus: 1})); - return tenantMigrationAccessBlocker; + if (tenantMigrationAccessBlocker && tenantId && + tenantMigrationAccessBlocker.hasOwnProperty(tenantId)) { + return tenantMigrationAccessBlocker[tenantId]; } return tenantMigrationAccessBlocker; |