mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-14767 system_versioning_alter_history breaks ALTER replication
Vers SQL: force VERS_ALTER_HISTORY_KEEP behavior in the slave thread
This commit is contained in:
committed by
Sergei Golubchik
parent
3f4d03b0dd
commit
dd7d169593
@@ -36,6 +36,7 @@ x
|
||||
1
|
||||
3
|
||||
2
|
||||
# check unversioned -> versioned replication
|
||||
connection master;
|
||||
create or replace table t1 (x int primary key);
|
||||
connection slave;
|
||||
@@ -68,6 +69,7 @@ select * from t1 for system_time all;
|
||||
x
|
||||
1
|
||||
2
|
||||
# same thing (UPDATE, DELETE), but without PK
|
||||
connection master;
|
||||
create or replace table t1 (x int);
|
||||
connection slave;
|
||||
@@ -92,6 +94,7 @@ select * from t1 for system_time all;
|
||||
x
|
||||
2
|
||||
1
|
||||
# multi-update
|
||||
connection master;
|
||||
create or replace table t1 (x int) with system versioning;
|
||||
create or replace table t2 (x int) with system versioning;
|
||||
@@ -113,6 +116,45 @@ select * from t2 for system_time all;
|
||||
x
|
||||
22
|
||||
2
|
||||
# MDEV-14767 system_versioning_alter_history breaks ALTER replication
|
||||
## Case 1: KEEP on the master, ALTER will work on the slave
|
||||
connection master;
|
||||
create or replace table t1 (a int) with system versioning;
|
||||
set system_versioning_alter_history= KEEP;
|
||||
alter table t1 add column b int;
|
||||
connection slave;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL,
|
||||
`b` int(11) DEFAULT NULL
|
||||
) ENGINE=INNODB_OR_MYISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
|
||||
## Case 2: ERROR on the master, it'll fail on the master, the slave won't see it
|
||||
connection master;
|
||||
set system_versioning_alter_history= ERROR;
|
||||
alter table t1 drop column b;
|
||||
ERROR HY000: Not allowed for system-versioned `test`.`t1`. Change @@system_versioning_alter_history to proceed with ALTER.
|
||||
connection slave;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL,
|
||||
`b` int(11) DEFAULT NULL
|
||||
) ENGINE=INNODB_OR_MYISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
|
||||
## Case 3: table is not versioned on the master, ALTER will work on the slave
|
||||
connection master;
|
||||
create or replace table t1 (a int);
|
||||
connection slave;
|
||||
create or replace table t1 (a int) with system versioning;
|
||||
connection master;
|
||||
alter table t1 add column b int;
|
||||
connection slave;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL,
|
||||
`b` int(11) DEFAULT NULL
|
||||
) ENGINE=INNODB_OR_MYISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
|
||||
connection master;
|
||||
drop table t1, t2;
|
||||
include/rpl_end.inc
|
||||
|
Reference in New Issue
Block a user