Issues with Executing Online DDL

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

Original topic: online ddl执行问题

| username: yytest

For online DDL, if a TiDB server receives a DDL request and this TiDB server is also the owner, will the submitted DDL still be cached in the queue in TiKV? Will it be executed directly without being cached in the queue?

| username: zhaokede | Original post link

You still need to queue. This can be seen as step-by-step.

| username: zhaokede | Original post link

In TiDB, the execution process of DDL (Data Definition Language) operations involves multiple components and steps. When you mention “a certain TiDB server received a DDL request and this TiDB server is also the owner,” the “owner” here refers to the node responsible for handling DDL operations within the entire TiDB cluster.

TiDB ensures that DDL operations are executed by only one node at a time through a mechanism called the DDL owner. When a TiDB server becomes the DDL owner, it has the authority to handle DDL operations. However, this does not mean that the DDL operation will be executed immediately without going through any buffer queue.

In fact, when TiDB processes DDL requests, it may use some queue or buffering mechanisms to manage these requests, ensuring their order and consistency.

| username: shigp_TIDBER | Original post link

If the TiDB server is the owner, the submitted DDL still needs to queue in the cache. If there are few items in the queue, it can be executed immediately.

| username: yytest | Original post link

The official documentation mentions that if a DDL is submitted to the TiDB server and it is the owner, it should be executed first without queuing.

| username: hacker_77powerful | Original post link

If there is no one in the queue, execute immediately.

| username: kelvin | Original post link

You probably need to queue up. It depends on how many people are in front of you in the queue.

| username: jiayou64 | Original post link

In this situation, the server without tasks will execute first, while other servers can concurrently perform index creation operations and other tasks.

| username: yytest | Original post link

According to the official documentation, it is indeed the case that if this TiDB server is the owner, it will prioritize processing the submitted DDL.

| username: 鱼跃龙门 | Original post link

In the v6 video I watched, there’s no need to queue; if it’s the owner, it gets executed directly.

| username: 濱崎悟空 | Original post link

Owners don’t need to queue?