diff options
author | sachin <sachin.setiya@mariadb.com> | 2019-03-20 15:04:24 +0530 |
---|---|---|
committer | sachin <sachin.setiya@mariadb.com> | 2019-03-20 15:29:05 +0530 |
commit | ba94f6008893f7a56b90a7c01ae72f508122e32f (patch) | |
tree | 3a2bd7323ec32801d1cae30f454012d99004f87a | |
parent | 0dd12b4f2a72245a0fb491685c172a7b0e48cbc5 (diff) | |
download | mariadb-git-bb-5.5-17119.tar.gz |
MDEV-17119 replicate_rewrite_db does not work for single chardatabase namebb-5.5-17119
Fixed issue in logic.
-rw-r--r-- | mysql-test/suite/rpl/r/rpl_rewrt_db.result | 19 | ||||
-rw-r--r-- | mysql-test/suite/rpl/t/rpl_rewrt_db-slave.opt | 2 | ||||
-rw-r--r-- | mysql-test/suite/rpl/t/rpl_rewrt_db.test | 19 | ||||
-rw-r--r-- | sql/mysqld.cc | 2 |
4 files changed, 40 insertions, 2 deletions
diff --git a/mysql-test/suite/rpl/r/rpl_rewrt_db.result b/mysql-test/suite/rpl/r/rpl_rewrt_db.result index 6cbd107fdcf..0c80887d169 100644 --- a/mysql-test/suite/rpl/r/rpl_rewrt_db.result +++ b/mysql-test/suite/rpl/r/rpl_rewrt_db.result @@ -1,19 +1,36 @@ include/master-slave.inc [connection master] +set sql_log_bin=0; +create database y; +set sql_log_bin=1; drop database if exists mysqltest1; +drop database if exists x; create database mysqltest1; +set sql_log_bin=0; +create database x; +set sql_log_bin=1; use mysqltest1; create table t1 (a int); insert into t1 values(9); +use x; +create table t1 (a int); +insert into t1 values(9); select * from mysqltest1.t1; a 9 +select * from x.t1; +a +9 show databases like 'mysqltest1'; Database (mysqltest1) mysqltest1 select * from test.t1; a 9 +select * from y.t1; +a +9 +use mysqltest1; drop table t1; drop database mysqltest1; drop database if exists rewrite; @@ -209,10 +226,12 @@ SET sql_log_bin= 0; DROP DATABASE database_master_temp_01; DROP DATABASE database_master_temp_02; DROP DATABASE database_master_temp_03; +DROP DATABASE x; SET sql_log_bin= 1; SET sql_log_bin= 0; DROP DATABASE database_slave_temp_01; DROP DATABASE database_slave_temp_02; DROP DATABASE database_slave_temp_03; +DROP DATABASE y; SET sql_log_bin= 1; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_rewrt_db-slave.opt b/mysql-test/suite/rpl/t/rpl_rewrt_db-slave.opt index 290b92e0a3e..84059110136 100644 --- a/mysql-test/suite/rpl/t/rpl_rewrt_db-slave.opt +++ b/mysql-test/suite/rpl/t/rpl_rewrt_db-slave.opt @@ -1 +1 @@ -"--replicate-rewrite-db=test->rewrite" "--replicate-rewrite-db=mysqltest1->test" "--replicate-rewrite-db=database_master_temp_01->database_slave_temp_01" "--replicate-rewrite-db=database_master_temp_02->database_slave_temp_02" "--replicate-rewrite-db=database_master_temp_03->database_slave_temp_03" +"--replicate-rewrite-db=test->rewrite" "--replicate-rewrite-db=mysqltest1 -> test" "--replicate-rewrite-db=x -> y" "--replicate-rewrite-db=database_master_temp_01->database_slave_temp_01" "--replicate-rewrite-db=database_master_temp_02->database_slave_temp_02" "--replicate-rewrite-db=database_master_temp_03->database_slave_temp_03" diff --git a/mysql-test/suite/rpl/t/rpl_rewrt_db.test b/mysql-test/suite/rpl/t/rpl_rewrt_db.test index 996ad0a10c7..bd0749bc2de 100644 --- a/mysql-test/suite/rpl/t/rpl_rewrt_db.test +++ b/mysql-test/suite/rpl/t/rpl_rewrt_db.test @@ -2,20 +2,37 @@ -- source include/have_binlog_format_mixed_or_statement.inc -- source include/master-slave.inc +--connection slave +set sql_log_bin=0; +create database y; +set sql_log_bin=1; + +--connection master --disable_warnings drop database if exists mysqltest1; +drop database if exists x; --enable_warnings create database mysqltest1; +set sql_log_bin=0; +create database x; +set sql_log_bin=1; use mysqltest1; create table t1 (a int); insert into t1 values(9); +use x; +create table t1 (a int); +insert into t1 values(9); select * from mysqltest1.t1; +select * from x.t1; sync_slave_with_master; +#TODO no it is no empty show databases like 'mysqltest1'; # should be empty select * from test.t1; +select * from y.t1; # cleanup connection master; +use mysqltest1; drop table t1; drop database mysqltest1; sync_slave_with_master; @@ -224,6 +241,7 @@ SET sql_log_bin= 0; DROP DATABASE database_master_temp_01; DROP DATABASE database_master_temp_02; DROP DATABASE database_master_temp_03; +DROP DATABASE x; SET sql_log_bin= 1; connection slave; @@ -231,6 +249,7 @@ SET sql_log_bin= 0; DROP DATABASE database_slave_temp_01; DROP DATABASE database_slave_temp_02; DROP DATABASE database_slave_temp_03; +DROP DATABASE y; SET sql_log_bin= 1; connection master; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index aa749e5aaef..6df6c1a8764 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -7596,7 +7596,7 @@ mysqld_get_one_option(int optid, val= p--; while (my_isspace(mysqld_charset, *p) && p > argument) *p-- = 0; - if (p == argument) + if (p == argument && my_isspace(mysqld_charset, *p)) /* Db name can be one char also */ { sql_print_error("Bad syntax in replicate-rewrite-db - empty FROM db!\n"); return 1; |