# Help resolving pt-table-sync error messages

**URL:** <https://forums.percona.com/t/help-resolving-pt-table-sync-error-messages/3692>\
**Category:** Percona Toolkit\
**Created:** [August 24, 2014, 7:15pm UTC](https://forums.percona.com/t/help-resolving-pt-table-sync-error-messages/3692 "2014-08-24T19:15:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ocgltd](https://avatars.discourse-cdn.com/v4/letter/o/5daacb/32.png) [@ocgltd](https://forums.percona.com/u/ocgltd)\
**Post date:** [August 24, 2014, 7:15pm UTC](https://forums.percona.com/t/help-resolving-pt-table-sync-error-messages/3692/1 "2014-08-24T19:15:25Z")

</div>

I’m trying to synchronize databases on two hosts, and am running into lock related errors. I changed the lock setting from 1 to 2 to 3 to try to resolve the issue, and although there are fewer errors, there are a couple I can’t resolve. My command is:

pt-table-sync --execute --verbose --user=un --password=pw --databases=asterisk --lock=3 --buffer-in-mysql h=otherhost h=localhost

and the errors (underlined in the excerpt) are:

[B][COLOR=#FF0000]# 0 0 0 0 Nibble 20:39:38 20:39:38 0 asterisk.sip

# 0 0 0 0 Nibble 20:39:38 20:39:38 0 asterisk.sipsettings

Can’t execute the query because you have a conflicting read lock [for Statement “INSERT INTO `asterisk`.`smartscreen`(`refnum`, `number_start`, `number_end`, `display_name`, `action`, `created`) VALUES (‘799’, ‘15196672050’, ‘15196672050’, ‘Some FAX’, ‘R’, ‘2006-10-24 00:47:06’) /_percona-toolkit src\_db:asterisk src\_tbl:smartscreen src\_dsn:P=3306,h=otherhost,p=…,u=un dst\_db:asterisk dst\_tbl:smartscreen dst\_dsn:P=3306,h=localhost,p=…,u=un lock:3 transaction:0 changing\_src:0 replicate:0 bidirectional:0 pid:23085 user:root host:myhost_/”] at line 10709 while doing asterisk.smartscreen on localhost

# 0 0 0 0 0 20:39:38 20:39:38 1 asterisk.smartscreen

# 0 0 0 0 Chunk 20:39:38 20:39:38 0 asterisk.sng\_mcu\_details

# 0 0 0 0 Chunk 20:39:39 20:39:39 0 asterisk.xmpp\_users

Failed to unlock server: I need a src argument at /mnt/lserver2/data/development/haast/bin/debug/library/pt-table-sync line 6105.[/B]

Can anyone explain the cause, and how to resolve this? (This is a unidirectional sync, from remote to local host). There is very little, if any, traffic on the databases at this time. So I don’t think an app is writing to/reading from the DB..I even restarted the mysql service but the errors remain.

---

<div class="post-metadata">

**Author:** ![ocgltd](https://avatars.discourse-cdn.com/v4/letter/o/5daacb/32.png) [@ocgltd](https://forums.percona.com/u/ocgltd)\
**Post date:** [August 24, 2014, 7:19pm UTC](https://forums.percona.com/t/help-resolving-pt-table-sync-error-messages/3692/2 "2014-08-24T19:19:54Z")

</div>

I tried the same command, running with lock=2 and here are more errors:

[B][COLOR=#FF0000]# 0 0 0 0 Nibble 20:48:12 20:48:12 0 asterisk.sip

# 0 0 0 0 Nibble 20:48:12 20:48:12 0 asterisk.sipsettings

Table ‘smartscreen’ was locked with a READ lock and can’t be updated [for Statement “INSERT INTO `asterisk`.`smartscreen`(`refnum`, `number_start`, `number_end`, `display_name`, `action`, `created`) VALUES (‘799’, ‘15196672050’, ‘15196672050’, ‘FAX’, ‘R’, ‘2006-10-24 00:47:06’) /_percona-toolkit src\_db:asterisk src\_tbl:smartscreen src\_dsn:P=3306,h=otherhost,p=…,u=un dst\_db:asterisk dst\_tbl:smartscreen dst\_dsn:P=3306,h=localhost,p=…,u=un lock:2 transaction:0 changing\_src:0 replicate:0 bidirectional:0 pid:23870 user:root host:thishost_/”] at line 10709 while doing asterisk.smartscreen on localhost

# 0 0 0 0 0 20:48:12 20:48:12 1 asterisk.smartscreen

Table ‘sng\_mcu\_details’ was not locked with LOCK TABLES [for Statement “SELECT MIN(`id`), MAX(`id`) FROM `asterisk`.`sng_mcu_details` FORCE INDEX (`PRIMARY`)”] at line 4206 while doing asterisk.sng\_mcu\_details on localhost

# 0 0 0 0 0 20:48:12 20:48:12 1 asterisk.sng\_mcu\_details

Table ‘sng\_mcu\_entries’ was not locked with LOCK TABLES [for Statement “SELECT MIN(`id`), MAX(`id`) FROM `asterisk`.`sng_mcu_entries` FORCE INDEX (`PRIMARY`)”] at line 4206 while doing asterisk.sng\_mcu\_entries on localhost

# 0 0 0 0 0 20:48:12 20:48:12 1 asterisk.sng\_mcu\_entries

Table ‘sysadmin\_options’ was not locked with LOCK TABLES [for Statement “SELECT MIN(`key`), MAX(`key`) FROM `asterisk`.`sysadmin_options` FORCE INDEX (`key`)”] at line 4206 while doing asterisk.sysadmin\_options on localhost

# 0 0 0 0 0 20:48:12 20:48:12 1 asterisk.sysadmin\_options

Table ‘sysadmin\_update\_log’ was not locked with LOCK TABLES [for Statement “SELECT MIN(`id`), MAX(`id`) FROM `asterisk`.`sysadmin_update_log` FORCE INDEX (`PRIMARY`)”] at line 4206 while doing asterisk.sysadmin\_update\_log on localhost

# 0 0 0 0 0 20:48:12 20:48:12 1 asterisk.sysadmin\_update\_log

Table ‘timeconditions’ was not locked with LOCK TABLES [for Statement “SELECT MIN(`timeconditions_id`), MAX(`timeconditions_id`) FROM `asterisk`.`timeconditions` FORCE INDEX (`PRIMARY`)”] at line 4206 while doing asterisk.timeconditions on localhost

# 0 0 0 0 0 20:48:12 20:48:12 1 asterisk.timeconditions

Table ‘timegroups\_details’ was not locked with LOCK TABLES [for Statement “SELECT MIN(`id`), MAX(`id`) FROM `asterisk`.`timegroups_details` FORCE INDEX (`PRIMARY`)”] at line 4206 while doing asterisk.timegroups\_details on localhost

# 0 0 0 0 0 20:48:12 20:48:12 1 asterisk.timegroups\_details

Table ‘timegroups\_groups’ was not locked with LOCK TABLES [for Statement “SELECT MIN(`id`), MAX(`id`) FROM `asterisk`.`timegroups_groups` FORCE INDEX (`PRIMARY`)”] at line 4206 while doing asterisk.timegroups\_groups on localhost

# 0 0 0 0 0 20:48:12 20:48:12 1 asterisk.timegroups\_groups

# 0 0 0 0 Nibble 20:48:12 20:48:12 0 asterisk.trunk\_dialpatterns

# 0 0 0 0 Nibble 20:48:12 20:48:12 0 asterisk.trunks[/B]

Is there a parameter I missing or set incorrectly, which would resolve this?

---

<div class="post-metadata">

**Author:** ![mirfan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/mirfan/32/16890_2.png) [@mirfan](https://forums.percona.com/u/mirfan)\
**Post date:** [August 31, 2014, 2:32pm UTC](https://forums.percona.com/t/help-resolving-pt-table-sync-error-messages/3692/3 "2014-08-31T14:32:06Z")

</div>

What could make you to use [–lock](http://www.percona.com/doc/percona-toolkit/2.2/pt-table-sync.html#cmdoption-pt-table-sync--lock) parameter of [pt-table-sync](http://www.percona.com/doc/percona-toolkit/2.2/pt-table-sync.html) ? If it’s replication slave i would suggest to use [–sync-to-master](http://www.percona.com/doc/percona-toolkit/2.2/pt-table-sync.html#cmdoption-pt-table-sync--sync-to-master) parameter.

---

<div class="post-metadata">

**Author:** ![ocgltd](https://avatars.discourse-cdn.com/v4/letter/o/5daacb/32.png) [@ocgltd](https://forums.percona.com/u/ocgltd)\
**Post date:** [October 31, 2014, 10:12pm UTC](https://forums.percona.com/t/help-resolving-pt-table-sync-error-messages/3692/4 "2014-10-31T22:12:15Z")

</div>

I have to run pt-table-sync from the slave (cannot be run from master). Unless I misunderstood manual, I the DSN must be of the slave (so wen run on the slave, it has no way of knowing what the master is).

Are you saying it is a mistake to specify any --lock setting? (If all lock settings except for ‘none’ cause failures, does that mean these are bugs or the option makes no sense?)
