File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -593,7 +593,9 @@ func (rc *Controller) restoreSchema(ctx context.Context) error {
593
593
// we can handle the duplicated created with createIfNotExist statement
594
594
// and we will check the schema in TiDB is valid with the datafile in DataCheck later.
595
595
logger := log .FromContext (ctx )
596
- concurrency := min (rc .cfg .App .RegionConcurrency , 8 )
596
+ // the minimum 4 comes the fact that when connect to non-owner TiDB, the max
597
+ // QPS is 2 per connection due to polling every 500ms.
598
+ concurrency := max (2 * rc .cfg .App .RegionConcurrency , 4 )
597
599
// sql.DB is a connection pool, we set it to concurrency + 1(for job generator)
598
600
// to reuse connections, as we might call db.Conn/conn.Close many times.
599
601
// there's no API to get sql.DB.MaxIdleConns, so we revert to its default which is 2
You can’t perform that action at this time.
0 commit comments