61 lines
1.4 KiB
Plaintext
61 lines
1.4 KiB
Plaintext
--source include/paxos.inc
|
|
|
|
create table t1(id int);
|
|
|
|
--connect (con1,127.0.0.1,root,,test,$MYPORT_1)
|
|
--connect (con2,127.0.0.1,root,,test,$MYPORT_2)
|
|
--connect (con3,127.0.0.1,root,,test,$MYPORT_3)
|
|
|
|
connection con1;
|
|
xa begin 'xa1';
|
|
insert into t1 values (1000);
|
|
xa end 'xa1';
|
|
xa prepare 'xa1';
|
|
disconnect con1;
|
|
|
|
connection default;
|
|
--source include/wait_follower_catchup.inc
|
|
|
|
--replace_result $PAXOS_PORT_2 PAXOS_PORT_2
|
|
--eval call dbms_consensus.change_leader("127.0.0.1:$PAXOS_PORT_2");
|
|
|
|
connection con2;
|
|
--enable_reconnect
|
|
--source include/wait_until_connected_again.inc
|
|
--disable_reconnect
|
|
|
|
let $wait_condition= select count(*)=1 from information_schema.alisql_cluster_local where role='leader';
|
|
--source include/wait_condition.inc
|
|
|
|
--sleep 5
|
|
|
|
xa commit 'xa1';
|
|
xa recover;
|
|
select * from test.t1;
|
|
--source include/wait_follower_catchup.inc
|
|
|
|
connection con3;
|
|
--source include/wait_apply_catchup.inc
|
|
xa recover;
|
|
select * from test.t1;
|
|
|
|
connection con2;
|
|
--replace_result $PAXOS_PORT_1 PAXOS_PORT_1
|
|
--eval call dbms_consensus.change_leader("127.0.0.1:$PAXOS_PORT_1");
|
|
|
|
--connect (con1,127.0.0.1,root,,test,$MYPORT_1)
|
|
connection con1;
|
|
|
|
let $wait_condition= select count(*)=1 from information_schema.alisql_cluster_local where role='leader';
|
|
--source include/wait_condition.inc
|
|
|
|
--sleep 5
|
|
|
|
xa recover;
|
|
select * from test.t1;
|
|
drop table t1;
|
|
|
|
disconnect con1;
|
|
disconnect con2;
|
|
disconnect con3;
|