summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/list_indexes.cpp
diff options
context:
space:
mode:
authorArun Banala <arun.banala@mongodb.com>2021-09-20 17:03:29 +0100
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-09-30 17:15:26 +0000
commit5e0dffb6d2723470e1f1bd93de6565c7a4e0353a (patch)
tree3ee6ca0e236a67c1a8a687774b0c53dda9a268b2 /src/mongo/db/commands/list_indexes.cpp
parent9f8e95a95b592c3686dcb1aa82ebcd9b7515974b (diff)
downloadmongo-5e0dffb6d2723470e1f1bd93de6565c7a4e0353a.tar.gz
SERVER-60144 Handle stale routing info on mongos for sharded time-series collections
Diffstat (limited to 'src/mongo/db/commands/list_indexes.cpp')
-rw-r--r--src/mongo/db/commands/list_indexes.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mongo/db/commands/list_indexes.cpp b/src/mongo/db/commands/list_indexes.cpp
index 54725eb7fb5..c9a42882944 100644
--- a/src/mongo/db/commands/list_indexes.cpp
+++ b/src/mongo/db/commands/list_indexes.cpp
@@ -74,8 +74,13 @@ IndexSpecsWithNamespaceString getIndexSpecsWithNamespaceString(OperationContext*
// Since time-series collections don't have UUIDs, we skip the time-series lookup
// if the target collection is specified as a UUID.
if (const auto& origNss = origNssOrUUID.nss()) {
- if (auto timeseriesOptions = timeseries::getTimeseriesOptions(opCtx, *origNss)) {
- auto bucketsNss = origNss->makeTimeseriesBucketsNamespace();
+ auto isCommandOnTimeseriesBucketNamespace =
+ cmd.getIsTimeseriesNamespace() && *cmd.getIsTimeseriesNamespace();
+ if (auto timeseriesOptions = timeseries::getTimeseriesOptions(
+ opCtx, *origNss, !isCommandOnTimeseriesBucketNamespace)) {
+ auto bucketsNss = isCommandOnTimeseriesBucketNamespace
+ ? *origNss
+ : origNss->makeTimeseriesBucketsNamespace();
AutoGetCollectionForReadCommandMaybeLockFree autoColl(opCtx, bucketsNss);
const CollectionPtr& coll = autoColl.getCollection();