77 lines
2.2 KiB
Plaintext
77 lines
2.2 KiB
Plaintext
--source include/have_debug_new.inc
|
|
--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)
|
|
let $MYPORT_CONSENSUS_3 = query_get_value("select $MYPORT_3+40 as c1", c1, 1);
|
|
let $MYPORT_CONSENSUS_2 = query_get_value("select $MYPORT_2+40 as c1", c1, 1);
|
|
|
|
--connection conn2
|
|
--enable_reconnect
|
|
set global consensus_auto_leader_transfer=ON;
|
|
stop xpaxos_replication;
|
|
--connection conn1
|
|
--enable_reconnect
|
|
#change consensus_node 3 consensus_force_sync false consensus_election_weight 1;
|
|
--replace_result $MYPORT_CONSENSUS_3 MYPORT_CONSENSUS_3
|
|
eval call dbms_consensus.configure_follower("127.0.0.1:$MYPORT_CONSENSUS_3", 1, 0);
|
|
use test;
|
|
create table t1(id int);
|
|
insert into t1 values(1);
|
|
#change consensus_leader to 2;
|
|
--replace_result $MYPORT_CONSENSUS_2 MYPORT_CONSENSUS_2
|
|
eval call dbms_consensus.change_leader("127.0.0.1:$MYPORT_CONSENSUS_2");
|
|
|
|
# case 1
|
|
--connection conn2
|
|
--enable_reconnect
|
|
--sleep 1
|
|
select role from information_schema.alisql_cluster_local;
|
|
|
|
--sleep 14
|
|
|
|
select role from information_schema.alisql_cluster_local;
|
|
|
|
# case 2
|
|
|
|
--connection conn1
|
|
--enable_reconnect
|
|
#change consensus_leader to 2;
|
|
--replace_result $MYPORT_CONSENSUS_2 MYPORT_CONSENSUS_2
|
|
eval call dbms_consensus.change_leader("127.0.0.1:$MYPORT_CONSENSUS_2");
|
|
|
|
--connection conn2
|
|
--enable_reconnect
|
|
--sleep 1
|
|
select role from information_schema.alisql_cluster_local;
|
|
|
|
--connection conn1
|
|
--enable_reconnect
|
|
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
|
|
|
--connection conn1
|
|
--enable_reconnect
|
|
--shutdown_server 0
|
|
|
|
--sleep 14
|
|
|
|
--connection conn2
|
|
--enable_reconnect
|
|
select role from information_schema.alisql_cluster_local;
|
|
|
|
--connection conn1
|
|
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
|
--source include/start_mysqld.inc
|
|
|
|
--sleep 15
|
|
|
|
--connection conn2
|
|
--enable_reconnect
|
|
select role from information_schema.alisql_cluster_local;
|
|
|
|
--connection conn1
|
|
--enable_reconnect
|
|
#change consensus_node 3 consensus_force_sync false consensus_election_weight 5;
|
|
--replace_result $MYPORT_CONSENSUS_3 MYPORT_CONSENSUS_3
|
|
eval call dbms_consensus.configure_follower("127.0.0.1:$MYPORT_CONSENSUS_3", 5, 0);
|
|
drop table test.t1;
|