Skip to content

Commit 4320926

Browse files
committed
SERVER-20580 Re-enable csrs_upgrade_during_migrate.js test
1 parent 7f6f5f4 commit 4320926

File tree

9 files changed

+41
-43
lines changed

9 files changed

+41
-43
lines changed

buildscripts/resmokeconfig/suites/sharding.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ selector:
44
- jstests/sharding/*.js
55
- jstests/sharding/replset_config/*.js
66
exclude_files:
7-
- jstests/sharding/csrs_upgrade_during_migrate.js # flaky - SERVER-20580
87

98
executor:
109
js_test:

buildscripts/resmokeconfig/suites/sharding_auth.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ selector:
1010
- jstests/sharding/replset_config/*.js
1111
- jstests/sharding/sync_cluster_config/*.js
1212
exclude_files:
13-
- jstests/sharding/csrs_upgrade_during_migrate.js # flaky - SERVER-20580
1413
# Skip any tests that run with auth explicitly.
1514
- jstests/sharding/*[aA]uth*.js
1615
- jstests/sharding/replset_config/*[aA]uth*.js

buildscripts/resmokeconfig/suites/sharding_auth_audit.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ selector:
1010
- jstests/sharding/replset_config/*.js
1111
- jstests/sharding/sync_cluster_config/*.js
1212
exclude_files:
13-
- jstests/sharding/csrs_upgrade_during_migrate.js # flaky - SERVER-20580
1413
# Skip any tests that run with auth explicitly.
1514
- jstests/sharding/*[aA]uth*.js
1615
- jstests/sharding/replset_config/*[aA]uth*.js

buildscripts/resmokeconfig/suites/sharding_continuous_config_stepdown.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ selector:
44
- jstests/sharding/*.js
55
- jstests/sharding/replset_config/*.js
66
exclude_files:
7-
# SERVER-20694
8-
- jstests/sharding/csrs_upgrade.js
9-
# Test is flaky - SERVER-20580
10-
- jstests/sharding/csrs_upgrade_during_migrate.js
117
# Auth tests require authentication on the stepdown thread's connection
128
- jstests/sharding/auth*.js
139
- jstests/sharding/cleanup_orphaned_auth.js

buildscripts/resmokeconfig/suites/sharding_ese.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ selector:
88
- jstests/sharding/*.js
99
- jstests/sharding/replset_config/*.js
1010
exclude_files:
11-
- jstests/sharding/csrs_upgrade_during_migrate.js # flaky - SERVER-20580
1211

1312
executor:
1413
js_test:

buildscripts/resmokeconfig/suites/sharding_legacy.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ selector:
44
- jstests/sharding/*.js
55
- jstests/sharding/sync_cluster_config/*.js
66
exclude_files:
7-
- jstests/sharding/csrs_upgrade_during_migrate.js # SERVER-20580
87

98
executor:
109
js_test:

jstests/replsets/rslib.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
var wait, occasionally, reconnect, getLatestOp, waitForAllMembers, reconfig, awaitOpTime;
2+
var waitUntilAllNodesCaughtUp;
3+
24
(function () {
35
"use strict";
46
var count = 0;
@@ -148,4 +150,35 @@ awaitOpTime = function (node, opTime) {
148150
});
149151
};
150152

153+
/**
154+
* Uses the results of running replSetGetStatus against an arbitrary replset node to wait until
155+
* all nodes in the set are replicated through the same optime.
156+
*/
157+
waitUntilAllNodesCaughtUp = function(rs) {
158+
var rsStatus;
159+
var firstConflictingIndex;
160+
var ot;
161+
var otherOt;
162+
assert.soon(function () {
163+
rsStatus = rs[0].adminCommand('replSetGetStatus');
164+
if (rsStatus.ok != 1) {
165+
return false;
166+
}
167+
assert.eq(rs.length, rsStatus.members.length, tojson(rsStatus));
168+
ot = rsStatus.members[0].optime;
169+
for (var i = 1; i < rsStatus.members.length; ++i) {
170+
otherOt = rsStatus.members[i].optime;
171+
if (bsonWoCompare({ts: otherOt.ts}, {ts: ot.ts}) ||
172+
bsonWoCompare({t: otherOt.t}, {t: ot.t})) {
173+
firstConflictingIndex = i;
174+
return false;
175+
}
176+
}
177+
return true;
178+
}, function () {
179+
return "Optimes of members 0 (" + tojson(ot) + ") and " + firstConflictingIndex + " (" +
180+
tojson(otherOt) + ") are different in " + tojson(rsStatus);
181+
});
182+
};
183+
151184
}());

