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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
|
test_kind: multi_stmt_txn_passthrough
selector:
roots:
- jstests/core/**/*.js
exclude_files:
# These tests run in the jscore_txn passthrough suites.
- jstests/core/txns/**/*.js
# The following tests fail because a certain command or functionality is not supported by
# mongos. This command or functionality is placed in a comment next to the failing test.
- jstests/core/apitest_db.js # serverStatus output doesn't have storageEngine.
- jstests/core/apitest_db_profile_level.js # profiling.
- jstests/core/apply_ops*.js # applyOps, SERVER-1439.
- jstests/core/awaitdata_getmore_cmd.js # capped collections.
- jstests/core/bypass_doc_validation.js # sharded $out output not permitted
- jstests/core/capped*.js # capped collections.
- jstests/core/check_shard_index.js # checkShardingIndex.
- jstests/core/collection_truncate.js # emptycapped.
- jstests/core/collmod_without_uuid.js # applyOps, SERVER-1439
- jstests/core/compact_keeps_indexes.js # compact.
- jstests/core/currentop.js # uses fsync.
- jstests/core/dbadmin.js # "local" database.
- jstests/core/dbhash.js # dbhash.
- jstests/core/dbhash2.js # dbhash.
- jstests/core/diagdata.js # Command not supported in mongos
- jstests/core/do_txn*.js # doTxn
- jstests/core/dropdb_race.js # syncdelay.
- jstests/core/fsync.js # uses fsync.
- jstests/core/geo_haystack*.js # geoSearch.
- jstests/core/geo_s2cursorlimitskip.js # profiling.
- jstests/core/geo_update_btree2.js # notablescan.
- jstests/core/index_id_options.js # "local" database.
- jstests/core/index9.js # "local" database.
- jstests/core/max_time_ms.js # sleep, SERVER-2212.
- jstests/core/mr_replaceIntoDB.js # MapReduceResult, SERVER-20495.
- jstests/core/notablescan.js # notablescan.
- jstests/core/profile*.js # profiling.
- jstests/core/queryoptimizera.js # "local" database.
- jstests/core/rename*.js # renameCollection.
- jstests/core/stages*.js # stageDebug.
- jstests/core/startup_log.js # "local" database.
- jstests/core/tailable_cursor_invalidation.js # capped collections.
- jstests/core/tailable_getmore_batch_size.js # capped collections.
- jstests/core/tailable_skip_limit.js # capped collections.
- jstests/core/top.js # top.
# The following tests fail because mongos behaves differently from mongod when testing certain
# functionality. The differences are in a comment next to the failing test.
- jstests/core/explain_missing_database.js # Behavior with no db different on mongos, SERVER-18047.
- jstests/core/geo_2d_explain.js # executionSuccess in different spot in explain().
- jstests/core/geo_s2explain.js # inputStage in different spot in explain().
- jstests/core/geo_s2sparse.js # keysPerIndex in different spot in validate().
- jstests/core/operation_latency_histogram.js # Stats are counted differently on mongos, SERVER-24880.
# Test expects to run against a standalone, but shards in this passthrough are repl sets.
- jstests/core/read_after_optime.js
# The following tests fail because they count indexes. These counts do not take into account the
# additional hashed shard key indexes that are automatically added by this passthrough.
- jstests/core/apitest_dbcollection.js
- jstests/core/bad_index_plugin.js
- jstests/core/create_indexes.js
- jstests/core/list_indexes_non_existent_ns.js
- jstests/core/rename6.js
# The following tests fail because they expect no databases to be created. However a DB is created
# automatically when we shard a collection.
- jstests/core/dbcase.js
- jstests/core/dbcase2.js
- jstests/core/no_db_created.js
- jstests/core/ns_length.js
- jstests/core/views/*.js # Views tests aren't expected to work when collections are implicitly sharded.
- jstests/core/killop_drop_collection.js # Uses fsyncLock.
# These tests fail because sharded clusters do not clean up correctly after failed index builds.
# See SERVER-33207 as an example.
- jstests/core/geo_borders.js
# TODO: Remove after fixing SERVER-32555. executionStats.nReturned is incorrect for sharded
# queries with a limit or for distinct commands.
- jstests/core/distinct_index1.js
- jstests/core/explain1.js
- jstests/core/explain4.js
- jstests/core/sortk.js
# TODO: Remove after fixing SERVER-32563. The implementation of explain for the count command is
# incorrect on sharded collections.
- jstests/core/explain_count.js
# TODO: Remove after fixing SERVER-14324. mapReduce behaves unpredictably when the out collection
# is sharded on anything other than {_id: 1}.
- jstests/core/mr_undef.js
# TODO SERVER-32311: These tests use plan stage helpers which can't handle sharded explain output.
- jstests/core/expr_index_use.js
- jstests/core/index_multikey.js
- jstests/core/optimized_match_explain.js
- jstests/core/sort_array.js
# TODO: SERVER-16605 MapReduce into sharded collection with hashed index fails
- jstests/core/mr1.js
- jstests/core/mr3.js
- jstests/core/mr4.js
##
## Limitations with the way the runner file injects transactions.
##
# These tests expects some statements to error, which will cause txns to abort entirely.
- jstests/core/and.js
- jstests/core/bulk_api_ordered.js
- jstests/core/bulk_api_unordered.js
- jstests/core/bulk_legacy_enforce_gle.js
- jstests/core/capped5.js
- jstests/core/commands_with_uuid.js
- jstests/core/dbcase.js
- jstests/core/dbcase2.js
- jstests/core/explain_execution_error.js
- jstests/core/expr.js
- jstests/core/find9.js
- jstests/core/find_getmore_bsonsize.js
- jstests/core/find_getmore_cmd.js
- jstests/core/geo_allowedcomparisons.js
- jstests/core/geo_big_polygon2.js
- jstests/core/geonear_key.js
- jstests/core/in.js
- jstests/core/index8.js # No explicit check for failed command.
- jstests/core/index_decimal.js
- jstests/core/index_multiple_compatibility.js
- jstests/core/index_partial_write_ops.js
- jstests/core/indexa.js # No explicit check for failed command.
- jstests/core/indexes_multiple_commands.js
- jstests/core/js2.js
- jstests/core/json_schema/json_schema.js
- jstests/core/mr_bigobject.js
- jstests/core/not2.js
- jstests/core/notablescan.js
- jstests/core/null_query_semantics.js
- jstests/core/or1.js
- jstests/core/or2.js
- jstests/core/or3.js
- jstests/core/orj.js
- jstests/core/ref.js
- jstests/core/ref4.js
- jstests/core/regex_limit.js
- jstests/core/remove_undefined.js
- jstests/core/set7.js
- jstests/core/sortb.js
- jstests/core/sortf.js
- jstests/core/sortg.js
- jstests/core/sortj.js
- jstests/core/tailable_skip_limit.js
- jstests/core/type_array.js
- jstests/core/uniqueness.js
- jstests/core/unset2.js
- jstests/core/update_addToSet.js
- jstests/core/update_array_offset_positional.js
- jstests/core/update_arrayFilters.js
- jstests/core/update_find_and_modify_id.js
- jstests/core/update_modifier_pop.js
- jstests/core/updateh.js
- jstests/core/updatej.js
# SERVER-38096 Mongos opCounter doesn't increase when last op causes the transaction to implicitly abort
- jstests/core/opcounters_write_cmd.js
# TODO: SERVER-38207 Cannot insert document with MaxKey shard key.
- jstests/core/type8.js
# TODO: SERVER-38690 Mongos should throw write targeting errors in a transaction.
- jstests/core/update_setOnInsert.js
##
## Some aggregation stages aren't allowed in a transaction.
##
# $explain (requires read concern local)
- jstests/core/agg_hint.js
- jstests/core/collation.js
- jstests/core/explain_shell_helpers.js
- jstests/core/index_partial_read_ops.js
- jstests/core/optimized_match_explain.js
- jstests/core/sort_array.js
- jstests/core/wildcard_index_count.js
# $indexStats
- jstests/core/index_stats.js
##
## SERVER-39175 WriteErrors get converted to WriteCommandErrors if part of a txn.
##
# The same error code, but with ok:0.
- jstests/core/json_schema/additional_items.js
- jstests/core/json_schema/additional_properties.js
- jstests/core/json_schema/bsontype.js
- jstests/core/json_schema/dependencies.js
- jstests/core/json_schema/encrypt.js
- jstests/core/json_schema/items.js
- jstests/core/json_schema/logical_keywords.js
- jstests/core/json_schema/min_max_items.js
- jstests/core/json_schema/min_max_properties.js
- jstests/core/json_schema/pattern_properties.js
- jstests/core/json_schema/required.js
- jstests/core/json_schema/unique_items.js
- jstests/core/field_name_validation.js
- jstests/core/fts_array.js
- jstests/core/inc-SERVER-7446.js
- jstests/core/invalid_db_name.js
- jstests/core/push_sort.js
# Checks for "WriteErrors" explicitly from the response of db.runCommand()
- jstests/core/max_doc_size.js
# Calls res.getWriteError() or res.hasWriteError().
- jstests/core/bulk_api_ordered.js
- jstests/core/bulk_api_unordered.js
- jstests/core/bulk_legacy_enforce_gle.js
- jstests/core/cappeda.js
- jstests/core/doc_validation.js
- jstests/core/doc_validation_options.js
- jstests/core/geo_multinest0.js
- jstests/core/insert_illegal_doc.js
- jstests/core/ns_length.js
- jstests/core/push2.js
- jstests/core/remove6.js
- jstests/core/removeb.js
- jstests/core/rename4.js
- jstests/core/shell_writeconcern.js
- jstests/core/storefunc.js
- jstests/core/update_arrayFilters.js
- jstests/core/update_dbref.js
- jstests/core/updatel.js
- jstests/core/write_result.js
# Multiple writes in a txn, some of which fail because the collection doesn't exist.
# We create the collection and retry the last write, but previous writes would have
# still failed.
- jstests/core/dbref1.js
- jstests/core/dbref2.js
- jstests/core/ref3.js
- jstests/core/update3.js
- jstests/core/rename3.js
##
## Misc. reasons.
##
# SERVER-34868 Cannot run a legacy query on a session.
- jstests/core/exhaust.js
- jstests/core/validate_cmd_ns.js
# SERVER-34772 Tailable Cursors are not allowed in a transaction.
- jstests/core/awaitdata_getmore_cmd.js
- jstests/core/getmore_cmd_maxtimems.js
- jstests/core/tailable_cursor_invalidation.js
- jstests/core/tailable_getmore_batch_size.js
# SERVER-34918 The "max" option of a capped collection can be exceeded until the next insert.
# The reason is that we don't update the count of a collection until a transaction commits,
# by which point it is too late to complain that "max" has been exceeded.
- jstests/core/capped_max1.js
# The "max" option of a capped collection can be temporarily exceeded before a
# txn is committed.
- jstests/core/bulk_insert_capped.js
# Wrong count for top info (WriteLock)
- jstests/core/top.js
# Expects collection to not have been created
- jstests/core/insert_id_undefined.js
# Creates sessions explicitly, resulting in txns being run through different sessions
# using a single txnNumber.
- jstests/core/json_schema/misc_validation.js
# Fails with implicit sessions because it will use multiple sessions on the same Mongo connection.
- jstests/core/dropdb.js
# Committing a transaction when the server is fsync locked fails.
- jstests/core/fsync.js
# Expects legacy errors ($err).
- jstests/core/constructors.js
# txn interrupted by command outside of txn before getMore runs.
- jstests/core/commands_namespace_parsing.js
- jstests/core/drop3.js
- jstests/core/ensure_sorted.js
- jstests/core/geo_s2cursorlimitskip.js
- jstests/core/getmore_invalidated_cursors.js
- jstests/core/getmore_invalidated_documents.js
- jstests/core/kill_cursors.js
- jstests/core/list_collections1.js
- jstests/core/list_indexes.js
- jstests/core/max_time_ms.js
- jstests/core/oro.js
# Expects certain number of operations in the system.profile collection.
- jstests/core/profile*.js
# Parallel Shell - we do not signal the override to end a txn when a parallel shell closes.
- jstests/core/awaitdata_getmore_cmd.js
- jstests/core/compact_keeps_indexes.js
- jstests/core/count10.js
- jstests/core/count_plan_summary.js
- jstests/core/coveredIndex3.js
- jstests/core/currentop.js
- jstests/core/distinct3.js
- jstests/core/find_and_modify_concurrent_update.js
- jstests/core/fsync.js
- jstests/core/geo_update_btree.js
- jstests/core/killop_drop_collection.js
- jstests/core/loadserverscripts.js
- jstests/core/mr_killop.js
- jstests/core/queryoptimizer3.js
- jstests/core/remove9.js
- jstests/core/removeb.js
- jstests/core/removec.js
- jstests/core/shellstartparallel.js
- jstests/core/updatef.js
# Command expects to see result from parallel operation.
# E.g. Suppose the following sequence of events: op1, join() op2 in parallel shell, op3.
# op3 will still be using the snapshot from op1, and not see op2 at all.
- jstests/core/cursora.js
- jstests/core/bench_test1.js
- jstests/core/benchrun_pipeline_updates.js
# The tests below use applyOps, SERVER-1439.
- jstests/core/list_collections1.js
- jstests/core/list_collections_filter.js
- jstests/core/rename_stayTemp.js
- jstests/core/txns/prepare_transaction_fails_on_temp_collections.js
# Does not support tojson of command objects.
- jstests/core/SERVER-23626.js
exclude_with_any_tags:
# "Cowardly refusing to override read concern of command: ..."
- assumes_read_concern_unchanged
# "writeConcern is not allowed within a multi-statement transaction"
- assumes_write_concern_unchanged
- assumes_against_mongod_not_mongos
# Tests tagged with the following will fail because they assume collections are not sharded.
- assumes_no_implicit_collection_creation_after_drop
- assumes_no_implicit_index_creation
- assumes_unsharded_collection
- cannot_create_unique_index_when_using_hashed_shard_key
# Retrying a query can change whether a plan cache entry is active.
- inspects_whether_plan_cache_entry_is_active
executor:
archive:
hooks:
- CheckReplDBHashInBackground
- CheckReplDBHash
- ValidateCollections
config:
shell_options:
eval: >-
var testingReplication = true;
load('jstests/libs/override_methods/implicitly_shard_accessed_collections.js');
load('jstests/libs/override_methods/enable_sessions.js');
load('jstests/libs/override_methods/txn_passthrough_cmd_massage.js');
load('jstests/libs/override_methods/network_error_and_txn_override.js');
global_vars:
TestData:
defaultReadConcernLevel: "local"
defaultTransactionReadConcernLevel: "local"
defaultTransactionWriteConcernW: 1
defaultWriteConcernW: 1
networkErrorAndTxnOverrideConfig:
wrapCRUDinTransactions: true
sessionOptions:
# Causal consistency is not required because tests in this suite only read from
# primaries, only one node is electable in each shard, and they use transactions with
# "local" level read concern, which should see all applied writes, including those that
# have not been majority replicated.
causalConsistency: false
readMode: commands
hooks:
- class: CheckReplDBHashInBackground
# The CheckReplDBHash hook waits until all operations have replicated to and have been applied
# on the secondaries, so we run the ValidateCollections hook after it to ensure we're
# validating the entire contents of the collection.
- class: CheckReplDBHash
- class: ValidateCollections
- class: CleanEveryN
n: 20
fixture:
class: ShardedClusterFixture
mongos_options:
set_parameters:
enableTestCommands: 1
mongod_options:
set_parameters:
logComponentVerbosity:
verbosity: 0
command: 2
replication:
election: 4
heartbeats: 2
initialSync: 2
rollback: 2
storage:
recovery: 2
transaction: 4
enableTestCommands: 1
numInitialSyncAttempts: 1
num_rs_nodes_per_shard: 2
num_shards: 2
|