[fix](ivm) Fall back to complete refresh on negative aggregate counts #70804
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 393 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.358
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #70804"
general
weight: 0.35
morrySnow
Background
An incremental aggregate materialized view applies signed changes from its base tables to the counts it already stores. Runtime guards reject a merge that would make a count negative. A refresh request that allows fallback can rebuild the view when the stored state cannot be used to apply the change.
What problem does this PR solve?
Issue Number: None
Related PR: #62606 (introduced the aggregate guards), #69772 (uses the same recovery path for expired stream offsets)
PR Type: Bugfix
Problem Summary:
An incremental refresh that calculates a negative count fails even when the request allows fallback. This can be reproduced by moving facts to an already populated group through an excluded dimension, then deleting more facts than the view has recorded for that group. The refresh now rebuilds the view and its stream baselines when the request allows fallback.
Details
IvmIncrRefreshManagerTestcovers other recognized executor errors.test_ivm_minmax_runtime_fallbackreaches the fallback path through a MIN/MAX boundary guard and does not make an aggregate count negative.NEGATIVE_AGGREGATE_COUNT. Use the existing direct-to-COMPLETEroute to recompute view state and reset the stream baselines together.COUNT(expr)in both deployment modes. The Apache Doris 3.1, 4.0, 4.1, and 4.2 release branches checked do not contain this classifier.INCREMENTAL FALLBACKandAUTOtryCOMPLETEafter this guard trips. StrictINCREMENTALreportsNEGATIVE_AGGREGATE_COUNTand includes the assertion detail.Testing
negative group countwith an unset fallback reason on a local cluster running the unfixed FE. A second refresh withINCREMENTAL FALLBACKfailed on the same assertion../build.sh --fecompleted with zero FE Core Checkstyle violations.test_ivm_negative_aggregate_count_fallbackpassed on the local shared-nothing cluster. Strict incremental failed with the classified reason and preserved the rows. Both fallback-enabled modes finished asCOMPLETE, followed by a successful incremental refresh.mtmv_p0/ivmpassed on the local shared-nothing cluster.Release note
Incremental aggregate materialized view refreshes that allow fallback now attempt a complete refresh if applying a change would make a count negative.
Check List (For Author)