jstests/sharding/csrs_upgrade.js

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
* config.version is read to confirm the availability of metadata
1515
* reads.
1616
*/
17+
18+
load("jstests/replsets/rslib.js");
19+
1720
var st;
1821
(function() {
1922
"use strict";
@@ -96,33 +99,6 @@ var st;
9699
}
97100
});
98101

99-
var waitUntilAllCaughtUp = function(csrs) {
100-
var rsStatus;
101-
var firstConflictingIndex;
102-
var ot;
103-
var otherOt;
104-
assert.soon(function () {
105-
rsStatus = csrs[0].adminCommand('replSetGetStatus');
106-
if (rsStatus.ok != 1) {
107-
return false;
108-
}
109-
assert.eq(csrs.length, rsStatus.members.length, tojson(rsStatus));
110-
ot = rsStatus.members[0].optime;
111-
for (var i = 1; i < rsStatus.members.length; ++i) {
112-
otherOt = rsStatus.members[i].optime;
113-
if (bsonWoCompare({ts: otherOt.ts}, {ts: ot.ts}) ||
114-
bsonWoCompare({t: otherOt.t}, {t: ot.t})) {
115-
firstConflictingIndex = i;
116-
return false;
117-
}
118-
}
119-
return true;
120-
}, function () {
121-
return "Optimes of members 0 (" + tojson(ot) + ") and " + firstConflictingIndex + " (" +
122-
tojson(otherOt) + ") are different in " + tojson(rsStatus);
123-
});
124-
};
125-
126102
var shardConfigs = st.s0.getCollection("config.shards").find().toArray();
127103
assert.eq(2, shardConfigs.length);
128104
var shard0Name = shardConfigs[0]._id;
@@ -192,7 +168,7 @@ var st;
192168
assertOpsWork(st.s0, "using SCCC protocol when first config server is primary of " +
193169
csrs.length + "-node replica set");
194170

195-
waitUntilAllCaughtUp(csrs);
171+
waitUntilAllNodesCaughtUp(csrs);
196172

197173
jsTest.log("Shutting down second and third SCCC config server nodes");
198174
MongoRunner.stopMongod(st.c1);

jstests/sharding/csrs_upgrade_during_migrate.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,7 @@ var st;
120120
jsTest.log("Adding non-voting members to csrs set: " + tojson(csrsConfig));
121121
assert.commandWorked(csrs[0].adminCommand({replSetReconfig: csrsConfig}));
122122

123-
// This write is an easy way to wait for all members of the CSRS set to have
124-
// replicated all of the documents.
125-
assert.writeOK(csrs[0].getCollection('config.tmp').insert({},
126-
{ writeConcern: { w:csrs.length }}));
123+
waitUntilAllNodesCaughtUp(csrs);
127124

128125
jsTest.log("Starting long-running chunk migration");
129126
// Turn on fail point to confirm that moveChunk aborts before getting to the critical section.
@@ -145,8 +142,9 @@ var st;
145142
return st.s0.getDB('config').changelog.findOne({what: 'moveChunk.start'});
146143
});
147144

148-
jsTest.log("Shutting down second and third SCCC config server nodes");
149-
MongoRunner.stopMongod(st.c1);
145+
// Only shut down one of the SCCC config servers to avoid any period without any config servers
146+
// online.
147+
jsTest.log("Shutting down third SCCC config server node");
150148
MongoRunner.stopMongod(st.c2);
151149

152150
csrsConfig.members.forEach(function (member) { member.votes = 1; member.priority = 1});

0 commit comments

Comments
 (0)