diff options
author | Jordi Olivares Provencio <jordi.olivares-provencio@mongodb.com> | 2022-10-27 13:43:32 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-10-27 14:44:23 +0000 |
commit | e79fa3438f0fe33a4e688e29fad0a161a8681523 (patch) | |
tree | 4becfd63815c2d813225aa0c6c4a142e1789a4a7 /src/mongo/db/introspect.cpp | |
parent | 0a36c400692c54d148c9c38601dff1ce825edb1f (diff) | |
download | mongo-e79fa3438f0fe33a4e688e29fad0a161a8681523.tar.gz |
SERVER-69820 Simplify Flow control ticket acquisition
Diffstat (limited to 'src/mongo/db/introspect.cpp')
-rw-r--r-- | src/mongo/db/introspect.cpp | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/src/mongo/db/introspect.cpp b/src/mongo/db/introspect.cpp index a64f1b825a3..ae73d9d3833 100644 --- a/src/mongo/db/introspect.cpp +++ b/src/mongo/db/introspect.cpp @@ -89,12 +89,6 @@ void profile(OperationContext* opCtx, NetworkOp op) { const string dbName(nsToDatabase(CurOp::get(opCtx)->getNS())); - auto origFlowControl = opCtx->shouldParticipateInFlowControl(); - - // The system.profile collection is non-replicated, so writes to it do not cause - // replication lag. As such, they should be excluded from Flow Control. - opCtx->setShouldParticipateInFlowControl(false); - // Set the opCtx to be only interruptible for replication state changes. This is needed // because for some operations that are already marked as killed due to errors such as // operation time exceeding maxTimeMS, we still want to output the profiler entry. Thus @@ -108,13 +102,11 @@ void profile(OperationContext* opCtx, NetworkOp op) { } // IX lock acquisitions beyond this block will not be related to writes to system.profile. - ON_BLOCK_EXIT([opCtx, origFlowControl] { - opCtx->setIgnoreInterruptsExceptForReplStateChange(false); - opCtx->setShouldParticipateInFlowControl(origFlowControl); - }); + ON_BLOCK_EXIT([opCtx] { opCtx->setIgnoreInterruptsExceptForReplStateChange(false); }); try { - const auto dbProfilingNS = NamespaceString(dbName, "system.profile"); + const auto dbProfilingNS = + NamespaceString(dbName, NamespaceString::kSystemDotProfileCollectionName); AutoGetCollection autoColl(opCtx, dbProfilingNS, MODE_IX); Database* const db = autoColl.getDb(); if (!db) { @@ -140,7 +132,6 @@ void profile(OperationContext* opCtx, NetworkOp op) { auto coll = CollectionCatalog::get(opCtx)->lookupCollectionByNamespace(opCtx, dbProfilingNS); - invariant(!opCtx->shouldParticipateInFlowControl()); WriteUnitOfWork wuow(opCtx); OpDebug* const nullOpDebug = nullptr; uassertStatusOK(collection_internal::insertDocument( @@ -160,9 +151,9 @@ void profile(OperationContext* opCtx, NetworkOp op) { Status createProfileCollection(OperationContext* opCtx, Database* db) { invariant(opCtx->lockState()->isDbLockedForMode(db->name(), MODE_IX)); - invariant(!opCtx->shouldParticipateInFlowControl()); - const auto dbProfilingNS = NamespaceString(db->name(), "system.profile"); + const auto dbProfilingNS = + NamespaceString(db->name(), NamespaceString::kSystemDotProfileCollectionName); // Checking the collection exists must also be done in the WCE retry loop. Only retrying // collection creation would endlessly throw errors because the collection exists: must check |