Details
-
Bug
-
Status: Done
-
Medium
-
Resolution: Fixed
-
3.4.0
-
None
-
None
-
No
-
Yes
-
Yes
-
5
Description
pt-archiver errors out on bulk-insert along with character set utf8mb4
Below are the steps to create the problem,
Create a table
CREATE TABLE `t1` ( `col1` int(11) NOT NULL AUTO_INCREMENT, `col2` varchar(3) DEFAULT NULL, PRIMARY KEY (`col1`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4
Insert a few rows in it
insert into t1 (col2) values ('あ'); insert into t1 (col2) values ('あ'); insert into t1 (col2) values ('あ'); insert into t1 (col2) values ('あ');
It will look like this
mysql> select * from t1; +------+------+ | col1 | col2 | +------+------+ | 4 | あ | | 5 | あ | | 6 | あ | | 7 | あ | +------+------+
Create another database say test2 and copy same table structure there on same DB host.
mysql> show create table test2.t1\G
*************************** 1. row ***************************
Table: t1
Create Table: CREATE TABLE `t1` (
`col1` int(11) NOT NULL AUTO_INCREMENT,
`col2` varchar(3) DEFAULT NULL,
PRIMARY KEY (`col1`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4
1 row in set (0.00 sec)
Run the pt-archiver with the below command
[root@yunus-shaikh-default ~]# pt-archiver --source u=root,p=*****,h=127.0.0.1:,P=3306,A=utf8mb4,D=test,t=t1 --dest D=test2 --skip-foreign-key-checks --bulk-insert --limit 100 --commit-each --no-delete --statistics --where "col1 = 5" --no-check-charset Wide character in print at /usr/bin/pt-archiver line 6815.
You will get the error.
If you remove --bulk-insert, it works fine and with the correct data as well.
[root@yunus-shaikh-default ~]# pt-archiver --source u=root,p=*****,h=127.0.0.1,P=3306,D=test,t=t1,A=utf8mb4 --dest D=test2 --skip-foreign-key-checks --limit 100 --commit-each --no-delete --statistics --where "col1 = 5" Started at 2022-11-09T04:56:06, ended at 2022-11-09T04:56:06 Source: A=utf8mb4,D=test,P=3306,h=127.0.0.1,p=...,t=t1,u=root Dest: A=utf8mb4,D=test2,P=3306,h=127.0.0.1,p=...,t=t1,u=root SELECT 1 INSERT 1 DELETE 0 Action Count Time Pct commit 4 0.0015 61.95 select 2 0.0004 16.65 inserting 1 0.0003 11.16 other 0 0.0002 10.25
mysql> select * from test2.t1; +------+------+ | col1 | col2 | +------+------+ | 5 | あ | +------+------+
Let me know if you have any questions on this.
Regards,
Yunus Shaikh.
Attachments
Issue Links
- relates to
-
PT-354 LP #1127450: pt-archiver --bulk-insert may corrupt data
-
- Done
-