mariadb/mysql-test/suite/versioning/t/rpl_test.inc
2017-07-31 11:44:12 +03:00

90 lines
2.4 KiB
PHP

#BUG#12662190 - COM_COMMIT IS NOT INCREMENTED FROM THE BINARY LOGS ON SLAVE, COM_BEGIN IS
#Testing command counters -BEFORE.
#Storing the before counts of Slave
connection slave;
let $slave_com_commit_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_commit', Value, 1);
let $slave_com_insert_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_insert', Value, 1);
let $slave_com_delete_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_delete', Value, 1);
let $slave_com_update_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_update', Value, 1);
connection master;
CREATE TABLE t1 (x int) with system versioning;
insert into t1 values (1);
SELECT * FROM t1;
delete from t1;
select * from t1;
select * from t1 for system_time all;
sync_slave_with_master;
select * from t1;
select * from t1 for system_time all;
connection master;
insert into t1 values (2);
sync_slave_with_master;
select * from t1;
connection master;
update t1 set x = 3;
sync_slave_with_master;
select * from t1;
select * from t1 for system_time all;
# check unversioned -> versioned replication
connection master;
create or replace table t1 (x int primary key);
sync_slave_with_master;
alter table t1 with system versioning;
connection master;
insert into t1 values (1);
sync_slave_with_master;
select * from t1;
select * from t1 for system_time all;
connection master;
update t1 set x= 2 where x = 1;
sync_slave_with_master;
select * from t1;
select * from t1 for system_time all;
connection master;
delete from t1;
sync_slave_with_master;
select * from t1;
select * from t1 for system_time all;
# same thing (UPDATE, DELETE), but without PK
connection master;
create or replace table t1 (x int);
sync_slave_with_master;
alter table t1 with system versioning;
connection master;
insert into t1 values (1);
update t1 set x= 2 where x = 1;
sync_slave_with_master;
select * from t1;
select * from t1 for system_time all;
connection master;
delete from t1;
sync_slave_with_master;
select * from t1;
select * from t1 for system_time all;
# multi-update
connection master;
create or replace table t1 (x int) with system versioning;
create or replace table t2 (x int) with system versioning;
insert into t1 values (1);
insert into t2 values (2);
update t1, t2 set t1.x=11, t2.x=22;
sync_slave_with_master;
select * from t1;
select * from t2;
select * from t1 for system_time all;
select * from t2 for system_time all;
connection master;
drop table t1, t2;