Skip to content

[fix](fe) Rebuild invalidated MTMV baseline on AUTO refresh - #33

Merged
yujun777 merged 1 commit into
yujun777:ivmfrom
seawinde:fix/trigger-exclude-table-regression
Aug 28, 2026
Merged

yujun777 merged 1 commit into
yujun777:ivmfrom
seawinde:fix/trigger-exclude-table-regression

Conversation

@seawinde

@seawinde seawinde commented Aug 28, 2026 •

Copy link
Copy Markdown
Collaborator

What problem does this PR solve?

Issue Number: N/A

Related PR: N/A

Problem Summary:

Changing excluded_trigger_tables clears the refresh snapshot while leaving a successfully refreshed MTMV in NORMAL/SUCCESS state. A later AUTO refresh can therefore run the partition freshness check against the new exclusions, incorrectly conclude that no partition needs refreshing, and leave stale data in the materialized view.

Root cause: In MTMVTask.buildAttempts(), AUTO refresh did not distinguish an initial MTMV without a snapshot from a previously successful MTMV whose snapshot had been invalidated.

File Change Description
MTMVTask.java Route only non-IVM AUTO refreshes in NORMAL/SUCCESS state without a snapshot directly to COMPLETE.
MTMVTaskTest.java Cover invalidated successful baselines and preserve the initial AUTO fallback chain.

This reuses the existing MTMV state and refresh state. It does not change IVM refresh behavior or the normal partition refresh path.

Release note

AUTO refresh now rebuilds a successfully established MTMV baseline after it has been invalidated.

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason

    ./run-fe-ut.sh --run org.apache.doris.mtmv.MTMVTaskTest: 49 tests passed.

    ./run-regression-test.sh --run -d mtmv_p0 -s test_excluded_trigger_table_mtmv: passed.

    ./run-regression-test.sh --run -d mtmv_p0/ivm: 71 of 77 suites passed; the 6 failures are unrelated pre-existing IVM stream cleanup, join event-key type, and explain-plan stability issues. The IVM excluded-trigger-table suite passed.

  • Behavior changed:

    • No.
    • Yes.

    Old behavior: AUTO refresh could skip rebuilding an invalidated successful baseline.

    New behavior: the affected non-IVM AUTO refresh performs a COMPLETE refresh.

  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

### What problem does this PR solve?

Issue Number: N/A

Related PR: N/A

Problem Summary: Changing excluded_trigger_tables clears the refresh snapshot while leaving a successfully refreshed MTMV in NORMAL state. AUTO refresh could then run the partition freshness check with the new exclusions, incorrectly conclude that no refresh was needed, and leave stale data in the materialized view. Route only non-IVM AUTO refreshes in NORMAL/SUCCESS state without a snapshot directly to COMPLETE so the invalidated baseline is rebuilt, while preserving initial refresh and existing partition refresh behavior.

### Release note

AUTO refresh now rebuilds a successfully established MTMV baseline after it has been invalidated.

### Check List (For Author)

- Test: Unit Test and Regression Test
    - ./run-fe-ut.sh --run org.apache.doris.mtmv.MTMVTaskTest
    - ./run-regression-test.sh --run -d mtmv_p0 -s test_excluded_trigger_table_mtmv
- Behavior changed: Yes. A non-IVM AUTO refresh rebuilds an invalidated successful baseline with COMPLETE refresh.
- Does this need documentation: No
@seawinde
seawinde force-pushed the fix/trigger-exclude-table-regression branch from 4843034 to 34b98d0 Compare August 28, 2026 03:47
@yujun777
yujun777 merged commit 75afbf3 into yujun777:ivm Aug 28, 2026
15 of 17 checks passed
yujun777 pushed a commit that referenced this pull request Sep 1, 2026
### What problem does this PR solve?

Issue Number: N/A

Related PR: N/A

Problem Summary: Changing excluded_trigger_tables clears the refresh snapshot while leaving a successfully refreshed MTMV in NORMAL state. AUTO refresh could then run the partition freshness check with the new exclusions, incorrectly conclude that no refresh was needed, and leave stale data in the materialized view. Route only non-IVM AUTO refreshes in NORMAL/SUCCESS state without a snapshot directly to COMPLETE so the invalidated baseline is rebuilt, while preserving initial refresh and existing partition refresh behavior.

### Release note

AUTO refresh now rebuilds a successfully established MTMV baseline after it has been invalidated.

### Check List (For Author)

- Test: Unit Test and Regression Test
    - ./run-fe-ut.sh --run org.apache.doris.mtmv.MTMVTaskTest
    - ./run-regression-test.sh --run -d mtmv_p0 -s test_excluded_trigger_table_mtmv
- Behavior changed: Yes. A non-IVM AUTO refresh rebuilds an invalidated successful baseline with COMPLETE refresh.
- Does this need documentation: No
yujun777 pushed a commit that referenced this pull request Sep 2, 2026
### What problem does this PR solve?

Issue Number: N/A

Related PR: N/A

Problem Summary: Changing excluded_trigger_tables clears the refresh snapshot while leaving a successfully refreshed MTMV in NORMAL state. AUTO refresh could then run the partition freshness check with the new exclusions, incorrectly conclude that no refresh was needed, and leave stale data in the materialized view. Route only non-IVM AUTO refreshes in NORMAL/SUCCESS state without a snapshot directly to COMPLETE so the invalidated baseline is rebuilt, while preserving initial refresh and existing partition refresh behavior.

### Release note

AUTO refresh now rebuilds a successfully established MTMV baseline after it has been invalidated.

### Check List (For Author)

- Test: Unit Test and Regression Test
    - ./run-fe-ut.sh --run org.apache.doris.mtmv.MTMVTaskTest
    - ./run-regression-test.sh --run -d mtmv_p0 -s test_excluded_trigger_table_mtmv
- Behavior changed: Yes. A non-IVM AUTO refresh rebuilds an invalidated successful baseline with COMPLETE refresh.
- Does this need documentation: No
yujun777 pushed a commit that referenced this pull request Sep 3, 2026
### What problem does this PR solve?

Issue Number: N/A

Related PR: N/A

Problem Summary: Changing excluded_trigger_tables clears the refresh snapshot while leaving a successfully refreshed MTMV in NORMAL state. AUTO refresh could then run the partition freshness check with the new exclusions, incorrectly conclude that no refresh was needed, and leave stale data in the materialized view. Route only non-IVM AUTO refreshes in NORMAL/SUCCESS state without a snapshot directly to COMPLETE so the invalidated baseline is rebuilt, while preserving initial refresh and existing partition refresh behavior.

### Release note

AUTO refresh now rebuilds a successfully established MTMV baseline after it has been invalidated.

### Check List (For Author)

- Test: Unit Test and Regression Test
    - ./run-fe-ut.sh --run org.apache.doris.mtmv.MTMVTaskTest
    - ./run-regression-test.sh --run -d mtmv_p0 -s test_excluded_trigger_table_mtmv
- Behavior changed: Yes. A non-IVM AUTO refresh rebuilds an invalidated successful baseline with COMPLETE refresh.
- Does this need documentation: No
yujun777 pushed a commit that referenced this pull request Sep 3, 2026
### What problem does this PR solve?

Issue Number: N/A

Related PR: N/A

Problem Summary: Changing excluded_trigger_tables clears the refresh snapshot while leaving a successfully refreshed MTMV in NORMAL state. AUTO refresh could then run the partition freshness check with the new exclusions, incorrectly conclude that no refresh was needed, and leave stale data in the materialized view. Route only non-IVM AUTO refreshes in NORMAL/SUCCESS state without a snapshot directly to COMPLETE so the invalidated baseline is rebuilt, while preserving initial refresh and existing partition refresh behavior.

### Release note

AUTO refresh now rebuilds a successfully established MTMV baseline after it has been invalidated.

### Check List (For Author)

- Test: Unit Test and Regression Test
    - ./run-fe-ut.sh --run org.apache.doris.mtmv.MTMVTaskTest
    - ./run-regression-test.sh --run -d mtmv_p0 -s test_excluded_trigger_table_mtmv
- Behavior changed: Yes. A non-IVM AUTO refresh rebuilds an invalidated successful baseline with COMPLETE refresh.
- Does this need documentation: No
yujun777 pushed a commit that referenced this pull request Sep 3, 2026
### What problem does this PR solve?

Issue Number: N/A

Related PR: N/A

Problem Summary: Changing excluded_trigger_tables clears the refresh snapshot while leaving a successfully refreshed MTMV in NORMAL state. AUTO refresh could then run the partition freshness check with the new exclusions, incorrectly conclude that no refresh was needed, and leave stale data in the materialized view. Route only non-IVM AUTO refreshes in NORMAL/SUCCESS state without a snapshot directly to COMPLETE so the invalidated baseline is rebuilt, while preserving initial refresh and existing partition refresh behavior.

### Release note

AUTO refresh now rebuilds a successfully established MTMV baseline after it has been invalidated.

### Check List (For Author)

- Test: Unit Test and Regression Test
    - ./run-fe-ut.sh --run org.apache.doris.mtmv.MTMVTaskTest
    - ./run-regression-test.sh --run -d mtmv_p0 -s test_excluded_trigger_table_mtmv
- Behavior changed: Yes. A non-IVM AUTO refresh rebuilds an invalidated successful baseline with COMPLETE refresh.
- Does this need documentation: No
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants