Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootstrap: use BatchCreateTableWithInfo to speed up #42432

Closed
wants to merge 11 commits into from
Prev Previous commit
address comment
Signed-off-by: lance6716 <lance6716@gmail.com>
  • Loading branch information
lance6716 committed Mar 22, 2023
commit 98b8e9e294a89355430882de0d215f4a5e1705b9
4 changes: 4 additions & 0 deletions session/bootstrap.go
Original file line number Diff line number Diff line change
@@ -2501,6 +2501,10 @@ func doDDLWorks(s Session, dom *domain.Domain) {
tableInfosPart1 = append(tableInfosPart1, tblInfo)
}
batchCreateTable(s, dom.DDL(), tableInfosPart1)
// batchCreateTable is an optimization, in order to keep same behaviour with
// before (such as assign same table ID to these tables), we need to execute
// the DDLs in order. CreateMDLView is a view that cannot use batchCreateTable,
// so it breaks tables into allCreateTablesPart1 and allCreateTablesPart2.
mustExecute(s, CreateMDLView)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So why CreateMDLView is skipped?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

98b8e9e

add comment

tableInfosPart2 := make([]*model.TableInfo, 0, len(allCreateTablesPart2))
for _, createTable := range allCreateTablesPart2 {