summaryrefslogtreecommitdiff
path: root/mysql-test/t/rpl_create_database.test
diff options
context:
space:
mode:
authormats@mysql.com <>2004-12-03 12:13:51 +0100
committermats@mysql.com <>2004-12-03 12:13:51 +0100
commit2bbdf2403dc9b6b8b4d4803c5e81b05958ea2890 (patch)
tree9bc3bd40e4b1f44785c9ff7e39f7d045b8960d70 /mysql-test/t/rpl_create_database.test
parent3455e345b2e9cd0674f3ed4abbebdbef6d5748b8 (diff)
downloadmariadb-git-2bbdf2403dc9b6b8b4d4803c5e81b05958ea2890.tar.gz
Bug#6391 (binlog-do-db rules ignored)
CREATE DATABASE statement used the current database instead of the database created when checking conditions for replication. CREATE/DROP/ALTER DATABASE statements are now replicated based on the manipulated database.
Diffstat (limited to 'mysql-test/t/rpl_create_database.test')
-rw-r--r--mysql-test/t/rpl_create_database.test68
1 files changed, 68 insertions, 0 deletions
diff --git a/mysql-test/t/rpl_create_database.test b/mysql-test/t/rpl_create_database.test
new file mode 100644
index 00000000000..39790b8afa4
--- /dev/null
+++ b/mysql-test/t/rpl_create_database.test
@@ -0,0 +1,68 @@
+#
+# Tests for replication of statements that manipulate databases.
+#
+# For this test file, we have a number of databases. All databases
+# with "greek" names will be replicated on the slave, while other names
+# (e.g., american) will not be replicated.
+#
+
+source include/master-slave.inc;
+
+# Bug#6391 (binlog-do-db rules ignored)
+# In this case, 'mysqltest_bob' should not be replicated to the slave.
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest_prometheus;
+DROP DATABASE IF EXISTS mysqltest_sisyfos;
+DROP DATABASE IF EXISTS mysqltest_bob;
+sync_slave_with_master;
+# This database is not replicated
+DROP DATABASE IF EXISTS mysqltest_bob;
+--enable_warnings
+
+connection master;
+CREATE DATABASE mysqltest_prometheus;
+CREATE DATABASE mysqltest_sisyfos;
+CREATE DATABASE mysqltest_bob;
+
+USE mysqltest_sisyfos;
+# These should be replicated
+CREATE TABLE t1 (b int);
+INSERT INTO t1 VALUES(1);
+
+USE mysqltest_bob;
+# These should *not* be replicated
+CREATE TABLE t2 (b int);
+INSERT INTO t2 VALUES(2);
+
+# Current database is now 'mysqltest_bob'
+# The following should be replicated
+ALTER DATABASE mysqltest_sisyfos CHARACTER SET latin1;
+
+USE mysqltest_sisyfos;
+# The following should *not* be replicated
+ALTER DATABASE mysqltest_bob CHARACTER SET latin1;
+
+SHOW DATABASES;
+sync_slave_with_master;
+SHOW DATABASES;
+
+connection master;
+DROP DATABASE IF EXISTS mysqltest_sisyfos;
+USE mysqltest_prometheus;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1);
+CREATE DATABASE mysqltest_sisyfos;
+USE mysqltest_sisyfos;
+CREATE TABLE t2 (a INT);
+SHOW BINLOG EVENTS;
+SHOW DATABASES;
+sync_slave_with_master;
+SHOW DATABASES;
+SHOW CREATE TABLE mysqltest_prometheus.t1;
+SHOW CREATE TABLE mysqltest_sisyfos.t2;
+
+connection master;
+DROP DATABASE IF EXISTS mysqltest_prometheus;
+DROP DATABASE IF EXISTS mysqltest_sisyfos;
+DROP DATABASE IF EXISTS mysqltest_bob;
+sync_slave_with_master;