1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Make SEQUENCE working with replication

- Old sequence code forced row based replication for any statements that
  refered to a sequence table. What is new is that row based replication
  is now sequence aware:
   - NEXT VALUE is now generating a short row based event with only
     next_value and round being replicated.
   - Short row based events are now on the slave updated as trough
     SET_VALUE(sequence_name)
   - Full row based events are on the slave updated with a full insert,
     which is practically same as ALTER SEQUENCE.
- INSERT on a SEQUENCE table does now a EXCLUSIVE LOCK to ensure that
  it is logged in binary log before any following NEXT VALUE calls.
- Enable all sequence tests and fixed found bugs
- ALTER SEQUENCE doesn't anymore allow changes that makes the next_value
  outside of allowed range
- SEQUENCE changes are done with TL_WRITE_ALLOW_WRITE. Because of this
  one can generate a statement for MyISAM with both
  TL_WRITE_CONCURRENT_INSERT and TL_WRITE_ALLOW_WRITE. To fix a warning
  I had to add an extra test in thr_lock.c for this.
- Removed UPDATE of SEQUENCE (no need to support this as we
  have ALTER SEQUENCE, which takes the EXCLUSIVE lock properly.
- Removed DBUG_ASSERT() in MDL_context::upgrade_shared_lock. This was
  removed upstream in MySQL 5.6 in 72f823de453.
- Simplified test in decided_logging_format() by using sql_command_flags()
- Fix that we log DROP SEQUENCE correctly.
- Fixed that Aria works with SEQUENCE
This commit is contained in:
Monty
2017-05-23 17:18:31 +03:00
parent d9304914be
commit 6a779a6d28
31 changed files with 1272 additions and 813 deletions

View File

@ -1,3 +1,7 @@
#
# This test is based on tests from ALISQL test suite
#
--source include/have_binlog_format_row.inc
--source include/master-slave.inc
--source include/have_innodb.inc
@ -30,7 +34,6 @@ create sequence s1;
show create table s1;
--sync_slave_with_master
connection slave;
use s_db;
show create table s1;
@ -164,7 +167,9 @@ show status like 'Qcache_inserts';
--echo ###########################################
connection m_normal_1;
create sequence s_db.s1;
select * from s_db.s1;
select next value for s_db.s1;
select * from s_db.s1;
create sequence s_db.s2;
drop sequence s_db.s2;
@ -240,9 +245,9 @@ connection s_normal_3;
use s_db;
select * from s_t;
connection m_normal_1;
select next value for s_t;
select * from s_t;
connection master;
--sync_slave_with_master
@ -255,7 +260,9 @@ select * from s_t;
--echo ------------------------------------------
connection m_normal_1;
select next value for s_t;
--error ER_ILLEGAL_HA
update s_t set next_value= 11;
alter sequence s_t restart=11;
commit;
select * from s_t;
@ -285,8 +292,10 @@ select * from s_t;
--echo ------------------------------------------
connection m_normal_1;
select * from s_t;
--error ER_SEQUENCE_INVALID_DATA
--error ER_ILLEGAL_HA
update s_t set next_value= 11,start=10, min_value=11;
--error ER_SEQUENCE_INVALID_DATA
ALTER SEQUENCE s_t restart with 11 start=10 minvalue=11;
commit;
create table t_1(id int);
@ -495,11 +504,11 @@ select next value for s1;
set session binlog_format=row;
select next value for s1;
select * from s1;
connection master;
--sync_slave_with_master
connection slave;
use s_db;
select * from s1;
@ -568,7 +577,6 @@ select * from t;
connection master;
--sync_slave_with_master
connection slave;
use s_db;
select * from t;
@ -655,6 +663,4 @@ drop user normal_2@'%';
drop user normal_3@'%';
drop user normal_4@'%';
--sync_slave_with_master
--source include/rpl_end.inc