diff options
author | Isabel Atkinson <isabel.atkinson@10gen.com> | 2020-03-10 10:45:07 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-03-18 16:14:43 +0000 |
commit | 466a5a5055b401024ed80021f52669b801aab2d4 (patch) | |
tree | 1bc0823ae09c5a337cead73ea425a9786b49edce | |
parent | 181f4103fe2c168d4a1e693511e0ebe7ae9d44e9 (diff) | |
download | mongo-466a5a5055b401024ed80021f52669b801aab2d4.tar.gz |
SERVER-46508 Use IDL to represent DeleteRequest
-rw-r--r-- | buildscripts/idl/idl/cpp_types.py | 2 | ||||
-rw-r--r-- | src/mongo/db/SConscript | 1 | ||||
-rw-r--r-- | src/mongo/db/commands/find_and_modify.cpp | 10 | ||||
-rw-r--r-- | src/mongo/db/commands/write_commands/write_commands.cpp | 7 | ||||
-rw-r--r-- | src/mongo/db/ops/delete.cpp | 5 | ||||
-rw-r--r-- | src/mongo/db/ops/delete_request.h | 158 | ||||
-rw-r--r-- | src/mongo/db/ops/delete_request.idl | 108 | ||||
-rw-r--r-- | src/mongo/db/ops/parsed_delete.cpp | 22 | ||||
-rw-r--r-- | src/mongo/db/ops/write_ops_exec.cpp | 5 | ||||
-rw-r--r-- | src/mongo/db/query/get_executor.cpp | 14 | ||||
-rw-r--r-- | src/mongo/db/query/get_executor.h | 2 | ||||
-rw-r--r-- | src/mongo/db/query/plan_executor.h | 46 | ||||
-rw-r--r-- | src/mongo/db/repl/storage_interface_impl.cpp | 7 |
13 files changed, 194 insertions, 193 deletions
diff --git a/buildscripts/idl/idl/cpp_types.py b/buildscripts/idl/idl/cpp_types.py index 72f8f31fa57..11390ccd8fd 100644 --- a/buildscripts/idl/idl/cpp_types.py +++ b/buildscripts/idl/idl/cpp_types.py @@ -602,7 +602,7 @@ def _call_method_or_global_function(expression, method_name): short_method_name = writer.get_method_name(method_name) if writer.is_function(method_name): return common.template_args('${method_name}(${expression})', expression=expression, - method_name=short_method_name) + method_name=method_name) return common.template_args('${expression}.${method_name}()', expression=expression, method_name=short_method_name) diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript index 6af9a1f9705..dfab1100fe3 100644 --- a/src/mongo/db/SConscript +++ b/src/mongo/db/SConscript @@ -1792,6 +1792,7 @@ env.Library( 'ops/update.cpp', 'ops/write_ops_retryability.cpp', env.Idlc('ops/single_write_result.idl')[0], + env.Idlc('ops/delete_request.idl')[0], ], LIBDEPS=[ '$BUILD_DIR/mongo/base', diff --git a/src/mongo/db/commands/find_and_modify.cpp b/src/mongo/db/commands/find_and_modify.cpp index baf31861f66..7c72dec9bfc 100644 --- a/src/mongo/db/commands/find_and_modify.cpp +++ b/src/mongo/db/commands/find_and_modify.cpp @@ -50,7 +50,7 @@ #include "mongo/db/matcher/extensions_callback_real.h" #include "mongo/db/namespace_string.h" #include "mongo/db/operation_context.h" -#include "mongo/db/ops/delete_request.h" +#include "mongo/db/ops/delete_request_gen.h" #include "mongo/db/ops/find_and_modify_result.h" #include "mongo/db/ops/insert.h" #include "mongo/db/ops/parsed_delete.h" @@ -150,7 +150,7 @@ void makeDeleteRequest(OperationContext* opCtx, requestOut->setCollation(args.getCollation()); requestOut->setMulti(false); requestOut->setReturnDeleted(true); // Always return the old value. - requestOut->setExplain(explain); + requestOut->setIsExplain(explain); requestOut->setYieldPolicy(opCtx->inMultiDocumentTransaction() ? PlanExecutor::INTERRUPT_ONLY : PlanExecutor::YIELD_AUTO); @@ -258,7 +258,8 @@ public: OpDebug* const opDebug = &curOp->debug(); if (args.isRemove()) { - DeleteRequest request(nsString); + auto request = DeleteRequest{}; + request.setNsString(nsString); const bool isExplain = true; makeDeleteRequest(opCtx, args, isExplain, &request); @@ -364,7 +365,8 @@ public: // return the document under concurrency, if a matching document exists. return writeConflictRetry(opCtx, "findAndModify", nsString.ns(), [&] { if (args.isRemove()) { - DeleteRequest request(nsString); + auto request = DeleteRequest{}; + request.setNsString(nsString); const bool isExplain = false; makeDeleteRequest(opCtx, args, isExplain, &request); diff --git a/src/mongo/db/commands/write_commands/write_commands.cpp b/src/mongo/db/commands/write_commands/write_commands.cpp index 4b4b6875648..1998e069b86 100644 --- a/src/mongo/db/commands/write_commands/write_commands.cpp +++ b/src/mongo/db/commands/write_commands/write_commands.cpp @@ -42,7 +42,7 @@ #include "mongo/db/lasterror.h" #include "mongo/db/matcher/extensions_callback_real.h" #include "mongo/db/namespace_string.h" -#include "mongo/db/ops/delete_request.h" +#include "mongo/db/ops/delete_request_gen.h" #include "mongo/db/ops/parsed_delete.h" #include "mongo/db/ops/parsed_update.h" #include "mongo/db/ops/write_ops.h" @@ -488,13 +488,14 @@ private: "explained write batches must be of size 1", _batch.getDeletes().size() == 1); - DeleteRequest deleteRequest(_batch.getNamespace()); + auto deleteRequest = DeleteRequest{}; + deleteRequest.setNsString(_batch.getNamespace()); deleteRequest.setQuery(_batch.getDeletes()[0].getQ()); deleteRequest.setCollation(write_ops::collationOf(_batch.getDeletes()[0])); deleteRequest.setMulti(_batch.getDeletes()[0].getMulti()); deleteRequest.setYieldPolicy(PlanExecutor::YIELD_AUTO); deleteRequest.setHint(_batch.getDeletes()[0].getHint()); - deleteRequest.setExplain(); + deleteRequest.setIsExplain(true); ParsedDelete parsedDelete(opCtx, &deleteRequest); uassertStatusOK(parsedDelete.parseRequest()); diff --git a/src/mongo/db/ops/delete.cpp b/src/mongo/db/ops/delete.cpp index 21a7a04ed19..17d4a41e9ad 100644 --- a/src/mongo/db/ops/delete.cpp +++ b/src/mongo/db/ops/delete.cpp @@ -33,7 +33,7 @@ #include "mongo/db/catalog/database.h" #include "mongo/db/exec/delete.h" -#include "mongo/db/ops/delete_request.h" +#include "mongo/db/ops/delete_request_gen.h" #include "mongo/db/ops/parsed_delete.h" #include "mongo/db/query/get_executor.h" #include "mongo/db/repl/repl_client_info.h" @@ -47,7 +47,8 @@ long long deleteObjects(OperationContext* opCtx, bool justOne, bool god, bool fromMigrate) { - DeleteRequest request(ns); + auto request = DeleteRequest{}; + request.setNsString(ns); request.setQuery(pattern); request.setMulti(!justOne); request.setGod(god); diff --git a/src/mongo/db/ops/delete_request.h b/src/mongo/db/ops/delete_request.h deleted file mode 100644 index 4758b3486bc..00000000000 --- a/src/mongo/db/ops/delete_request.h +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#pragma once - -#include <string> - -#include "mongo/db/jsobj.h" -#include "mongo/db/namespace_string.h" -#include "mongo/db/pipeline/runtime_constants_gen.h" -#include "mongo/db/query/plan_executor.h" - -namespace mongo { - -class DeleteRequest { - DeleteRequest(const DeleteRequest&) = delete; - DeleteRequest& operator=(const DeleteRequest&) = delete; - -public: - explicit DeleteRequest(const NamespaceString& nsString) - : _nsString(nsString), - _multi(false), - _god(false), - _fromMigrate(false), - _isExplain(false), - _returnDeleted(false), - _yieldPolicy(PlanExecutor::NO_YIELD) {} - - void setQuery(const BSONObj& query) { - _query = query; - } - void setProj(const BSONObj& proj) { - _proj = proj; - } - void setSort(const BSONObj& sort) { - _sort = sort; - } - void setRuntimeConstants(RuntimeConstants runtimeConstants) { - _runtimeConstants = std::move(runtimeConstants); - } - void setCollation(const BSONObj& collation) { - _collation = collation; - } - void setMulti(bool multi = true) { - _multi = multi; - } - void setGod(bool god = true) { - _god = god; - } - void setFromMigrate(bool fromMigrate = true) { - _fromMigrate = fromMigrate; - } - void setExplain(bool isExplain = true) { - _isExplain = isExplain; - } - void setReturnDeleted(bool returnDeleted = true) { - _returnDeleted = returnDeleted; - } - void setYieldPolicy(PlanExecutor::YieldPolicy yieldPolicy) { - _yieldPolicy = yieldPolicy; - } - - const NamespaceString& getNamespaceString() const { - return _nsString; - } - const BSONObj& getQuery() const { - return _query; - } - const BSONObj& getProj() const { - return _proj; - } - const BSONObj& getSort() const { - return _sort; - } - const boost::optional<RuntimeConstants>& getRuntimeConstants() const { - return _runtimeConstants; - } - const BSONObj& getCollation() const { - return _collation; - } - bool isMulti() const { - return _multi; - } - bool isGod() const { - return _god; - } - bool isFromMigrate() const { - return _fromMigrate; - } - bool isExplain() const { - return _isExplain; - } - void setHint(const BSONObj& hint) { - _hint = hint; - } - BSONObj getHint() const { - return _hint; - } - bool shouldReturnDeleted() const { - return _returnDeleted; - } - PlanExecutor::YieldPolicy getYieldPolicy() const { - return _yieldPolicy; - } - - void setStmtId(StmtId stmtId) { - _stmtId = std::move(stmtId); - } - - StmtId getStmtId() const { - return _stmtId; - } - -private: - const NamespaceString& _nsString; - BSONObj _hint; - BSONObj _query; - BSONObj _proj; - BSONObj _sort; - BSONObj _collation; - boost::optional<RuntimeConstants> _runtimeConstants; - // The statement id of this request. - StmtId _stmtId = kUninitializedStmtId; - bool _multi; - bool _god; - bool _fromMigrate; - bool _isExplain; - bool _returnDeleted; - PlanExecutor::YieldPolicy _yieldPolicy; -}; - -} // namespace mongo diff --git a/src/mongo/db/ops/delete_request.idl b/src/mongo/db/ops/delete_request.idl new file mode 100644 index 00000000000..4f7cbed7b78 --- /dev/null +++ b/src/mongo/db/ops/delete_request.idl @@ -0,0 +1,108 @@ +# Copyright (C) 2020-present MongoDB, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the Server Side Public License, version 1, +# as published by MongoDB, Inc. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# Server Side Public License for more details. +# +# You should have received a copy of the Server Side Public License +# along with this program. If not, see +# <http://www.mongodb.com/licensing/server-side-public-license>. +# +# As a special exception, the copyright holders give permission to link the +# code of portions of this program with the OpenSSL library under certain +# conditions as described in each individual source file and distribute +# linked combinations including the program with the OpenSSL library. You +# must comply with the Server Side Public License in all respects for +# all of the code used other than as permitted herein. If you modify file(s) +# with this exception, you may extend this exception to your version of the +# file(s), but you are not obligated to do so. If you do not wish to do so, +# delete this exception statement from your version. If you delete this +# exception statement from all source files in the program, then also delete +# it in the license file. +# + +global: + cpp_namespace: "mongo" + cpp_includes: + - "mongo/db/logical_session_id.h" + - "mongo/db/query/plan_executor.h" + +imports: + - "mongo/db/logical_session_id.idl" + - "mongo/db/pipeline/runtime_constants.idl" + - "mongo/idl/basic_types.idl" + - "mongo/db/query/hint.idl" + +types: + yield_policy: + bson_serialization_type: string + description: "The yielding policy of the plan executor" + cpp_type: "PlanExecutor::YieldPolicy" + serializer: "::mongo::PlanExecutor::serializeYieldPolicy" + deserializer: "mongo::PlanExecutor::parseFromBSON" + stmt_id: + bson_serialization_type: int + description: "" + cpp_type: "mongo::StmtId" + deserializer: "mongo::BSONElement::_numberInt" + +structs: + DeleteRequest: + description: "Specifies a delete command." + fields: + nsString: + description: "Specifies the namespace string for the delete." + type: namespacestring + hint: + description: "Specifies the hint to use for the delete." + type: object + query: + description: "Specifies the query to use for the delete." + type: object + proj: + description: "Specifies the projection to use for the delete." + type: object + sort: + description: "Specifies the sort to use for the delete." + type: object + collation: + description: "Specifies the collation to use for the delete." + type: object + runtimeConstants: + description: "A collection of values that do not change once computed." + type: RuntimeConstants + optional: true + stmtId: + description: "The statement ID for the delete." + type: stmt_id + default: kUninitializedStmtId + multi: + description: "If true, deletes all documents that meet the query criteria. If false, + limits the delete to one document which meets the query criteria." + type: bool + default: false + god: + description: "If true, execute the delete in GodMode." + type: bool + default: false + fromMigrate: + description: "" + type: bool + default: false + isExplain: + description: "If true, running an explain of the delete command." + type: bool + default: false + returnDeleted: + description: "If true, return the deleted documents." + type: bool + default: false + yieldPolicy: + description: "The yielding policy of the plan executor." + type: yield_policy + default: PlanExecutor::NO_YIELD diff --git a/src/mongo/db/ops/parsed_delete.cpp b/src/mongo/db/ops/parsed_delete.cpp index 4f71d9b9562..3d71ec95ca3 100644 --- a/src/mongo/db/ops/parsed_delete.cpp +++ b/src/mongo/db/ops/parsed_delete.cpp @@ -37,7 +37,7 @@ #include "mongo/db/catalog/database.h" #include "mongo/db/exec/delete.h" #include "mongo/db/matcher/extensions_callback_real.h" -#include "mongo/db/ops/delete_request.h" +#include "mongo/db/ops/delete_request_gen.h" #include "mongo/db/query/canonical_query.h" #include "mongo/db/query/collation/collator_factory_interface.h" #include "mongo/db/query/get_executor.h" @@ -54,11 +54,11 @@ Status ParsedDelete::parseRequest() { dassert(!_canonicalQuery.get()); // It is invalid to request that the DeleteStage return the deleted document during a // multi-remove. - invariant(!(_request->shouldReturnDeleted() && _request->isMulti())); + invariant(!(_request->getReturnDeleted() && _request->getMulti())); // It is invalid to request that a ProjectionStage be applied to the DeleteStage if the // DeleteStage would not return the deleted document. - invariant(_request->getProj().isEmpty() || _request->shouldReturnDeleted()); + invariant(_request->getProj().isEmpty() || _request->getReturnDeleted()); std::unique_ptr<CollatorInterface> collator(nullptr); if (!_request->getCollation().isEmpty()) { @@ -70,10 +70,8 @@ Status ParsedDelete::parseRequest() { } collator = uassertStatusOK(std::move(statusWithCollator)); } - _expCtx = make_intrusive<ExpressionContext>(_opCtx, - std::move(collator), - _request->getNamespaceString(), - _request->getRuntimeConstants()); + _expCtx = make_intrusive<ExpressionContext>( + _opCtx, std::move(collator), _request->getNsString(), _request->getRuntimeConstants()); if (CanonicalQuery::isSimpleIdQuery(_request->getQuery())) { return Status::OK(); @@ -85,15 +83,15 @@ Status ParsedDelete::parseRequest() { Status ParsedDelete::parseQueryToCQ() { dassert(!_canonicalQuery.get()); - const ExtensionsCallbackReal extensionsCallback(_opCtx, &_request->getNamespaceString()); + const ExtensionsCallbackReal extensionsCallback(_opCtx, &_request->getNsString()); // The projection needs to be applied after the delete operation, so we do not specify a // projection during canonicalization. - auto qr = std::make_unique<QueryRequest>(_request->getNamespaceString()); + auto qr = std::make_unique<QueryRequest>(_request->getNsString()); qr->setFilter(_request->getQuery()); qr->setSort(_request->getSort()); qr->setCollation(_request->getCollation()); - qr->setExplain(_request->isExplain()); + qr->setExplain(_request->getIsExplain()); qr->setHint(_request->getHint()); // Limit should only used for the findAndModify command when a sort is specified. If a sort @@ -102,7 +100,7 @@ Status ParsedDelete::parseQueryToCQ() { // deleted out from under it, but a limit could inhibit that and give an EOF when the delete // has not actually deleted a document. This behavior is fine for findAndModify, but should // not apply to deletes in general. - if (!_request->isMulti() && !_request->getSort().isEmpty()) { + if (!_request->getMulti() && !_request->getSort().isEmpty()) { qr->setLimit(1); } @@ -130,7 +128,7 @@ const DeleteRequest* ParsedDelete::getRequest() const { } PlanExecutor::YieldPolicy ParsedDelete::yieldPolicy() const { - return _request->isGod() ? PlanExecutor::NO_YIELD : _request->getYieldPolicy(); + return _request->getGod() ? PlanExecutor::NO_YIELD : _request->getYieldPolicy(); } bool ParsedDelete::hasParsedQuery() const { diff --git a/src/mongo/db/ops/write_ops_exec.cpp b/src/mongo/db/ops/write_ops_exec.cpp index be883aa7013..260e4f7c711 100644 --- a/src/mongo/db/ops/write_ops_exec.cpp +++ b/src/mongo/db/ops/write_ops_exec.cpp @@ -52,7 +52,7 @@ #include "mongo/db/introspect.h" #include "mongo/db/lasterror.h" #include "mongo/db/matcher/extensions_callback_real.h" -#include "mongo/db/ops/delete_request.h" +#include "mongo/db/ops/delete_request_gen.h" #include "mongo/db/ops/insert.h" #include "mongo/db/ops/parsed_delete.h" #include "mongo/db/ops/parsed_update.h" @@ -878,7 +878,8 @@ static SingleWriteResult performSingleDeleteOp(OperationContext* opCtx, curOp.ensureStarted(); } - DeleteRequest request(ns); + auto request = DeleteRequest{}; + request.setNsString(ns); request.setQuery(op.getQ()); request.setCollation(write_ops::collationOf(op)); request.setMulti(op.getMulti()); diff --git a/src/mongo/db/query/get_executor.cpp b/src/mongo/db/query/get_executor.cpp index ce5dafd80f6..dc5d3434462 100644 --- a/src/mongo/db/query/get_executor.cpp +++ b/src/mongo/db/query/get_executor.cpp @@ -738,8 +738,8 @@ StatusWith<unique_ptr<PlanExecutor, PlanExecutor::Deleter>> getExecutorDelete( OperationContext* opCtx = expCtx->opCtx; const DeleteRequest* request = parsedDelete->getRequest(); - const NamespaceString& nss(request->getNamespaceString()); - if (!request->isGod()) { + const NamespaceString& nss(request->getNsString()); + if (!request->getGod()) { if (nss.isSystem() && opCtx->lockState()->shouldConflictWithSecondaryBatchApplication()) { uassert(12050, "cannot delete from system namespace", nss.isLegalClientSystemNS()); } @@ -759,10 +759,10 @@ StatusWith<unique_ptr<PlanExecutor, PlanExecutor::Deleter>> getExecutorDelete( } auto deleteStageParams = std::make_unique<DeleteStageParams>(); - deleteStageParams->isMulti = request->isMulti(); - deleteStageParams->fromMigrate = request->isFromMigrate(); - deleteStageParams->isExplain = request->isExplain(); - deleteStageParams->returnDeleted = request->shouldReturnDeleted(); + deleteStageParams->isMulti = request->getMulti(); + deleteStageParams->fromMigrate = request->getFromMigrate(); + deleteStageParams->isExplain = request->getIsExplain(); + deleteStageParams->returnDeleted = request->getReturnDeleted(); deleteStageParams->sort = request->getSort(); deleteStageParams->opDebug = opDebug; deleteStageParams->stmtId = request->getStmtId(); @@ -859,7 +859,7 @@ StatusWith<unique_ptr<PlanExecutor, PlanExecutor::Deleter>> getExecutorDelete( cq->getExpCtx().get(), std::move(deleteStageParams), ws.get(), collection, root.release()); if (!request->getProj().isEmpty()) { - invariant(request->shouldReturnDeleted()); + invariant(request->getReturnDeleted()); const bool allowPositional = true; StatusWith<unique_ptr<PlanStage>> projStatus = applyProjection( diff --git a/src/mongo/db/query/get_executor.h b/src/mongo/db/query/get_executor.h index 4390557ef05..905903bd607 100644 --- a/src/mongo/db/query/get_executor.h +++ b/src/mongo/db/query/get_executor.h @@ -30,7 +30,7 @@ #pragma once #include "mongo/db/catalog/index_catalog_entry.h" -#include "mongo/db/ops/delete_request.h" +#include "mongo/db/ops/delete_request_gen.h" #include "mongo/db/ops/parsed_delete.h" #include "mongo/db/ops/parsed_update.h" #include "mongo/db/ops/update_request.h" diff --git a/src/mongo/db/query/plan_executor.h b/src/mongo/db/query/plan_executor.h index 178652b2594..ffb54ee7c90 100644 --- a/src/mongo/db/query/plan_executor.h +++ b/src/mongo/db/query/plan_executor.h @@ -146,6 +146,52 @@ public: ALWAYS_MARK_KILLED, }; + static std::string serializeYieldPolicy(YieldPolicy yieldPolicy) { + switch (yieldPolicy) { + case YIELD_AUTO: + return "YIELD_AUTO"; + case WRITE_CONFLICT_RETRY_ONLY: + return "WRITE_CONFLICT_RETRY_ONLY"; + case YIELD_MANUAL: + return "YIELD_MANUAL"; + case NO_YIELD: + return "NO_YIELD"; + case INTERRUPT_ONLY: + return "INTERRUPT_ONLY"; + case ALWAYS_TIME_OUT: + return "ALWAYS_TIME_OUT"; + case ALWAYS_MARK_KILLED: + return "ALWAYS_MARK_KILLED"; + } + MONGO_UNREACHABLE; + } + + static YieldPolicy parseFromBSON(const StringData& element) { + const std::string& yieldPolicy = element.toString(); + if (yieldPolicy == "YIELD_AUTO") { + return YIELD_AUTO; + } + if (yieldPolicy == "WRITE_CONFLICT_RETRY_ONLY") { + return WRITE_CONFLICT_RETRY_ONLY; + } + if (yieldPolicy == "YIELD_MANUAL") { + return YIELD_MANUAL; + } + if (yieldPolicy == "NO_YIELD") { + return NO_YIELD; + } + if (yieldPolicy == "INTERRUPT_ONLY") { + return INTERRUPT_ONLY; + } + if (yieldPolicy == "ALWAYS_TIME_OUT") { + return ALWAYS_TIME_OUT; + } + if (yieldPolicy == "ALWAYS_MARK_KILLED") { + return ALWAYS_MARK_KILLED; + } + MONGO_UNREACHABLE; + } + /** * This class will ensure a PlanExecutor is disposed before it is deleted. */ diff --git a/src/mongo/db/repl/storage_interface_impl.cpp b/src/mongo/db/repl/storage_interface_impl.cpp index 4e0d7ea8851..c78a7efc763 100644 --- a/src/mongo/db/repl/storage_interface_impl.cpp +++ b/src/mongo/db/repl/storage_interface_impl.cpp @@ -64,7 +64,7 @@ #include "mongo/db/logical_clock.h" #include "mongo/db/matcher/extensions_callback_real.h" #include "mongo/db/operation_context.h" -#include "mongo/db/ops/delete_request.h" +#include "mongo/db/ops/delete_request_gen.h" #include "mongo/db/ops/parsed_update.h" #include "mongo/db/ops/update_request.h" #include "mongo/db/query/get_executor.h" @@ -998,14 +998,15 @@ Status StorageInterfaceImpl::updateSingleton(OperationContext* opCtx, Status StorageInterfaceImpl::deleteByFilter(OperationContext* opCtx, const NamespaceString& nss, const BSONObj& filter) { - DeleteRequest request(nss); + auto request = DeleteRequest{}; + request.setNsString(nss); request.setQuery(filter); request.setMulti(true); request.setYieldPolicy(PlanExecutor::NO_YIELD); // This disables the isLegalClientSystemNS() check in getExecutorDelete() which is used to // disallow client deletes from unrecognized system collections. - request.setGod(); + request.setGod(true); return writeConflictRetry(opCtx, "StorageInterfaceImpl::deleteByFilter", nss.ns(), [&] { // ParsedDelete needs to be inside the write conflict retry loop because it may create a |