summaryrefslogtreecommitdiff
path: root/mysql-test/suite/rpl/t/rpl_redirect.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/suite/rpl/t/rpl_redirect.test')
-rw-r--r--mysql-test/suite/rpl/t/rpl_redirect.test47
1 files changed, 47 insertions, 0 deletions
diff --git a/mysql-test/suite/rpl/t/rpl_redirect.test b/mysql-test/suite/rpl/t/rpl_redirect.test
new file mode 100644
index 00000000000..078d1048794
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_redirect.test
@@ -0,0 +1,47 @@
+#
+# Test of automatic redirection of queries to master/slave.
+#
+
+source include/master-slave.inc;
+# We disable this for now as PS doesn't handle redirection
+--disable_ps_protocol
+
+#first, make sure the slave has had enough time to register
+save_master_pos;
+connection slave;
+sync_with_master;
+
+#discover slaves
+connection master;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
+SHOW SLAVE STATUS;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+SHOW SLAVE HOSTS;
+rpl_probe;
+
+#turn on master/slave query direction auto-magic
+enable_rpl_parse;
+create table t1 ( n int);
+insert into t1 values (1),(2),(3),(4);
+disable_rpl_parse;
+save_master_pos;
+connection slave;
+sync_with_master;
+insert into t1 values(5);
+connection master;
+enable_rpl_parse;
+# The first of the queries will be sent to the slave, the second to the master.
+SELECT * FROM t1 ORDER BY n;
+SELECT * FROM t1 ORDER BY n;
+disable_rpl_parse;
+SELECT * FROM t1 ORDER BY n;
+connection slave;
+SELECT * FROM t1 ORDER BY n;
+
+# Cleanup
+connection master;
+drop table t1;
+sync_slave_with_master;
+
+# End of 4.1 tests