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
|
/**
* Tests that chunk migration interruption before processing post/pre image oplog entry leads
* to consistent config.transactions data across primary and secondaries (SERVER-67492)
*/
(function() {
"use strict";
load("jstests/sharding/libs/create_sharded_collection_util.js");
load("jstests/libs/fail_point_util.js");
load('jstests/libs/parallel_shell_helpers.js');
const st = new ShardingTest({mongos: 1, shards: 2, rs: {nodes: 2}});
const interruptBeforeProcessingPrePostImageOriginatingOpFP =
configureFailPoint(st.rs1.getPrimary(), "interruptBeforeProcessingPrePostImageOriginatingOp");
const collection = st.s.getCollection("test.mycoll");
CreateShardedCollectionUtil.shardCollectionWithChunks(collection, {x: 1}, [
{min: {x: MinKey}, max: {x: 0}, shard: st.shard0.shardName},
{min: {x: 0}, max: {x: 100}, shard: st.shard0.shardName},
{min: {x: 100}, max: {x: MaxKey}, shard: st.shard1.shardName},
]);
assert.commandWorked(collection.insert({_id: 0, x: 10}));
assert.commandWorked(collection.runCommand("findAndModify", {
query: {x: 10},
update: {$set: {y: 2}},
new: true,
txnNumber: NumberLong(1),
}));
const res = st.s.adminCommand({
moveChunk: collection.getFullName(),
find: {x: 10},
to: st.shard1.shardName,
});
assert.commandFailedWithCode(res, ErrorCodes.CommandFailed);
interruptBeforeProcessingPrePostImageOriginatingOpFP.wait();
interruptBeforeProcessingPrePostImageOriginatingOpFP.off();
st.stop();
})();
|