mariadb/mysql-test/suite/versioning/r/rpl_row.result
Aleksey Midenkov d37bb140b1 MDEV-31297 Create table as select on system versioned tables do not
work consistently on replication

Row-based replication does not execute CREATE .. SELECT but instead
CREATE TABLE. CREATE .. SELECT creates implict system fields on
unusual place: in-between declared fields and select fields. That was
done because select_field_pos logic requires select fields go last in
create_list.

So, CREATE .. SELECT on master and CREATE TABLE on slave create system
fields on different positions and replication gets field mismatch.

To fix this we've changed CREATE .. SELECT to create implicit system
fields on usual place in the end and updated select_field_pos for
handling this case.
2024-10-08 13:08:10 +03:00

76 lines
2.1 KiB
Text

include/master-slave.inc
[connection master]
# MDEV-16252: MINIMAL binlog_row_image does not work for versioned tables
set @old_row_image= @@binlog_row_image;
set binlog_row_image= minimal;
create or replace table t1 (pk int, i int, primary key(pk))
with system versioning;
insert into t1 values (1,10),(2,20);
update t1 set i = 0;
connection slave;
connection master;
drop table t1;
set binlog_row_image= @old_row_image;
#
# MDEV-28254 Wrong position for row_start, row_end after adding column
# to implicit versioned table
#
set @@system_versioning_alter_history= keep;
set @@session.time_zone='+00:00';
create table t1 (x int) with system versioning engine innodb;
alter table t1 add column y int, algorithm=inplace;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
connection slave;
drop table t1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`x` int(11) DEFAULT NULL,
`y` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
connection master;
set timestamp= 12345;
insert t1 values (1, 1);
select *, unix_timestamp(row_start) as row_start, unix_timestamp(row_end) as row_end from t1;
x y row_start row_end
1 1 12345.000000 2147483647.999999
set timestamp= default;
### INSERT INTO `test`.`t1`
### SET
### @1=1
### @2=1
### @3=12345.000000
### @4=2147483647.999999
connection slave;
select * from t1;
x y
1 1
connection master;
drop table t1;
#
# MDEV-31297 Create table as select on system versioned tables do not work consistently on replication
#
connection master;
create table t engine=innodb with system versioning as select 1 as i;
show create table t;
Table Create Table
t CREATE TABLE `t` (
`i` int(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
select * from t;
i
1
connection slave;
show create table t;
Table Create Table
t CREATE TABLE `t` (
`i` int(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
select * from t;
i
1
connection master;
drop table t;
include/rpl_end.inc