diff --git a/mysql-test/suite/rpl/r/sequence.result b/mysql-test/suite/rpl/r/sequence.result new file mode 100644 index 00000000000..9e0c8b7bc5b --- /dev/null +++ b/mysql-test/suite/rpl/r/sequence.result @@ -0,0 +1,129 @@ +include/rpl_init.inc [topology=1->2->3] +include/rpl_connect.inc [creating master] +include/rpl_connect.inc [creating slave] +include/rpl_connect.inc [creating slave2] +connection master; +set @@default_storage_engine="aria"; +CREATE SEQUENCE s1 cache=10; +create table t1 select * from s1; +select NEXT VALUE for s1,seq from seq_1_to_20; +NEXT VALUE for s1 seq +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +10 10 +11 11 +12 12 +13 13 +14 14 +15 15 +16 16 +17 17 +18 18 +19 19 +20 20 +insert into t1 select * from s1; +do setval(s1,5, 1, 0); +insert into t1 select * from s1; +do setval(s1, 5000, 1 ,0); +insert into t1 select * from s1; +alter sequence s1 minvalue=-1 start=-1 restart=-1; +insert into t1 select * from s1; +insert into s1 values(-100,-1000,9223372036854775806,1,1,1000,0,0); +insert into t1 select * from s1; +select * from t1; +next_value min_value max_value start increment cache cycle round +1 1 9223372036854775806 1 1 10 0 0 +21 1 9223372036854775806 1 1 10 0 0 +21 1 9223372036854775806 1 1 10 0 0 +5001 1 9223372036854775806 1 1 10 0 0 +-1 -1 9223372036854775806 -1 1 10 0 0 +-100 -1000 9223372036854775806 1 1 1000 0 0 +connection slave; +select * from t1; +next_value min_value max_value start increment cache cycle round +1 1 9223372036854775806 1 1 10 0 0 +21 1 9223372036854775806 1 1 10 0 0 +21 1 9223372036854775806 1 1 10 0 0 +5001 1 9223372036854775806 1 1 10 0 0 +-1 -1 9223372036854775806 -1 1 10 0 0 +-100 -1000 9223372036854775806 1 1 1000 0 0 +connection slave2; +select * from t1; +next_value min_value max_value start increment cache cycle round +1 1 9223372036854775806 1 1 10 0 0 +21 1 9223372036854775806 1 1 10 0 0 +21 1 9223372036854775806 1 1 10 0 0 +5001 1 9223372036854775806 1 1 10 0 0 +-1 -1 9223372036854775806 -1 1 10 0 0 +-100 -1000 9223372036854775806 1 1 1000 0 0 +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE SEQUENCE s1 cache=10 +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE TABLE `t1` ( + `next_value` bigint(21) NOT NULL COMMENT 'next not cached value', + `min_value` bigint(21) NOT NULL COMMENT 'min value', + `max_value` bigint(21) NOT NULL COMMENT 'max value', + `start` bigint(21) NOT NULL COMMENT 'start value', + `increment` bigint(21) NOT NULL COMMENT 'increment value', + `cache` bigint(21) NOT NULL COMMENT 'cache size', + `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state', + `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done' +) PAGE_CHECKSUM=1 +master-bin.000001 # Annotate_rows # # create table t1 select * from s1 +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # select NEXT VALUE for s1,seq from seq_1_to_20 +master-bin.000001 # Table_map # # table_id: # (test.s1) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # insert into t1 select * from s1 +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # insert into t1 select * from s1 +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # do setval(s1, 5000, 1 ,0) +master-bin.000001 # Table_map # # table_id: # (test.s1) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # insert into t1 select * from s1 +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; alter sequence s1 minvalue=-1 start=-1 restart=-1 +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # insert into t1 select * from s1 +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # insert into s1 values(-100,-1000,9223372036854775806,1,1,1000,0,0) +master-bin.000001 # Table_map # # table_id: # (test.s1) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # insert into t1 select * from s1 +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +connection master; +drop table s1,t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/sequence.cnf b/mysql-test/suite/rpl/t/sequence.cnf new file mode 100644 index 00000000000..58b605ad928 --- /dev/null +++ b/mysql-test/suite/rpl/t/sequence.cnf @@ -0,0 +1,8 @@ +!include ../my.cnf + +[mysqld.3] +log-slave-updates + +[ENV] +SERVER_MYPORT_3= @mysqld.3.port +SERVER_MYSOCK_3= @mysqld.3.socket diff --git a/mysql-test/suite/rpl/t/sequence.test b/mysql-test/suite/rpl/t/sequence.test new file mode 100644 index 00000000000..436a0b1cdab --- /dev/null +++ b/mysql-test/suite/rpl/t/sequence.test @@ -0,0 +1,52 @@ +# +# Testing sequences with replication +# + +--source include/have_binlog_format_row.inc +--source include/have_aria.inc +--source include/have_sequence.inc + +--let $rpl_topology= 1->2->3 +--source include/rpl_init.inc + +--let $rpl_connection_name= master +--let $rpl_server_number= 1 +--source include/rpl_connect.inc + +--let $rpl_connection_name= slave +--let $rpl_server_number= 2 +--source include/rpl_connect.inc + +--let $rpl_connection_name= slave2 +--let $rpl_server_number= 3 +--source include/rpl_connect.inc + +--connection master + +set @@default_storage_engine="aria"; + +CREATE SEQUENCE s1 cache=10; +create table t1 select * from s1; +select NEXT VALUE for s1,seq from seq_1_to_20; +insert into t1 select * from s1; +do setval(s1,5, 1, 0); +insert into t1 select * from s1; +do setval(s1, 5000, 1 ,0); +insert into t1 select * from s1; +alter sequence s1 minvalue=-1 start=-1 restart=-1; +insert into t1 select * from s1; +insert into s1 values(-100,-1000,9223372036854775806,1,1,1000,0,0); +insert into t1 select * from s1; +select * from t1; +--sync_slave_with_master +select * from t1; +--sync_slave_with_master slave2 +select * from t1; + +--let $binlog_file = LAST +source include/show_binlog_events.inc; + +connection master; +drop table s1,t1; + +--source include/rpl_end.inc