diff options
| author | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-02-18 17:02:53 -0300 |
|---|---|---|
| committer | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-02-18 17:02:53 -0300 |
| commit | 959575a5ca598bf5f37fb5cebe7ed1d80d3d71f7 (patch) | |
| tree | acc8d60aedb12b70048e676e8a7349deb0010db8 /src/mongo/db/pipeline/process_interface/shardsvr_process_interface.cpp | |
| parent | 76588293975fc059cf076779e4283e6ffaf8afff (diff) | |
New upstream version 6.0.20upstream
Diffstat (limited to 'src/mongo/db/pipeline/process_interface/shardsvr_process_interface.cpp')
| -rw-r--r-- | src/mongo/db/pipeline/process_interface/shardsvr_process_interface.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mongo/db/pipeline/process_interface/shardsvr_process_interface.cpp b/src/mongo/db/pipeline/process_interface/shardsvr_process_interface.cpp index 9755fcc7dbd..aa6914f88c3 100644 --- a/src/mongo/db/pipeline/process_interface/shardsvr_process_interface.cpp +++ b/src/mongo/db/pipeline/process_interface/shardsvr_process_interface.cpp @@ -110,7 +110,9 @@ Status ShardServerProcessInterface::insert( BatchedCommandRequest batchInsertCommand(std::move(insertCommand)); - batchInsertCommand.setWriteConcern(wc.toBSON()); + const auto originalWC = expCtx->opCtx->getWriteConcern(); + ScopeGuard resetWCGuard([&] { expCtx->opCtx->setWriteConcern(originalWC); }); + expCtx->opCtx->setWriteConcern(wc); cluster::write(expCtx->opCtx, batchInsertCommand, &stats, &response, targetEpoch); @@ -129,7 +131,10 @@ StatusWith<MongoProcessInterface::UpdateResult> ShardServerProcessInterface::upd BatchWriteExecStats stats; BatchedCommandRequest batchUpdateCommand(std::move(updateCommand)); - batchUpdateCommand.setWriteConcern(wc.toBSON()); + + const auto originalWC = expCtx->opCtx->getWriteConcern(); + ScopeGuard resetWCGuard([&] { expCtx->opCtx->setWriteConcern(originalWC); }); + expCtx->opCtx->setWriteConcern(wc); cluster::write(expCtx->opCtx, batchUpdateCommand, &stats, &response, targetEpoch); |
