Skip to content

Commit d62890f

Browse files
committed
SERVER-34384 Add passthrough test for secondary reads
1 parent 1f5410f commit d62890f

File tree

10 files changed

+181
-6
lines changed

10 files changed

+181
-6
lines changed
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
test_kind: js_test
2+
3+
selector:
4+
roots:
5+
- jstests/core/**/*.js
6+
exclude_files:
7+
# Operations within a transaction do not support write concern.
8+
- jstests/core/txns/**/*.js
9+
# These tests are not expected to pass with replica-sets:
10+
- jstests/core/dbadmin.js
11+
- jstests/core/opcounters_write_cmd.js
12+
- jstests/core/read_after_optime.js
13+
- jstests/core/capped_update.js
14+
# These tests attempt to read from the "system.profile" collection, which may be missing entries
15+
# if a write was performed on the primary of the replica set instead.
16+
- jstests/core/*profile*.js
17+
# Two cursors can be established on different secondaries, so the count of
18+
# $listLocalCursors will not always be 2.
19+
- jstests/core/list_all_local_cursors.js
20+
21+
# Tests that fail for Causal Consistency with default injected readPreference 'secondary'
22+
# "TODO SERVER-30384: These tests assume that documents are returned in the same order they are
23+
# written when no sort is specified; however, the order of documents within a collection can
24+
# be different across a primary and secondary."
25+
- jstests/core/coveredIndex1.js
26+
- jstests/core/distinct1.js
27+
- jstests/core/elemMatchProjection.js
28+
- jstests/core/find4.js
29+
- jstests/core/find5.js
30+
- jstests/core/fts1.js
31+
- jstests/core/find_dedup.js
32+
- jstests/core/fts_spanish.js
33+
- jstests/core/geo_distinct.js
34+
- jstests/core/geo_s2ordering.js
35+
- jstests/core/group1.js
36+
- jstests/core/group2.js
37+
- jstests/core/maxscan.js
38+
- jstests/core/nan.js
39+
- jstests/core/null2.js
40+
- jstests/core/not2.js
41+
- jstests/core/sorta.js
42+
- jstests/core/sortc.js
43+
- jstests/core/sort3.js
44+
- jstests/core/sort4.js
45+
- jstests/core/ord.js
46+
# Parallel shell is not causally consistent
47+
- jstests/core/cursora.js
48+
- jstests/core/find_and_modify_concurrent_update.js
49+
- jstests/core/shellstartparallel.js
50+
- jstests/core/loadserverscripts.js
51+
# getMore is not causal consistent because afterClusterTime has been specified
52+
# by the preceding find command which establishes the cursor. Therefore,
53+
# getMore cannot be guaranteed to get executed after commands in between find
54+
# and getMore.
55+
- jstests/core/drop3.js
56+
- jstests/core/ord.js
57+
- jstests/core/tailable_cursor_invalidation.js
58+
- jstests/core/tailable_skip_limit.js
59+
# doTxn uses a different session so the operationTime of the default session
60+
# will not be advanced by doTxn. Therefore, operations in the default
61+
# session cannot be guaranteed to get executed after doTxn.
62+
- jstests/core/bypass_doc_validation.js
63+
- jstests/core/collation.js
64+
65+
exclude_with_any_tags:
66+
##
67+
# The next three tags correspond to the special errors thrown by the
68+
# set_read_and_write_concerns.js override when it refuses to replace the readConcern or
69+
# writeConcern of a particular command. Above each tag are the message(s) that cause the tag to be
70+
# warranted.
71+
##
72+
# "Cowardly refusing to override read concern of command: ..."
73+
- assumes_read_concern_unchanged
74+
# "Cowardly refusing to override write concern of command: ..."
75+
- assumes_write_concern_unchanged
76+
# "Cowardly refusing to run test with overridden write concern when it uses a command that can
77+
# only perform w=1 writes: ..."
78+
- requires_eval_command
79+
##
80+
# The next tag corresponds to the special error thrown by the set_read_preference_secondary.js
81+
# override when it refuses to replace the readPreference of a particular command. Above each tag
82+
# are the message(s) that cause the tag to be warranted.
83+
##
84+
# "Cowardly refusing to override read preference of command: ..."
85+
# "Cowardly refusing to run test with overridden read preference when it reads from a
86+
# non-replicated collection: ..."
87+
- assumes_read_preference_unchanged
88+
##
89+
# collStats and dbStats are not causally consistent
90+
- requires_collstats
91+
- requires_dbstats
92+
93+
executor:
94+
archive:
95+
hooks:
96+
- CheckReplDBHash
97+
- CheckReplOplogs
98+
- ValidateCollections
99+
config:
100+
shell_options:
101+
global_vars:
102+
TestData:
103+
defaultReadConcernLevel: local
104+
defaultWriteConcern: {w: 1}
105+
eval: >-
106+
testingReplication = true;
107+
load('jstests/libs/override_methods/set_read_and_write_concerns.js');
108+
load('jstests/libs/override_methods/set_read_preference_secondary.js');
109+
load('jstests/libs/override_methods/enable_causal_consistency.js');
110+
readMode: commands
111+
hooks:
112+
# The CheckReplDBHash hook waits until all operations have replicated to and have been applied
113+
# on the secondaries, so we run the ValidateCollections hook after it to ensure we're
114+
# validating the entire contents of the collection.
115+
- class: CheckReplOplogs
116+
- class: CheckReplDBHash
117+
- class: ValidateCollections
118+
- class: CleanEveryN
119+
n: 20
120+
fixture:
121+
class: ReplicaSetFixture
122+
mongod_options:
123+
set_parameters:
124+
enableTestCommands: 1
125+
numInitialSyncAttempts: 1
126+
num_nodes: 5
127+
# We give each of the nodes a vote in a 5-node replica set so that the
128+
# secondaries have different beliefs about the majority commit point
129+
# relative to the cluster's majority commit point.
130+
voting_secondaries: true
131+
use_replica_set_connection_string: true

etc/evergreen.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4239,6 +4239,17 @@ tasks:
42394239
resmoke_args: --suites=write_concern_majority_passthrough --storageEngine=wiredTiger
42404240
run_multiple_jobs: true
42414241

4242+
- <<: *task_template
4243+
name: secondary_reads_passthrough
4244+
depends_on:
4245+
- name: jsCore
4246+
commands:
4247+
- func: "do setup"
4248+
- func: "run tests"
4249+
vars:
4250+
resmoke_args: --suites=secondary_reads_passthrough --storageEngine=wiredTiger
4251+
run_multiple_jobs: true
4252+
42424253
- <<: *task_template
42434254
name: replica_sets
42444255
commands:
@@ -9588,6 +9599,9 @@ buildvariants:
95889599
- name: write_concern_majority_passthrough
95899600
distros:
95909601
- rhel62-large
9602+
- name: secondary_reads_passthrough
9603+
distros:
9604+
- rhel62-large
95919605
- name: package
95929606
distros:
95939607
- ubuntu1604-packer
@@ -9717,6 +9731,7 @@ buildvariants:
97179731
- name: update_fuzzer
97189732
- name: update_fuzzer_replication
97199733
- name: write_concern_majority_passthrough
9734+
- name: secondary_reads_passthrough
97209735

97219736
- name: enterprise-rhel-70-64-bit
97229737
display_name: "* Enterprise RHEL 7.0"
@@ -10089,6 +10104,7 @@ buildvariants:
1008910104
- name: sslSpecial
1009010105
- name: tool
1009110106
- name: write_concern_majority_passthrough
10107+
- name: secondary_reads_passthrough
1009210108
- name: push
1009310109
distros:
1009410110
- rhel70-small
@@ -10195,6 +10211,7 @@ buildvariants:
1019510211
- name: sslSpecial
1019610212
- name: tool
1019710213
- name: write_concern_majority_passthrough
10214+
- name: secondary_reads_passthrough
1019810215
- name: push
1019910216
distros:
1020010217
- rhel70-small
@@ -10292,6 +10309,7 @@ buildvariants:
1029210309
- name: sslSpecial
1029310310
- name: tool
1029410311
- name: write_concern_majority_passthrough
10312+
- name: secondary_reads_passthrough
1029510313
- name: push
1029610314
distros:
1029710315
- rhel62-large
@@ -10621,6 +10639,7 @@ buildvariants:
1062110639
- name: sslSpecial
1062210640
- name: tool
1062310641
- name: write_concern_majority_passthrough
10642+
- name: secondary_reads_passthrough
1062410643
- name: push
1062510644
distros:
1062610645
- suse12-test
@@ -11273,6 +11292,7 @@ buildvariants:
1127311292
- name: update_fuzzer
1127411293
- name: update_fuzzer_replication
1127511294
- name: write_concern_majority_passthrough
11295+
- name: secondary_reads_passthrough
1127611296

1127711297
- name: enterprise-rhel-62-64-bit-mobile
1127811298
display_name: Enterprise RHEL 6.2 (mobile)
@@ -11653,6 +11673,7 @@ buildvariants:
1165311673
- name: sslSpecial
1165411674
- name: tool
1165511675
- name: write_concern_majority_passthrough
11676+
- name: secondary_reads_passthrough
1165611677

1165711678
- name: enterprise-rhel-72-s390x-inmem
1165811679
display_name: Enterprise RHEL 7.2 s390x (inMemory) DEBUG
@@ -11739,6 +11760,7 @@ buildvariants:
1173911760
- name: sslSpecial
1174011761
- name: tool
1174111762
- name: write_concern_majority_passthrough
11763+
- name: secondary_reads_passthrough
1174211764

1174311765
- name: ubuntu1404-rocksdb
1174411766
display_name: Ubuntu 14.04 (RocksDB)
@@ -11897,6 +11919,7 @@ buildvariants:
1189711919
- name: update_fuzzer
1189811920
- name: update_fuzzer_replication
1189911921
- name: write_concern_majority_passthrough
11922+
- name: secondary_reads_passthrough
1190011923

1190111924
- name: ubuntu1604-asan
1190211925
display_name: ~ ASAN SSL Ubuntu 16.04
@@ -12067,6 +12090,7 @@ buildvariants:
1206712090
- name: update_fuzzer
1206812091
- name: update_fuzzer_replication
1206912092
- name: write_concern_majority_passthrough
12093+
- name: secondary_reads_passthrough
1207012094

1207112095
- name: ubuntu1604-debug-aubsan-lite
1207212096
display_name: "! {A,UB}SAN Enterprise SSL Ubuntu 16.04 DEBUG"
@@ -12195,6 +12219,7 @@ buildvariants:
1219512219
- name: sslSpecial
1219612220
- name: tool
1219712221
- name: write_concern_majority_passthrough
12222+
- name: secondary_reads_passthrough
1219812223

1219912224
- name: enterprise-ubuntu-dynamic-1604-64-bit
1220012225
display_name: "* Shared Library Enterprise Ubuntu 16.04"

jstests/core/apitest_dbcollection.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*
44
* @tags: [
55
* requires_fastcount,
6+
* requires_collstats,
67
*
78
* # indexDetails result is not correct with mobile storage engine.
89
* # TODO SERVER-34579

jstests/core/auth1.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @tags: [requires_non_retryable_commands, requires_auth]
1+
// @tags: [requires_non_retryable_commands, requires_auth, assumes_write_concern_unchanged]
22

33
var mydb = db.getSiblingDB('auth1_db');
44
mydb.dropAllUsers();

jstests/core/auth_copydb.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
// @tags: [requires_non_retryable_commands, requires_fastcount, requires_auth]
1+
// @tags: [
2+
// requires_non_retryable_commands,
3+
// requires_fastcount,
4+
// requires_auth,
5+
// assumes_write_concern_unchanged
6+
// ]
27

38
a = db.getSisterDB("copydb2-test-a");
49
b = db.getSisterDB("copydb2-test-b");

jstests/core/connection_status.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
// @tags: [requires_non_retryable_commands, requires_auth]
1+
// @tags: [
2+
// requires_non_retryable_commands,
3+
// requires_auth,
4+
// assumes_write_concern_unchanged
5+
// ]
26

37
// Tests the connectionStatus command
48
(function() {

jstests/core/rename7.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @tags: [requires_non_retryable_commands, requires_fastcount]
1+
// @tags: [requires_non_retryable_commands, requires_fastcount, requires_collstats]
22

33
// ***************************************************************
44
// rename7.js

jstests/core/role_management_helpers.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// @tags: [
22
// requires_non_retryable_commands,
33
// requires_auth,
4+
// assumes_write_concern_unchanged,
45
// ]
56

67
// This test is a basic sanity check of the shell helpers for manipulating role objects

jstests/core/user_management_helpers.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
// @tags: [requires_non_retryable_commands, requires_auth]
1+
// @tags: [
2+
// requires_non_retryable_commands,
3+
// requires_auth,
4+
// assumes_write_concern_unchanged
5+
// ]
26

37
// This test is a basic sanity check of the shell helpers for manipulating user objects
48
// It is not a comprehensive test of the functionality of the user manipulation commands

jstests/core/validate_user_documents.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
// @tags: [requires_non_retryable_commands, requires_auth]
1+
// @tags: [
2+
// requires_non_retryable_commands,
3+
// requires_auth,
4+
// assumes_write_concern_unchanged
5+
// ]
26

37
// Ensure that inserts and updates of the system.users collection validate the schema of inserted
48
// documents.

0 commit comments

Comments
 (0)