pt-table-checksum corrupts data if PK is binary
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
In Progress
|
High
|
Carlos Salguero |
Bug Description
If Primary Key is BINARY and tables on master and slave have differences data, reported for lower_bound and upper_bound in checksums table not relevant to actual content.
How to repeat.
1. Start MTR suite: ./mtr --start --suite=rpl rpl_alter &
2. Enable replication:
$mysql -h127.0.0.1 -P13002 -uroot
...
mysql> CHANGE MASTER TO master_
Query OK, 0 rows affected, 1 warning (0.47 sec)
mysql> start slave;
Query OK, 0 rows affected (0.02 sec)
3. On master (port 13001):
mysql> create database percona;
Query OK, 1 row affected (0.02 sec)
mysql> create database db1;
Query OK, 1 row affected (0.01 sec)
mysql> use percona
Database changed
mysql> CREATE TABLE `dsns` (
-> `id` int(11) NOT NULL AUTO_INCREMENT,
-> `parent_id` int(11) DEFAULT NULL,
-> `dsn` varchar(255) NOT NULL,
-> PRIMARY KEY (`id`)
-> );
Query OK, 0 rows affected (0.36 sec)
mysql> insert into dsns(dsn) values(
Query OK, 1 row affected (0.06 sec)
4. Load attached dump to master:
mysql -h127.0.0.1 -P13001 -uroot db1 < t1_master.sql
5. Load attached dump to slave:
mysql -h127.0.0.1 -P13002 -uroot db1 < t1_slave.sql
6. Run pt-table-checksum
$ ~/build/
TS ERRORS DIFFS ROWS CHUNKS SKIPPED TIME TABLE
11-14T14:28:04 0 10 103 13 0 5.071 db1.t1
7. Connect to percona database on slave (port 13002) and run:
mysql> select * from checksums;
+-----+
| db | tbl | chunk | chunk_time | chunk_index | lower_boundary | upper_boundary | this_crc | this_cnt | master_crc | master_cnt | ts |
+-----+
| db1 | t1 | 1 | 0.166802 | PRIMARY | U<PMÐâº!8YùãZ | U<PMÐâº!8YùãZ | e01583ca | 10 | 166001dd | 10 | 2017-11-14 14:27:59 |
| db1 | t1 | 2 | 0.145081 | PRIMARY | U<PMÐâº!8YùãZ | 'U<PMÐâº!8YùãZ' | 11767253 | 10 | ccf2d046 | 10 | 2017-11-14 14:27:59 |
| db1 | t1 | 3 | 0.137513 | PRIMARY | (U<PMÐâº!8YùãZ( | 6U<PMÐâº!8YùãZ6 | 3adb2295 | 10 | b4893b83 | 10 | 2017-11-14 14:28:00 |
| db1 | t1 | 4 | 0.177275 | PRIMARY | 7U<PMÐâº!8YùãZ7 | EU<PMÐâº!8YùãZE | 379c30d2 | 10 | 58bb8022 | 10 | 2017-11-14 14:28:00 |
| db1 | t1 | 5 | 0.190659 | PRIMARY | FU<PMÐâº!8YùãZF | USÅÝ
+¢…Ÿž5¥ | ebcfe880 | 10 | 16d38831 | 10 | 2017-11-14 14:28:00 |
| db1 | t1 | 6 | 0.118443 | PRIMARY | UU<PMÐâº!8YùãZU | dU<PMÐâº!8YùãZd | 42cf5e7 | 10 | 3e5774a3 | 10 | 2017-11-14 14:28:01 |
| db1 | t1 | 7 | 0.130475 | PRIMARY | eSÅÝ
+¢…Ÿž5¦ | sU<PMÐâº!8YùãZs | 37f2aac0 | 10 | 45846761 | 10 | 2017-11-14 14:28:01 |
| db1 | t1 | 8 | 0.131578 | PRIMARY | tU<PMÐâº!8YùãZt | xU<PMÐâº!8YùãZx | bfd404d6 | 10 | 3e4196c4 | 10 | 2017-11-14 14:28:01 |
| db1 | t1 | 9 | 0.262167 | PRIMARY | yU<PMÐâº!8YùãZy | ‡U<PMÐâº!8YùãZ‡ | 1fb53acb | 10 | c8a36ff5 | 10 | 2017-11-14 14:28:02 |
| db1 | t1 | 10 | 0.151902 | PRIMARY | ˆU<PMÐâº!8YùãZˆ | –U<PMÐâº!8YùãZ– | 35492b1f | 10 | 2634f201 | 10 | 2017-11-14 14:28:02 |
| db1 | t1 | 11 | 0.109676 | PRIMARY | —U<PMÐâº!8YùãZ— | ™U<PMÐâº!8YùãZ™ | b27d4b56 | 3 | b27d4b56 | 3 | 2017-11-14 14:28:02 |
| db1 | t1 | 12 | 0.116479 | PRIMARY | NULL | U<PMÐâº!8YùãZ | 0 | 0 | 0 | 0 | 2017-11-14 14:28:02 |
| db1 | t1 | 13 | 0.096695 | PRIMARY | ™U<PMÐâº!8YùãZ™ | NULL | 0 | 0 | 0 | 0 | 2017-11-14 14:28:03 |
+-----+
13 rows in set (0.01 sec)
mysql> select hex(lower_
+------
| hex(lower_boundary) | length(
+------
| 10553C504DC3901
| 19553C504DC3901
| 28553C504DC3901
| 37553C504DC3901
| 46553C504DC3901
| 55553C504DC3901
| 6553C38504C39D0
| 74553C504DC3901
| 79553C504DC3901
| CB86553C504DC39
| E28094553C504DC
| NULL | NULL | 10553C504DC3901
| E284A2553C504DC
+------
13 rows in set (0.00 sec)
mysql> select min(length(guid)), max(length(guid)) from db1.t1;
+------
| min(length(guid)) | max(length(guid)) |
+------
| 16 | 16 |
+------
1 row in set (0.01 sec)
You will see what data in checksum table is longer than data in original table. It is not possible to use this data to identify modified chunks.
Changed in percona-toolkit: | |
importance: | Undecided → Medium |
importance: | Medium → High |
assignee: | nobody → Carlos Salguero (carlos-salguero) |
milestone: | none → 3.0.6 |
tags: | added: pt219 |
Changed in percona-toolkit: | |
status: | Confirmed → In Progress |
There is a problem with the Perl DBI driver.
I tried to fix it or at least to find a workaround but I couldn't.