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
101
102
103
104
105
106
107
108
|
'use strict';
/**
* Performs updates that will change a document's shard key while migrating chunks and killing
* sessions. Only runs updates that cause a document to change shards to increase the odds of
* killing an internal transaction.
*
* @tags: [
* requires_sharding,
* assumes_balancer_off,
* uses_transactions,
* ]
*/
load('jstests/concurrency/fsm_libs/extend_workload.js');
load('jstests/concurrency/fsm_workload_helpers/kill_session.js'); // for killSession
load('jstests/concurrency/fsm_workloads/random_moveChunk_update_shard_key.js');
load('jstests/libs/override_methods/retry_on_killed_session.js');
// By default retry_on_killed_session.js will only retry known retryable operations like reads and
// retryable writes, but the moveChunks in this test may be interrupted and are safe to retry so opt
// into always retrying killed operations.
TestData.alwaysRetryOnKillSessionErrors = true;
var $config = extendWorkload($config, function($config, $super) {
$config.data.retryOnKilledSession = true;
// The base workload uses connCache, so wrap killSessions so the fsm runner doesn't complain
// that it only expects 2 arguments.
$config.states.killSession = function wrappedKillSession(db, collName, connCache) {
return killSession(db, collName);
};
$config.transitions = {
init: {
killSession: 0.1,
moveChunk: 0.1,
findAndModifyWithRetryableWriteAcrossChunks: 0.2,
findAndModifyWithTransactionAcrossChunks: 0.2,
updateWithRetryableWriteAcrossChunks: 0.2,
updateWithTransactionAcrossChunks: 0.2,
},
killSession: {
killSession: 0.1,
moveChunk: 0.1,
findAndModifyWithRetryableWriteAcrossChunks: 0.15,
findAndModifyWithTransactionAcrossChunks: 0.15,
updateWithRetryableWriteAcrossChunks: 0.15,
updateWithTransactionAcrossChunks: 0.15,
verifyDocuments: 0.2
},
moveChunk: {
killSession: 0.1,
moveChunk: 0.1,
findAndModifyWithRetryableWriteAcrossChunks: 0.15,
findAndModifyWithTransactionAcrossChunks: 0.15,
updateWithRetryableWriteAcrossChunks: 0.15,
updateWithTransactionAcrossChunks: 0.15,
verifyDocuments: 0.2
},
findAndModifyWithRetryableWriteAcrossChunks: {
killSession: 0.1,
moveChunk: 0.1,
findAndModifyWithRetryableWriteAcrossChunks: 0.15,
findAndModifyWithTransactionAcrossChunks: 0.15,
updateWithRetryableWriteAcrossChunks: 0.15,
updateWithTransactionAcrossChunks: 0.15,
verifyDocuments: 0.2
},
findAndModifyWithTransactionAcrossChunks: {
killSession: 0.1,
moveChunk: 0.1,
findAndModifyWithRetryableWriteAcrossChunks: 0.15,
findAndModifyWithTransactionAcrossChunks: 0.15,
updateWithRetryableWriteAcrossChunks: 0.15,
updateWithTransactionAcrossChunks: 0.15,
verifyDocuments: 0.2
},
updateWithRetryableWriteAcrossChunks: {
killSession: 0.1,
moveChunk: 0.1,
findAndModifyWithRetryableWriteAcrossChunks: 0.15,
findAndModifyWithTransactionAcrossChunks: 0.15,
updateWithRetryableWriteAcrossChunks: 0.15,
updateWithTransactionAcrossChunks: 0.15,
verifyDocuments: 0.2
},
updateWithTransactionAcrossChunks: {
killSession: 0.1,
moveChunk: 0.1,
findAndModifyWithRetryableWriteAcrossChunks: 0.15,
findAndModifyWithTransactionAcrossChunks: 0.15,
updateWithRetryableWriteAcrossChunks: 0.15,
updateWithTransactionAcrossChunks: 0.15,
verifyDocuments: 0.2
},
verifyDocuments: {
killSession: 0.1,
moveChunk: 0.1,
findAndModifyWithRetryableWriteAcrossChunks: 0.15,
findAndModifyWithTransactionAcrossChunks: 0.15,
updateWithRetryableWriteAcrossChunks: 0.15,
updateWithTransactionAcrossChunks: 0.15,
verifyDocuments: 0.2
},
};
return $config;
});
|