polardbxengine/mysql-test/suite/xcluster/t/xcluster.test

61 lines
1.4 KiB
Plaintext

--source include/paxos.inc
--source include/not_valgrind.inc
--source include/not_windows.inc
#--source include/have_innodb.inc
--source include/have_binlog_format_row.inc
--source include/have_log_bin.inc
# connect 3 server. must have test database
--connect (conn1,127.0.0.1,root,,test,$MYPORT_1)
--connect (conn2,127.0.0.1,root,,test,$MYPORT_2)
--connect (conn3,127.0.0.1,root,,test,$MYPORT_3)
# wait leader and find who is leader
--connection conn1
--let $isleader=`select server_id from information_schema.alisql_cluster_local where role='leader'`
if ($isleader)
{
--let $leader= $isleader
}
--connection conn2
--let $isleader=`select server_id from information_schema.alisql_cluster_local where role='leader'`
if ($isleader)
{
--let $leader= $isleader
}
--connection conn3
--let $isleader=`select server_id from information_schema.alisql_cluster_local where role='leader'`
if ($isleader)
{
--let $leader= $isleader
}
# test leader transfer
if ($leader == 1)
{
--connection conn1
}
if ($leader == 2)
{
--connection conn2
}
if ($leader == 3)
{
--connection conn3
}
#change consensus_leader to 1;
--replace_result $PAXOS_PORT_1 PAXOS_PORT_1
eval call dbms_consensus.change_leader("127.0.0.1:$PAXOS_PORT_1");
--connection conn1
let $wait_condition= select count(*)=1 from information_schema.alisql_cluster_local where role='leader';
--source include/wait_condition.inc
select server_id, role from information_schema.alisql_cluster_local;