|
This feature flag enables a query optimization for time-series collections. It doesn't create any persistent data because it's only a query, and it doesn't send messages to other nodes because this optimization only applies within each mongod.
When a node is doing initial sync, I believe it doesn't count as a secondary, because the data is not consistent until it's caught up. So I wouldn't expect user queries to be routed there, and I don't think it matters whether any particular query optimization is used. But to defend against malicious inputs let's assume it can happen, and make sure we don't trigger the invariant() check.
This feature flag exists on 3 branches: v5.0, v6.0, and v7.0. Here are all the occurrences of "gFeatureFlagBucketUnpackWithSort":
- It's declared in the IDL.
- In document_source_sort.cpp we check the flag when registering the parser for $_internalBoundedSort. This registration happens during startup, so we expect FCV to be uninitialized. The appropriate thing to do is consider the feature to be enabled, so we register the parser, which can check the actual FCV later when parsing each request. On all three branches we are calling either isEnabledAndIgnoreFCV() or isEnabledAndIgnoreFCVUnsafeAtStartup(), so this is good.
- In pipeline_d.cpp we check the flag to decide whether to try the optimization. These checks all either use isEnabledAndIgnoreFCV() or isVersionInitialized() && isEnabled(). While this is not very consistent, it won't hit the invariant.
Going forward, on branches v7.1 and later this feature flag has been removed (SERVER-67588).
|