diff options
author | Gregory Noma <gregory.noma@gmail.com> | 2020-04-09 17:32:46 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-04-09 21:56:33 +0000 |
commit | b0e3eed55a031a43ddc9674c71da7c3e5e59eb64 (patch) | |
tree | 29c5ed52da80e091568277e942e6023d2f72c805 /jstests | |
parent | 437b5f31521e39615553803324fae2b1ddb3b2b8 (diff) | |
download | mongo-b0e3eed55a031a43ddc9674c71da7c3e5e59eb64.tar.gz |
SERVER-47360 Take collection MODE_IX lock instead of database MODE_X lock when creating system.profile
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/noPassthrough/profile_interrupted_op.js | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/jstests/noPassthrough/profile_interrupted_op.js b/jstests/noPassthrough/profile_interrupted_op.js index f0fff91b734..f48c96f4dfa 100644 --- a/jstests/noPassthrough/profile_interrupted_op.js +++ b/jstests/noPassthrough/profile_interrupted_op.js @@ -1,10 +1,11 @@ -// Test what happens when the profiler (introspect.cpp) wants to log an operation, but the -// 'system.profiler' collection does not yet exist and is not safe to create, because the operation -// context is an interrupted state (SERVER-38481). -// -// This test restarts the server and requires that data persists across restarts. -// @tags: [requires_persistence, requires_profiling] - +/** + * Tests that when the profiler (introspect.cpp) wants to log an operation but the + * 'system.profiler' collection does not yet exist and the operation context is an interrupted + * state, the collection can still be successfully created on the fly. + * + * This test restarts the server and requires that data persists across restarts. + * @tags: [requires_persistence, requires_profiling] + */ (function() { "use strict"; @@ -49,24 +50,10 @@ const err = assert.throws(function() { assert.contains( err.code, [ErrorCodes.MaxTimeMSExpired, ErrorCodes.Interrupted, ErrorCodes.InternalError], err); -// -// Profiling is not necessary for the rest of the test. We turn it off to make sure it doesn't -// interfere with any remaining commands. -// -db.setProfilingLevel(0); - -// -// The mongod should print out a warning to indicate the potential need for a manually created -// 'system.profile' collection. -// -checkLog.contains(standalone, "Manually create profile collection"); - -// -// The mongod should not create the 'system.profile' collection automatically. -// +// The mongod should have created the 'system.profile' collection automatically. const res = db.runCommand({listCollections: 1, filter: {name: "system.profile"}}); assert.commandWorked(res); -assert.eq(res.cursor.firstBatch, [], res); +assert.eq(res.cursor.firstBatch.length, 1, res); MongoRunner.stopMongod(standalone); })(); |