diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2015-04-15 11:22:29 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2015-04-15 13:04:02 -0400 |
commit | e02bc3b1738b0c49f5bf2cbde320892cdfa539a5 (patch) | |
tree | 7f10fe78b95b516069cdfc1356628e62861b49eb /src | |
parent | 0a93c411a6a22c0dac8a82fed0efc4e60f62f40d (diff) | |
download | mongo-e02bc3b1738b0c49f5bf2cbde320892cdfa539a5.tar.gz |
SERVER-18064 Move shard.cpp under the sharding client library
Diffstat (limited to 'src')
25 files changed, 60 insertions, 70 deletions
diff --git a/src/mongo/SConscript b/src/mongo/SConscript index 0ecbe97c0bb..e9a1640bcc7 100644 --- a/src/mongo/SConscript +++ b/src/mongo/SConscript @@ -905,7 +905,6 @@ env.Library('coreshard', 's/chunk.cpp', 's/chunk_manager.cpp', 's/config_server_checker_service.cpp', - 's/shard.cpp', 's/shard_key_pattern.cpp' ], LIBDEPS=[ diff --git a/src/mongo/client/dbclientcursor.cpp b/src/mongo/client/dbclientcursor.cpp index aeb60c6adda..94ed23d18d7 100644 --- a/src/mongo/client/dbclientcursor.cpp +++ b/src/mongo/client/dbclientcursor.cpp @@ -36,8 +36,7 @@ #include "mongo/client/connpool.h" #include "mongo/db/dbmessage.h" #include "mongo/db/namespace_string.h" -#include "mongo/s/shard.h" -#include "mongo/s/stale_exception.h" // for RecvStaleConfigException +#include "mongo/s/stale_exception.h" #include "mongo/util/debug_util.h" #include "mongo/util/exit.h" #include "mongo/util/log.h" diff --git a/src/mongo/client/parallel.cpp b/src/mongo/client/parallel.cpp index caaada1cf82..fc4fa920bac 100644 --- a/src/mongo/client/parallel.cpp +++ b/src/mongo/client/parallel.cpp @@ -551,7 +551,7 @@ namespace mongo { void ParallelSortClusteredCursor::setupVersionAndHandleSlaveOk( PCStatePtr state, const Shard& shard, - ShardPtr primary, + boost::shared_ptr<Shard> primary, const NamespaceString& ns, const string& vinfo, ChunkManagerPtr manager ) { @@ -1158,8 +1158,8 @@ namespace mongo { return _cursorMap.size(); } - ShardPtr ParallelSortClusteredCursor::getQueryShard() { - return ShardPtr(new Shard(_cursorMap.begin()->first)); + boost::shared_ptr<Shard> ParallelSortClusteredCursor::getQueryShard() { + return boost::shared_ptr<Shard>(new Shard(_cursorMap.begin()->first)); } void ParallelSortClusteredCursor::getQueryShards(set<Shard>& shards) { @@ -1169,9 +1169,9 @@ namespace mongo { } } - ShardPtr ParallelSortClusteredCursor::getPrimary() { + boost::shared_ptr<Shard> ParallelSortClusteredCursor::getPrimary() { if (isSharded()) - return ShardPtr(); + return boost::shared_ptr<Shard>(); return _cursorMap.begin()->second.pcState->primary; } diff --git a/src/mongo/client/parallel.h b/src/mongo/client/parallel.h index 0730811c59f..60e1cd93f1d 100644 --- a/src/mongo/client/parallel.h +++ b/src/mongo/client/parallel.h @@ -37,10 +37,10 @@ #include "mongo/db/matcher/matcher.h" #include "mongo/db/namespace_string.h" #include "mongo/s/client/shard_connection.h" -#include "mongo/s/shard.h" namespace mongo { + class Shard; class StaleConfigException; /** @@ -114,7 +114,7 @@ namespace mongo { // Version information ChunkManagerPtr manager; - ShardPtr primary; + boost::shared_ptr<Shard> primary; // Cursor status information long long count; @@ -225,13 +225,13 @@ namespace mongo { * Returns the single shard with an open cursor. * It is an error to call this if getNumQueryShards() > 1 */ - ShardPtr getQueryShard(); + boost::shared_ptr<Shard> getQueryShard(); /** * Returns primary shard with an open cursor. * It is an error to call this if the collection is sharded. */ - ShardPtr getPrimary(); + boost::shared_ptr<Shard> getPrimary(); ChunkManagerPtr getChunkManager( const Shard& shard ); DBClientCursorPtr getShardCursor( const Shard& shard ); @@ -277,7 +277,7 @@ namespace mongo { */ void setupVersionAndHandleSlaveOk( PCStatePtr state /* in & out */, const Shard& shard, - ShardPtr primary /* in */, + boost::shared_ptr<Shard> primary /* in */, const NamespaceString& ns, const std::string& vinfo, ChunkManagerPtr manager /* in */ ); diff --git a/src/mongo/db/pipeline/document_source.h b/src/mongo/db/pipeline/document_source.h index d665a1e591a..53c07871bb3 100644 --- a/src/mongo/db/pipeline/document_source.h +++ b/src/mongo/db/pipeline/document_source.h @@ -47,12 +47,12 @@ #include "mongo/db/pipeline/expression.h" #include "mongo/db/pipeline/value.h" #include "mongo/db/sorter/sorter.h" -#include "mongo/s/shard.h" #include "mongo/s/strategy.h" #include "mongo/util/intrusive_counter.h" namespace mongo { + class Accumulator; class Document; class Expression; diff --git a/src/mongo/db/pipeline/document_source_command_shards.cpp b/src/mongo/db/pipeline/document_source_command_shards.cpp index d48da244e97..80bbab2d95e 100644 --- a/src/mongo/db/pipeline/document_source_command_shards.cpp +++ b/src/mongo/db/pipeline/document_source_command_shards.cpp @@ -29,7 +29,7 @@ #include "mongo/platform/basic.h" #include "mongo/db/pipeline/document_source.h" -#include "mongo/s/shard.h" +#include "mongo/s/client/shard.h" namespace mongo { diff --git a/src/mongo/s/balance.cpp b/src/mongo/s/balance.cpp index 1b556bed8f4..50f63399afd 100644 --- a/src/mongo/s/balance.cpp +++ b/src/mongo/s/balance.cpp @@ -50,7 +50,7 @@ #include "mongo/s/distlock.h" #include "mongo/s/grid.h" #include "mongo/s/server.h" -#include "mongo/s/shard.h" +#include "mongo/s/client/shard.h" #include "mongo/s/type_actionlog.h" #include "mongo/s/type_collection.h" #include "mongo/s/type_mongos.h" diff --git a/src/mongo/s/balancer_policy.cpp b/src/mongo/s/balancer_policy.cpp index e97c41fc187..e8b0461da99 100644 --- a/src/mongo/s/balancer_policy.cpp +++ b/src/mongo/s/balancer_policy.cpp @@ -31,10 +31,11 @@ #include "mongo/platform/basic.h" +#include "mongo/s/balancer_policy.h" + #include <algorithm> #include "mongo/client/connpool.h" -#include "mongo/s/balancer_policy.h" #include "mongo/s/catalog/catalog_manager.h" #include "mongo/s/catalog/type_shard.h" #include "mongo/s/chunk_manager.h" diff --git a/src/mongo/s/balancer_policy.h b/src/mongo/s/balancer_policy.h index 445821fca2d..0e011d7ece0 100644 --- a/src/mongo/s/balancer_policy.h +++ b/src/mongo/s/balancer_policy.h @@ -28,8 +28,7 @@ * then also delete it in the license file. */ -#ifndef S_BALANCER_POLICY_HEADER -#define S_BALANCER_POLICY_HEADER +#pragma once #include <boost/noncopyable.hpp> @@ -37,7 +36,6 @@ #include "mongo/base/owned_pointer_vector.h" #include "mongo/db/jsobj.h" #include "mongo/s/catalog/type_chunk.h" -#include "mongo/s/shard.h" namespace mongo { @@ -236,5 +234,3 @@ namespace mongo { } // namespace mongo - -#endif // S_BALANCER_POLICY_HEADER diff --git a/src/mongo/s/catalog/legacy/catalog_manager_legacy.cpp b/src/mongo/s/catalog/legacy/catalog_manager_legacy.cpp index 7b4a22800b8..fa22cb8b72f 100644 --- a/src/mongo/s/catalog/legacy/catalog_manager_legacy.cpp +++ b/src/mongo/s/catalog/legacy/catalog_manager_legacy.cpp @@ -52,7 +52,7 @@ #include "mongo/s/client/dbclient_multi_command.h" #include "mongo/s/client/shard_connection.h" #include "mongo/s/distlock.h" -#include "mongo/s/shard.h" +#include "mongo/s/client/shard.h" #include "mongo/s/type_database.h" #include "mongo/s/write_ops/batched_command_request.h" #include "mongo/s/write_ops/batched_command_response.h" diff --git a/src/mongo/s/chunk.h b/src/mongo/s/chunk.h index cead91be27b..80c3d95423d 100644 --- a/src/mongo/s/chunk.h +++ b/src/mongo/s/chunk.h @@ -35,7 +35,7 @@ #include "mongo/db/keypattern.h" #include "mongo/platform/atomic_word.h" #include "mongo/s/chunk_version.h" -#include "mongo/s/shard.h" +#include "mongo/s/client/shard.h" #include "mongo/s/shard_key_pattern.h" #include "mongo/util/concurrency/ticketholder.h" #include "mongo/util/debug_util.h" diff --git a/src/mongo/s/client/SConscript b/src/mongo/s/client/SConscript index c914e9e3534..c22a4be4635 100644 --- a/src/mongo/s/client/SConscript +++ b/src/mongo/s/client/SConscript @@ -6,6 +6,7 @@ env.Library( target='sharding_client', source=[ 'dbclient_multi_command.cpp', + 'shard.cpp', 'shard_connection.cpp', ], LIBDEPS=[ diff --git a/src/mongo/s/shard.cpp b/src/mongo/s/client/shard.cpp index 710c039538e..0ed061636c2 100644 --- a/src/mongo/s/shard.cpp +++ b/src/mongo/s/client/shard.cpp @@ -1,7 +1,5 @@ -// shard.cpp - /** - * Copyright (C) 2008 10gen Inc. + * Copyright (C) 2008-2015 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, @@ -32,7 +30,7 @@ #include "mongo/platform/basic.h" -#include "mongo/s/shard.h" +#include "mongo/s/client/shard.h" #include <boost/make_shared.hpp> #include <set> @@ -57,7 +55,6 @@ #include "mongo/s/scc_fast_query_handler.h" #include "mongo/s/version_manager.h" #include "mongo/util/log.h" -#include "mongo/util/stacktrace.h" namespace mongo { diff --git a/src/mongo/s/shard.h b/src/mongo/s/client/shard.h index 8a760764893..78e73a6ac36 100644 --- a/src/mongo/s/shard.h +++ b/src/mongo/s/client/shard.h @@ -1,43 +1,40 @@ -// @file shard.h - /** -* Copyright (C) 2008 10gen 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) 2008-2015 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 #include <boost/shared_ptr.hpp> -#include "mongo/bson/bsonmisc.h" #include "mongo/client/dbclientinterface.h" -#include "mongo/util/assert_util.h" namespace mongo { + class BSONObj; class ShardStatus; /* diff --git a/src/mongo/s/client/shard_connection.cpp b/src/mongo/s/client/shard_connection.cpp index a5552dc2129..aeac40d6eec 100644 --- a/src/mongo/s/client/shard_connection.cpp +++ b/src/mongo/s/client/shard_connection.cpp @@ -37,7 +37,7 @@ #include "mongo/db/commands.h" #include "mongo/db/lasterror.h" #include "mongo/s/chunk_manager.h" -#include "mongo/s/shard.h" +#include "mongo/s/client/shard.h" #include "mongo/s/stale_exception.h" #include "mongo/s/version_manager.h" #include "mongo/util/concurrency/spin_lock.h" diff --git a/src/mongo/s/commands/cluster_fsync_cmd.cpp b/src/mongo/s/commands/cluster_fsync_cmd.cpp index 7430f2dd503..b75c56ea34f 100644 --- a/src/mongo/s/commands/cluster_fsync_cmd.cpp +++ b/src/mongo/s/commands/cluster_fsync_cmd.cpp @@ -29,7 +29,7 @@ #include "mongo/platform/basic.h" #include "mongo/db/commands.h" -#include "mongo/s/shard.h" +#include "mongo/s/client/shard.h" namespace mongo { namespace { diff --git a/src/mongo/s/commands/cluster_kill_op.cpp b/src/mongo/s/commands/cluster_kill_op.cpp index 88f43fd88d9..d5199c3a432 100644 --- a/src/mongo/s/commands/cluster_kill_op.cpp +++ b/src/mongo/s/commands/cluster_kill_op.cpp @@ -41,7 +41,7 @@ #include "mongo/db/audit.h" #include "mongo/db/auth/authorization_session.h" #include "mongo/db/commands.h" -#include "mongo/s/shard.h" +#include "mongo/s/client/shard.h" #include "mongo/util/log.h" #include "mongo/util/mongoutils/str.h" diff --git a/src/mongo/s/commands/cluster_list_databases_cmd.cpp b/src/mongo/s/commands/cluster_list_databases_cmd.cpp index 571b396fa06..8468c9e3cce 100644 --- a/src/mongo/s/commands/cluster_list_databases_cmd.cpp +++ b/src/mongo/s/commands/cluster_list_databases_cmd.cpp @@ -36,7 +36,7 @@ #include "mongo/client/connpool.h" #include "mongo/db/commands.h" -#include "mongo/s/shard.h" +#include "mongo/s/client/shard.h" namespace mongo { diff --git a/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp b/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp index 126f68a770f..64c764a57f5 100644 --- a/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp +++ b/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp @@ -41,7 +41,7 @@ #include "mongo/s/chunk_manager.h" #include "mongo/s/config.h" #include "mongo/s/grid.h" -#include "mongo/s/shard.h" +#include "mongo/s/client/shard.h" namespace mongo { diff --git a/src/mongo/s/commands/cluster_remove_shard_cmd.cpp b/src/mongo/s/commands/cluster_remove_shard_cmd.cpp index 108b9acefbf..fa05e587ee2 100644 --- a/src/mongo/s/commands/cluster_remove_shard_cmd.cpp +++ b/src/mongo/s/commands/cluster_remove_shard_cmd.cpp @@ -41,7 +41,7 @@ #include "mongo/s/catalog/type_shard.h" #include "mongo/s/cluster_write.h" #include "mongo/s/grid.h" -#include "mongo/s/shard.h" +#include "mongo/s/client/shard.h" #include "mongo/s/type_database.h" #include "mongo/util/log.h" diff --git a/src/mongo/s/commands/run_on_all_shards_cmd.cpp b/src/mongo/s/commands/run_on_all_shards_cmd.cpp index 4a1bc37a961..8029a60e77f 100644 --- a/src/mongo/s/commands/run_on_all_shards_cmd.cpp +++ b/src/mongo/s/commands/run_on_all_shards_cmd.cpp @@ -39,7 +39,7 @@ #include "mongo/db/jsobj.h" #include "mongo/client/parallel.h" -#include "mongo/s/shard.h" +#include "mongo/s/client/shard.h" #include "mongo/util/log.h" namespace mongo { diff --git a/src/mongo/s/config.h b/src/mongo/s/config.h index 40bbebc172b..f8361fbc695 100644 --- a/src/mongo/s/config.h +++ b/src/mongo/s/config.h @@ -31,7 +31,7 @@ #include <boost/shared_ptr.hpp> #include "mongo/client/dbclient_rs.h" -#include "mongo/s/shard.h" +#include "mongo/s/client/shard.h" #include "mongo/s/shard_key_pattern.h" #include "mongo/util/concurrency/mutex.h" diff --git a/src/mongo/s/d_migrate.cpp b/src/mongo/s/d_migrate.cpp index ceb81d8e088..8d6945f48a2 100644 --- a/src/mongo/s/d_migrate.cpp +++ b/src/mongo/s/d_migrate.cpp @@ -83,7 +83,7 @@ #include "mongo/s/d_state.h" #include "mongo/s/distlock.h" #include "mongo/s/grid.h" -#include "mongo/s/shard.h" +#include "mongo/s/client/shard.h" #include "mongo/util/assert_util.h" #include "mongo/util/elapsed_tracker.h" #include "mongo/util/exit.h" diff --git a/src/mongo/s/dbclient_shard_resolver.cpp b/src/mongo/s/dbclient_shard_resolver.cpp index a25609a672a..cc8f89130a0 100644 --- a/src/mongo/s/dbclient_shard_resolver.cpp +++ b/src/mongo/s/dbclient_shard_resolver.cpp @@ -32,7 +32,7 @@ #include "mongo/client/replica_set_monitor.h" #include "mongo/s/config.h" -#include "mongo/s/shard.h" +#include "mongo/s/client/shard.h" namespace mongo { diff --git a/src/mongo/s/shard_test.cpp b/src/mongo/s/shard_test.cpp index ff1fccc88d6..00f9aeab2ee 100644 --- a/src/mongo/s/shard_test.cpp +++ b/src/mongo/s/shard_test.cpp @@ -28,7 +28,7 @@ * then also delete it in the license file. */ -#include "mongo/s/shard.h" +#include "mongo/s/client/shard.h" #include "mongo/unittest/unittest.h" namespace mongo { |