pt-table-sync does not work with special characters (like '-') in database name
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
New
|
Undecided
|
Unassigned |
Bug Description
> pt-table-sync --version
pt-table-sync 2.2.6
Mysql version:
Server version: 5.6.20-68.0 Percona Server (GPL), Release 68.0, Revision 656
STR:
1) Configure replication between db-master and db-slave (db-master -> db-slave);
2) Create database with '-' in name:
create database `test-01`;
use `test-01`;
CREATE TABLE test_table (id INT) ENGINE = InnoDB;
insert into test_table values (1);
insert into test_table values (2);
3) calculate checksum (should be executed from db-slave server):
/usr/bin/
4) try to sync tables (if there are any diffs):
> /usr/bin/
DBD::mysql::db selectall_arrayref failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-01.pt_
Issuing rollback() due to DESTROY without explicit disconnect() of DBD::mysql::db handle ;host=db-
Issuing rollback() due to DESTROY without explicit disconnect() of DBD::mysql::db handle ;host=db-
We can't rename our production databases (to exclude '-'). Also we need to have pt_table_checksum per each database and to keep this table in the corresponding database.
I have fixed the issue in the following way:
> diff -u /usr/bin/
--- /usr/bin/
+++ ./pt-table-sync 2015-06-01 07:46:55.823409148 +0000
@@ -4943,6 +4943,8 @@
sub find_replicatio
my ( $self, $dbh, $table ) = @_;
+ $table =~ s/(.*)\
+
my $sql
= "SELECT db, tbl, CONCAT(db, '.', tbl) AS `table`, "
. "chunk, chunk_index, lower_boundary, upper_boundary, "
This is duplicate of https:/ /bugs.launchpad .net/percona- toolkit/ +bug/1437775.