-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Cluster Scalability
-
ALL
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Commands that are only supported on sharded clusters are typically gated by a call to assertCanAcceptShardedCommands(), which fails with a clear ShardingStateNotInitialized error when the command is invoked on a replica set (i.e. a node that isn't part of a sharded cluster).
The autoSplitVector command does not follow this pattern. Its typedRun performs its own uassert check on ClusterRole::ShardServer (auto_split_vector_command.cpp#L97-L99) before reaching the assertCanAcceptShardedCommands() call. As a result, invoking autoSplitVector on a replica set fails with:
IllegalOperation: The autoSplitVector command can only be invoked on shards (no CSRS).
instead of the standard ShardingStateNotInitialized error other shard-only commands produce. This inconsistency is confusing for callers/operators, since the message references "shards" and "CSRS" rather than indicating that the node simply isn't part of a sharded cluster.
We should make autoSplitVector's error behavior consistent with other shard-only commands by relying on assertCanAcceptShardedCommands() instead of (or before) the separate ClusterRole check.