blob: 8f741f7ef49c264b83d3a3b8e13078fabef482f2 (
plain)
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
|
/**
* Commits a shard split and aborts it prior to marking it for garbage collection and checks that we
* recover the tenant access blockers since the split is aborted but not marked as garbage
* collectable. Checks that `abortOpTime` and `blockOpTime` are set.
* @tags: [requires_fcv_63, serverless]
*/
import {TenantMigrationTest} from "jstests/replsets/libs/tenant_migration_test.js";
import {
assertMigrationState,
findSplitOperation,
ShardSplitTest
} from "jstests/serverless/libs/shard_split_test.js";
load("jstests/libs/fail_point_util.js"); // for "configureFailPoint"
// Skip db hash check because secondary is left with a different config.
TestData.skipCheckDBHashes = true;
const test = new ShardSplitTest({
quickGarbageCollection: true,
nodeOptions: {
setParameter: {
"failpoint.PrimaryOnlyServiceSkipRebuildingInstances": tojson({mode: "alwaysOn"}),
}
}
});
test.addRecipientNodes();
let donorPrimary = test.donor.getPrimary();
// Pause the shard split before waiting to mark the doc for garbage collection.
const fp = configureFailPoint(donorPrimary.getDB("admin"), "pauseShardSplitAfterBlocking");
const tenantIds = [ObjectId(), ObjectId()];
const operation = test.createSplitOperation(tenantIds);
const commitThread = operation.commitAsync();
fp.wait();
assert.commandWorked(operation.abort());
fp.off();
commitThread.join();
assert.commandFailed(commitThread.returnData());
assertMigrationState(donorPrimary, operation.migrationId, "aborted");
test.stop({shouldRestart: true});
test.donor.startSet({restart: true});
donorPrimary = test.donor.getPrimary();
assert(findSplitOperation(donorPrimary, operation.migrationId), "There must be a config document");
test.validateTenantAccessBlockers(
operation.migrationId, tenantIds, TenantMigrationTest.DonorAccessState.kAborted);
test.stop();
|