Search before asking
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?
- 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.
CANCEL ALTER TABLE COLUMN FROM db.tbl.
- 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?
Code of Conduct
Search before asking
Version
master
What's Wrong?
When a schema-change job is cancelled while the table is still in the
WAITING_STABLEsub-state (the table never became stable, so the job was never promoted toSCHEMA_CHANGE), the table'sOlapTableStateis not reset back toNORMAL.Root cause:
SchemaChangeJobV2.changeTableState(invoked from the job'scancelInternal) only resets the table when its state isSCHEMA_CHANGE; a table inWAITING_STABLEis left untouched. In addition,SchemaChangeHandler.cancelColumnJobthrows "could not find related job" when a table is flaggedWAITING_STABLEbut has no live job (an orphaned state older binaries could leave behind).As a result the table stays permanently stuck in
WAITING_STABLEwith no live job, and every subsequentALTER/TRUNCATE/DROP PARTITION/RENAME/CANCEL ALTERon it is rejected — the only way to recover isDROP TABLE.What You Expected?
Cancelling a schema-change job that is still
WAITING_STABLEshould reset the table back toNORMALso it is usable again. A table left in an orphanedWAITING_STABLE(no backing job) should be self-healed byCANCEL ALTER TABLErather than requiringDROP TABLE.How to Reproduce?
ALTER TABLE ... ADD COLUMNon a table that is not stable (e.g. a replica inDECOMMISSION), so the pending schema-change job parks inWAITING_STABLE.CANCEL ALTER TABLE COLUMN FROM db.tbl.WAITING_STABLE; subsequent ALTER/TRUNCATE/DROP PARTITION/RENAME/CANCEL are rejected.Anything Else?
No response
Are you willing to submit PR?
Code of Conduct