Baymine opened a new issue, #66177:
URL: https://github.com/apache/doris/issues/66177

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) 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?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to