summaryrefslogtreecommitdiff
path: root/src/mongo/s/catalog
diff options
context:
space:
mode:
authorJordi Serra Torrens <jordi.serra-torrens@mongodb.com>2021-02-09 12:20:43 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-02-16 11:16:19 +0000
commit24a3d286b9c3c7c85af127f3819e2757e175a03d (patch)
treeb340cbccd0fd3a8c82b48bd57c161f6db86ded9c /src/mongo/s/catalog
parent881a8d0ddad5a9209ca6083736ac6729183ff25e (diff)
downloadmongo-24a3d286b9c3c7c85af127f3819e2757e175a03d.tar.gz
SERVER-53105: Pass 'hint' when querying config.chunks in ConfigServerCatalogCacheLoader
Diffstat (limited to 'src/mongo/s/catalog')
-rw-r--r--src/mongo/s/catalog/sharding_catalog_client.h17
-rw-r--r--src/mongo/s/catalog/sharding_catalog_client_impl.cpp10
-rw-r--r--src/mongo/s/catalog/sharding_catalog_client_impl.h17
-rw-r--r--src/mongo/s/catalog/sharding_catalog_client_mock.cpp6
-rw-r--r--src/mongo/s/catalog/sharding_catalog_client_mock.h6
5 files changed, 34 insertions, 22 deletions
diff --git a/src/mongo/s/catalog/sharding_catalog_client.h b/src/mongo/s/catalog/sharding_catalog_client.h
index 43c2c160a18..d2d7fde1165 100644
--- a/src/mongo/s/catalog/sharding_catalog_client.h
+++ b/src/mongo/s/catalog/sharding_catalog_client.h
@@ -173,12 +173,14 @@ public:
*
* Returns a vector of ChunkTypes, or a !OK status if an error occurs.
*/
- virtual StatusWith<std::vector<ChunkType>> getChunks(OperationContext* opCtx,
- const BSONObj& filter,
- const BSONObj& sort,
- boost::optional<int> limit,
- repl::OpTime* opTime,
- repl::ReadConcernLevel readConcern) = 0;
+ virtual StatusWith<std::vector<ChunkType>> getChunks(
+ OperationContext* opCtx,
+ const BSONObj& filter,
+ const BSONObj& sort,
+ boost::optional<int> limit,
+ repl::OpTime* opTime,
+ repl::ReadConcernLevel readConcern,
+ const boost::optional<BSONObj>& hint = boost::none) = 0;
/**
* Retrieves all zones defined for the specified collection. The returned vector is sorted based
@@ -341,7 +343,8 @@ private:
const NamespaceString& nss,
const BSONObj& query,
const BSONObj& sort,
- boost::optional<long long> limit) = 0;
+ boost::optional<long long> limit,
+ const boost::optional<BSONObj>& hint = boost::none) = 0;
};
} // namespace mongo
diff --git a/src/mongo/s/catalog/sharding_catalog_client_impl.cpp b/src/mongo/s/catalog/sharding_catalog_client_impl.cpp
index ff7053ab8ee..d740406f842 100644
--- a/src/mongo/s/catalog/sharding_catalog_client_impl.cpp
+++ b/src/mongo/s/catalog/sharding_catalog_client_impl.cpp
@@ -404,14 +404,15 @@ StatusWith<std::vector<ChunkType>> ShardingCatalogClientImpl::getChunks(
const BSONObj& sort,
boost::optional<int> limit,
OpTime* opTime,
- repl::ReadConcernLevel readConcern) {
+ repl::ReadConcernLevel readConcern,
+ const boost::optional<BSONObj>& hint) {
invariant(serverGlobalParams.clusterRole == ClusterRole::ConfigServer ||
readConcern == repl::ReadConcernLevel::kMajorityReadConcern);
// Convert boost::optional<int> to boost::optional<long long>.
auto longLimit = limit ? boost::optional<long long>(*limit) : boost::none;
auto findStatus = _exhaustiveFindOnConfig(
- opCtx, kConfigReadSelector, readConcern, ChunkType::ConfigNS, query, sort, longLimit);
+ opCtx, kConfigReadSelector, readConcern, ChunkType::ConfigNS, query, sort, longLimit, hint);
if (!findStatus.isOK()) {
return findStatus.getStatus().withContext("Failed to load chunks");
}
@@ -877,9 +878,10 @@ StatusWith<repl::OpTimeWith<vector<BSONObj>>> ShardingCatalogClientImpl::_exhaus
const NamespaceString& nss,
const BSONObj& query,
const BSONObj& sort,
- boost::optional<long long> limit) {
+ boost::optional<long long> limit,
+ const boost::optional<BSONObj>& hint) {
auto response = Grid::get(opCtx)->shardRegistry()->getConfigShard()->exhaustiveFindOnConfig(
- opCtx, readPref, readConcern, nss, query, sort, limit);
+ opCtx, readPref, readConcern, nss, query, sort, limit, hint);
if (!response.isOK()) {
return response.getStatus();
}
diff --git a/src/mongo/s/catalog/sharding_catalog_client_impl.h b/src/mongo/s/catalog/sharding_catalog_client_impl.h
index 66f25e71fb3..767b4ae3c17 100644
--- a/src/mongo/s/catalog/sharding_catalog_client_impl.h
+++ b/src/mongo/s/catalog/sharding_catalog_client_impl.h
@@ -85,12 +85,14 @@ public:
StatusWith<std::vector<std::string>> getDatabasesForShard(OperationContext* opCtx,
const ShardId& shardName) override;
- StatusWith<std::vector<ChunkType>> getChunks(OperationContext* opCtx,
- const BSONObj& query,
- const BSONObj& sort,
- boost::optional<int> limit,
- repl::OpTime* opTime,
- repl::ReadConcernLevel readConcern) override;
+ StatusWith<std::vector<ChunkType>> getChunks(
+ OperationContext* opCtx,
+ const BSONObj& query,
+ const BSONObj& sort,
+ boost::optional<int> limit,
+ repl::OpTime* opTime,
+ repl::ReadConcernLevel readConcern,
+ const boost::optional<BSONObj>& hint = boost::none) override;
StatusWith<std::vector<TagsType>> getTagsForCollection(OperationContext* opCtx,
const NamespaceString& nss) override;
@@ -178,7 +180,8 @@ private:
const NamespaceString& nss,
const BSONObj& query,
const BSONObj& sort,
- boost::optional<long long> limit) override;
+ boost::optional<long long> limit,
+ const boost::optional<BSONObj>& hint = boost::none) override;
/**
* Queries the config servers for the database metadata for the given database, using the
diff --git a/src/mongo/s/catalog/sharding_catalog_client_mock.cpp b/src/mongo/s/catalog/sharding_catalog_client_mock.cpp
index 7f3c5a90299..deec7539db3 100644
--- a/src/mongo/s/catalog/sharding_catalog_client_mock.cpp
+++ b/src/mongo/s/catalog/sharding_catalog_client_mock.cpp
@@ -82,7 +82,8 @@ StatusWith<std::vector<ChunkType>> ShardingCatalogClientMock::getChunks(
const BSONObj& sort,
boost::optional<int> limit,
repl::OpTime* opTime,
- repl::ReadConcernLevel readConcern) {
+ repl::ReadConcernLevel readConcern,
+ const boost::optional<BSONObj>& hint) {
return {ErrorCodes::InternalError, "Method not implemented"};
}
@@ -174,7 +175,8 @@ ShardingCatalogClientMock::_exhaustiveFindOnConfig(OperationContext* opCtx,
const NamespaceString& nss,
const BSONObj& query,
const BSONObj& sort,
- boost::optional<long long> limit) {
+ boost::optional<long long> limit,
+ const boost::optional<BSONObj>& hint) {
return {ErrorCodes::InternalError, "Method not implemented"};
}
diff --git a/src/mongo/s/catalog/sharding_catalog_client_mock.h b/src/mongo/s/catalog/sharding_catalog_client_mock.h
index ba7ec3ba81e..0930579d55d 100644
--- a/src/mongo/s/catalog/sharding_catalog_client_mock.h
+++ b/src/mongo/s/catalog/sharding_catalog_client_mock.h
@@ -67,7 +67,8 @@ public:
const BSONObj& sort,
boost::optional<int> limit,
repl::OpTime* opTime,
- repl::ReadConcernLevel readConcern) override;
+ repl::ReadConcernLevel readConcern,
+ const boost::optional<BSONObj>& hint) override;
StatusWith<std::vector<TagsType>> getTagsForCollection(OperationContext* opCtx,
const NamespaceString& nss) override;
@@ -139,7 +140,8 @@ private:
const NamespaceString& nss,
const BSONObj& query,
const BSONObj& sort,
- boost::optional<long long> limit) override;
+ boost::optional<long long> limit,
+ const boost::optional<BSONObj>& hint) override;
};
} // namespace mongo