← Back to Pull requests

[fix](ivm) Fall back to regular MVs when stream prerequisites are missing #70799

Closed
unknown closed this pull request without merging on Nov 23, 2026 06:23 UTC
View on GitHub
unknown unknown commented on Nov 20, 2026 08:06 UTC
Author

Background

Doris uses REFRESH AUTO by default for asynchronous materialized views. During creation, AUTO probes whether the view can use incremental view maintenance (IVM). IVM reads base table changes through internal table streams.

What problem does this PR solve?

Issue Number: None
Related PR: #62606 (introduced the IVM CREATE probe)
PR Type: Bugfix

Problem Summary:

Creating an asynchronous materialized view over a changelog-enabled table could fail when the FE stream switch was disabled or a merge-on-write base table had no historical changelog values. For example, CREATE MATERIALIZED VIEW mv BUILD DEFERRED AS SELECT k, SUM(v) FROM t GROUP BY k could reach Stream creation and fail after the IVM view was registered. AUTO now creates a regular asynchronous materialized view in either case.

Details

  • Frequency: Always when IVM query analysis succeeds and a required stream fails either prerequisite.

  • Root cause: CreateMTMVInfo only retried regular MV analysis when the IVM query probe failed. The catalog checked Stream availability after the IVM schema was already registered.

  • Why existing tests missed it: CreateMTMVCommandTest enabled table streams in class setup, and its prior AUTO fallback tests exercised query analysis errors. test_ivm_basic_mtmv exercises explicit incremental refresh with the required changelog history enabled.

  • Fix: Reuse the catalog's Stream enablement and base table checks during IVM CREATE analysis. Skip excluded base tables and existing targets of IF NOT EXISTS. Restore the original MV properties before retrying regular analysis.

  • Other paths and branches: Both deployment modes share this FE precheck. Stream DDL still validates the live state when it provisions streams. The AUTO IVM probe is absent from the upstream 3.1, 4.0, 4.1, and 4.2 branches.

  • Behavior change: AUTO reports the qualified materialized view name and the fallback reason in the FE log. Explicit INCREMENTAL reports missing Stream prerequisites during analysis.
  • Testing

  • Ran ./run-fe-ut.sh --run CreateMTMVCommandTest locally. All 101 tests passed.

  • The new cases check AUTO and explicit INCREMENTAL with the Stream switch disabled or historical values missing. They also cover an existing IF NOT EXISTS target and verify that IVM-derived properties do not survive fallback.

  • The existing excluded-table case now uses a base table without historical values and still provisions only the required Stream.

  • The new cases were run on the fixed code.
  • Release note

    None

    Check List (For Author)

  • Behavior changed: Yes (see Details).

  • Does this need documentation: No. AUTO follows the documented fallback behavior.

  • Pre-submission status: Ready. The focused FE unit tests cover both reported prerequisites.
  • Diff: 351 lines (+263 / -88) across 4 files Reviewer: morrySnow Review duration: 4217m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 351 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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.351
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #70799"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.5% (MEDIUM) · Higher = larger blast radius
    42.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.8% · Safe to merge
    16.8%
    Repository