# Pt-Archiver changes binary data when using --bulk-insert option

**URL:** <https://forums.percona.com/t/pt-archiver-changes-binary-data-when-using-bulk-insert-option/6634>\
**Category:** Percona Toolkit\
**Created:** [October 17, 2018, 2:32am UTC](https://forums.percona.com/t/pt-archiver-changes-binary-data-when-using-bulk-insert-option/6634 "2018-10-17T02:32:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ivan.dugandzic99](https://avatars.discourse-cdn.com/v4/letter/i/49beb7/32.png) [@ivan.dugandzic99](https://forums.percona.com/u/ivan.dugandzic99)\
**Post date:** [October 17, 2018, 2:32am UTC](https://forums.percona.com/t/pt-archiver-changes-binary-data-when-using-bulk-insert-option/6634/1 "2018-10-17T02:32:23Z")

</div>

Pt-Arciver have issue when archiving binary data columns with `--bulk-insert` option and having UTF8 charset defined.  
Binary data stored in destination table contain bad (changed) values.

When `--bulk-insert` is not used and data internally are not stored in file this issue can be avoided but it hurts performance and i would love ti use batching.  
When `--no-check-charset` is used instead UTF8 it 's ok in some cases but risky cause disabling this check may cause text to be erroneously converted from one character set to another.

Destination table is created from source DB `show create table` command and contain identical structure:

CREATE TABLE `ncr_event_store_archive_v1` (  
`event_id` binary(16) NOT NULL,  
`event_name` varchar(255) COLLATE utf8\_unicode\_ci NOT NULL,  
`payload` longtext COLLATE utf8\_unicode\_ci NOT NULL COMMENT ‘(DC2Type:json\_array)’,  
`occurred` char(27) COLLATE utf8\_unicode\_ci NOT NULL,  
`dispatched` char(27) COLLATE utf8\_unicode\_ci DEFAULT NULL,  
`created_at` datetime DEFAULT NULL,  
`updated_at` datetime DEFAULT NULL,  
`causation_id` binary(16) DEFAULT NULL,  
`causation_name` varchar(255) COLLATE utf8\_unicode\_ci DEFAULT NULL,  
PRIMARY KEY (`event_id`),  
KEY `dispatched_created_at` (`dispatched`,`created_at`)  
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8\_unicode\_ci

Command used for archiving is:

“pt-archiver --source h=mariadbY,P=,D=seven,t=ncr\_event\_store,u=root,p=pass --dest h=mariadbY,P=,D=seven\_archive,t=ncr\_event\_store\_archive\_v1,u=root,p=pass --where “ncr\_event\_store.created\_at \< ‘2018-10-16’” --limit=3000 --bulk-insert --commit-each --skip-foreign-key-checks --pid=”/var/run/pt-archiver-pid-ncr\_event\_store" --sentinel=“/var/tmp/pt-archiver-sentinel-ncr\_event\_store” --charset=“UTF8” --no-delete --why-quit --statistics --progress=100000 --analyze=ds"

Pt-Archiver version: pt-archiver 3.0.12

---

<div class="post-metadata">

**Author:** ![lorraine.pocklington](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lorraine.pocklington/32/37_2.png) [@lorraine.pocklington](https://forums.percona.com/u/lorraine.pocklington)\
**Post date:** [October 17, 2018, 2:48am UTC](https://forums.percona.com/t/pt-archiver-changes-binary-data-when-using-bulk-insert-option/6634/2 "2018-10-17T02:48:26Z")

</div>

Hello, thanks for this report, I will ask the team to take a look. I need to check in on the status of a bug fix as it’s possible that it’s relevant here.

---

<div class="post-metadata">

**Author:** ![ivan.dugandzic99](https://avatars.discourse-cdn.com/v4/letter/i/49beb7/32.png) [@ivan.dugandzic99](https://forums.percona.com/u/ivan.dugandzic99)\
**Post date:** [November 9, 2018, 3:55am UTC](https://forums.percona.com/t/pt-archiver-changes-binary-data-when-using-bulk-insert-option/6634/3 "2018-11-09T03:55:23Z")

</div>

Hello, do you have any news regarding this issue?
