refine the context and context-like struct usage in DDL
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Enhancement
Currently the context usage is a bit of messy. One problem is https://github.com/pingcap/tidb/issues/56017 and I think a better context usage and cancellation will solve it. After a simple review of current DDL code, I think there should to 2 types of context:
1. the context of a DDL job. All job execution logic should use this context. And another goroutine polling the job state should cancel the context if it's not `JobStateRunning`.
2. the context of DDL module. Job rollingback, canceling, cleanup, scheduling, execution and other module-level action should use this context. It's canceled when the parent context is canceled which means domain is closing.
Contributor guide
Assessment
This issue has not been assessed yet.