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

140 lines
3.2 KiB
Plaintext

# Author: xianlin.lh@alipay.com
# Aone: http://aone.alibaba-inc.com/aone2/task/28567
# RB: http://rb.corp.taobao.com/r/77401/
#--source include/master-slave.inc
--source include/have_binlog_format_row.inc
--source include/paxos.inc
#create user 'root'@'127.0.0.1';
#grant all on *.* to 'root'@'127.0.0.1' with grant option;
--connect (conn1,127.0.0.1,root,,test,$MYPORT_1)
--connect (conn2,127.0.0.1,root,,test,$MYPORT_2)
#--disable_query_log
#call mtr.add_suppression("Slave SQL for channel.* The slave coordinator and worker threads are stopped,.*Error_code: 1756");
#call mtr.add_suppression("Slave SQL for channel.*Could not execute Update_rows event on table test.t1;.*");
#call mtr.add_suppression("Slave SQL for channel.*Could not execute Delete_rows event on table test.t1;.*");
#--enable_query_log
#connection slave;
connection conn2;
show global variables like "slave_exec_mode";
show global variables like 'binlog_format';
connection conn1;
show global variables like 'binlog_format';
connection conn1;
create table `t1`(
`pk` int(11) not null default '0',
`uk1` int(11) default null,
`uk2` int(11) default null,
primary key (`pk`),
unique key `uk1` (`uk1`),
unique key `uk2` (`uk2`)
)engine=innodb default charset=gbk;
insert into t1 values(1,2,3);
#sync_slave_with_master;
--source include/wait_follower_catchup.inc
connection conn2;
select * from t1;
set force_revise=ON;
set sql_log_bin=OFF;
delete from t1 where pk=1;
insert into t1 values(2,2,2);
insert into t1 values(3,3,3);
set force_revise=OFF;
set sql_log_bin=ON;
connection conn1;
delete from t1 where pk=1;
#sync_slave_with_master;
--source include/wait_follower_catchup.inc
connection conn2;
select * from t1;
connection conn1;
insert into t1 values(1,2,3);
#sync_slave_with_master;
--source include/wait_follower_catchup.inc
connection conn2;
set force_revise=ON;
set sql_log_bin=OFF;
delete from t1 where pk=1;
insert into t1 values(2,2,2);
insert into t1 values(3,3,3);
set force_revise=OFF;
set sql_log_bin=ON;
select * from t1;
connection conn1;
update t1 set uk1=4, uk2=5 where pk=1;
#sync_slave_with_master;
--source include/wait_follower_catchup.inc
select * from t1;
connection conn2;
select * from t1;
set force_revise=ON;
set sql_log_bin=OFF;
insert into t1 values(2,2,2);
insert into t1 values(3,3,3);
set force_revise=OFF;
set sql_log_bin=ON;
select * from t1;
connection conn1;
update t1 set uk1=2, uk2=3 where pk=1;
#sync_slave_with_master;
--source include/wait_follower_catchup.inc
select * from t1;
connection conn2;
select * from t1;
connection conn1;
drop table t1;
#sync_slave_with_master;
--source include/wait_follower_catchup.inc
--echo "vitual column smart"
connection conn1;
CREATE TABLE t1 (
`id` int unsigned,
`feature` json,
`barcode` varchar(256) GENERATED ALWAYS AS (json_extract(`feature`,'$.barcode')) VIRTUAL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
insert into t1(id, feature) value(1, NULL);
select * from t1;
#sync_slave_with_master;
--source include/wait_follower_catchup.inc
select * from t1;
delete from t1;
connection conn1;
delete from t1;
#sync_slave_with_master;
--source include/wait_follower_catchup.inc
select * from t1;
connection conn1;
drop table t1;
#sync_slave_with_master;
--source include/wait_follower_catchup.inc
#connection conn2;
#stop slave;