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

@ -40,3 +40,45 @@ select * from s1;
next_value min_value max_value start increment cache cycle round
2001 1 9223372036854775806 1 1 1000 0 0
drop sequence s1;
#
# <20>NSERT
#
create sequence s1;
create sequence s2;
insert into s1 (next_value, min_value) values (100,1000);
ERROR HY000: Field 'max_value' doesn't have a default value
insert into s1 values (next value for s1, 1,9223372036854775806,1,1,1000,0,0);
ERROR HY000: Table 's1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into s1 values (next value for s2, 1,9223372036854775806,1,1,1000,0,0);
ERROR HY000: Wrong INSERT into a SEQUENCE. One can only do single table INSERT into a squence object (like with mysqldump). If you want to change the SEQUENCE, use ALTER SEQUENCE instead.
insert into s1 select * from s2;
ERROR HY000: Wrong INSERT into a SEQUENCE. One can only do single table INSERT into a squence object (like with mysqldump). If you want to change the SEQUENCE, use ALTER SEQUENCE instead.
insert into s1 values(1000,9223372036854775806,1,1,1,1000,0,0);
ERROR HY000: Sequence 'test.s1' values are conflicting
insert into s1 values(0,9223372036854775806,1,1,1,1000,0,0);
ERROR HY000: Sequence 'test.s1' values are conflicting
select * from s1;
next_value min_value max_value start increment cache cycle round
1 1 9223372036854775806 1 1 1000 0 0
insert into s1 values(1000,1,9223372036854775806,1,1,1000,0,0);
select * from s1;
next_value min_value max_value start increment cache cycle round
1000 1 9223372036854775806 1 1 1000 0 0
select next value for s1;
next value for s1
1000
select * from s1;
next_value min_value max_value start increment cache cycle round
2000 1 9223372036854775806 1 1 1000 0 0
insert into s2 values(0, 1, 10, 1, 2, 1, 1, 0);
ERROR HY000: Sequence 'test.s2' values are conflicting
drop sequence s1,s2;
#
# UPDATE and DELETE
#
create sequence s1;
update s1 set next_value=100;
ERROR HY000: Storage engine SEQUENCE of the table `test`.`s1` doesn't have this option
delete from s1 where next_value > 0;
ERROR HY000: Storage engine SEQUENCE of the table `test`.`s1` doesn't have this option
drop sequence s1;