[MDEV-14767] system_versioning_alter_history breaks ALTER replication Created: 2017-12-25  Updated: 2023-07-19  Resolved: 2018-02-22

Status: Closed
Project: MariaDB Server
Component/s: Replication, Versioned Tables
Affects Version/s: 10.3.4
Fix Version/s: 10.3.5

Type: Bug Priority: Critical
Reporter: Elena Stepanova Assignee: Aleksey Midenkov
Resolution: Fixed Votes: 0
Labels: None
Environment:

bb-10.3-temporal ea49441c41


Issue Links:
Relates
relates to MDEV-16877 system_versioning_alter_history with ... Closed
relates to MDEV-24273 System versioning replication fails w... Closed

 Description   

system_versioning_alter_history should either be GLOBAL-only, or be included into binlog events.

ALTER TABLE for a versioned table can now break replication too easily, since system_versioning_alter_history can be changed by any user in a session (of course, not any user is allowed to ALTER a table, but still). Given the obvious effect that it has on replication, I think the value should be either included into the binary log, or only be modifiable globally. It would still break replication if it's modified globally, but the exposure would be not that big.

The test case is obvious:

--source include/master-slave.inc
 
create or replace table t1 (a int) with system versioning;
set system_versioning_alter_history= KEEP;
alter table t1 add column b int;
--sync_slave_with_master
 
# Cleanup
--connection master
drop table t1;
--source include/rpl_end.inc

Last_Errno	4118
Last_Error	Error 'Not allowed for system-versioned `test`.`t1`. Change @@system_versioning_alter_history to proceed with ALTER.' on query. Default database: 'test'. Query: 'alter table t1 add column b int'



 Comments   
Comment by Sergei Golubchik [ 2018-02-14 ]

Another possibility, make system_versioning_alter_history to be always KEEP in the replication thread.

So

  • it's is KEEP on the master, ALTER will work on the slave
  • if it's ERROR on the master, it'll fail on the master, the slave won't see it
  • if the table is not version on the master, ALTER will work on the slave
Generated at Thu Feb 08 08:16:07 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.