diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2015-07-29 11:02:24 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2015-07-29 14:22:36 -0400 |
commit | a06c27a9887c9dd8fc43d9e7d8727a1840292911 (patch) | |
tree | bb88c00709b79e925458f2ce497a9b94f3c205f6 /src | |
parent | b0067ef44c6461beed332c8bbfc40ceb55d05d40 (diff) | |
download | mongo-a06c27a9887c9dd8fc43d9e7d8727a1840292911.tar.gz |
Revert "SERVER-19319 Send setShardVersion command after sharding a collection"
This reverts commit b0067ef44c6461beed332c8bbfc40ceb55d05d40.
Diffstat (limited to 'src')
23 files changed, 87 insertions, 741 deletions
diff --git a/src/mongo/db/auth/authz_manager_external_state_s.cpp b/src/mongo/db/auth/authz_manager_external_state_s.cpp index 6d6ae04db01..bb62e56168c 100644 --- a/src/mongo/db/auth/authz_manager_external_state_s.cpp +++ b/src/mongo/db/auth/authz_manager_external_state_s.cpp @@ -42,7 +42,6 @@ #include "mongo/db/commands.h" #include "mongo/db/jsobj.h" #include "mongo/s/catalog/catalog_manager.h" -#include "mongo/s/config.h" #include "mongo/s/grid.h" #include "mongo/stdx/memory.h" #include "mongo/util/mongoutils/str.h" diff --git a/src/mongo/db/pipeline/document_source.h b/src/mongo/db/pipeline/document_source.h index 81171f234e0..7767f16e0dc 100644 --- a/src/mongo/db/pipeline/document_source.h +++ b/src/mongo/db/pipeline/document_source.h @@ -51,11 +51,9 @@ #include "mongo/db/pipeline/expression.h" #include "mongo/db/pipeline/value.h" #include "mongo/db/sorter/sorter.h" -#include "mongo/s/strategy.h" #include "mongo/stdx/functional.h" #include "mongo/util/intrusive_counter.h" - namespace mongo { class Document; diff --git a/src/mongo/db/pipeline/pipeline_d.cpp b/src/mongo/db/pipeline/pipeline_d.cpp index 7bba04b67ce..639ecfaed07 100644 --- a/src/mongo/db/pipeline/pipeline_d.cpp +++ b/src/mongo/db/pipeline/pipeline_d.cpp @@ -43,6 +43,7 @@ #include "mongo/db/service_context.h" #include "mongo/db/s/sharded_connection_info.h" #include "mongo/db/s/sharding_state.h" +#include "mongo/s/chunk_version.h" namespace mongo { diff --git a/src/mongo/s/SConscript b/src/mongo/s/SConscript index 705f48744c9..1669b744cbe 100644 --- a/src/mongo/s/SConscript +++ b/src/mongo/s/SConscript @@ -32,11 +32,9 @@ env.Library( target='common', source=[ 'chunk_diff.cpp', - 'set_shard_version_request.cpp', ], LIBDEPS=[ 'catalog/catalog_types', - '$BUILD_DIR/mongo/client/connection_string', ] ) @@ -51,29 +49,23 @@ env.Library( ) env.CppUnitTest( - target='chunk_diff_test', - source=[ - 'chunk_diff_test.cpp', - ], - LIBDEPS=[ - 'common', - ] -) - -env.CppUnitTest( target='chunk_version_test', source=[ 'chunk_version_test.cpp', ], LIBDEPS=[ - 'common', + '$BUILD_DIR/mongo/base', + '$BUILD_DIR/mongo/client/clientdriver', + '$BUILD_DIR/mongo/db/common', + '$BUILD_DIR/mongo/db/range_arithmetic', + 'catalog/catalog_types', ] ) env.CppUnitTest( - target='set_shard_version_request_test', + target='chunk_diff_test', source=[ - 'set_shard_version_request_test.cpp', + 'chunk_diff_test.cpp', ], LIBDEPS=[ 'common', diff --git a/src/mongo/s/catalog/replset/catalog_manager_replica_set.cpp b/src/mongo/s/catalog/replset/catalog_manager_replica_set.cpp index 5204bca6432..99b797b0336 100644 --- a/src/mongo/s/catalog/replset/catalog_manager_replica_set.cpp +++ b/src/mongo/s/catalog/replset/catalog_manager_replica_set.cpp @@ -63,7 +63,6 @@ #include "mongo/s/chunk_manager.h" #include "mongo/s/config.h" #include "mongo/s/grid.h" -#include "mongo/s/set_shard_version_request.h" #include "mongo/s/shard_key_pattern.h" #include "mongo/s/write_ops/batched_command_request.h" #include "mongo/s/write_ops/batched_command_response.h" @@ -212,28 +211,13 @@ Status CatalogManagerReplicaSet::shardCollection(OperationContext* txn, collInfo.save(ns); manager->reload(true); - // Tell the primary mongod to refresh its data - // TODO: Think the real fix here is for mongos to just - // assume that all collections are sharded, when we get there - SetShardVersionRequest ssv = - SetShardVersionRequest::makeForVersioning(_configServerConnectionString, - dbPrimaryShardId, - primaryShard->getConnString(), - NamespaceString(ns), - manager->getVersion(), - true); - - auto ssvStatus = grid.shardRegistry()->runCommandWithNotMasterRetries( - dbPrimaryShardId, "admin", ssv.toBSON()); - if (!ssvStatus.isOK()) { - warning() << "could not update initial version of " << ns << " on shard primary " - << dbPrimaryShardId << ssvStatus.getStatus(); - } - - logChange(txn->getClient()->clientAddress(true), - "shardCollection", - ns, - BSON("version" << manager->getVersion().toString())); + // TODO(spencer) SERVER-19319: Send setShardVersion to primary shard so it knows to start + // rejecting unversioned writes. + + BSONObj finishDetail = BSON("version" + << ""); // TODO(spencer) SERVER-19319 Report actual version used + + logChange(txn->getClient()->clientAddress(true), "shardCollection", ns, finishDetail); return Status::OK(); } diff --git a/src/mongo/s/catalog/replset/catalog_manager_replica_set_shard_collection_test.cpp b/src/mongo/s/catalog/replset/catalog_manager_replica_set_shard_collection_test.cpp index 05a73346816..c366a48aee5 100644 --- a/src/mongo/s/catalog/replset/catalog_manager_replica_set_shard_collection_test.cpp +++ b/src/mongo/s/catalog/replset/catalog_manager_replica_set_shard_collection_test.cpp @@ -49,7 +49,6 @@ #include "mongo/s/chunk.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/grid.h" -#include "mongo/s/set_shard_version_request.h" #include "mongo/s/shard_key_pattern.h" #include "mongo/s/write_ops/batched_command_request.h" #include "mongo/s/write_ops/batched_command_response.h" @@ -238,27 +237,6 @@ public: }); } - void expectSetShardVersion(const HostAndPort& expectedTargetHost, - const string& expectedNs, - const ChunkVersion& expectedChunkVersion) { - onCommand([&](const RemoteCommandRequest& request) { - ASSERT_EQ(expectedTargetHost, request.target); - - SetShardVersionRequest ssv = - assertGet(SetShardVersionRequest::parseFromBSON(request.cmdObj)); - - ASSERT(!ssv.isInit()); - ASSERT(ssv.isAuthoritative()); - ASSERT_EQ(catalogManager()->connectionString().toString(), - ssv.getConfigServer().toString()); - ASSERT_EQ(expectedTargetHost.toString(), ssv.getShardConnectionString().toString()); - ASSERT_EQ(expectedNs, ssv.getNS().ns()); - ASSERT_EQ(expectedChunkVersion.toString(), ssv.getNSVersion().toString()); - - return BSON("ok" << true); - }); - } - protected: const HostAndPort configHost{"configHost1"}; const HostAndPort clientHost{"clientHost1"}; @@ -426,16 +404,14 @@ TEST_F(ShardCollectionTest, noInitialChunksOrData) { expectReloadChunks(ns, {expectedChunk}); expectLoadNewestChunk(ns, expectedChunk); - // Expect the set shard version for that namespace - expectSetShardVersion(shardHost, ns, actualVersion); - // Respond to request to write final changelog entry indicating success. expectChangeLogInsert(configHost, clientHost.toString(), network()->now(), "shardCollection", ns, - BSON("version" << actualVersion.toString())); + BSON("version" + << "")); future.timed_get(kFutureTimeout); } @@ -445,7 +421,6 @@ TEST_F(ShardCollectionTest, withInitialChunks) { const HostAndPort shard0Host{"shardHost0"}; const HostAndPort shard1Host{"shardHost1"}; const HostAndPort shard2Host{"shardHost2"}; - ShardType shard0; shard0.setName("shard0"); shard0.setHost(shard0Host.toString()); @@ -606,16 +581,14 @@ TEST_F(ShardCollectionTest, withInitialChunks) { expectReloadChunks(ns, expectedChunks); expectLoadNewestChunk(ns, expectedChunks[4]); - // Expect the set shard version for that namespace - expectSetShardVersion(shard0Host, ns, expectedChunks[4].getVersion()); - // Respond to request to write final changelog entry indicating success. expectChangeLogInsert(configHost, clientHost.toString(), network()->now(), "shardCollection", ns, - BSON("version" << expectedChunks[4].getVersion().toString())); + BSON("version" + << "")); future.timed_get(kFutureTimeout); } @@ -786,16 +759,14 @@ TEST_F(ShardCollectionTest, withInitialData) { expectReloadChunks(ns, expectedChunks); expectLoadNewestChunk(ns, expectedChunks[4]); - // Expect the set shard version for that namespace - expectSetShardVersion(shardHost, ns, expectedChunks[4].getVersion()); - // Respond to request to write final changelog entry indicating success. expectChangeLogInsert(configHost, clientHost.toString(), network()->now(), "shardCollection", ns, - BSON("version" << expectedChunks[4].getVersion().toString())); + BSON("version" + << "")); future.timed_get(kFutureTimeout); } diff --git a/src/mongo/s/chunk.cpp b/src/mongo/s/chunk.cpp index e49d271c145..06d64007cff 100644 --- a/src/mongo/s/chunk.cpp +++ b/src/mongo/s/chunk.cpp @@ -35,7 +35,6 @@ #include "mongo/client/connpool.h" #include "mongo/client/dbclientcursor.h" #include "mongo/client/remote_command_targeter.h" -#include "mongo/config.h" #include "mongo/db/commands.h" #include "mongo/db/lasterror.h" #include "mongo/db/query/query_solution.h" @@ -49,7 +48,6 @@ #include "mongo/s/chunk_manager.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/client/shard_connection.h" -#include "mongo/s/config.h" #include "mongo/s/grid.h" #include "mongo/s/shard_key_pattern.h" #include "mongo/util/log.h" diff --git a/src/mongo/s/client/shard.cpp b/src/mongo/s/client/shard.cpp index 3cb9cd344e2..22604c33eb8 100644 --- a/src/mongo/s/client/shard.cpp +++ b/src/mongo/s/client/shard.cpp @@ -54,10 +54,6 @@ Shard::Shard(const ShardId& id, Shard::~Shard() = default; -ShardPtr Shard::lookupRSName(const string& name) { - return grid.shardRegistry()->lookupRSName(name); -} - std::string Shard::toString() const { return _id + ":" + _cs.toString(); } diff --git a/src/mongo/s/client/shard.h b/src/mongo/s/client/shard.h index 991d2c0195c..11ae44c1422 100644 --- a/src/mongo/s/client/shard.h +++ b/src/mongo/s/client/shard.h @@ -77,8 +77,6 @@ public: */ std::string toString() const; - static ShardPtr lookupRSName(const std::string& name); - static void reloadShardInfo(); private: diff --git a/src/mongo/s/cluster_write.cpp b/src/mongo/s/cluster_write.cpp index 7133e64f297..877fc896a69 100644 --- a/src/mongo/s/cluster_write.cpp +++ b/src/mongo/s/cluster_write.cpp @@ -126,7 +126,7 @@ void splitIfNeeded(const NamespaceString& nss, const TargeterStats& stats) { shared_ptr<DBConfig> config = status.getValue(); ChunkManagerPtr chunkManager; - ShardPtr dummyShard; + shared_ptr<Shard> dummyShard; config->getChunkManagerOrPrimary(nss.ns(), chunkManager, dummyShard); if (!chunkManager) { diff --git a/src/mongo/s/commands/cluster_find_and_modify_cmd.cpp b/src/mongo/s/commands/cluster_find_and_modify_cmd.cpp index 4f14f66fe2c..9bd33cb24f0 100644 --- a/src/mongo/s/commands/cluster_find_and_modify_cmd.cpp +++ b/src/mongo/s/commands/cluster_find_and_modify_cmd.cpp @@ -201,7 +201,7 @@ private: return shardKey; } - bool _runCommand(DBConfigPtr conf, + bool _runCommand(shared_ptr<DBConfig> conf, const ShardId& shardId, const string& ns, const BSONObj& cmdObj, diff --git a/src/mongo/s/commands/cluster_pipeline_cmd.cpp b/src/mongo/s/commands/cluster_pipeline_cmd.cpp index 50d3a094ae6..6209735fe32 100644 --- a/src/mongo/s/commands/cluster_pipeline_cmd.cpp +++ b/src/mongo/s/commands/cluster_pipeline_cmd.cpp @@ -247,7 +247,10 @@ private: // returned cursors with mongos's cursorCache. BSONObj aggRunCommand(DBClientBase* conn, const string& db, BSONObj cmd, int queryOptions); - bool aggPassthrough(DBConfigPtr conf, BSONObj cmd, BSONObjBuilder& result, int queryOptions); + bool aggPassthrough(shared_ptr<DBConfig> conf, + BSONObj cmd, + BSONObjBuilder& result, + int queryOptions); } clusterPipelineCmd; DocumentSourceMergeCursors::CursorIds PipelineCommand::parseCursors( @@ -381,7 +384,7 @@ BSONObj PipelineCommand::aggRunCommand(DBClientBase* conn, return result; } -bool PipelineCommand::aggPassthrough(DBConfigPtr conf, +bool PipelineCommand::aggPassthrough(shared_ptr<DBConfig> conf, BSONObj cmd, BSONObjBuilder& out, int queryOptions) { diff --git a/src/mongo/s/commands/cluster_shard_collection_cmd.cpp b/src/mongo/s/commands/cluster_shard_collection_cmd.cpp index bf1e1c8097a..1cde82d9bde 100644 --- a/src/mongo/s/commands/cluster_shard_collection_cmd.cpp +++ b/src/mongo/s/commands/cluster_shard_collection_cmd.cpp @@ -174,6 +174,7 @@ public: const auto shard = grid.shardRegistry()->getShard(config->getPrimaryId()); shardConnString = shard->getConnString(); } + ScopedDbConnection conn(shardConnString); // check that collection is not capped diff --git a/src/mongo/s/commands/commands_public.cpp b/src/mongo/s/commands/commands_public.cpp index 17b2abfd7bc..f899a6cd10f 100644 --- a/src/mongo/s/commands/commands_public.cpp +++ b/src/mongo/s/commands/commands_public.cpp @@ -99,21 +99,26 @@ public: } protected: - bool passthrough(DBConfigPtr conf, const BSONObj& cmdObj, BSONObjBuilder& result) { + bool passthrough(shared_ptr<DBConfig> conf, const BSONObj& cmdObj, BSONObjBuilder& result) { return _passthrough(conf->name(), conf, cmdObj, 0, result); } - bool adminPassthrough(DBConfigPtr conf, const BSONObj& cmdObj, BSONObjBuilder& result) { + bool adminPassthrough(shared_ptr<DBConfig> conf, + const BSONObj& cmdObj, + BSONObjBuilder& result) { return _passthrough("admin", conf, cmdObj, 0, result); } - bool passthrough(DBConfigPtr conf, const BSONObj& cmdObj, int options, BSONObjBuilder& result) { + bool passthrough(shared_ptr<DBConfig> conf, + const BSONObj& cmdObj, + int options, + BSONObjBuilder& result) { return _passthrough(conf->name(), conf, cmdObj, options, result); } private: bool _passthrough(const string& db, - DBConfigPtr conf, + shared_ptr<DBConfig> conf, const BSONObj& cmdObj, int options, BSONObjBuilder& result) { diff --git a/src/mongo/s/config.cpp b/src/mongo/s/config.cpp index 557315fd31a..a467d9b583c 100644 --- a/src/mongo/s/config.cpp +++ b/src/mongo/s/config.cpp @@ -57,7 +57,6 @@ namespace mongo { -using std::endl; using std::set; using std::string; using std::unique_ptr; @@ -144,13 +143,12 @@ DBConfig::DBConfig(std::string name, const DatabaseType& dbt) : _name(name) { DBConfig::~DBConfig() = default; bool DBConfig::isSharded(const string& ns) { - if (!_shardingEnabled) + if (!_shardingEnabled) { return false; + } + stdx::lock_guard<stdx::mutex> lk(_lock); - return _isSharded(ns); -} -bool DBConfig::_isSharded(const string& ns) { if (!_shardingEnabled) { return false; } @@ -170,22 +168,22 @@ const ShardId& DBConfig::getShardId(const string& ns) { return _primaryId; } -void DBConfig::enableSharding(bool save) { - if (_shardingEnabled) - return; - +void DBConfig::enableSharding() { verify(_name != "config"); stdx::lock_guard<stdx::mutex> lk(_lock); + if (_shardingEnabled) { + return; + } + _shardingEnabled = true; - if (save) - _save(); + _save(); } bool DBConfig::removeSharding(const string& ns) { if (!_shardingEnabled) { warning() << "could not remove sharding for collection " << ns - << ", sharding not enabled for db" << endl; + << ", sharding not enabled for db"; return false; } @@ -199,7 +197,7 @@ bool DBConfig::removeSharding(const string& ns) { CollectionInfo& ci = _collections[ns]; if (!ci.isSharded()) { warning() << "could not remove sharding for collection " << ns - << ", no sharding information found" << endl; + << ", no sharding information found"; return false; } @@ -275,7 +273,7 @@ std::shared_ptr<ChunkManager> DBConfig::getChunkManager(const string& ns, bool earlyReload = !_collections[ns].isSharded() && (shouldReload || forceReload); if (earlyReload) { // This is to catch cases where there this is a new sharded collection - _reload(); + _load(); } CollectionInfo& ci = _collections[ns]; @@ -480,7 +478,7 @@ bool DBConfig::reload() { { stdx::lock_guard<stdx::mutex> lk(_lock); - successful = _reload(); + successful = _load(); } // If we aren't successful loading the database entry, we don't want to keep the stale @@ -492,11 +490,6 @@ bool DBConfig::reload() { return successful; } -bool DBConfig::_reload() { - // TODO: i don't think is 100% correct - return _load(); -} - bool DBConfig::dropDatabase(OperationContext* txn, string& errmsg) { /** * 1) update config server @@ -505,7 +498,7 @@ bool DBConfig::dropDatabase(OperationContext* txn, string& errmsg) { * 4) drop everywhere to clean up loose ends */ - log() << "DBConfig::dropDatabase: " << _name << endl; + log() << "DBConfig::dropDatabase: " << _name; grid.catalogManager()->logChange( txn->getClient()->clientAddress(true), "dropDatabase.start", _name, BSONObj()); @@ -516,11 +509,11 @@ bool DBConfig::dropDatabase(OperationContext* txn, string& errmsg) { DatabaseType::ConfigNS, BSON(DatabaseType::name(_name)), 0, NULL); if (!result.isOK()) { errmsg = result.reason(); - log() << "could not drop '" << _name << "': " << errmsg << endl; + log() << "could not drop '" << _name << "': " << errmsg; return false; } - LOG(1) << "\t removed entry from config server for: " << _name << endl; + LOG(1) << "\t removed entry from config server for: " << _name; set<ShardId> shardIds; @@ -566,7 +559,7 @@ bool DBConfig::dropDatabase(OperationContext* txn, string& errmsg) { conn.done(); } - LOG(1) << "\t dropped primary db for: " << _name << endl; + LOG(1) << "\t dropped primary db for: " << _name; grid.catalogManager()->logChange( txn->getClient()->clientAddress(true), "dropDatabase", _name, BSONObj()); @@ -583,13 +576,14 @@ bool DBConfig::_dropShardedCollections(OperationContext* txn, while (true) { CollectionInfoMap::iterator i = _collections.begin(); for (; i != _collections.end(); ++i) { - // log() << "coll : " << i->first << " and " << i->second.isSharded() << endl; - if (i->second.isSharded()) + if (i->second.isSharded()) { break; + } } - if (i == _collections.end()) + if (i == _collections.end()) { break; + } if (seen.count(i->first)) { errmsg = "seen a collection twice!"; @@ -597,7 +591,7 @@ bool DBConfig::_dropShardedCollections(OperationContext* txn, } seen.insert(i->first); - LOG(1) << "\t dropping sharded collection: " << i->first << endl; + LOG(1) << "\t dropping sharded collection: " << i->first; i->second.getCM()->getAllShardIds(&shardIds); @@ -608,12 +602,12 @@ bool DBConfig::_dropShardedCollections(OperationContext* txn, if (!removeSharding(i->first)) { warning() << "collection " << i->first << " was reloaded as unsharded before drop completed" - << " during drop of all collections" << endl; + << " during drop of all collections"; } num++; uassert(10184, "_dropShardedCollections too many collections - bailing", num < 100000); - LOG(2) << "\t\t dropped " << num << " so far" << endl; + LOG(2) << "\t\t dropped " << num << " so far"; } return true; @@ -637,7 +631,7 @@ void DBConfig::getAllShardedCollections(set<string>& namespaces) { stdx::lock_guard<stdx::mutex> lk(_lock); for (CollectionInfoMap::const_iterator i = _collections.begin(); i != _collections.end(); i++) { - log() << "Coll : " << i->first << " sharded? " << i->second.isSharded() << endl; + log() << "Coll : " << i->first << " sharded? " << i->second.isSharded(); if (i->second.isSharded()) namespaces.insert(i->first); } @@ -748,7 +742,7 @@ void ConfigServer::replicaSetChange(const string& setName, const string& newConn Client::initThread("replSetChange"); try { - ShardPtr s = Shard::lookupRSName(setName); + std::shared_ptr<Shard> s = grid.shardRegistry()->lookupRSName(setName); if (!s) { LOG(1) << "shard not found for set: " << newConnectionString; return; diff --git a/src/mongo/s/config.h b/src/mongo/s/config.h index a9ee646f138..415adfd7d46 100644 --- a/src/mongo/s/config.h +++ b/src/mongo/s/config.h @@ -42,8 +42,6 @@ class DatabaseType; class DBConfig; class OperationContext; -typedef std::shared_ptr<DBConfig> DBConfigPtr; - struct CollectionInfo { CollectionInfo() { _dirty = false; @@ -118,7 +116,7 @@ public: return _primaryId; } - void enableSharding(bool save = true); + void enableSharding(); /** @return true if there was sharding info to remove @@ -161,21 +159,14 @@ public: protected: typedef std::map<std::string, CollectionInfo> CollectionInfoMap; - - /** - lockless - */ - bool _isSharded(const std::string& ns); - bool _dropShardedCollections(OperationContext* txn, int& num, std::set<ShardId>& shardIds, std::string& errmsg); bool _load(); - bool _reload(); - void _save(bool db = true, bool coll = true); + void _save(bool db = true, bool coll = true); // Name of the database which this entry caches const std::string _name; diff --git a/src/mongo/s/request.h b/src/mongo/s/request.h index 775b44f6511..cee65b0dce2 100644 --- a/src/mongo/s/request.h +++ b/src/mongo/s/request.h @@ -27,7 +27,6 @@ * then also delete it in the license file. */ - #pragma once #include "mongo/db/dbmessage.h" diff --git a/src/mongo/s/server.cpp b/src/mongo/s/server.cpp index a2c7cec3ff6..4c312fc7750 100644 --- a/src/mongo/s/server.cpp +++ b/src/mongo/s/server.cpp @@ -40,7 +40,6 @@ #include "mongo/client/global_conn_pool.h" #include "mongo/client/remote_command_targeter_factory_impl.h" #include "mongo/client/replica_set_monitor.h" -#include "mongo/config.h" #include "mongo/db/audit.h" #include "mongo/db/auth/authorization_manager.h" #include "mongo/db/auth/authorization_manager_global.h" diff --git a/src/mongo/s/set_shard_version_request.cpp b/src/mongo/s/set_shard_version_request.cpp deleted file mode 100644 index 5c869c22f01..00000000000 --- a/src/mongo/s/set_shard_version_request.cpp +++ /dev/null @@ -1,214 +0,0 @@ -/** - * Copyright (C) 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. - */ - -#include "mongo/platform/basic.h" - -#include "mongo/s/set_shard_version_request.h" - -#include "mongo/base/status_with.h" -#include "mongo/bson/bsonobj.h" -#include "mongo/bson/bsonobjbuilder.h" -#include "mongo/bson/util/bson_extract.h" -#include "mongo/util/assert_util.h" -#include "mongo/util/mongoutils/str.h" - -namespace mongo { -namespace { - -const char kCmdName[] = "setShardVersion"; -const char kConfigServer[] = "configdb"; -const char kShardName[] = "shard"; -const char kShardConnectionString[] = "shardHost"; -const char kInit[] = "init"; -const char kAuthoritative[] = "authoritative"; -const char kVersion[] = "version"; - -} // namespace - -SetShardVersionRequest::SetShardVersionRequest(ConnectionString configServer, - std::string shardName, - ConnectionString shardConnectionString) - : _init(true), - _configServer(std::move(configServer)), - _shardName(std::move(shardName)), - _shardCS(std::move(shardConnectionString)) {} - -SetShardVersionRequest::SetShardVersionRequest(ConnectionString configServer, - std::string shardName, - ConnectionString shardConnectionString, - NamespaceString nss, - ChunkVersion version, - bool isAuthoritative) - : _init(false), - _configServer(std::move(configServer)), - _shardName(std::move(shardName)), - _shardCS(std::move(shardConnectionString)), - _nss(std::move(nss)), - _version(std::move(version)), - _isAuthoritative(isAuthoritative) {} - -SetShardVersionRequest::SetShardVersionRequest() = default; - -SetShardVersionRequest SetShardVersionRequest::makeForInit( - const ConnectionString& configServer, - const std::string& shardName, - const ConnectionString& shardConnectionString) { - return SetShardVersionRequest(configServer, shardName, shardConnectionString); -} - -SetShardVersionRequest SetShardVersionRequest::makeForVersioning( - const ConnectionString& configServer, - const std::string& shardName, - const ConnectionString& shardConnectionString, - const NamespaceString& nss, - const ChunkVersion& nssVersion, - bool isAuthoritative) { - return SetShardVersionRequest( - configServer, shardName, shardConnectionString, nss, nssVersion, isAuthoritative); -} - -StatusWith<SetShardVersionRequest> SetShardVersionRequest::parseFromBSON(const BSONObj& cmdObj) { - SetShardVersionRequest request; - - { - std::string configServer; - Status status = bsonExtractStringField(cmdObj, kConfigServer, &configServer); - if (!status.isOK()) - return status; - - auto configServerStatus = ConnectionString::parse(configServer); - if (!configServerStatus.isOK()) - return configServerStatus.getStatus(); - - request._configServer = std::move(configServerStatus.getValue()); - } - - { - Status status = bsonExtractStringField(cmdObj, kShardName, &request._shardName); - if (!status.isOK()) - return status; - } - - { - std::string shardCS; - Status status = bsonExtractStringField(cmdObj, kShardConnectionString, &shardCS); - if (!status.isOK()) - return status; - - auto shardCSStatus = ConnectionString::parse(shardCS); - if (!shardCSStatus.isOK()) - return shardCSStatus.getStatus(); - - request._shardCS = std::move(shardCSStatus.getValue()); - } - - { - Status status = bsonExtractBooleanFieldWithDefault(cmdObj, kInit, false, &request._init); - if (!status.isOK()) - return status; - } - - if (request.isInit()) { - return request; - } - - // Only initialize the version information if this is not an "init" request - - { - std::string ns; - Status status = bsonExtractStringField(cmdObj, kCmdName, &ns); - if (!status.isOK()) - return status; - - NamespaceString nss(ns); - - if (!nss.isValid()) { - return {ErrorCodes::InvalidNamespace, - str::stream() << ns << " is not a valid namespace"}; - } - - request._nss = std::move(nss); - } - - { - bool canParse; - - ChunkVersion chunkVersion = ChunkVersion::fromBSON(cmdObj, kVersion, &canParse); - if (!canParse) { - return {ErrorCodes::BadValue, "Unable to parse shard version"}; - } - - request._version = std::move(chunkVersion); - } - - { - bool isAuthoritative; - Status status = - bsonExtractBooleanFieldWithDefault(cmdObj, kAuthoritative, false, &isAuthoritative); - if (!status.isOK()) - return status; - - request._isAuthoritative = isAuthoritative; - } - - return request; -} - -BSONObj SetShardVersionRequest::toBSON() const { - BSONObjBuilder cmdBuilder; - - cmdBuilder.append(kCmdName, _init ? "" : _nss.get().ns()); - cmdBuilder.append(kInit, _init); - cmdBuilder.append(kConfigServer, _configServer.toString()); - cmdBuilder.append(kShardName, _shardName); - cmdBuilder.append(kShardConnectionString, _shardCS.toString()); - - if (!_init) { - _version.get().addToBSON(cmdBuilder, kVersion); - cmdBuilder.append(kAuthoritative, isAuthoritative()); - } - - return cmdBuilder.obj(); -} - -const NamespaceString& SetShardVersionRequest::getNS() const { - invariant(!_init); - return _nss.get(); -} - -const ChunkVersion SetShardVersionRequest::getNSVersion() const { - invariant(!_init); - return _version.get(); -} - -bool SetShardVersionRequest::isAuthoritative() const { - invariant(!_init); - return _isAuthoritative.get_value_or(false); -} - -} // namespace mongo diff --git a/src/mongo/s/set_shard_version_request.h b/src/mongo/s/set_shard_version_request.h deleted file mode 100644 index 881c2a3bfe5..00000000000 --- a/src/mongo/s/set_shard_version_request.h +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Copyright (C) 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/optional.hpp> -#include <string> - -#include "mongo/client/connection_string.h" -#include "mongo/db/namespace_string.h" -#include "mongo/s/chunk_version.h" - -namespace mongo { - -class BSONObj; -struct ChunkVersion; -template <typename T> -class StatusWith; - -/** - * Encapsulates the parsing and construction logic for the SetShardVersion command. - */ -class SetShardVersionRequest { -public: - /** - * Constructs a new set shard version request, which is of the "init" type, meaning it has no - * namespace or version information associated with it and the init flag is set. - */ - static SetShardVersionRequest makeForInit(const ConnectionString& configServer, - const std::string& shardName, - const ConnectionString& shardConnectionString); - - /** - * Constructs a new set shard version request, which is of the "versioning" type, meaning it has - * both initialization data and namespace and version information associated with it. - */ - static SetShardVersionRequest makeForVersioning(const ConnectionString& configServer, - const std::string& shardName, - const ConnectionString& shard, - const NamespaceString& nss, - const ChunkVersion& nssVersion, - bool isAuthoritative); - - /** - * Parses an SSV request from a set shard version command. - */ - static StatusWith<SetShardVersionRequest> parseFromBSON(const BSONObj& cmdObj); - - /** - * Produces a BSON representation of the request, which can be used for sending as a command. - */ - BSONObj toBSON() const; - - /** - * Returns whether this is an "init" type of request, where we only have the config server - * information and the identity that the targeted shard should assume or it contains namespace - * version as well. If this value is true, it is illegal to access anything other than the - * config server, shard name and shard connection string fields. - */ - bool isInit() const { - return _init; - } - - const ConnectionString& getConfigServer() const { - return _configServer; - } - - const std::string& getShardName() const { - return _shardName; - } - - const ConnectionString& getShardConnectionString() const { - return _shardCS; - } - - /** - * Returns the namespace associated with this set shard version request. It is illegal to access - * this field if isInit() returns true. - */ - const NamespaceString& getNS() const; - - /** - * Returns the version of the namespace associated with this set shard version request. It is - * illegal to access this field if isInit() returns true. - */ - const ChunkVersion getNSVersion() const; - - /** - * Returns whether this request should force the version to be set instead of it being reloaded - * and recalculated from the metadata. It is illegal to access this field if isInit() returns - * true. - */ - bool isAuthoritative() const; - -private: - SetShardVersionRequest(ConnectionString configServer, - std::string shardName, - ConnectionString shardConnectionString); - - SetShardVersionRequest(ConnectionString configServer, - std::string shardName, - ConnectionString shardConnectionString, - NamespaceString nss, - ChunkVersion nssVersion, - bool isAuthoritative); - - SetShardVersionRequest(); - - bool _init{false}; - - ConnectionString _configServer; - - std::string _shardName; - ConnectionString _shardCS; - - // These values are only set if _init is false - boost::optional<NamespaceString> _nss; - boost::optional<ChunkVersion> _version; - boost::optional<bool> _isAuthoritative; -}; - -} // namespace mongo diff --git a/src/mongo/s/set_shard_version_request_test.cpp b/src/mongo/s/set_shard_version_request_test.cpp deleted file mode 100644 index a71026e67d0..00000000000 --- a/src/mongo/s/set_shard_version_request_test.cpp +++ /dev/null @@ -1,219 +0,0 @@ -/** - * Copyright (C) 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. - */ - -#include "mongo/platform/basic.h" - -#include "mongo/bson/bsonmisc.h" -#include "mongo/bson/oid.h" -#include "mongo/s/set_shard_version_request.h" -#include "mongo/unittest/unittest.h" - -namespace mongo { - -using unittest::assertGet; - -namespace { - -const ConnectionString configCS = ConnectionString::forReplicaSet( - "ConfigRS", {HostAndPort{"configHost1:27017"}, HostAndPort{"configHost2:27017"}}); - -const ConnectionString shardCS = ConnectionString::forReplicaSet( - "ShardRS", {HostAndPort{"shardHost1:12345"}, HostAndPort{"shardHost2:12345"}}); - -TEST(SetShardVersionRequest, ParseInit) { - SetShardVersionRequest request = - assertGet(SetShardVersionRequest::parseFromBSON( - BSON("setShardVersion" - << "" - << "init" << true << "configdb" << configCS.toString() << "shard" - << "TestShard" - << "shardHost" << shardCS.toString()))); - - ASSERT(request.isInit()); - ASSERT_EQ(request.getConfigServer().toString(), configCS.toString()); - ASSERT_EQ(request.getShardName(), "TestShard"); - ASSERT_EQ(request.getShardConnectionString().toString(), shardCS.toString()); -} - -TEST(SetShardVersionRequest, ParseFull) { - const ChunkVersion chunkVersion(1, 2, OID::gen()); - - SetShardVersionRequest request = - assertGet(SetShardVersionRequest::parseFromBSON( - BSON("setShardVersion" - << "db.coll" - << "configdb" << configCS.toString() << "shard" - << "TestShard" - << "shardHost" << shardCS.toString() << "version" - << Timestamp(chunkVersion.toLong()) << "versionEpoch" << chunkVersion.epoch()))); - - ASSERT(!request.isInit()); - ASSERT(!request.isAuthoritative()); - ASSERT_EQ(request.getConfigServer().toString(), configCS.toString()); - ASSERT_EQ(request.getShardName(), "TestShard"); - ASSERT_EQ(request.getShardConnectionString().toString(), shardCS.toString()); - ASSERT_EQ(request.getNS().toString(), "db.coll"); - ASSERT_EQ(request.getNSVersion().majorVersion(), chunkVersion.majorVersion()); - ASSERT_EQ(request.getNSVersion().minorVersion(), chunkVersion.minorVersion()); - ASSERT_EQ(request.getNSVersion().epoch(), chunkVersion.epoch()); -} - -TEST(SetShardVersionRequest, ParseFullAuhtoritative) { - const ChunkVersion chunkVersion(1, 2, OID::gen()); - - SetShardVersionRequest request = - assertGet(SetShardVersionRequest::parseFromBSON( - BSON("setShardVersion" - << "db.coll" - << "configdb" << configCS.toString() << "shard" - << "TestShard" - << "shardHost" << shardCS.toString() << "version" - << Timestamp(chunkVersion.toLong()) << "versionEpoch" << chunkVersion.epoch() - << "authoritative" << true))); - - ASSERT(!request.isInit()); - ASSERT(request.isAuthoritative()); - ASSERT_EQ(request.getConfigServer().toString(), configCS.toString()); - ASSERT_EQ(request.getShardName(), "TestShard"); - ASSERT_EQ(request.getShardConnectionString().toString(), shardCS.toString()); - ASSERT_EQ(request.getNS().toString(), "db.coll"); - ASSERT_EQ(request.getNSVersion().majorVersion(), chunkVersion.majorVersion()); - ASSERT_EQ(request.getNSVersion().minorVersion(), chunkVersion.minorVersion()); - ASSERT_EQ(request.getNSVersion().epoch(), chunkVersion.epoch()); -} - -TEST(SetShardVersionRequest, ParseInitNoConfigServer) { - auto ssvStatus = - SetShardVersionRequest::parseFromBSON(BSON("setShardVersion" - << "" - << "init" << true << "shard" - << "TestShard" - << "shardHost" << shardCS.toString())); - - ASSERT_EQ(ErrorCodes::NoSuchKey, ssvStatus.getStatus().code()); -} - -TEST(SetShardVersionRequest, ParseFullNoNS) { - const ChunkVersion chunkVersion(1, 2, OID::gen()); - - auto ssvStatus = - SetShardVersionRequest::parseFromBSON(BSON("setShardVersion" - << "" - << "configdb" << configCS.toString() << "shard" - << "TestShard" - << "shardHost" << shardCS.toString() << "version" - << Timestamp(chunkVersion.toLong()) - << "versionEpoch" << chunkVersion.epoch())); - - ASSERT_EQ(ErrorCodes::InvalidNamespace, ssvStatus.getStatus().code()); -} - -TEST(SetShardVersionRequest, ParseFullNSContainsDBOnly) { - const ChunkVersion chunkVersion(1, 2, OID::gen()); - - auto ssvStatus = - SetShardVersionRequest::parseFromBSON(BSON("setShardVersion" - << "dbOnly" - << "configdb" << configCS.toString() << "shard" - << "TestShard" - << "shardHost" << shardCS.toString() << "version" - << Timestamp(chunkVersion.toLong()) - << "versionEpoch" << chunkVersion.epoch())); - - ASSERT_EQ(ErrorCodes::InvalidNamespace, ssvStatus.getStatus().code()); -} - -TEST(SetShardVersionRequest, ToSSVCommandInit) { - SetShardVersionRequest ssv = - SetShardVersionRequest::makeForInit(configCS, "TestShard", shardCS); - - ASSERT(ssv.isInit()); - ASSERT_EQ(ssv.getConfigServer().toString(), configCS.toString()); - ASSERT_EQ(ssv.getShardName(), "TestShard"); - ASSERT_EQ(ssv.getShardConnectionString().toString(), shardCS.toString()); - - ASSERT_EQ(ssv.toBSON(), - BSON("setShardVersion" - << "" - << "init" << true << "configdb" << configCS.toString() << "shard" - << "TestShard" - << "shardHost" << shardCS.toString())); -} - -TEST(SetShardVersionRequest, ToSSVCommandFull) { - const ChunkVersion chunkVersion(1, 2, OID::gen()); - - SetShardVersionRequest ssv = SetShardVersionRequest::makeForVersioning( - configCS, "TestShard", shardCS, NamespaceString("db.coll"), chunkVersion, false); - - ASSERT(!ssv.isInit()); - ASSERT(!ssv.isAuthoritative()); - ASSERT_EQ(ssv.getConfigServer().toString(), configCS.toString()); - ASSERT_EQ(ssv.getShardName(), "TestShard"); - ASSERT_EQ(ssv.getShardConnectionString().toString(), shardCS.toString()); - ASSERT_EQ(ssv.getNS().ns(), "db.coll"); - ASSERT_EQ(ssv.getNSVersion().toBSONWithPrefix("version"), - chunkVersion.toBSONWithPrefix("version")); - - ASSERT_EQ(ssv.toBSON(), - BSON("setShardVersion" - << "db.coll" - << "init" << false << "configdb" << configCS.toString() << "shard" - << "TestShard" - << "shardHost" << shardCS.toString() << "version" - << Timestamp(chunkVersion.toLong()) << "versionEpoch" << chunkVersion.epoch() - << "authoritative" << false)); -} - -TEST(SetShardVersionRequest, ToSSVCommandFullAuthoritative) { - const ChunkVersion chunkVersion(1, 2, OID::gen()); - - SetShardVersionRequest ssv = SetShardVersionRequest::makeForVersioning( - configCS, "TestShard", shardCS, NamespaceString("db.coll"), chunkVersion, true); - - ASSERT(!ssv.isInit()); - ASSERT(ssv.isAuthoritative()); - ASSERT_EQ(ssv.getConfigServer().toString(), configCS.toString()); - ASSERT_EQ(ssv.getShardName(), "TestShard"); - ASSERT_EQ(ssv.getShardConnectionString().toString(), shardCS.toString()); - ASSERT_EQ(ssv.getNS().ns(), "db.coll"); - ASSERT_EQ(ssv.getNSVersion().toBSONWithPrefix("version"), - chunkVersion.toBSONWithPrefix("version")); - - ASSERT_EQ(ssv.toBSON(), - BSON("setShardVersion" - << "db.coll" - << "init" << false << "configdb" << configCS.toString() << "shard" - << "TestShard" - << "shardHost" << shardCS.toString() << "version" - << Timestamp(chunkVersion.toLong()) << "versionEpoch" << chunkVersion.epoch() - << "authoritative" << true)); -} - -} // namespace -} // namespace mongo diff --git a/src/mongo/s/strategy.cpp b/src/mongo/s/strategy.cpp index fb7c3e1c154..ba9aaa9ff65 100644 --- a/src/mongo/s/strategy.cpp +++ b/src/mongo/s/strategy.cpp @@ -67,7 +67,6 @@ namespace mongo { using std::unique_ptr; using std::shared_ptr; -using std::endl; using std::set; using std::string; using std::stringstream; @@ -157,7 +156,7 @@ void Strategy::queryOp(Request& r) { uassertStatusOK(status); LOG(3) << "query: " << q.ns << " " << q.query << " ntoreturn: " << q.ntoreturn - << " options: " << q.queryOptions << endl; + << " options: " << q.queryOptions; if (q.ntoreturn == 1 && strstr(q.ns, ".$cmd")) throw UserException(8010, "something is wrong, shouldn't see a command here"); @@ -216,7 +215,7 @@ void Strategy::queryOp(Request& r) { bool hasMore = cc->sendNextBatch(q.ntoreturn, buffer, docCount); if (hasMore) { - LOG(5) << "storing cursor : " << cc->getId() << endl; + LOG(5) << "storing cursor : " << cc->getId(); int cursorLeftoverMillis = maxTimeMS.getValue() - queryTimer.millis(); if (maxTimeMS.getValue() == 0) { // 0 represents "no limit". @@ -258,7 +257,7 @@ void Strategy::clientCommandOp(Request& r) { QueryMessage q(r.d()); LOG(3) << "command: " << q.ns << " " << q.query << " ntoreturn: " << q.ntoreturn - << " options: " << q.queryOptions << endl; + << " options: " << q.queryOptions; if (q.queryOptions & QueryOption_Exhaust) { uasserted(18527, @@ -313,7 +312,7 @@ void Strategy::clientCommandOp(Request& r) { throw e; loops--; - log() << "retrying command: " << q.query << endl; + log() << "retrying command: " << q.query; // For legacy reasons, ns may not actually be set in the exception :-( string staleNS = e.getns(); @@ -359,7 +358,7 @@ bool Strategy::handleSpecialNamespaces(Request& r, QueryMessage& q) { } else if (strcmp(ns, "unlock") == 0) { reply.append("err", "can't do unlock through mongos"); } else { - warning() << "unknown sys command [" << ns << "]" << endl; + warning() << "unknown sys command [" << ns << "]"; return false; } @@ -490,7 +489,7 @@ void Strategy::getMore(Request& r) { uassertStatusOK(status); if (!host.empty()) { - LOG(3) << "single getmore: " << ns << endl; + LOG(3) << "single getmore: " << ns; // we used ScopedDbConnection because we don't get about config versions // not deleting data is handled elsewhere @@ -549,7 +548,7 @@ void Strategy::getMore(Request& r) { hasMore ? cursor->getId() : 0); return; } else { - LOG(3) << "could not find cursor " << id << " in cache for " << ns << endl; + LOG(3) << "could not find cursor " << id << " in cache for " << ns; replyToQuery(ResultFlag_CursorNotFound, r.p(), r.m(), 0, 0, 0); return; diff --git a/src/mongo/s/strategy.h b/src/mongo/s/strategy.h index fc9568d5ec6..40d71f2fd4d 100644 --- a/src/mongo/s/strategy.h +++ b/src/mongo/s/strategy.h @@ -1,6 +1,5 @@ -// strategy.h -/* - * Copyright (C) 2010 10gen Inc. +/** + * Copyright (C) 2010-2014 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, @@ -18,25 +17,23 @@ * 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. + * 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 "chunk.h" -#include "request.h" +#include "mongo/client/connection_string.h" +#include "mongo/s/client/shard.h" +#include "mongo/s/request.h" namespace mongo { -class BatchItemRef; - /** * Legacy interface for processing client read/write/cmd requests. */ @@ -95,4 +92,5 @@ public: protected: static bool handleSpecialNamespaces(Request& r, QueryMessage& q); }; -} + +} // namespace mongo |