-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 5.2.0, 4.2.17, 5.0.5, 5.1.1, 4.4.12
-
Component/s: None
-
Fully Compatible
-
ALL
-
-
QE 2022-02-07, QE 2022-02-21, QE 2022-03-07, QE 2022-03-21
The reason why the document source group may return different results for in-memory group and spilled group is because when the document source group spills, it spills the accumulator state in the final state, not in intermediate state. For example, $sum accumulator stores decimal total and non-decimal total separately but when the document source group spills data, it calls AccumulatorState::getValue() which returns the final state == decimalTotal.add(nonDecimalTotal.getDecimal()).
We may have potentially similar issues for accumulators that need intermediate state in sharded environment and it needs further investigation. I haven’t yet gone deeper on this aspect. But I’m not sure what’s MongoDB’s guarantee about aggregation results in sharded environment.
If we had similar issues for sharded envionment, those issues would exist for both the classic engine and the SBE. To fix the sharded environment issues (assuming there are), we need to send the full intermediate accumulator state over the wire. Currently, we’re sending semi-processed intermediate accumulator state over the wire.
- has to be done before
-
SERVER-64227 Remove $sum/$avg merging logic which handles old input data format from a shard after branching 6.0
- Closed
- is related to
-
SERVER-63260 Fix the issue that $group returns different results for in-memory group and spilled group when using $avg
- Closed