Skip to content

Too many connections #1

@fingerring1314

Description

@fingerring1314

在使用v1.2.3版本进行表结构比对时,源库MySQL设置了最大连接数151。使用如下的配置文件,设置parallelThds = 1、queueSize = 1,执行比对名命令# ./gt-checksum -f ./gtc_struct_check.conf

cat gtc_struct_check.conf
[DSNs]
srcDSN = mysql|xxx
dstDSN = mysql|xxxxxxx

[Schema]
tables = db1.:db2.
checkNoIndexTable = yes
caseSensitiveObjectName = no

[Rules]
parallelThds = 1
queueSize = 1
chunkSize = 10000
checkObject = struct
memoryLimit =2048

[Repair]
datafix = file
fixTrxNum = 1000
fixFileName = ./datafix_struct.sql

[Logs]
logFile = ./gtc.log11
logLevel = info
;logLevel = debug

运行后发现源库的连接数会一直增长一直增长(select count (1) from information_schema.processlist;),最后会报错
Initializing gt-checksum
Reading configuration files
Opening log files
Checking configuration options
gt-checksum: Starting table checks
gt-checksum: Checking table structure
gt-checksum: Table structure verification failed. Check ./gtc.log11 for details or set logLevel=debug

tail gtc.log11
[2026/03/04 11:07:31] [error] dbquery_dispos.go:392 (5) [Q_Table_Comment] The first connection to the MySQL database failed to execute the sql statement.sql message is {SELECT TABLE_COMMENT AS tableComment FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='' AND TABLE_NAME='xxx';} Error info is {Error 1040: Too many connections}
[2026/03/04 11:07:32] [error] dbquery_dispos.go:392 (5) [Q_Table_Comment] The second connection to the MySQL database failed to execute the sql statement.sql message is {SELECT TABLE_COMMENT AS tableComment FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='' AND TABLE_NAME='xxx';} Error info is {Error 1040: Too many connections}
[2026/03/04 11:07:33] [error] dbquery_dispos.go:392 (5) [Q_Table_Comment] The third connection to the MySQL database failed to execute the sql statement.sql message is {SELECT TABLE_COMMENT AS tableComment FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='' AND TABLE_NAME='xxx';} Error info is {Error 1040: Too many connections}
[2026/03/04 11:07:33] [error] dbquery_dispos.go:395 (5) [Q_Table_Comment] Failed to connect to the MySQL database, unable to execute the sql statement.
[2026/03/04 11:07:33] [error] schema_tab_struct.go:328 (5) Error checking source table existence gujing_new.scada_data_table: Error 1040: Too many connections

请问如何控制不断增加的连接数量

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions