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

45 lines
1.4 KiB
Plaintext

--connect (conn1,127.0.0.1,root,,test,$MYPORT_1)
--connect (conn2,127.0.0.1,root,,test,$MYPORT_1)
--connect (conn3,127.0.0.1,root,,test,$MYPORT_1)
--source include/paxos.inc
--connection conn1
create table t1(id int);
SET debug_sync = "bgc_after_sync_stage_before_commit_stage WAIT_FOR continue";
--send insert into t1 values (1)
--connection conn2
# sleep to ensure 'insert' sql go to ordered_commit
--sleep 1
#change consensus_leader to 2;
--replace_result $PAXOS_PORT_2 PAXOS_PORT_2
eval call dbms_consensus.change_leader("127.0.0.1:$PAXOS_PORT_2");
--connection conn3
# should fail
--send insert into t1 values(2)
--connection conn2
let $wait_condition= select count(*)=0 from information_schema.alisql_cluster_local where role='leader';
--source include/wait_condition.inc
SET debug_sync = "now SIGNAL continue";
--connect (conn4,127.0.0.1,root,,test,$MYPORT_2)
--connection conn4
#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");
--connect (conn5,127.0.0.1,root,,test,$MYPORT_1)
--connection conn5
let $wait_condition= select count(*)=1 from information_schema.alisql_cluster_local where role='leader';
--source include/wait_condition.inc
select * from t1;
--connect (conn6,127.0.0.1,root,,test,$MYPORT_2)
--connection conn6
select * from t1;
--connection conn5
drop table t1;