|
ClusterAggregate was originally intended to exclusively run on mongoS, with sharded_agg_helpers.cpp intended to be the set of common functions that allowed mongoD to do cross-shard routing. However, as a result of SERVER-45389, ClusterAggregate was incidentally linked into mongoD and ClusterAggregate::runAggregate can now be invoked directly in a mongoD context. This was at best semi-intentional, and gave rise to the issue detailed in SERVER-66270. The only reason that similar problems did not surface earlier is that the only place where ClusterAggregate::runAggregate is actually invoked by mongoD is in the PeriodicShardedIndexConsistencyChecker.
Since we did not consciously make the decision to allow ClusterAggregate::runAggregate to be executed on mongoD, we should consider whether we want this to be the case going forward.
|