11 Star 95 Fork 23

万里数据库 / gt-checksum

 / 详情

执行gt-checksum后,results 后面没有打印表名和结果,是为什么?

已修复
缺陷
创建于  
2023-04-14 17:52

./gt-checksum -S type=mysql,user=dba_test,passwd=123,host=172.2.1.4,port=3306,charset=utf8mb4 -D type=mysql,user=dba_test,passwd=123,host=172.1.0.10,port=3306,charset=utf8mb4 -t ues.*
-- gt-checksum init configuration files --
-- gt-checksum init log files --
-- gt-checksum init check parameter --
-- gt-checksum init check table name --
-- gt-checksum init check table column --
-- gt-checksum init check table index column --
-- gt-checksum init source and dest transaction snapshoot conn pool --
-- gt-checksum init cehck table query plan and check data --

** gt-checksum Overview of results **
Check time: 0.22s (Seconds)
Schema Table IndexCol checkMod Rows Differences Datafix

评论 (9)

sem 创建了缺陷

补充:源端是云上MySQL, 目标端是云下MySQL

看打印的信息,表名都没有获取到

在命令行里设置 --ll=debug 看看更多输出日志内容是怎样的

./gt-checksum -S type=mysql,user=dba_test,passwd=123,host=172.2.1.4,port=3306,charset=utf8mb4 -D type=mysql,user=dba_test,passwd=123,host=172.1.0.10,port=3306,charset=utf8mb4 --ll=debug -t ues.*
-- gt-checksum init configuration files --
-- gt-checksum init log files --
-- gt-checksum init check parameter --
-- gt-checksum init check table name --
-- gt-checksum init check table column --
-- gt-checksum init check table index column --
-- gt-checksum init source and dest transaction snapshoot conn pool --
-- gt-checksum init cehck table query plan and check data --

** gt-checksum Overview of results **
Check time: 0.26s (Seconds)
Schema Table IndexCol checkMod Rows Differences Datafix

分析日志中,有一段获取字段索引的SQL,table_schema和table_name不应该传入大写,大写的查询结果是空。应该传入小写。小写是有结果集的。
[2023/04/17 01:52:05] [debug] my_query_table_date.go:24 (24) [Q_Index_Statistics] Generate a sql statement to query the index statistics of table UES.UES_ENCRYPT_VERSION under the MySQL database.sql messige is {select isc.COLUMN_NAME as columnName,isc.COLUMN_TYPE as columnType,isc.COLUMN_KEY as columnKey,isc.EXTRA as autoIncrement,iss.NON_UNIQUE as nonUnique,iss.INDEX_NAME as indexName,iss.SEQ_IN_INDEX IndexSeq,isc.ORDINAL_POSITION columnSeq from information_schema.columns isc inner join (select NON_UNIQUE,INDEX_NAME,SEQ_IN_INDEX,COLUMN_NAME from information_schema.STATISTICS where table_schema='UES' and table_name='UES_ENCRYPT_VERSION') as iss on isc.column_name =iss.column_name where isc.table_schema='UES' and isc.table_name='UES_ENCRYPT_VERSION';}
[2023/04/17 01:52:05] [debug] my_query_table_date.go:34 (24) [Q_Index_Statistics] The index statistics query of table UES.UES_ENCRYPT_VERSION under the MySQL database is completed. index statistics is {[]}
[2023/04/17 01:52:05] [debug] schema_tab_struct.go:575 (23) Table UES.UES_ENCRYPT_VERSION index list information query completed. index list message is {map[]}
[2023/04/17 01:52:05] [warn] schema_tab_struct.go:580 (23) The current table UES.UES_ENCRYPT_VERSION has no index.

(root@localhost) [(none)] 02:16: > select isc.COLUMN_NAME as columnName,
-> isc.COLUMN_TYPE as columnType,
-> isc.COLUMN_KEY as columnKey,
-> isc.EXTRA as autoIncrement,
-> iss.NON_UNIQUE as nonUnique,
-> iss.INDEX_NAME as indexName,
-> iss.SEQ_IN_INDEX IndexSeq,
-> isc.ORDINAL_POSITION columnSeq
-> from information_schema.columns isc inner join
-> (select NON_UNIQUE,INDEX_NAME,SEQ_IN_INDEX,COLUMN_NAME
-> from information_schema.STATISTICS
-> where table_schema='UES'
-> and table_name='UES_ENCRYPT_VERSION')
-> as iss
-> on isc.column_name =iss.column_name
-> where isc.table_schema='UES'
-> and isc.table_name='UES_ENCRYPT_VERSION';
Empty set (0.00 sec)

(root@localhost) [(none)] 02:20: > select isc.COLUMN_NAME as columnName,
-> isc.COLUMN_TYPE as columnType,
-> isc.COLUMN_KEY as columnKey,
-> isc.EXTRA as autoIncrement,
-> iss.NON_UNIQUE as nonUnique,
-> iss.INDEX_NAME as indexName,
-> iss.SEQ_IN_INDEX IndexSeq,
-> isc.ORDINAL_POSITION columnSeq
-> from information_schema.columns isc inner join
-> (select NON_UNIQUE,INDEX_NAME,SEQ_IN_INDEX,COLUMN_NAME
-> from information_schema.STATISTICS
-> where table_schema='ues'
-> and table_name='ues_encrypt_version')
-> as iss
-> on isc.column_name =iss.column_name
-> where isc.table_schema='ues'
-> and isc.table_name='ues_encrypt_version';
+-------------+-------------+-----------+---------------+-----------+----------------+----------+-----------+
| columnName | columnType | columnKey | autoIncrement | nonUnique | indexName | IndexSeq | columnSeq |
+-------------+-------------+-----------+---------------+-----------+----------------+----------+-----------+
| id | bigint(20) | PRI | | 0 | PRIMARY | 1 | 1 |
| key_version | varchar(64) | UNI | | 0 | uk_key_version | 1 | 2 |
+-------------+-------------+-----------+---------------+-----------+----------------+----------+-----------+
2 rows in set (0.00 sec)

查看一下数据库是否开启了区分大小写参数,如果开启了,需要指定一下gt-checksum的区分大小写参数,否则默认会转换成大写

嗯,用配置文件的方式指定参数大写运行成功。但是用命令行方式,lowerCaseTableNames=yes 这个参数放在前面或者放在后面都不能成功执行

缺少-吧,示例: go run .\greatdbCheck.go -S type=mysql,user=pcms,passwd=xxx,host=172.17.140.xxx,port=3307 -D type=mysql,user
=pcms,passwd=xxx,host=172.17.140.xxx,port=3307 -t scott.bmsql_item1 -nit yes -lowerCaseTableNames=yes

ywlianghang 任务状态待确认 修改为已确认
ywlianghang 任务状态已确认 修改为修复中
ywlianghang 任务状态修复中 修改为已修复

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(3)
8779455 greatsql 1615290631
Go
1
https://gitee.com/GreatSQL/gt-checksum.git
git@gitee.com:GreatSQL/gt-checksum.git
GreatSQL
gt-checksum
gt-checksum

搜索帮助

344bd9b3 5694891 D2dac590 5694891