pingcap / pingcap/tidb

inject table metas as kv instead of DDL for testkit boostrap

Open
#56,727 3 comments 0 reactions 0 assignees View on GitHub
type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement
Many unit tests are using testkit.CreateMockStore or testkit.CreateMockStoreAndDomain to create a new mock TiDB cluster for the following cases. The above methods wrap up the bootstrap procedure that creates all the system tables using DDL. Normally, DDL operations will dispatch the job to the owner and then await the owner's response. Together with other mechanisms such as MDL or infoschema syncing , it is much slower than just writing key/values to the KV layer. A natural thought is that writing the meta to the KV layer directly without the complex DDL process may accelerate the tests. We have reasons why DDL is not necessary when bootstrapping:
1. There is no user traffic when bootstrapping. We do not need online DDL to achieve async schema change.
2. There are only simple operations in bootstrap, such as CREATE TABLE/VIEW/DATABASE which only write meta without the reorg phase.
3. After refactoring, we can use a standalone metabuild.Context to build all the tables' meta without the help of a real session.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.