mirror of https://github.com/mongodb/mongo
SERVER-115499 block find and modify commands from running in the UWE (#45272)
GitOrigin-RevId: e31edc69c56a71d0e2ff29fceeded5f3dd7fad93
This commit is contained in:
parent
874182abea
commit
02888731a6
|
|
@ -812,43 +812,6 @@ bool FindAndModifyCmd::run(OperationContext* opCtx,
|
|||
// Collect metrics.
|
||||
_updateMetrics->collectMetrics(originalCmdObj);
|
||||
|
||||
if (unified_write_executor::isEnabled(opCtx)) {
|
||||
auto cmdObjForShard = CommandHelpers::filterCommandRequestForPassthrough(originalCmdObj);
|
||||
|
||||
// Evaluate let parameters once before forwarding to the shards for non-deterministic
|
||||
// operators like $rand.
|
||||
cmdObjForShard = expandLetParams(opCtx, originalNss, cmdObjForShard);
|
||||
|
||||
// Manually appending the required "$db" field name so that we can pass the parsed command
|
||||
// request to further processing.
|
||||
{
|
||||
BSONObjBuilder bob(cmdObjForShard);
|
||||
bob.append(write_ops::FindAndModifyCommandRequest::kDbNameFieldName,
|
||||
DatabaseNameUtil::serialize(originalNss.dbName(), SerializationContext{}));
|
||||
cmdObjForShard = bob.obj();
|
||||
}
|
||||
|
||||
auto request = write_ops::FindAndModifyCommandRequest::parse(
|
||||
cmdObjForShard, IDLParserContext("ClusterFindAndModify"));
|
||||
request.setNamespace(originalNss);
|
||||
|
||||
auto response = unified_write_executor::findAndModify(opCtx, request, originalCmdObj);
|
||||
if (response.swReply.isOK()) {
|
||||
auto& reply = response.swReply.getValue();
|
||||
if (response.wce) {
|
||||
reply.setWriteConcernError(response.wce->toBSON());
|
||||
}
|
||||
reply.serialize(&result);
|
||||
} else {
|
||||
if (response.wce && !result.hasField("writeConcernError")) {
|
||||
result.append("writeConcernError", response.wce->toBSON());
|
||||
}
|
||||
uassertStatusOK(response.swReply.getStatus());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (processFLEFindAndModify(opCtx, originalCmdObj, result) == FLEBatchResult::kProcessed) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,6 +127,8 @@ BulkWriteCommandReply bulkWrite(OperationContext* opCtx,
|
|||
executeWriteCommand(opCtx, WriteCommandRef{request}, originalCommand));
|
||||
}
|
||||
|
||||
// TODO(SERVER-115515) Clean up FAM code in UWE (here and across files in
|
||||
// mongo/s/write_ops/unified_write_executor/*).
|
||||
FindAndModifyCommandResponse findAndModify(
|
||||
OperationContext* opCtx,
|
||||
const write_ops::FindAndModifyCommandRequest& originalRequest,
|
||||
|
|
|
|||
Loading…
Reference in New Issue