diff options
author | Yuhong Zhang <yuhong.zhang@mongodb.com> | 2023-04-12 15:04:06 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-04-12 19:31:30 +0000 |
commit | b853b29e41b406ea0c037a627c45c5d86058154b (patch) | |
tree | f55606c22c7560d3965e4764e3c36f998c2fd1ed | |
parent | f1a26e82843f2a2654832ac15e257bf223f9a70d (diff) | |
download | mongo-b853b29e41b406ea0c037a627c45c5d86058154b.tar.gz |
SERVER-75921 Remove conflicting error message for sharded time-series singleton delete with an id query
(cherry picked from commit e1d387e7d410fc83362f99626985ed5beb0271f8)
-rw-r--r-- | src/mongo/s/collection_routing_info_targeter.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/mongo/s/collection_routing_info_targeter.cpp b/src/mongo/s/collection_routing_info_targeter.cpp index 6d4befd609e..93f780de552 100644 --- a/src/mongo/s/collection_routing_info_targeter.cpp +++ b/src/mongo/s/collection_routing_info_targeter.cpp @@ -591,15 +591,20 @@ std::vector<ShardEndpoint> CollectionRoutingInfoTargeter::targetDelete( MatchExpressionParser::kAllowAllSpecialFeatures), str::stream() << "Could not parse delete query " << deleteQuery); - // Single deletes must target a single shard or be exact-ID. + // Regular single deletes must target a single shard or be exact-ID. + // Time-series single deletes must target a single shard. + auto isShardedTimeseriesCollection = isShardedTimeSeriesBucketsNamespace(); uassert(ErrorCodes::ShardKeyNotFound, - str::stream() << "A single delete on a sharded collection must contain an exact match " - "on _id (and have the collection default collation) or contain the " - "shard key (and have the simple collation). Delete request: " - << deleteOp.toBSON() - << ", shard key pattern: " << _cri.cm.getShardKeyPattern().toString(), + fmt::format("A single delete on a sharded {} contain the shard key (and have the " + "simple collation). Delete request: {}, shard key pattern: {}", + isShardedTimeseriesCollection + ? "time-series collection must" + : "collection must contain an exact match on _id (and have the " + "collection default collation) or", + deleteOp.toBSON().toString(), + _cri.cm.getShardKeyPattern().toString()), !_cri.cm.isSharded() || deleteOp.getMulti() || - (isExactIdQuery(opCtx, *cq, _cri.cm) && !isShardedTimeSeriesBucketsNamespace()) || + (isExactIdQuery(opCtx, *cq, _cri.cm) && !isShardedTimeseriesCollection) || feature_flags::gFeatureFlagUpdateOneWithoutShardKey.isEnabled( serverGlobalParams.featureCompatibility)); |