diff options
author | Daniel Gottlieb <daniel.gottlieb@mongodb.com> | 2022-04-13 15:49:02 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-04-13 20:49:59 +0000 |
commit | 4606b3cd56fd4ca9c5c39ebc8a0f7e0cfb790f9e (patch) | |
tree | b9e24e7a5c530b115fe0adc1f0eb536c6a4d1ac8 /src/mongo/db/ops | |
parent | 66cb1dcbee5ecc7c388bec5fa0136b4205f67a58 (diff) | |
download | mongo-4606b3cd56fd4ca9c5c39ebc8a0f7e0cfb790f9e.tar.gz |
SERVER-65454: Reset curop namespace after config.image_collection lookup.
Diffstat (limited to 'src/mongo/db/ops')
-rw-r--r-- | src/mongo/db/ops/write_ops_retryability.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/ops/write_ops_retryability.cpp b/src/mongo/db/ops/write_ops_retryability.cpp index 41dcdd121f3..1f1c28cda28 100644 --- a/src/mongo/db/ops/write_ops_retryability.cpp +++ b/src/mongo/db/ops/write_ops_retryability.cpp @@ -34,12 +34,14 @@ #include "mongo/db/ops/write_ops_retryability.h" #include "mongo/bson/util/bson_extract.h" +#include "mongo/db/curop.h" #include "mongo/db/dbdirectclient.h" #include "mongo/db/namespace_string.h" #include "mongo/db/ops/write_ops_gen.h" #include "mongo/db/repl/image_collection_entry_gen.h" #include "mongo/logv2/log.h" #include "mongo/logv2/redaction.h" +#include "mongo/stdx/mutex.h" namespace mongo { namespace { @@ -118,8 +120,14 @@ BSONObj extractPreOrPostImage(OperationContext* opCtx, const repl::OplogEntry& o LogicalSessionId sessionId = oplog.getSessionId().get(); TxnNumber txnNumber = oplog.getTxnNumber().get(); Timestamp ts = oplog.getTimestamp(); + auto curOp = CurOp::get(opCtx); + const std::string existingNS = curOp->getNS(); BSONObj imageDoc = client.findOne(NamespaceString::kConfigImagesNamespace, BSON("_id" << sessionId.toBSON())); + { + stdx::lock_guard<Client> clientLock(*opCtx->getClient()); + curOp->setNS_inlock(existingNS); + } if (imageDoc.isEmpty()) { LOGV2_WARNING(5676402, "Image lookup for a retryable findAndModify was not found", |