感觉 @Haaahei 说的情况类似于 MTS 并行复制引发的死锁类似, 前段时间我也在排查类似该方向的问题。有一些参考资料您可以参考下。
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import time
import pymysql
mgr1conf ={
"host": "xxxxxx",
"user": "gyz",
"password": "123456",
"db": "gyz",
"port": xxxx
}
def connDb(sql, dbconf=mgr1conf,fetchopt="all"):
try:
conn = pymysql.connect(**dbconf)
cursor = conn.cursor(pymysql.cursors.DictCursor)
cursor.execute(sql)
if fetchopt == "all":
res = cursor.fetchall()
elif fetchopt == "one":
res = cursor.fetchone()
conn.commit()
cursor.close()
conn.close()
return res
except Exception, e:
print(e)
return e
while 1:
for i in range(1,101):
sql = "replace into t1(col1) values('col{0}');".format(i)
connDb(sql)
表结构
CREATE TABLE `t1` (
`id` int NOT NULL AUTO_INCREMENT COMMENT 'ID',
`col1` varchar(100) NOT NULL DEFAULT '' COMMENT 'col1',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uk_col1` (`col1`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='test1'
您可以尝试在上游创建相应表结构,然后用脚本压测时,在下游 TiCDC的表现