Skip to content

[fix](sync) Treat empty cancel alter job list as all rollup jobs#62712

Open
seawinde wants to merge 1 commit intoapache:masterfrom
seawinde:fix_cancel_alter_empty_job_list
Open

[fix](sync) Treat empty cancel alter job list as all rollup jobs#62712
seawinde wants to merge 1 commit intoapache:masterfrom
seawinde:fix_cancel_alter_empty_job_list

Conversation

@seawinde
Copy link
Copy Markdown
Member

What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary:
Nereids always constructs a non-null alter job id list for CANCEL ALTER TABLE, using an empty list when the SQL omits explicit job ids. SchemaChangeHandler already treats an empty list as "cancel all unfinished jobs on the table", but MaterializedViewHandler only checked for null. As a result, CANCEL ALTER TABLE ... ROLLUP FROM db.tbl could incorrectly search by explicit job ids, find nothing, and throw Table[...] is not under ROLLUP even when the table still had unfinished rollup jobs.

This change aligns MaterializedViewHandler with SchemaChangeHandler by treating an empty job-id list the same as an omitted list, and adds regression tests for both the handler path and the Nereids parser behavior.

Release note

None

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
  • Behavior changed:

    • No.
    • Yes. CANCEL ALTER TABLE ROLLUP/MATERIALIZED VIEW without explicit job ids now treats an empty job-id list the same as an omitted list.
  • Does this need documentation?

    • No.
    • Yes.

### What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: Nereids always constructs a non-null alter job id list for CANCEL ALTER TABLE, using an empty list when the SQL omits explicit job ids. SchemaChangeHandler already treats an empty list as "cancel all unfinished jobs on the table", but MaterializedViewHandler only checked for null. As a result, `CANCEL ALTER TABLE ... ROLLUP FROM db.tbl` could incorrectly search by explicit job ids, find nothing, and throw `Table[...] is not under ROLLUP` even when the table had unfinished rollup jobs.

### Release note

None

### Check List (For Author)

- Test: Attempted FE unit test
    - Unit Test: `./run-fe-ut.sh --run org.apache.doris.alter.RollupJobV2Test#testCancelRollupWithEmptyJobIdList` (blocked by local FE build failure in pattern generation: `PatternDescribableProcessor` missing `org.apache.doris.nereids.pattern.generator.javaast.TypeBound` during `generate-patterns`)
- Behavior changed: Yes (CANCEL ALTER TABLE ROLLUP/MATERIALIZED VIEW without explicit job ids now treats an empty job-id list the same as an omitted list)
- Does this need documentation: No
@hello-stephen
Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@seawinde seawinde changed the title [fix](fe) Treat empty cancel alter job list as all rollup jobs [fix](sync) Treat empty cancel alter job list as all rollup jobs Apr 22, 2026
@seawinde
Copy link
Copy Markdown
Member Author

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 0.00% (0/1) 🎉
Increment coverage report
Complete coverage report

@morrySnow
Copy link
Copy Markdown
Contributor

/review

@hello-stephen
Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 0.00% (0/1) 🎉
Increment coverage report
Complete coverage report

@github-actions
Copy link
Copy Markdown
Contributor

PR approved by at least one committer and no changes requested.

@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label Apr 22, 2026
@github-actions
Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues found.

Critical checkpoints:

  • Goal / correctness: LogicalPlanBuilder.visitCancelAlterTable() always builds a non-null alterJobIdList, so changing MaterializedViewHandler.cancel() to treat an empty list as "all unfinished jobs on this table" correctly aligns the rollup/MV path with the existing FE behavior for omitted job ids. The new tests cover both the parser shape and the handler behavior.
  • Scope: Minimal and focused. One handler condition changed plus targeted tests.
  • Concurrency / locking: The touched path still collects candidate jobs under the table write lock and performs cancel() outside the lock, matching the existing locking pattern. I did not find a new deadlock or lock-expansion risk in this change.
  • Lifecycle / static init: Not involved.
  • Config / compatibility / FE-BE protocol / persistence / data writes: Not involved.
  • Parallel paths: This change makes the rollup/MV cancel path consistent with the existing empty-list handling used in the other cancel-job paths.
  • Special condition: The new emptiness check is necessary because the Nereids parser uses an empty list, not null, when SQL omits explicit job ids.
  • Test coverage: Good targeted unit coverage was added for the parser and rollup handler. Residual gap: there is still no end-to-end regression test for the user-visible SQL statement.
  • Test results in this runner: I could not execute the targeted FE unit test here because thirdparty/installed/bin/protoc is missing, so this review is based on static analysis only.
  • Observability / performance: No concerns for a change this small.

Non-blocking nit:

  • The PR title is [fix](sync) ..., but the code change is in FE; [fix](fe) ... would match the repository's usual module naming better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants