Closed YuJuncen closed 2 weeks ago
A patch that shows how we need to modify the code for batching.
I think the option to "Remove the --ddl-batch-size parameter directly, then fetch the max raft entry size from TiKV, then use this as the target batch size." seems like the simplest from an operational perspective and reduces complexity by avoiding potentially conflicting configuration settings across components.
It seems now ddl-batch-size
doesn't impact the speed of creating tables. Probably because the optimization of DDL in the master branch. Close it for now.
Enhancement
The argument
--ddl-batch-size
for restoring was initially added at https://github.com/pingcap/tidb/pull/29380 for controlling the size of the ddl jobCreateTabels
: once it grows up to the max size of a raft command, we cannot create any table, eventually we fail.The problem is that this controls the number of tables of a batch but not the total size of table infos. So with complex tables, a batch may be too huge to be committed (We made https://github.com/pingcap/tidb/issues/39829 for fixing this...). With simple tables, a batch may be too small to be effective enough.
We can either:
--ddl-batch-size
parameter directly, then fetch the max raft entry size from TiKV, then use this as the target batch size.--ddl-batch-size
parameter, then add a new parameter like--ddl-batch-size-in-bytes
, then use this as the target batch size.