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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
/**
* Tests that a donor resumes coordinating a migration if it fails over after creating the
* migration coordinator document but before deleting it.
*/
// This test induces failovers on shards.
TestData.skipCheckingUUIDsConsistentAcrossCluster = true;
(function() {
'use strict';
load('jstests/sharding/migration_coordinator_failover_include.js');
load('jstests/replsets/rslib.js');
const dbName = "test";
var st = new ShardingTest({shards: 2, rs: {nodes: 2}});
assert.commandWorked(st.s.adminCommand({enableSharding: dbName}));
assert.commandWorked(st.s.adminCommand({movePrimary: dbName, to: st.shard0.shardName}));
runMoveChunkMakeDonorStepDownAfterFailpoint(st,
dbName,
"moveChunkHangAtStep3",
false /* shouldMakeMigrationFailToCommitOnConfig */,
ErrorCodes.OperationFailed);
runMoveChunkMakeDonorStepDownAfterFailpoint(st,
dbName,
"moveChunkHangAtStep4",
false /* shouldMakeMigrationFailToCommitOnConfig */,
ErrorCodes.OperationFailed);
runMoveChunkMakeDonorStepDownAfterFailpoint(st,
dbName,
"moveChunkHangAtStep5",
false /* shouldMakeMigrationFailToCommitOnConfig */,
ErrorCodes.OperationFailed);
runMoveChunkMakeDonorStepDownAfterFailpoint(
st,
dbName,
"hangInEnsureChunkVersionIsGreaterThanThenSimulateErrorUninterruptible",
true /* shouldMakeMigrationFailToCommitOnConfig */,
[ErrorCodes.OperationFailed, ErrorCodes.StaleEpoch]);
runMoveChunkMakeDonorStepDownAfterFailpoint(
st,
dbName,
"hangInRefreshFilteringMetadataUntilSuccessThenSimulateErrorUninterruptible",
true /* shouldMakeMigrationFailToCommitOnConfig */,
[ErrorCodes.OperationFailed, ErrorCodes.StaleEpoch]);
runMoveChunkMakeDonorStepDownAfterFailpoint(
st,
dbName,
"hangInPersistMigrateAbortDecisionThenSimulateErrorUninterruptible",
true /* shouldMakeMigrationFailToCommitOnConfig */,
[ErrorCodes.OperationFailed, ErrorCodes.StaleEpoch]);
runMoveChunkMakeDonorStepDownAfterFailpoint(
st,
dbName,
"hangInDeleteRangeDeletionLocallyThenSimulateErrorUninterruptible",
true /* shouldMakeMigrationFailToCommitOnConfig */,
[ErrorCodes.OperationFailed, ErrorCodes.StaleEpoch]);
runMoveChunkMakeDonorStepDownAfterFailpoint(
st,
dbName,
"hangInReadyRangeDeletionOnRecipientThenSimulateErrorUninterruptible",
true /* shouldMakeMigrationFailToCommitOnConfig */,
[ErrorCodes.OperationFailed, ErrorCodes.StaleEpoch]);
runMoveChunkMakeDonorStepDownAfterFailpoint(st,
dbName,
"hangInAdvanceTxnNumThenSimulateErrorUninterruptible",
true /* shouldMakeMigrationFailToCommitOnConfig */,
[ErrorCodes.OperationFailed, ErrorCodes.StaleEpoch]);
runMoveChunkMakeDonorStepDownAfterFailpoint(st,
dbName,
"hangBeforeMakingAbortDecisionDurable",
true /* shouldMakeMigrationFailToCommitOnConfig */,
[ErrorCodes.OperationFailed, ErrorCodes.StaleEpoch]);
runMoveChunkMakeDonorStepDownAfterFailpoint(st,
dbName,
"hangBeforeSendingAbortDecision",
true /* shouldMakeMigrationFailToCommitOnConfig */,
[ErrorCodes.OperationFailed, ErrorCodes.StaleEpoch]);
runMoveChunkMakeDonorStepDownAfterFailpoint(st,
dbName,
"hangBeforeForgettingMigrationAfterAbortDecision",
true /* shouldMakeMigrationFailToCommitOnConfig */,
[ErrorCodes.OperationFailed, ErrorCodes.StaleEpoch]);
st.stop();
})();
|