Is TiDB's DDL serial?

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

Original topic: tidb的ddl是串行的吗?

| username: Running

The image is not available, please provide the text you need translated.

| username: hey-hoho | Original post link

TiDB’s DDL achieves online, asynchronous schema changes in a distributed environment without locking by implementing Google F1’s online asynchronous schema change algorithm. To simplify the design, TiDB only allows one node to execute DDL operations at any given time. Users can send multiple DDL requests to any TiDB node, but all DDL requests are executed serially by the worker of the owner node within TiDB.

  • worker: Each node has a worker to handle DDL operations.
  • owner: Only one node in the entire cluster can be elected as the owner, and any node can be elected to this role. The node elected as the owner has the right to handle DDL operations through its worker. The owner node is elected from multiple TiDB nodes using Etcd’s election feature. The owner has a term, and it actively maintains its term by renewing it. When the owner node goes down, other nodes can detect this through Etcd and elect a new owner.

The following diagram describes the simple processing flow of a DDL request in TiDB:

| username: 裤衩儿飞上天 | Original post link

There are two DDL job queues in TiKV, one for the add index queue and the other for other DDL operations. So strictly speaking, not all DDL operations are serialized.

| username: weixiaobing | Original post link

6.2 * Introduced a new DDL parallel execution framework to reduce DDL blocking and significantly improve execution efficiency.

| username: Running | Original post link

I have enabled the parameter tidb_enable_concurrent_ddl, but during execution, using admin show ddl jobs, I still see multiple DDLs waiting, and creating indexes globally is still slow.

| username: weixiaobing | Original post link

The test verification is fine.

| username: 我是咖啡哥 | Original post link

Is setting this parameter sufficient?

| username: weixiaobing | Original post link

Yes, it only started in version 6.2.

| username: Running | Original post link

Could it be that I upgraded step by step from 4.0, and the kernel doesn’t support it? :innocent:

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.