summaryrefslogtreecommitdiff
path: root/src/mongo/db/service_entry_point_common.cpp
diff options
context:
space:
mode:
authorRushan Chen <rushan.chen@mongodb.com>2023-01-11 11:58:28 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-01-11 12:33:37 +0000
commit37bbca32d5adc3654dff73b94816a7bd56cd9d42 (patch)
treef8f7bcb6b6f2e2d70a07b545363a75f62a2b47b1 /src/mongo/db/service_entry_point_common.cpp
parent6cf2a3f731b730a5562a507ed064edc4f86c67e2 (diff)
downloadmongo-37bbca32d5adc3654dff73b94816a7bd56cd9d42.tar.gz
SERVER-70445 check existence of TimeseriesOptions before using the time series bucket collection name space
Diffstat (limited to 'src/mongo/db/service_entry_point_common.cpp')
-rw-r--r--src/mongo/db/service_entry_point_common.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp
index d4b0c5b99fc..091d4d80d39 100644
--- a/src/mongo/db/service_entry_point_common.cpp
+++ b/src/mongo/db/service_entry_point_common.cpp
@@ -1708,12 +1708,10 @@ void ExecCommandDatabase::_initiateCommand() {
// possible that a stale mongos may send the request over a view namespace. In this case, we
// initialize the 'OperationShardingState' with buckets namespace.
auto bucketNss = _invocation->ns().makeTimeseriesBucketsNamespace();
- auto namespaceForSharding = CollectionCatalog::get(opCtx)
- ->lookupCollectionByNamespaceForRead(opCtx, bucketNss)
- .get()
- ? bucketNss
- : _invocation->ns();
-
+ auto coll =
+ CollectionCatalog::get(opCtx)->lookupCollectionByNamespaceForRead(opCtx, bucketNss);
+ auto namespaceForSharding =
+ (coll && coll->getTimeseriesOptions()) ? bucketNss : _invocation->ns();
boost::optional<ShardVersion> shardVersion;
if (auto shardVersionElem = request.body[ShardVersion::kShardVersionField]) {
shardVersion = ShardVersion::parse(shardVersionElem);