What is done during the execution process of Online DDL statements?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: Online DDL语句执行流程中做的?

| username: yytest

  1. TiDB Server performs parsing and compiling to generate an execution plan.
  2. Lock all tables corresponding to the DDL statements in the job queue to a read-only state.

Which one do you think is necessary for Online DDL?

Personally, I think it should be 1 because online DDL does not block read and write operations.

| username: yytest | Original post link

Is there a teacher who can help take a look?

| username: hey-hoho | Original post link

Refer to the DDL execution principles:

| username: 小龙虾爱大龙虾 | Original post link

You are wrong! We need English content, directly translate it, don’t say anything else.

| username: zhh_912 | Original post link

Refer to the principles of DDL execution.

| username: yytest | Original post link

  1. It shouldn’t necessarily be done by DDL.
| username: 小于同学 | Original post link

Learned.

| username: 友利奈绪 | Original post link

Indeed, there is an issue with 2.

| username: lemonade010 | Original post link

  1. Locking all tables corresponding to DDL statements in the job queue to read-only state
    This is obviously wrong.
    According to whether user operations are blocked during execution, DDL statements can be classified as:
  • Offline DDL statements: When the database receives a user’s DDL statement, it will first lock the database object to be modified, then execute the metadata change. During the execution of the DDL, user operations modifying the data will be blocked.
  • Online DDL statements: When the database executes DDL statements, it uses certain methods to ensure that the DDL execution does not block user operations. It also ensures that user operations can submit modifications during the DDL execution, maintaining the correctness and consistency of the data of the corresponding objects during the execution process.
| username: TiDBer_H5NdJb5Q | Original post link

Online DDL will not block read and write operations, so it should not lock the table.

| username: 扬仔_tidb | Original post link

You’re quite serious, this is an exam question :grinning:

| username: TiDBer_QYr0vohO | Original post link

It’s 1, right?

| username: kelvin | Original post link

Refer to the principles of DDL execution.

| username: jiayou64 | Original post link

  1. All jobs, definitely not right.
| username: TiDBer_RjzUpGDL | Original post link

I choose 1.

| username: zhaokede | Original post link

  1. The TiDB Server performs parsing and compiling to generate an execution plan.
  2. It seems that there is no locking during execution.