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

95 lines
2.6 KiB
Plaintext

--source include/paxos.inc
--connect (leader,127.0.0.1,root,,test,$MYPORT_1)
--connect (f1,127.0.0.1,root,,test,$MYPORT_2)
--connect (f2,127.0.0.1,root,,test,$MYPORT_3)
#
# purge [force] log
#
--connection f1
flush local logs;
--connection f2
flush local logs;
--connection leader
create table t1(id int);
flush local logs;
insert into t1 values (1);
#purge consensus_log before 100000000;
call dbms_consensus.purge_log(100000000);
# --replace_column 1 # 2 # 3 #
# show consensus logs;
--source include/wait_follower_catchup.inc
insert into t1 values (1);
--connection f1
--error ER_CONSENSUS_COMMAND_ERROR
#purge consensus_log before 100000000;
call dbms_consensus.purge_log(100000000);
#purge force consensus_log before 100000000;
call dbms_consensus.force_purge_log(100000000);
# --replace_column 1 # 2 # 3 #
# show consensus logs;
--connection f2
--error ER_CONSENSUS_COMMAND_ERROR
#purge consensus_log before 100000000;
call dbms_consensus.purge_log(100000000);
#purge force consensus_log before 100000000;
call dbms_consensus.force_purge_log(100000000);
# --replace_column 1 # 2 # 3 #
# show consensus logs;
#
# purge local
#
--connection f1
flush local logs;
--connection f2
flush local logs;
--connection leader
flush local logs;
insert into t1 values (1);
--source include/wait_follower_catchup.inc
# add a fake learner, matchindex is always 0
#add consensus_learner "127.0.0.1:24000";
call dbms_consensus.add_learner("127.0.0.1:24000");
#change consensus_node 100 consensus_learner_source 2;
--replace_result $PAXOS_PORT_2 PAXOS_PORT_2
eval call dbms_consensus.configure_learner("127.0.0.1:24000", "127.0.0.1:$PAXOS_PORT_2");
insert into t1 values (1);
#purge local consensus_log before 100000000;
call dbms_consensus.local_purge_log(100000000);
# --replace_column 1 # 2 # 3 #
# show consensus logs;
#purge force consensus_log before 100000000;
call dbms_consensus.force_purge_log(100000000);
# --replace_column 1 # 2 # 3 #
# show consensus logs;
--connection f1
--sleep 2 # wait apply configure change
--echo # for f1: purge local should fail
#purge local consensus_log before 100000000;
call dbms_consensus.local_purge_log(100000000);
# --replace_column 1 # 2 # 3 #
# show consensus logs;
#purge force consensus_log before 100000000;
call dbms_consensus.force_purge_log(100000000);
# --replace_column 1 # 2 # 3 #
# show consensus logs;
--connection f2
--echo # for f2: purge local should success
#purge local consensus_log before 100000000;
call dbms_consensus.local_purge_log(100000000);
# --replace_column 1 # 2 # 3 #
# show consensus logs;
--connection leader
#drop consensus_learner "127.0.0.1:24000";
call dbms_consensus.drop_learner("127.0.0.1:24000");
drop table t1;