-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: 9.0.4, 9.0.8
-
Component/s: Query Execution, Write Ops
-
None
-
Environment:Single-node replica set, FCV 9.0, official mongo:9.0.8 Docker image (also seen on 9.0.4). Not sharded. Fixed one-day buckets (bucketMaxSpanSeconds = bucketRoundingSeconds = 86400).
-
Query Execution
-
ALL
-
-
None
-
None
-
None
-
None
-
None
-
None
-
None
On a time-series collection with a compound secondary index on meta, measurementField, a deleteMany with a filter like
{s: X, t: {$in: [...]}, w: {$lt: N}}
sometimes deletes measurements that do not match the filter. Sometimes deletedCount is correct while other measurements of the same series still disappear. Sometimes deletedCount is also too high (e.g. reported 9, expected 1; 32 of 39 measurements lost).
The same workload never loses data when:
- the delete is hinted to s: 1, t: 1, or
- the s: 1, w: 1 index does not exist.
So the problem seems specific to the delete path when it is planned on the measurement-field secondary index (bucket unpacking / residual predicate evaluation for that plan).
Expected
Each deleteMany removes only measurements with s == S, t in the list, and w < current. deletedCount equals the expected count and the remaining count matches on every step.
Actual
Occasionally (about 1% of trials) measurements outside the filter are deleted. Example from 9.0.8:
trial 13 w=6 AFTER DELETE reported=9 wantDeleted=1 left=7 want=39
The lost measurements were at timestamps not in the $in list, across all three daily buckets.
Workaround
Hint metaField: 1, timeField: 1 on deletes, or avoid secondary indexes on measurement fields that delete filters reference.
Possibly related (none match)
SERVER-131496: fixed-bucket predicate generator on the write path, but only for extended-range dates. Our dates are in 2024.SERVER-94559/SERVER-99527: sharded, 7.0/8.0. Ours is not sharded.SERVER-122729: sharded, during upgrade/downgrade.
- is related to
-
SERVER-94559 Time-series measurement deletes update the minTime of a bucket
-
- Closed
-
-
SERVER-99527 Time-series measurement deletes can cause bucket minTime to differ from _id time
-
- Closed
-
-
SERVER-131496 Time-series write path ignores extended-range data when selecting bucket-level predicate generator
-
- Closed
-
-
SERVER-122729 Investigate document count mismatch on deleteMany of sharded timeseries concurrent with upgrade/downgrade
-
- Closed
-