br icon indicating copy to clipboard operation
br copied to clipboard

Bypass the DDL layer for creating tables faster

Open YuJuncen opened this issue 4 years ago • 1 comments

Feature Request

Describe your feature request related problem:

When restoring many tables, it cost too many time for creating table, rebase auto ID or things likewise.

Describe the feature you'd like:

Use the meta.Meta API from TiDB directly to create tables.

Describe alternatives you've considered:

The current version -- using DDL to create tables, or execute the DDLs over the owner node.

Teachability, Documentation, Adoption, Migration Strategy:

There are about three steps when we want to creating a table from a model.TableInfo:

  1. alloc a new table ID for new table.
  2. create the table via Meta.CreateTableOrView.
  3. update the diff to the information schema, and waiting for other TiDB instance update this too.

(TODO: consistency, performance testing, etc..)

YuJuncen avatar Jul 26 '21 07:07 YuJuncen

seems very helpful for DM's schema tracker 👍 will port it after your PR merged.

lance6716 avatar Aug 03 '21 07:08 lance6716