diff options
author | Spencer T Brody <spencer@mongodb.com> | 2015-08-19 17:14:33 -0400 |
---|---|---|
committer | Spencer T Brody <spencer@mongodb.com> | 2015-08-25 12:56:28 -0400 |
commit | f415aad16ec26a89110a71232dc898218dc5d85c (patch) | |
tree | 14cae84b235c52981d8d661b5219d02aab193cf0 /src/mongo/s/client/shard_registry.h | |
parent | eb0430ee860d22b164cd603ce7186842f72c8537 (diff) | |
download | mongo-f415aad16ec26a89110a71232dc898218dc5d85c.tar.gz |
SERVER-19875 Add OperationContext to CatalogManager::getAllShards
Diffstat (limited to 'src/mongo/s/client/shard_registry.h')
-rw-r--r-- | src/mongo/s/client/shard_registry.h | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/mongo/s/client/shard_registry.h b/src/mongo/s/client/shard_registry.h index 5f1349de7f8..38cdae15cbc 100644 --- a/src/mongo/s/client/shard_registry.h +++ b/src/mongo/s/client/shard_registry.h @@ -46,6 +46,7 @@ class BSONObjBuilder; class CatalogManager; struct HostAndPort; class NamespaceString; +class OperationContext; class RemoteCommandTargeterFactory; class Shard; class ShardType; @@ -123,12 +124,17 @@ public: return _configServerCS; } - void reload(); + void reload(OperationContext* txn); /** * Returns shared pointer to shard object with given shard id. */ - std::shared_ptr<Shard> getShard(const ShardId& shardId); + std::shared_ptr<Shard> getShard(OperationContext* txn, const ShardId& shardId); + + /** + * Returns shared pointer to the shard object representing the config servers. + */ + std::shared_ptr<Shard> getConfigShard(); /** * Instantiates a new detached shard connection, which does not appear in the list of shards @@ -196,15 +202,24 @@ public: * response object for any kind of command-specific failure. The only exception is * NotMaster errors, which we intercept and follow the rules described above for handling. */ - StatusWith<BSONObj> runCommandWithNotMasterRetries(const ShardId& shard, + StatusWith<BSONObj> runCommandWithNotMasterRetries(OperationContext* txn, + const ShardId& shard, const std::string& dbname, const BSONObj& cmdObj); - StatusWith<CommandResponse> runCommandWithNotMasterRetries(const ShardId& shardId, + StatusWith<CommandResponse> runCommandWithNotMasterRetries(OperationContext* txn, + const ShardId& shardId, const std::string& dbname, const BSONObj& cmdObj, const BSONObj& metadata); + StatusWith<BSONObj> runCommandOnConfigWithNotMasterRetries(const std::string& dbname, + const BSONObj& cmdObj); + + StatusWith<CommandResponse> runCommandOnConfigWithNotMasterRetries(const std::string& dbname, + const BSONObj& cmdObj, + const BSONObj& metadata); + private: typedef std::map<ShardId, std::shared_ptr<Shard>> ShardMap; @@ -220,6 +235,11 @@ private: std::shared_ptr<Shard> _findUsingLookUp(const ShardId& shardId); + StatusWith<CommandResponse> _runCommandWithNotMasterRetries(RemoteCommandTargeter* targeter, + const std::string& dbname, + const BSONObj& cmdObj, + const BSONObj& metadata); + // Factory to obtain remote command targeters for shards const std::unique_ptr<RemoteCommandTargeterFactory> _targeterFactory; |