pt-table-checksum几点测试

1、count(*)和checksum对比

root@xxx03:21:10>select count(*) from t;
+----------+
| count(*) |
+----------+
|  6566404 |
+----------+
1 row in set (3.38 sec)
 
root@xxx03:21:25>checksum table t;
+-------+----------+
| Table | Checksum |
+-------+----------+
| xxx.t |  3579567 |
+-------+----------+
1 row in set (5.39 sec)

小结:经过多次测试,和pt-table-checksum作者测试时间基本相同,checksum近2倍于count操作(big table)

2、pt-table-checksum过程中不锁表(checksum不锁表)
session 1:

/usr/bin/pt-table-checksum h=xxx.xxx.xxx.xxx,u=tb,p=tb h=xxx.xxx.xxx.xxx,u=tb,p=tb -d xxx   -t t
DATABASE TABLE CHUNK HOST           ENGINE      COUNT         CHECKSUM TIME WAIT STAT  LAG
xxx      t         0 xxx.xxx.xxx.xxx InnoDB       NULL          3579567    5    0 NULL NULL
xxx      t         0 xxx.xxx.xxx.xxx InnoDB       NULL          3579567    5    0 NULL NULL

session 2:
读写都不受影响

root@xxx 03:56:15>  insert into t values(99999999,'a',now());
Query OK, 1 row affected (0.00 sec)
root@xxx 03:56:16>select * from t where id=99999999;
8 rows in set (0.00 sec)

3、当slave延迟于master的情况,checksum值不一致

slave:
root@xxx 03:13:47>stop slave;
Query OK, 0 rows affected (0.05 sec)
 
master:
root@xxx 03:14:15> insert into t values(99999999,'a',now());
Query OK, 1 row affected (0.00 sec)
 
/usr/bin/pt-table-checksum h=xxx.xxx.xxx.xxx,u=tb,p=tb h=xxx.xxx.xxx.xxx,u=tb,p=tb -d xxx -t  t
DATABASE TABLE CHUNK HOST           ENGINE      COUNT         CHECKSUM TIME WAIT STAT  LAG
xxx      t         0 xxx.xxx.xxx.xxx  InnoDB       NULL       2703600780    6    0 NULL NULL
xxx      t         0 xxx.xxx.xxx.xxx InnoDB       NULL       3896121768    6    0 NULL NULL

3 Responses to “pt-table-checksum几点测试”

  1. admin说道:

    最新版本中pt-table-checksum,可以不执行checksum table,它把table按pk或uk分成多个chunk,对chunk做比较。

  2. admin说道:

    pt-table-checksum –version
    pt-table-checksum 2.0.1测试没有问题
    “h=xxx.xxx.xxx.xxx”改成” hxxx.xxx.xxx.xxx”试试

Post a Comment