Skip to content

Commit 9f64a4b

Browse files
committed
SERVER-23256 Make profiler tests run serially with fsyncLock tests.
1 parent a1ad099 commit 9f64a4b

File tree

3 files changed

+49
-30
lines changed

3 files changed

+49
-30
lines changed

jstests/core/apitest_db.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,22 +130,26 @@ dd("e");
130130
* profile level
131131
*/
132132

133-
db.setProfilingLevel(0);
134-
assert(db.getProfilingLevel() == 0, "prof level 0");
133+
// A test-specific database is used for profiler testing so as not to interfere with other tests
134+
// that modify profiler level, when run in parallel.
135+
var profileLevelDB = db.getSiblingDB("apitest_db_profile_level");
135136

136-
db.setProfilingLevel(1);
137-
assert(db.getProfilingLevel() == 1, "p1");
137+
profileLevelDB.setProfilingLevel(0);
138+
assert(profileLevelDB.getProfilingLevel() == 0, "prof level 0");
138139

139-
db.setProfilingLevel(2);
140-
assert(db.getProfilingLevel() == 2, "p2");
140+
profileLevelDB.setProfilingLevel(1);
141+
assert(profileLevelDB.getProfilingLevel() == 1, "p1");
141142

142-
db.setProfilingLevel(0);
143-
assert(db.getProfilingLevel() == 0, "prof level 0");
143+
profileLevelDB.setProfilingLevel(2);
144+
assert(profileLevelDB.getProfilingLevel() == 2, "p2");
145+
146+
profileLevelDB.setProfilingLevel(0);
147+
assert(profileLevelDB.getProfilingLevel() == 0, "prof level 0");
144148

145149
dd("f");
146150
asserted = false;
147151
try {
148-
db.setProfilingLevel(10);
152+
profileLevelDB.setProfilingLevel(10);
149153
assert(false);
150154
} catch (e) {
151155
asserted = true;

jstests/core/geo_s2cursorlimitskip.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Test various cursor behaviors
2-
var t = db.geo_s2getmmm;
2+
3+
var testDB = db.getSiblingDB("geo_s2cursorlimitskip");
4+
var t = testDB.geo_s2getmmm;
35
t.drop();
46
t.ensureIndex({geo: "2dsphere"});
57

@@ -42,9 +44,9 @@ assert.eq(cursor.count(), totalPointCount);
4244
// Disable profiling in order to drop the system.profile collection.
4345
// Then enable profiling for all operations. This is acceptable because
4446
// our test is blacklisted from the parallel suite.
45-
db.setProfilingLevel(0);
46-
db.system.profile.drop();
47-
db.setProfilingLevel(2);
47+
testDB.setProfilingLevel(0);
48+
testDB.system.profile.drop();
49+
testDB.setProfilingLevel(2);
4850

4951
for (var j = 0; j < initialAdvance; j++) {
5052
assert(cursor.hasNext());
@@ -54,21 +56,21 @@ for (var j = 0; j < initialAdvance; j++) {
5456
assert(cursor.hasNext());
5557

5658
// Cursor was advanced 10 times, batchSize=4 => 1 query + 2 getmore.
57-
assert.eq(1, db.system.profile.count({op: "query", ns: t.getFullName()}));
58-
assert.eq(2, db.system.profile.count({op: "getmore", ns: t.getFullName()}));
59+
assert.eq(1, testDB.system.profile.count({op: "query", ns: t.getFullName()}));
60+
assert.eq(2, testDB.system.profile.count({op: "getmore", ns: t.getFullName()}));
5961

6062
for (var k = initialAdvance; k < totalPointCount; k++) {
6163
assert(cursor.hasNext());
6264
var tmpPoint = cursor.next();
6365
}
6466

6567
// Cursor was advanced 200 times, batchSize=4 => 1 query + 49 getmore.
66-
assert.eq(1, db.system.profile.count({op: "query", ns: t.getFullName()}));
67-
assert.eq(49, db.system.profile.count({op: "getmore", ns: t.getFullName()}));
68+
assert.eq(1, testDB.system.profile.count({op: "query", ns: t.getFullName()}));
69+
assert.eq(49, testDB.system.profile.count({op: "getmore", ns: t.getFullName()}));
6870

6971
// Disable profiling again - no longer needed for remainder of test
70-
db.setProfilingLevel(0);
71-
db.system.profile.drop();
72+
testDB.setProfilingLevel(0);
73+
testDB.system.profile.drop();
7274

7375
// Shouldn't be any more points to look at now.
7476
assert(!cursor.hasNext());

jstests/libs/parallelTester.js

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,9 @@ if (typeof _threadInject != "undefined") {
156156
"index_bigkeys_nofail.js",
157157
"index_bigkeys_validation.js",
158158

159-
// tests turn on profiling
160-
"profile1.js",
161-
"profile3.js",
162-
"geo_s2cursorlimitskip.js",
163-
164159
"mr_drop.js",
165160
"mr3.js",
166161
"indexh.js",
167-
"apitest_db.js",
168-
"evalb.js",
169162
"evald.js",
170163
"evalf.js",
171164
"killop.js",
@@ -203,11 +196,31 @@ if (typeof _threadInject != "undefined") {
203196
parallelFilesDir + "/fsync.js",
204197
parallelFilesDir + "/auth1.js",
205198

206-
// These tests expect the profiler to be on or off at specific points
207-
// during the test run.
208-
parallelFilesDir + "/cursor6.js",
199+
// These tests expect the profiler to be on or off at specific points. They should not
200+
// be run in parallel with tests that peform fsyncLock. User operations skip writing to
201+
// the system.profile collection while the server is fsyncLocked.
202+
//
203+
// The profiler tests can be run in parallel with each other as they use test-specific
204+
// databases.
205+
parallelFilesDir + "/apitest_db.js",
206+
parallelFilesDir + "/evalb.js",
207+
parallelFilesDir + "/geo_s2cursorlimitskip.js",
208+
parallelFilesDir + "/profile1.js",
209209
parallelFilesDir + "/profile2.js",
210-
parallelFilesDir + "/updatee.js"
210+
parallelFilesDir + "/profile3.js",
211+
parallelFilesDir + "/profile_agg.js",
212+
parallelFilesDir + "/profile_count.js",
213+
parallelFilesDir + "/profile_delete.js",
214+
parallelFilesDir + "/profile_distinct.js",
215+
parallelFilesDir + "/profile_find.js",
216+
parallelFilesDir + "/profile_findandmodify.js",
217+
parallelFilesDir + "/profile_geonear.js",
218+
parallelFilesDir + "/profile_getmore.js",
219+
parallelFilesDir + "/profile_group.js",
220+
parallelFilesDir + "/profile_insert.js",
221+
parallelFilesDir + "/profile_mapreduce.js",
222+
parallelFilesDir + "/profile_no_such_db.js",
223+
parallelFilesDir + "/profile_update.js"
211224
];
212225
var serialTests = makeKeys(serialTestsArr);
213226

0 commit comments

Comments
 (0)