docs/agents/ddl/04-dev-checklist.md
This doc is a practical checklist for making DDL changes without breaking online DDL guarantees.
Use this decision table:
| Change type | Correct place |
|---|---|
| Pure statement parsing/AST changes | pkg/parser/* |
| Planner builds DDL plan nodes | pkg/planner/* |
| Transaction boundary / generic AST dispatch | pkg/executor/ddl.go |
| Convert statement → job args / job submission / waiting | pkg/ddl/executor.go |
| Persistent step execution, schema state transitions, meta writes | pkg/ddl/job_worker.go + the per-action handlers (e.g. pkg/ddl/table.go, pkg/ddl/schema.go, pkg/ddl/index.go, pkg/ddl/modify_column.go, pkg/ddl/partition.go) |
| Job args encoding/decoding, job version compat | pkg/meta/model/* |
| Schema sync / versioning mechanisms | pkg/ddl/schemaver/*, pkg/ddl/schema_version.go |
If your logic must survive restart/owner transfer, it belongs in the job execution path (DDL workers), not pkg/executor/.
pkg/executor/ddl.go switch only if a new AST type is introduced.pkg/ddl/executor.go (or reuse an existing one).model.Job + typed args (prefer v2 if supported by the job type).WaitVersionSynced happen at the right boundaries.pkg/ddl/*_test.go (prefer targeted tests).tests/integrationtest/.Unit test (targeted):
pushd pkg/ddl
go test -run TestXxx --tags=intest
popd
Integration tests (when behavior is user-visible / cross-module):
pushd tests/integrationtest
./run-tests.sh -t <TestName>
popd
If you need to update the recorded result set, use -r:
pushd tests/integrationtest
./run-tests.sh -r <TestName>
popd
Failpoints:
failpoint. or testfailpoint., enable failpoints before running tests and disable afterwards:make failpoint-enable && (
pushd pkg/ddl
go test -run TestXxx --tags=intest
rc=$?
popd
make failpoint-disable
exit $rc
)
Build system note (Bazel):
_test.go), run make bazel_prepare and include generated *.bazel/*.bzl changes.SQL-level:
ADMIN SHOW DDL JOBSADMIN SHOW DDL JOB QUERIESADMIN CANCEL DDL JOBS <job_id>Code-level:
pkg/ddl/executor.go:DoDDLJobWrapper (wait loop) and follow job ID through submit/schedule/worker.logutil.DDLLogger() in pkg/ddl/*).WaitVersionSynced.pkg/executor/ instead of pkg/ddl/.