# Online Ddl Related Modules

![left](./student-guide/diagram/OnlineDDLRelatedModules_aa_001_20220509.png)

------------------------------------------------------------
TiDB database supports online DDL, that is, DDL operations do not lock tables, and DML statements are not blocked. Next, let's take a look at the various modules required to execute DDL.

First, the entire TiDB database allows only one TiDB Server to perform DDL operations at the same time. Every TiDB Server has a worker module that handles DDL operations and is enabled only if the current TiDB Server role is owner.

If you have more than one TiDB Server in your TiDB database, then these TiDB Servers will take turns to become the owner role according to a fixed time (by elect). This time is called a term of office. When a TiDB Server is the owner role and is in the term of office, its worker model The block can then handle DDL operations.

The current owner role information of the database is persisted in PD, and the woker module can check whether the TiDB server in which it is located is currently the ownere role. When the term of owner expires, PD will initiate and be responsible for selecting a new owner.

Secondly, in addition to the worker module, there is also a load schema module, which is used to load the latest schema information after the current TiDB Server becomes the owner role, so that the TiDB server with the current owner role has the latest schema information.

Finally, the start job module is responsible for receiving DDL request and assigning IDs to DDL operations. Here we call each DDL operation assigned an ID a job. The start job will persist the job to the queue in TiKV.
