Skip to content

[Bug] Table stuck in WAITING_STABLE after cancelling a schema-change job that never became stable #66177

Description

@Baymine

Search before asking

  • I had searched in the issues and found no similar issues.

Version

master

What's Wrong?

When a schema-change job is cancelled while the table is still in the WAITING_STABLE sub-state (the table never became stable, so the job was never promoted to SCHEMA_CHANGE), the table's OlapTableState is not reset back to NORMAL.

Root cause: SchemaChangeJobV2.changeTableState (invoked from the job's cancelInternal) only resets the table when its state is SCHEMA_CHANGE; a table in WAITING_STABLE is left untouched. In addition, SchemaChangeHandler.cancelColumnJob throws "could not find related job" when a table is flagged WAITING_STABLE but has no live job (an orphaned state older binaries could leave behind).

As a result the table stays permanently stuck in WAITING_STABLE with no live job, and every subsequent ALTER / TRUNCATE / DROP PARTITION / RENAME / CANCEL ALTER on it is rejected — the only way to recover is DROP TABLE.

What You Expected?

Cancelling a schema-change job that is still WAITING_STABLE should reset the table back to NORMAL so it is usable again. A table left in an orphaned WAITING_STABLE (no backing job) should be self-healed by CANCEL ALTER TABLE rather than requiring DROP TABLE.

How to Reproduce?

  1. Start an ALTER TABLE ... ADD COLUMN on a table that is not stable (e.g. a replica in DECOMMISSION), so the pending schema-change job parks in WAITING_STABLE.
  2. CANCEL ALTER TABLE COLUMN FROM db.tbl.
  3. The table remains in WAITING_STABLE; subsequent ALTER/TRUNCATE/DROP PARTITION/RENAME/CANCEL are rejected.

Anything Else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions