1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
/**
* Starts a shard split through `abortShardSplit` and assert that no tenant access blockers are
* recovered since we do not recover access blockers for aborted split marked garbage collectable.
* Also verifies the serverless operation lock is not acquired when starting a split in aborted
* state.
* @tags: [requires_fcv_62, featureFlagShardSplit]
*/
load("jstests/libs/fail_point_util.js"); // for "configureFailPoint"
load('jstests/libs/parallel_shell_helpers.js'); // for "startParallelShell"
load("jstests/noPassthrough/libs/server_parameter_helpers.js"); // for "setParameter"
load("jstests/serverless/libs/basic_serverless_test.js");
load("jstests/replsets/libs/tenant_migration_test.js");
const {getServerlessOperationLock} = TenantMigrationUtil;
(function() {
"use strict";
// Skip db hash check because secondary is left with a different config.
TestData.skipCheckDBHashes = true;
const recipientTagName = "recipientNode";
const recipientSetName = "recipient";
const test = new BasicServerlessTest({
recipientTagName,
recipientSetName,
quickGarbageCollection: true,
nodeOptions: {
setParameter:
{"failpoint.PrimaryOnlyServiceSkipRebuildingInstances": tojson({mode: "alwaysOn"})}
}
});
test.addRecipientNodes();
let donorPrimary = test.donor.getPrimary();
const migrationId = UUID();
assert.isnull(findSplitOperation(donorPrimary, migrationId));
// Pause the shard split before waiting to mark the doc for garbage collection.
let fp = configureFailPoint(donorPrimary.getDB("admin"), "pauseShardSplitAfterDecision");
const tenantIds = ["tenant5", "tenant6"];
assert.commandWorked(donorPrimary.adminCommand({abortShardSplit: 1, migrationId}));
fp.wait();
assertMigrationState(donorPrimary, migrationId, "aborted");
jsTestLog("Stopping the set");
test.stop({shouldRestart: true});
jsTestLog("Restarting the set");
test.donor.startSet({restart: true});
donorPrimary = test.donor.getPrimary();
assert(findSplitOperation(donorPrimary, migrationId), "There must be a config document");
// we do not recover access blockers for kAborted marked for garbage collection
tenantIds.every(tenantId => {
assert.isnull(BasicServerlessTest.getTenantMigrationAccessBlocker(
{node: donorPrimary, tenantId: tenantId}));
});
// We do not acquire the lock for document marked for garbage collection
assert.eq(getServerlessOperationLock(donorPrimary), null);
test.stop();
})();
|