diff options
author | David Storch <david.storch@10gen.com> | 2018-11-07 11:04:09 -0500 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2018-11-12 10:29:15 -0500 |
commit | 7369fd49c9d0c348406e08a3308d6e12cdcb057a (patch) | |
tree | 4941508e4f61ea73411699161ab25f8bcb129582 /src/mongo/db/ops | |
parent | bc8bfc6b8ad5ebf05090ae49f8fa8bf35d028d28 (diff) | |
download | mongo-7369fd49c9d0c348406e08a3308d6e12cdcb057a.tar.gz |
SERVER-37446 Make UPDATE and DELETE inherit from RequiresMutableCollectionStage.
Also deletes UpdateLifecyle, which was used as part of the
UpdateStage's yield recovery, but is no longer necessary.
Diffstat (limited to 'src/mongo/db/ops')
-rw-r--r-- | src/mongo/db/ops/update.cpp | 1 | ||||
-rw-r--r-- | src/mongo/db/ops/update_lifecycle.h | 64 | ||||
-rw-r--r-- | src/mongo/db/ops/update_lifecycle_impl.cpp | 57 | ||||
-rw-r--r-- | src/mongo/db/ops/update_lifecycle_impl.h | 66 | ||||
-rw-r--r-- | src/mongo/db/ops/update_request.h | 13 | ||||
-rw-r--r-- | src/mongo/db/ops/write_ops_exec.cpp | 3 |
6 files changed, 0 insertions, 204 deletions
diff --git a/src/mongo/db/ops/update.cpp b/src/mongo/db/ops/update.cpp index 2774cb24cd0..ff5ad3b307d 100644 --- a/src/mongo/db/ops/update.cpp +++ b/src/mongo/db/ops/update.cpp @@ -45,7 +45,6 @@ #include "mongo/db/concurrency/write_conflict_exception.h" #include "mongo/db/exec/update.h" #include "mongo/db/op_observer.h" -#include "mongo/db/ops/update_lifecycle.h" #include "mongo/db/query/explain.h" #include "mongo/db/query/get_executor.h" #include "mongo/db/query/plan_summary_stats.h" diff --git a/src/mongo/db/ops/update_lifecycle.h b/src/mongo/db/ops/update_lifecycle.h deleted file mode 100644 index a2da7e4d805..00000000000 --- a/src/mongo/db/ops/update_lifecycle.h +++ /dev/null @@ -1,64 +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 - -namespace mongo { - -class Collection; -class OperationContext; -class UpdateIndexData; - - -class UpdateLifecycle { -public: - virtual ~UpdateLifecycle() {} - - /** - * Update the cached collection pointer that this lifecycle object uses. - */ - virtual void setCollection(Collection* collection) = 0; - - /** - * Can the update continue? - * - * The (only) implementation will check the following: - * 1.) Collection still exists - * 2.) Shard version has not changed (indicating that the query/update is not valid - */ - virtual bool canContinue() const = 0; - - /** - * Return a pointer to any indexes if there is a collection. - */ - virtual const UpdateIndexData* getIndexKeys(OperationContext* opCtx) const = 0; -}; - -} // namespace mongo diff --git a/src/mongo/db/ops/update_lifecycle_impl.cpp b/src/mongo/db/ops/update_lifecycle_impl.cpp deleted file mode 100644 index 5921a27673b..00000000000 --- a/src/mongo/db/ops/update_lifecycle_impl.cpp +++ /dev/null @@ -1,57 +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. - */ - -#include "mongo/platform/basic.h" - -#include "mongo/db/ops/update_lifecycle_impl.h" - -#include "mongo/db/catalog/collection.h" -#include "mongo/db/field_ref.h" - -namespace mongo { - -UpdateLifecycleImpl::UpdateLifecycleImpl(const NamespaceString& nsStr) : _nsString(nsStr) {} - -void UpdateLifecycleImpl::setCollection(Collection* collection) { - _collection = collection; -} - -bool UpdateLifecycleImpl::canContinue() const { - // Collection needs to exist to continue - return _collection; -} - -const UpdateIndexData* UpdateLifecycleImpl::getIndexKeys(OperationContext* opCtx) const { - if (_collection) - return &_collection->infoCache()->getIndexKeys(opCtx); - return NULL; -} - -} // namespace mongo diff --git a/src/mongo/db/ops/update_lifecycle_impl.h b/src/mongo/db/ops/update_lifecycle_impl.h deleted file mode 100644 index f5608a70fbb..00000000000 --- a/src/mongo/db/ops/update_lifecycle_impl.h +++ /dev/null @@ -1,66 +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 "mongo/base/disallow_copying.h" -#include "mongo/db/namespace_string.h" -#include "mongo/db/ops/update_lifecycle.h" -#include "mongo/s/chunk_version.h" - -namespace mongo { - -class Collection; - -class UpdateLifecycleImpl : public UpdateLifecycle { - MONGO_DISALLOW_COPYING(UpdateLifecycleImpl); - -public: - /** - * ignoreVersion is for shard version checking and - * means that version checks will not be done - * - * nsString represents the namespace for the - */ - UpdateLifecycleImpl(const NamespaceString& nsString); - - virtual void setCollection(Collection* collection); - - virtual bool canContinue() const; - - virtual const UpdateIndexData* getIndexKeys(OperationContext* opCtx) const; - -private: - const NamespaceString& _nsString; - - Collection* _collection; -}; - -} /* namespace mongo */ diff --git a/src/mongo/db/ops/update_request.h b/src/mongo/db/ops/update_request.h index 3fcfcf11cd3..af6d2aa7a01 100644 --- a/src/mongo/db/ops/update_request.h +++ b/src/mongo/db/ops/update_request.h @@ -42,7 +42,6 @@ namespace mongo { namespace str = mongoutils::str; class FieldRef; -class UpdateLifecycle; class UpdateRequest { public: @@ -65,7 +64,6 @@ public: _multi(false), _fromMigration(false), _fromOplogApplication(false), - _lifecycle(NULL), _isExplain(false), _returnDocs(ReturnDocOption::RETURN_NONE), _yieldPolicy(PlanExecutor::NO_YIELD) {} @@ -165,14 +163,6 @@ public: return _fromOplogApplication; } - inline void setLifecycle(UpdateLifecycle* value) { - _lifecycle = value; - } - - inline UpdateLifecycle* getLifecycle() const { - return _lifecycle; - } - inline void setExplain(bool value = true) { _isExplain = value; } @@ -284,9 +274,6 @@ private: // True if this update was triggered by the application of an oplog entry. bool _fromOplogApplication; - // The lifecycle data, and events used during the update request. - UpdateLifecycle* _lifecycle; - // Whether or not we are requesting an explained update. Explained updates are read-only. bool _isExplain; diff --git a/src/mongo/db/ops/write_ops_exec.cpp b/src/mongo/db/ops/write_ops_exec.cpp index 834a2034033..b205ebbb26b 100644 --- a/src/mongo/db/ops/write_ops_exec.cpp +++ b/src/mongo/db/ops/write_ops_exec.cpp @@ -54,7 +54,6 @@ #include "mongo/db/ops/insert.h" #include "mongo/db/ops/parsed_delete.h" #include "mongo/db/ops/parsed_update.h" -#include "mongo/db/ops/update_lifecycle_impl.h" #include "mongo/db/ops/update_request.h" #include "mongo/db/ops/write_ops_exec.h" #include "mongo/db/ops/write_ops_gen.h" @@ -575,9 +574,7 @@ static SingleWriteResult performSingleUpdateOp(OperationContext* opCtx, curOp.ensureStarted(); } - UpdateLifecycleImpl updateLifecycle(ns); UpdateRequest request(ns); - request.setLifecycle(&updateLifecycle); request.setQuery(op.getQ()); request.setUpdates(op.getU()); request.setCollation(write_ops::collationOf(op)); |