blob: 4fb5f14c8d0fb18ca4add843e8c9e3fd2a881407 (
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
|
/*
* Test that a well timed abortShardSplit command does not abort an already committed split.
*
* @tags: [requires_fcv_63, serverless]
*/
import {assertMigrationState, ShardSplitTest} from "jstests/serverless/libs/shard_split_test.js";
load("jstests/libs/fail_point_util.js");
const failpoints = ["pauseShardSplitAfterUpdatingToCommittedState"];
function testAbortAfterSplitIsAppliedStillsCommits(failpoint) {
"use strict";
const tenantIds = [ObjectId(), ObjectId()];
const test = new ShardSplitTest({quickGarbageCollection: true});
test.addRecipientNodes();
const donorPrimary = test.getDonorPrimary();
const operation = test.createSplitOperation(tenantIds);
let blockFp = configureFailPoint(donorPrimary, failpoint);
let splitThread = operation.commitAsync();
blockFp.wait();
// abortCmd expects to have the decisionPromise fullfilled which would be blocked by the
// `failpoint` already blocking from returning the promise.
let ranAbortFp = configureFailPoint(donorPrimary, "pauseShardSplitAfterReceivingAbortCmd");
let abortThread = operation.abortAsync();
ranAbortFp.wait();
blockFp.off();
assert.commandWorked(splitThread.returnData());
// now that the decisionPromise is fullfilled we can remove the failpoint.
ranAbortFp.off();
assert.commandFailed(abortThread.returnData());
assertMigrationState(donorPrimary, operation.migrationId, "committed");
operation.forget();
test.waitForGarbageCollection(operation.migrationId, tenantIds);
test.stop();
}
failpoints.forEach(fp => {
testAbortAfterSplitIsAppliedStillsCommits(fp);
});
|