diff options
author | ADAM David Alan Martin <adam.martin@10gen.com> | 2017-06-05 11:07:00 -0400 |
---|---|---|
committer | ADAM David Alan Martin <adam.martin@10gen.com> | 2017-06-05 11:07:00 -0400 |
commit | 7226d27bb57301fcfb995b22bcb3b0eee23ba540 (patch) | |
tree | 84f3b91260b4835a5c62488d66a39538f25a7794 | |
parent | 6e41f26f639689ae55284af07abf033f8c7b3e7b (diff) | |
download | mongo-7226d27bb57301fcfb995b22bcb3b0eee23ba540.tar.gz |
SERVER-29253 Migrate cursor manager to the client cursor lib.
Putting `CursorManager` and `ClientCursor` in the same library
allows us to remove a cycle exemption in cursor and to fully
resolve mmap_v1 against dependencies.
-rw-r--r-- | src/mongo/db/SConscript | 7 | ||||
-rw-r--r-- | src/mongo/db/assemble_response.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/catalog/SConscript | 3 | ||||
-rw-r--r-- | src/mongo/db/catalog/collection.h | 4 | ||||
-rw-r--r-- | src/mongo/db/clientcursor.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/getmore_cmd.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/killcursors_cmd.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/list_collections.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/list_indexes.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/cursor_manager.cpp (renamed from src/mongo/db/catalog/cursor_manager.cpp) | 6 | ||||
-rw-r--r-- | src/mongo/db/cursor_manager.h (renamed from src/mongo/db/catalog/cursor_manager.h) | 54 | ||||
-rw-r--r-- | src/mongo/db/storage/mmap_v1/SConscript | 9 | ||||
-rw-r--r-- | src/mongo/dbtests/cursor_manager_test.cpp | 2 |
13 files changed, 44 insertions, 53 deletions
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript index e6b85a9329e..90cf669054b 100644 --- a/src/mongo/db/SConscript +++ b/src/mongo/db/SConscript @@ -606,16 +606,13 @@ env.Library( target="clientcursor", source=[ "clientcursor.cpp", + "cursor_manager.cpp", ], LIBDEPS=[ "$BUILD_DIR/mongo/base", "$BUILD_DIR/mongo/util/background_job", "query/query", - #"catalog/catalog", # CYCLE (CursorManager) - ], - LIBDEPS_TAGS=[ - # TODO(ADAM, 2017-03-10): See `CYCLE` tags above - 'illegal_cyclic_or_unresolved_dependencies_whitelisted', + "background", ], ) diff --git a/src/mongo/db/assemble_response.cpp b/src/mongo/db/assemble_response.cpp index 1eda99f8c94..abbb666e8d0 100644 --- a/src/mongo/db/assemble_response.cpp +++ b/src/mongo/db/assemble_response.cpp @@ -34,10 +34,10 @@ #include "mongo/db/audit.h" #include "mongo/db/auth/authorization_session.h" -#include "mongo/db/catalog/cursor_manager.h" #include "mongo/db/commands/fsync.h" #include "mongo/db/curop.h" #include "mongo/db/curop_metrics.h" +#include "mongo/db/cursor_manager.h" #include "mongo/db/dbdirectclient.h" #include "mongo/db/diag_log.h" #include "mongo/db/introspect.h" diff --git a/src/mongo/db/catalog/SConscript b/src/mongo/db/catalog/SConscript index 7e19fa604cb..20180689ef7 100644 --- a/src/mongo/db/catalog/SConscript +++ b/src/mongo/db/catalog/SConscript @@ -154,7 +154,6 @@ env.Library( "collection_compact.cpp", "collection_impl.cpp", "collection_info_cache_impl.cpp", - "cursor_manager.cpp", "database_impl.cpp", "database_holder_impl.cpp", "index_catalog_impl.cpp", @@ -173,6 +172,7 @@ env.Library( 'index_key_validate', '$BUILD_DIR/mongo/base', '$BUILD_DIR/mongo/db/auth/authmongod', + '$BUILD_DIR/mongo/db/clientcursor', '$BUILD_DIR/mongo/db/concurrency/lock_manager', '$BUILD_DIR/mongo/db/curop', '$BUILD_DIR/mongo/db/query/query', @@ -187,7 +187,6 @@ env.Library( '$BUILD_DIR/mongo/db/background', '$BUILD_DIR/mongo/db/db_raii', '$BUILD_DIR/mongo/db/index/index_access_methods', - '$BUILD_DIR/mongo/db/clientcursor', '$BUILD_DIR/mongo/db/s/balancer', '$BUILD_DIR/mongo/db/views/views_mongod', ], diff --git a/src/mongo/db/catalog/collection.h b/src/mongo/db/catalog/collection.h index caf3a32288e..002a5c21366 100644 --- a/src/mongo/db/catalog/collection.h +++ b/src/mongo/db/catalog/collection.h @@ -1,4 +1,4 @@ -/*- +/** * Copyright (C) 2017 MongoDB Inc. * * This program is free software: you can redistribute it and/or modify @@ -38,8 +38,8 @@ #include "mongo/bson/mutable/damage_vector.h" #include "mongo/db/catalog/coll_mod.h" #include "mongo/db/catalog/collection_info_cache.h" -#include "mongo/db/catalog/cursor_manager.h" #include "mongo/db/catalog/index_catalog.h" +#include "mongo/db/cursor_manager.h" #include "mongo/db/exec/collection_scan_common.h" #include "mongo/db/namespace_string.h" #include "mongo/db/op_observer.h" diff --git a/src/mongo/db/clientcursor.cpp b/src/mongo/db/clientcursor.cpp index b181d8d4d6c..b6a686ba717 100644 --- a/src/mongo/db/clientcursor.cpp +++ b/src/mongo/db/clientcursor.cpp @@ -259,6 +259,7 @@ ClientCursor* ClientCursorPin::getCursor() const { return _cursor; } +namespace { // // ClientCursorMonitor // @@ -287,7 +288,6 @@ public: } }; -namespace { // Only one instance of the ClientCursorMonitor exists ClientCursorMonitor clientCursorMonitor; diff --git a/src/mongo/db/commands/getmore_cmd.cpp b/src/mongo/db/commands/getmore_cmd.cpp index d14f77b249b..e9c46da135a 100644 --- a/src/mongo/db/commands/getmore_cmd.cpp +++ b/src/mongo/db/commands/getmore_cmd.cpp @@ -36,11 +36,11 @@ #include "mongo/base/disallow_copying.h" #include "mongo/db/auth/authorization_session.h" #include "mongo/db/catalog/collection.h" -#include "mongo/db/catalog/cursor_manager.h" #include "mongo/db/client.h" #include "mongo/db/clientcursor.h" #include "mongo/db/commands.h" #include "mongo/db/curop.h" +#include "mongo/db/cursor_manager.h" #include "mongo/db/db_raii.h" #include "mongo/db/exec/working_set_common.h" #include "mongo/db/query/cursor_response.h" diff --git a/src/mongo/db/commands/killcursors_cmd.cpp b/src/mongo/db/commands/killcursors_cmd.cpp index 394039ab124..7e2aaa91cbc 100644 --- a/src/mongo/db/commands/killcursors_cmd.cpp +++ b/src/mongo/db/commands/killcursors_cmd.cpp @@ -30,9 +30,9 @@ #include "mongo/base/disallow_copying.h" #include "mongo/db/catalog/collection.h" -#include "mongo/db/catalog/cursor_manager.h" #include "mongo/db/commands/killcursors_common.h" #include "mongo/db/curop.h" +#include "mongo/db/cursor_manager.h" #include "mongo/db/db_raii.h" #include "mongo/db/query/killcursors_request.h" #include "mongo/db/stats/top.h" diff --git a/src/mongo/db/commands/list_collections.cpp b/src/mongo/db/commands/list_collections.cpp index 13bb793ff8b..bbf9e37e18d 100644 --- a/src/mongo/db/commands/list_collections.cpp +++ b/src/mongo/db/commands/list_collections.cpp @@ -37,12 +37,12 @@ #include "mongo/db/auth/authorization_session.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/collection_catalog_entry.h" -#include "mongo/db/catalog/cursor_manager.h" #include "mongo/db/catalog/database.h" #include "mongo/db/catalog/database_catalog_entry.h" #include "mongo/db/clientcursor.h" #include "mongo/db/commands.h" #include "mongo/db/commands/list_collections_filter.h" +#include "mongo/db/cursor_manager.h" #include "mongo/db/db_raii.h" #include "mongo/db/exec/queued_data_stage.h" #include "mongo/db/exec/working_set.h" diff --git a/src/mongo/db/commands/list_indexes.cpp b/src/mongo/db/commands/list_indexes.cpp index 0e639d07108..3d2b5577388 100644 --- a/src/mongo/db/commands/list_indexes.cpp +++ b/src/mongo/db/commands/list_indexes.cpp @@ -31,13 +31,13 @@ #include "mongo/db/auth/authorization_session.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/collection_catalog_entry.h" -#include "mongo/db/catalog/cursor_manager.h" #include "mongo/db/catalog/database.h" #include "mongo/db/clientcursor.h" #include "mongo/db/commands.h" #include "mongo/db/commands/feature_compatibility_version.h" #include "mongo/db/concurrency/write_conflict_exception.h" #include "mongo/db/curop.h" +#include "mongo/db/cursor_manager.h" #include "mongo/db/db_raii.h" #include "mongo/db/exec/queued_data_stage.h" #include "mongo/db/exec/working_set.h" diff --git a/src/mongo/db/catalog/cursor_manager.cpp b/src/mongo/db/cursor_manager.cpp index 918134b057d..f1bdd8a9442 100644 --- a/src/mongo/db/catalog/cursor_manager.cpp +++ b/src/mongo/db/cursor_manager.cpp @@ -1,5 +1,3 @@ -// cursor_manager.cpp - /** * Copyright (C) 2013 MongoDB Inc. * @@ -28,7 +26,7 @@ * it in the license file. */ -#include "mongo/db/catalog/cursor_manager.h" +#include "mongo/db/cursor_manager.h" #include "mongo/base/data_cursor.h" #include "mongo/base/init.h" @@ -76,7 +74,6 @@ CursorId cursorIdFromParts(uint32_t collectionIdentifier, uint32_t cursor) { x |= cursor; return x; } -} // namespace class GlobalCursorIdCache { public: @@ -268,6 +265,7 @@ std::size_t GlobalCursorIdCache::timeoutCursors(OperationContext* opCtx, Date_t return totalTimedOut; } +} // namespace // --- diff --git a/src/mongo/db/catalog/cursor_manager.h b/src/mongo/db/cursor_manager.h index 70fce8f3804..40408c48830 100644 --- a/src/mongo/db/catalog/cursor_manager.h +++ b/src/mongo/db/cursor_manager.h @@ -1,32 +1,30 @@ -// cursor_manager.h - /** -* Copyright (C) 2013 MongoDB Inc. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU Affero General Public License, version 3, -* as published by the Free Software Foundation. -* -* 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 -* GNU Affero General Public License for more details. -* -* You should have received a copy of the GNU Affero General Public License -* along with this program. If not, see <http://www.gnu.org/licenses/>. -* -* 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 GNU Affero General 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. -*/ + * Copyright (C) 2013 MongoDB Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * 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 + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * 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 GNU Affero General 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 diff --git a/src/mongo/db/storage/mmap_v1/SConscript b/src/mongo/db/storage/mmap_v1/SConscript index dfea5c764da..fd2b47b426f 100644 --- a/src/mongo/db/storage/mmap_v1/SConscript +++ b/src/mongo/db/storage/mmap_v1/SConscript @@ -57,20 +57,19 @@ env.Library( '$BUILD_DIR/mongo/db/catalog/database_holder', '$BUILD_DIR/mongo/db/catalog/index_catalog', '$BUILD_DIR/mongo/db/catalog/index_create', + '$BUILD_DIR/mongo/db/clientcursor', '$BUILD_DIR/mongo/db/commands', + '$BUILD_DIR/mongo/db/commands/server_status', '$BUILD_DIR/mongo/db/concurrency/lock_manager', '$BUILD_DIR/mongo/db/diag_log', '$BUILD_DIR/mongo/db/index_names', '$BUILD_DIR/mongo/db/index/index_descriptor', '$BUILD_DIR/mongo/db/storage/journal_listener', + '$BUILD_DIR/mongo/db/storage/kv/kv_prefix', '$BUILD_DIR/mongo/db/storage/storage_engine_lock_file', '$BUILD_DIR/mongo/db/storage/storage_engine_metadata', '$BUILD_DIR/mongo/db/index/index_access_methods', - #'$BUILD_DIR/mongo/db/catalog/catalog', # CYCLE (CursorManager & applyUpdateOperators) - ], - LIBDEPS_TAGS=[ - # TODO(ADAM, 2017-04-25): See `CYCLE` tags above - 'illegal_cyclic_or_unresolved_dependencies_whitelisted', + '$BUILD_DIR/mongo/db/ops/write_ops', ], ) diff --git a/src/mongo/dbtests/cursor_manager_test.cpp b/src/mongo/dbtests/cursor_manager_test.cpp index dc26a74b2e0..07ec00df8fc 100644 --- a/src/mongo/dbtests/cursor_manager_test.cpp +++ b/src/mongo/dbtests/cursor_manager_test.cpp @@ -28,9 +28,9 @@ #include "mongo/platform/basic.h" -#include "mongo/db/catalog/cursor_manager.h" #include "mongo/db/client.h" #include "mongo/db/clientcursor.h" +#include "mongo/db/cursor_manager.h" #include "mongo/db/exec/queued_data_stage.h" #include "mongo/db/exec/working_set.h" #include "mongo/db/exec/working_set_common.h" |