diff options
Diffstat (limited to 'mysql-test/suite')
122 files changed, 6607 insertions, 260 deletions
diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_do_server_ids.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_do_server_ids.result new file mode 100644 index 00000000000..0f5d1694522 --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_do_server_ids.result @@ -0,0 +1,161 @@ +############################### +# Test Setup +############################### +set @a=UNIX_TIMESTAMP("1970-01-21 15:32:22"); +SET timestamp=@a; +RESET MASTER; +SET @@session.gtid_domain_id= 0; +SET @@session.server_id= 1; +CREATE TABLE t1 (a int); +SET @@session.server_id= 2; +CREATE TABLE t2 (a int); +INSERT INTO t2 values (3); +SET @@session.gtid_domain_id= 1; +SET @@session.server_id= 1; +CREATE TABLE t3 (a int); +INSERT INTO t3 values (4); +SET @@session.server_id= 3; +SET timestamp=@a+1; +CREATE TABLE t4 (a int); +SET timestamp=@a+2; +INSERT INTO t4 values (5); +SET @@session.gtid_domain_id= 0; +SET @@session.server_id= 1; +INSERT INTO t1 values (1); +SET @@session.gtid_domain_id= 2; +SET @@session.server_id= 1; +CREATE TABLE t5 (a int); +INSERT INTO t5 values (6); +SET @@session.gtid_domain_id= 0; +SET @@session.server_id= 1; +INSERT INTO t1 values (2); +FLUSH LOGS; +SET @@session.gtid_domain_id= 0; +SET @@session.server_id= 2; +CREATE TABLE t6 (a int); +INSERT INTO t6 values (1); +FLUSH LOGS; +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +DROP TABLE t4; +DROP TABLE t5; +DROP TABLE t6; +RESET MASTER; +############################### +# Test Cases +############################### +# +# Test Case 1) --do-server-ids with a single server id limits output +# to that single server +# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=2 | MYSQL +DROP TABLE t2; +# +# Test Case 2) --do-server-ids with multiple server ids limits output +# to the provided servers +# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=2,3 | MYSQL +DROP TABLE t2; +DROP TABLE t4; +# +# Test Case 3) --do-server-ids when combined with --do-domain-ids should +# intersect the results +# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --do-domain-ids=0 | MYSQL +DROP TABLE t1; +# +# Test Case 4) --do-server-ids when combined with --ignore-domain-ids should +# intersect the results +# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --ignore-domain-ids=0 | MYSQL +DROP TABLE t3; +DROP TABLE t5; +# +# Test Case 5) --do-server-ids when combined with a GTID range should +# intersect the results +# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --stop-position=0-1-4 | MYSQL +DROP TABLE t1; +# +# Test Case 6) --do-server-ids when combined with both --ignore-domain-ids +# and a GTID range should intersect all results +# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --ignore-domain-ids=0 --start-position=1-1-0 | MYSQL +DROP TABLE t3; +DROP TABLE t5; +# +# Test Case 7) --do-server-ids when combined with both --do-domain-ids and +# a GTID range should intersect all results +# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=2 --do-domain-ids=0 --start-position=0-1-0 | MYSQL +DROP TABLE t2; +# +# Test Case 8) --do-server-ids and --offset=<n> skips n events after the +# first GTID is found +CREATE TABLE t4 (a int); +# MYSQL_BINLOG BINLOG_FILE_PARAM --offset=5 --do-server-ids=3 --do-domain-ids=1 | MYSQL +DROP TABLE t4; +# +# Test Case 9) --do-server-ids with --start-datetime=<T> where T occurs +# after the first GTID is found results in no events before T +CREATE TABLE t4 (a int); +# MYSQL_BINLOG BINLOG_FILE_PARAM --start-datetime="1970-01-21 15:32:24" --do-server-ids=3 --do-domain-ids=1 | MYSQL +DROP TABLE t4; +# +# Test Case 10) --do-server-ids works with --read-from-remote-server +# Setup test specific data +RESET MASTER; +SET @@session.gtid_domain_id= 0; +SET @@session.server_id= 1; +CREATE TABLE t1 (a int); +INSERT INTO t1 VALUES (1); +SET @@session.server_id= 2; +CREATE TABLE t2 (a int); +INSERT INTO t2 VALUES (1); +SET @@session.server_id= 1; +DROP TABLE t1; +DROP TABLE t2; +# MYSQL_BINLOG BINLOG_FILENAME --read-from-remote-server --do-server-ids=2 | MYSQL +DROP TABLE t2; +# +# Test Case 11) --do-server-ids works over multiple binary log input +# files +# MYSQL_BINLOG BINLOG_FILE_PARAM BINLOG_FILE_PARAM2 --do-server-ids=2 | MYSQL +DROP TABLE t2; +DROP TABLE t6; +# +# Test Case 12) --do-server-ids re-specifications should override +# previous ones +# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --do-server-ids=2 | MYSQL +DROP TABLE t2; +# +# Test Case 13) --do-server-ids and --server-id should be aliases and +# a re-specification of one should override the former +# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --server-id=2 | MYSQL +DROP TABLE t2; +# +# Test Case 14) --ignore-server-ids re-specifications should override +# previous ones +# MYSQL_BINLOG BINLOG_FILE_PARAM --ignore-server-ids=2 --ignore-server-ids=1,3 | MYSQL +DROP TABLE t2; +# +# Test Case 15) --do-domain-ids re-specifications should override +# previous ones +# MYSQL_BINLOG BINLOG_FILE_PARAM --do-domain-ids=1 --do-domain-ids=0 | MYSQL +DROP TABLE t1,t2; +# +# Test Case 16) --ignore-domain-ids re-specifications should override +# previous ones +# MYSQL_BINLOG BINLOG_FILE_PARAM --ignore-domain-ids=0 --ignore-domain-ids=1,2 | MYSQL +DROP TABLE t1,t2; +############################## +# Error Cases +############################## +# +# Error Case 1: +# --ignore-server-ids and --do-server-ids both specified +# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --ignore-server-ids=2 +# +# Error Case 2: +# Invalid server ID number provided +# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=-1 +############################## +# Cleanup +############################## +SET @@global.gtid_domain_id= 0; +SET @@global.server_id= 1; +# End of tests diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_do_server_ids.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_do_server_ids.test new file mode 100644 index 00000000000..9f32e2db071 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_do_server_ids.test @@ -0,0 +1,477 @@ +# +# Purpose: +# +# This test validates that the option --do-server-ids for the mariadb-binlog +# command line tool correctly filters events by server id. +# +# +# Methodology: +# +# This test invokes mariadb-binlog using combinations of --do-server-ids with +# various combinations of other parameters to ensure it correctly filters by +# server id. Specifically, the following test cases are validated: +# Test Case 1) --do-server-ids with a single server id limits output to that +# single server +# Test Case 2) --do-server-ids with multiple server ids limits output to the +# provided servers +# Test Case 3) --do-server-ids when combined with --do-domain-ids should +# intersect the results +# Test Case 4) --do-server-ids when combined with --ignore-domain-ids should +# intersect the results +# Test Case 5) --do-server-ids when combined with a GTID range should +# intersect the results +# Test Case 6) --do-server-ids when combined with both --ignore-domain-ids +# and a GTID range should intersect all results +# Test Case 7) --do-server-ids when combined with both --do-domain-ids and +# a GTID range should intersect all results +# Test Case 8) --do-server-ids and --offset=<n> skips n events after the +# first GTID is found +# Test Case 9) --do-server-ids with --start-datetime=<T> where T occurs +# after the first GTID is found results in no events before T +# Test Case 10) --do-server-ids works with --read-from-remote-server +# Test Case 11) --do-server-ids works over multiple binary log input files +# Test Case 12) --do-server-ids re-specifications should override previous +# ones +# Test Case 13) --do-server-ids and --server-id should be aliases and a +# re-specification of one should override the former +# Test Case 14) --ignore-server-ids re-specifications should override +# previous ones +# Test Case 15) --do-domain-ids re-specifications should override previous +# ones +# Test Case 16) --ignore-domain-ids re-specifications should override +# previous ones +# +# Additionally, this test validates the following error scenarios: +# Error Case 1) --do-server-ids and --ignore-server-ids cannot be specified +# together +# Error Case 2) Invalid server ID number provided +# +# +# References: +# +# MDEV-20119: Implement the --do-domain-ids, --ignore-domain-ids, and +# --ignore-server-ids options for mysqlbinlog +# + +--source include/have_log_bin.inc + +--echo ############################### +--echo # Test Setup +--echo ############################### + + +# Save old state +let $ORIG_GTID_DOMAIN_ID = `select @@session.gtid_domain_id`; +let $ORIG_SERVER_ID = `select @@session.server_id`; + +# Configure test variables +--let $MYSQLD_DATADIR=`select @@datadir` + +--let table_inconsistent_err= "table data is inconsistent after replaying binlog events"; +--let table_exists_error= "table exists but binlog playback should have excluded its creation"; + +# Initialize test data +set @a=UNIX_TIMESTAMP("1970-01-21 15:32:22"); +SET timestamp=@a; +RESET MASTER; + +SET @@session.gtid_domain_id= 0; +SET @@session.server_id= 1; +CREATE TABLE t1 (a int); + +SET @@session.server_id= 2; +CREATE TABLE t2 (a int); +INSERT INTO t2 values (3); +--let t2_checksum= `CHECKSUM TABLE t2` + +SET @@session.gtid_domain_id= 1; +SET @@session.server_id= 1; +CREATE TABLE t3 (a int); +INSERT INTO t3 values (4); +--let t3_checksum= `CHECKSUM TABLE t3` + +SET @@session.server_id= 3; +SET timestamp=@a+1; +CREATE TABLE t4 (a int); +SET timestamp=@a+2; +INSERT INTO t4 values (5); +--let t4_checksum= `CHECKSUM TABLE t4` + +SET @@session.gtid_domain_id= 0; +SET @@session.server_id= 1; +INSERT INTO t1 values (1); +--let t1_partial_checksum= `CHECKSUM TABLE t1` + +SET @@session.gtid_domain_id= 2; +SET @@session.server_id= 1; +CREATE TABLE t5 (a int); +INSERT INTO t5 values (6); +--let t5_checksum= `CHECKSUM TABLE t5` + +SET @@session.gtid_domain_id= 0; +SET @@session.server_id= 1; +INSERT INTO t1 values (2); +--let t1_checksum= `CHECKSUM TABLE t1` + +FLUSH LOGS; + +SET @@session.gtid_domain_id= 0; +SET @@session.server_id= 2; +CREATE TABLE t6 (a int); +INSERT INTO t6 values (1); +--let t6_checksum= `CHECKSUM TABLE t6` +FLUSH LOGS; + +--let BINLOG_FILENAME= query_get_value(SHOW BINARY LOGS, Log_name, 1) +--let BINLOG_FILENAME2= query_get_value(SHOW BINARY LOGS, Log_name, 2) +--let BINLOG_FILE_PARAM= $MYSQLD_DATADIR/$BINLOG_FILENAME.orig +--let BINLOG_FILE_PARAM2= $MYSQLD_DATADIR/$BINLOG_FILENAME2.orig +--copy_file $MYSQLD_DATADIR/$BINLOG_FILENAME $BINLOG_FILE_PARAM +--copy_file $MYSQLD_DATADIR/$BINLOG_FILENAME2 $BINLOG_FILE_PARAM2 + +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +DROP TABLE t4; +DROP TABLE t5; +DROP TABLE t6; +RESET MASTER; + +--echo ############################### +--echo # Test Cases +--echo ############################### + +--echo # +--echo # Test Case 1) --do-server-ids with a single server id limits output +--echo # to that single server +--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=2 | MYSQL +--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --do-server-ids=2 | $MYSQL +if ($t2_checksum != `CHECKSUM TABLE t2`) +{ + die $table_inconsistent_err; +} +if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t1','t3','t4','t5','t6')`) +{ + die $table_exists_error; +} +DROP TABLE t2; + + +--echo # +--echo # Test Case 2) --do-server-ids with multiple server ids limits output +--echo # to the provided servers +--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=2,3 | MYSQL +--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --do-server-ids=2,3 | $MYSQL +if ($t2_checksum != `CHECKSUM TABLE t2`) +{ + die $table_inconsistent_err; +} +if ($t4_checksum != `CHECKSUM TABLE t4`) +{ + die $table_inconsistent_err; +} +if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t1','t3','t5','t6')`) +{ + die $table_exists_error; +} +DROP TABLE t2; +DROP TABLE t4; + + +--echo # +--echo # Test Case 3) --do-server-ids when combined with --do-domain-ids should +--echo # intersect the results +--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --do-domain-ids=0 | MYSQL +--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --do-server-ids=1 --do-domain-ids=0 | $MYSQL +if ($t1_checksum != `CHECKSUM TABLE t1`) +{ + die $table_inconsistent_err; +} +if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t2','t3','t4','t5','t6')`) +{ + die $table_exists_error; +} +DROP TABLE t1; + + +--echo # +--echo # Test Case 4) --do-server-ids when combined with --ignore-domain-ids should +--echo # intersect the results +--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --ignore-domain-ids=0 | MYSQL +--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --do-server-ids=1 --ignore-domain-ids=0 | $MYSQL +if ($t3_checksum != `CHECKSUM TABLE t3`) +{ + die $table_inconsistent_err; +} +if ($t5_checksum != `CHECKSUM TABLE t5`) +{ + die $table_inconsistent_err; +} +if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t1','t2','t4','t6')`) +{ + die $table_exists_error; +} +DROP TABLE t3; +DROP TABLE t5; + + +--echo # +--echo # Test Case 5) --do-server-ids when combined with a GTID range should +--echo # intersect the results +--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --stop-position=0-1-4 | MYSQL +--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --do-server-ids=1 --stop-position=0-1-4 | $MYSQL +if ($t1_partial_checksum != `CHECKSUM TABLE t1`) +{ + die $table_inconsistent_err; +} +if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t2','t3','t4','t5','t6')`) +{ + die $table_exists_error; +} +DROP TABLE t1; + + +--echo # +--echo # Test Case 6) --do-server-ids when combined with both --ignore-domain-ids +--echo # and a GTID range should intersect all results +--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --ignore-domain-ids=0 --start-position=1-1-0 | MYSQL +--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --do-server-ids=1 --ignore-domain-ids=0 --start-position=1-1-0 | $MYSQL +if ($t3_checksum != `CHECKSUM TABLE t3`) +{ + die $table_inconsistent_err; +} +if ($t5_checksum != `CHECKSUM TABLE t5`) +{ + die $table_inconsistent_err; +} +if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t1','t2','t4','t6')`) +{ + die $table_exists_error; +} +DROP TABLE t3; +DROP TABLE t5; + + +--echo # +--echo # Test Case 7) --do-server-ids when combined with both --do-domain-ids and +--echo # a GTID range should intersect all results +--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=2 --do-domain-ids=0 --start-position=0-1-0 | MYSQL +--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --do-server-ids=2 --do-domain-ids=0 --start-position=0-1-0 | $MYSQL +if ($t2_checksum != `CHECKSUM TABLE t2`) +{ + die $table_inconsistent_err; +} +if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t1','t3','t4','t5','t6')`) +{ + die $table_exists_error; +} +DROP TABLE t2; + + + +--echo # +--echo # Test Case 8) --do-server-ids and --offset=<n> skips n events after the +--echo # first GTID is found + +# t4 needs to be specified because its creation should be skipped from +# --offset specification +CREATE TABLE t4 (a int); + +--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --offset=5 --do-server-ids=3 --do-domain-ids=1 | MYSQL +--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --offset=5 --do-server-ids=3 --do-domain-ids=1 | $MYSQL +if ($t4_checksum != `CHECKSUM TABLE t4`) +{ + die $table_inconsistent_err; +} +if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t1','t2','t3','t5','t6')`) +{ + die $table_exists_error; +} +DROP TABLE t4; + + +--echo # +--echo # Test Case 9) --do-server-ids with --start-datetime=<T> where T occurs +--echo # after the first GTID is found results in no events before T + +# t4 needs to be specified because its creation should be skipped from +# --start-datetime specification +CREATE TABLE t4 (a int); + +--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --start-datetime="1970-01-21 15:32:24" --do-server-ids=3 --do-domain-ids=1 | MYSQL +--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --start-datetime="1970-01-21 15:32:24" --do-server-ids=3 --do-domain-ids=1 | $MYSQL +if ($t4_checksum != `CHECKSUM TABLE t4`) +{ + die $table_inconsistent_err; +} +if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t1','t2','t3','t5','t6')`) +{ + die $table_exists_error; +} +DROP TABLE t4; + + +--echo # +--echo # Test Case 10) --do-server-ids works with --read-from-remote-server + +--echo # Setup test specific data +RESET MASTER; + +SET @@session.gtid_domain_id= 0; +SET @@session.server_id= 1; +CREATE TABLE t1 (a int); +INSERT INTO t1 VALUES (1); + +SET @@session.server_id= 2; +CREATE TABLE t2 (a int); +INSERT INTO t2 VALUES (1); +--let t11_t2_checksum= `CHECKSUM TABLE t2` + +SET @@session.server_id= 1; +DROP TABLE t1; +DROP TABLE t2; + +--echo # MYSQL_BINLOG BINLOG_FILENAME --read-from-remote-server --do-server-ids=2 | MYSQL +--exec $MYSQL_BINLOG $BINLOG_FILENAME --read-from-remote-server --do-server-ids=2 | $MYSQL +if ($t11_t2_checksum != `CHECKSUM TABLE t2`) +{ + die $table_inconsistent_err; +} +if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t1','t3','t4','t5','t6')`) +{ + die $table_exists_error; +} +DROP TABLE t2; + + +--echo # +--echo # Test Case 11) --do-server-ids works over multiple binary log input +--echo # files +--echo # MYSQL_BINLOG BINLOG_FILE_PARAM BINLOG_FILE_PARAM2 --do-server-ids=2 | MYSQL +--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM $BINLOG_FILE_PARAM2 --do-server-ids=2 | $MYSQL +if ($t2_checksum != `CHECKSUM TABLE t2`) +{ + die $table_inconsistent_err; +} +if ($t6_checksum != `CHECKSUM TABLE t6`) +{ + die $table_inconsistent_err; +} +if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t1','t3','t4','t5')`) +{ + die $table_exists_error; +} +DROP TABLE t2; +DROP TABLE t6; + +--echo # +--echo # Test Case 12) --do-server-ids re-specifications should override +--echo # previous ones +--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --do-server-ids=2 | MYSQL +--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --do-server-ids=1 --do-server-ids=2 | $MYSQL +if ($t2_checksum != `CHECKSUM TABLE t2`) +{ + die $table_inconsistent_err; +} +if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t1','t3','t4','t5','t6')`) +{ + die $table_exists_error; +} +DROP TABLE t2; + +--echo # +--echo # Test Case 13) --do-server-ids and --server-id should be aliases and +--echo # a re-specification of one should override the former +--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --server-id=2 | MYSQL +--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --do-server-ids=1 --server-id=2 | $MYSQL +if ($t2_checksum != `CHECKSUM TABLE t2`) +{ + die $table_inconsistent_err; +} +if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t1','t3','t4','t5','t6')`) +{ + die $table_exists_error; +} +DROP TABLE t2; + +--echo # +--echo # Test Case 14) --ignore-server-ids re-specifications should override +--echo # previous ones +--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --ignore-server-ids=2 --ignore-server-ids=1,3 | MYSQL +--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --ignore-server-ids=2 --ignore-server-ids=1,3 | $MYSQL +if ($t2_checksum != `CHECKSUM TABLE t2`) +{ + die $table_inconsistent_err; +} +if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t1','t3','t4','t5','t6')`) +{ + die $table_exists_error; +} +DROP TABLE t2; + +--echo # +--echo # Test Case 15) --do-domain-ids re-specifications should override +--echo # previous ones +--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --do-domain-ids=1 --do-domain-ids=0 | MYSQL +--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --do-domain-ids=1 --do-domain-ids=0 | $MYSQL +if ($t1_checksum != `CHECKSUM TABLE t1`) +{ + die $table_inconsistent_err; +} +if ($t2_checksum != `CHECKSUM TABLE t2`) +{ + die $table_inconsistent_err; +} +if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t3','t4','t5','t6')`) +{ + die $table_exists_error; +} +DROP TABLE t1,t2; + +--echo # +--echo # Test Case 16) --ignore-domain-ids re-specifications should override +--echo # previous ones +--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --ignore-domain-ids=0 --ignore-domain-ids=1,2 | MYSQL +--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --ignore-domain-ids=0 --ignore-domain-ids=1,2 | $MYSQL +if ($t1_checksum != `CHECKSUM TABLE t1`) +{ + die $table_inconsistent_err; +} +if ($t2_checksum != `CHECKSUM TABLE t2`) +{ + die $table_inconsistent_err; +} +if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t3','t4','t5','t6')`) +{ + die $table_exists_error; +} +DROP TABLE t1,t2; + +--echo ############################## +--echo # Error Cases +--echo ############################## + +--echo # +--echo # Error Case 1: +--echo # --ignore-server-ids and --do-server-ids both specified +--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --ignore-server-ids=2 +--error 1 +--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --do-server-ids=1 --ignore-server-ids=2 + +--echo # +--echo # Error Case 2: +--echo # Invalid server ID number provided +--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=-1 +--error 1 +--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --do-server-ids=-1 + +--echo ############################## +--echo # Cleanup +--echo ############################## +--eval SET @@global.gtid_domain_id= $ORIG_GTID_DOMAIN_ID +--eval SET @@global.server_id= $ORIG_SERVER_ID + +--remove_file $BINLOG_FILE_PARAM +--remove_file $BINLOG_FILE_PARAM2 + +--echo # End of tests diff --git a/mysql-test/suite/encryption/r/innodb_encrypt_log.result b/mysql-test/suite/encryption/r/innodb_encrypt_log.result index b436435090b..5c6c7ebae90 100644 --- a/mysql-test/suite/encryption/r/innodb_encrypt_log.result +++ b/mysql-test/suite/encryption/r/innodb_encrypt_log.result @@ -21,7 +21,6 @@ Warning 1478 Ignoring encryption parameter during temporary table creation. INSERT INTO t VALUES (NULL,1,1,'private','secret'),(NULL,2,2,'sacred','success'), (NULL,3,3,'story','secure'),(NULL,4,4,'security','sacrament'); -SET GLOBAL innodb_change_buffering=none; SET GLOBAL innodb_flush_log_at_trx_commit=1; INSERT INTO t0 SELECT NULL, t1.col_int, t1.col_int_key, t1.col_char, t1.col_char_key diff --git a/mysql-test/suite/encryption/r/tempfiles_encrypted.result b/mysql-test/suite/encryption/r/tempfiles_encrypted.result index 4643e846be5..04897ef3105 100644 --- a/mysql-test/suite/encryption/r/tempfiles_encrypted.result +++ b/mysql-test/suite/encryption/r/tempfiles_encrypted.result @@ -3931,7 +3931,7 @@ DROP TABLE t1; # MDEV-18916: crash in Window_spec::print_partition() with decimals # SELECT cast((rank() over w1) as decimal (53,56)); -ERROR 42000: Too big scale 56 specified for 'rank() over w1'. Maximum is 38 +ERROR 42000: Too big scale specified for 'rank() over w1'. Maximum is 38 SELECT cast((rank() over w1) as decimal (53,30)); ERROR HY000: Window specification with name 'w1' is not defined # diff --git a/mysql-test/suite/encryption/t/innodb_encrypt_log.test b/mysql-test/suite/encryption/t/innodb_encrypt_log.test index 1d016be73c8..5448a606ba8 100644 --- a/mysql-test/suite/encryption/t/innodb_encrypt_log.test +++ b/mysql-test/suite/encryption/t/innodb_encrypt_log.test @@ -29,11 +29,6 @@ INSERT INTO t VALUES (NULL,1,1,'private','secret'),(NULL,2,2,'sacred','success'), (NULL,3,3,'story','secure'),(NULL,4,4,'security','sacrament'); -# Prevent change buffering of key(col_char_key), so that -# after the restart, the data ('secret','success','secure','sacrament') -# cannot be emitted to the unencrypted redo log by change buffer merge. -SET GLOBAL innodb_change_buffering=none; - # Force a redo log flush at the next commit. SET GLOBAL innodb_flush_log_at_trx_commit=1; INSERT INTO t0 diff --git a/mysql-test/suite/engines/iuds/r/insert_decimal.result b/mysql-test/suite/engines/iuds/r/insert_decimal.result index 2f174c5e70b..a36c6c852dc 100644 --- a/mysql-test/suite/engines/iuds/r/insert_decimal.result +++ b/mysql-test/suite/engines/iuds/r/insert_decimal.result @@ -1010,7 +1010,7 @@ ROUND(c1,c2) TRUNCATE(c1,c2) 1.133000 1.132000 DROP TABLE t5; CREATE TABLE t7(c1 DECIMAL(66,0)); -ERROR 42000: Too big precision 66 specified for 'c1'. Maximum is 65 +ERROR 42000: Too big precision specified for 'c1'. Maximum is 65 CREATE TABLE t7(c1 DECIMAL(5,10)); ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'c1') DROP TABLE t1,t2; diff --git a/mysql-test/suite/funcs_1/r/storedproc.result b/mysql-test/suite/funcs_1/r/storedproc.result index efeb63ae616..6b10384744c 100644 --- a/mysql-test/suite/funcs_1/r/storedproc.result +++ b/mysql-test/suite/funcs_1/r/storedproc.result @@ -143,7 +143,7 @@ BEGIN SET @v1 = f1; SELECT @v1; END// -ERROR 42000: Too big precision 256 specified for 'f1'. Maximum is 65 +ERROR 42000: Too big precision specified for 'f1'. Maximum is 65 DROP PROCEDURE IF EXISTS sp1// Warnings: Note 1305 PROCEDURE db_storedproc.sp1 does not exist @@ -153,7 +153,7 @@ BEGIN SET @v1 = f1; SELECT @v1; END// -ERROR 42000: Too big precision 66 specified for 'f1'. Maximum is 65 +ERROR 42000: Too big precision specified for 'f1'. Maximum is 65 DROP PROCEDURE IF EXISTS sp1// Warnings: Note 1305 PROCEDURE db_storedproc.sp1 does not exist @@ -1549,7 +1549,7 @@ BEGIN SET f1 = 1000000 + f1; RETURN f1; END// -ERROR 42000: Too big scale 61 specified for 'f1'. Maximum is 38 +ERROR 42000: Too big scale specified for 'f1'. Maximum is 38 SELECT fn1( 1.3326e+8 ); ERROR 42000: FUNCTION db_storedproc.fn1 does not exist CREATE FUNCTION fn1( f1 DECIMAL(63, 30) ) RETURNS DECIMAL(63, 30) @@ -5837,7 +5837,7 @@ fetch cur1 into e; SELECT x, y, z, a, b, c, d, e; close cur1; END// -ERROR 42000: Too big scale 255 specified for 'b'. Maximum is 38 +ERROR 42000: Too big scale specified for 'b'. Maximum is 38 CALL sp6(); ERROR 42000: PROCEDURE db_storedproc.sp6 does not exist DROP PROCEDURE IF EXISTS sp6; diff --git a/mysql-test/suite/galera/r/MDEV-22458.result b/mysql-test/suite/galera/r/MDEV-22458.result index d1f9d94bd1c..7c853735641 100644 --- a/mysql-test/suite/galera/r/MDEV-22458.result +++ b/mysql-test/suite/galera/r/MDEV-22458.result @@ -4,7 +4,7 @@ CREATE TABLE t1 (a INT); connect con1,localhost,root,,test; INSERT INTO t1 VALUES (1),(2),(3),(4); SHOW EXPLAIN FOR $con1; -ERROR HY000: Target is not running an EXPLAINable command +ERROR HY000: Target is not executing an operation with a query plan connection con1; INSERT INTO t1 VALUES (5),(6),(7),(8); DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_defaults.result b/mysql-test/suite/galera/r/galera_defaults.result index d6bbcbae680..04f45a7c770 100644 --- a/mysql-test/suite/galera/r/galera_defaults.result +++ b/mysql-test/suite/galera/r/galera_defaults.result @@ -3,7 +3,7 @@ connection node_1; # Correct Galera library found SELECT COUNT(*) `expect 50` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%'; expect 50 -49 +50 SELECT VARIABLE_NAME, VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%' @@ -57,6 +57,7 @@ WSREP_SST_AUTH WSREP_SST_DONOR WSREP_SST_DONOR_REJECTS_QUERIES OFF WSREP_SST_METHOD rsync +WSREP_STATUS_FILE WSREP_SYNC_WAIT 15 WSREP_TRX_FRAGMENT_SIZE 0 WSREP_TRX_FRAGMENT_UNIT bytes diff --git a/mysql-test/suite/galera_sr/disabled.def b/mysql-test/suite/galera_sr/disabled.def index 1132a0097c4..9cca05eb62c 100644 --- a/mysql-test/suite/galera_sr/disabled.def +++ b/mysql-test/suite/galera_sr/disabled.def @@ -13,3 +13,5 @@ GCF-1060 : MDEV-26528 wrong usage of mutex LOCK_thd_kill and LOCK_thd_kill galera_sr_cc_master : MDEV-29882 Galera test failure on galera_sr_cc_master mysql-wsrep-features#138 : At line 25: query 'DROP TABLE t1' failed: 2013: Lost connection to MySQL server during query +# Links to below failures in MDEV-30172 +MDEV-25718 : timeout related to wsrep_sync_wait and DEBUG_SYNC diff --git a/mysql-test/suite/innodb/r/ibuf_delete.result b/mysql-test/suite/innodb/r/ibuf_delete.result index 1481fca9bf6..7423d3cfa3e 100644 --- a/mysql-test/suite/innodb/r/ibuf_delete.result +++ b/mysql-test/suite/innodb/r/ibuf_delete.result @@ -1,5 +1,7 @@ SET @buffering= @@innodb_change_buffering; SET GLOBAL innodb_change_buffering= deletes; +Warnings: +Warning 1287 '@@innodb_change_buffering' is deprecated and will be removed in a future release SET @flush= @@innodb_flush_log_at_trx_commit; SET GLOBAL innodb_flush_log_at_trx_commit= 0; CREATE TABLE t1 ( @@ -46,4 +48,6 @@ INSERT INTO t2 SELECT @x, @x, @x, @x, @x, @x, @x, @x, @x, @x, @x, @x, @x FROM seq_1_to_768; DROP TABLE t1, t2; SET GLOBAL innodb_change_buffering= @buffering; +Warnings: +Warning 1287 '@@innodb_change_buffering' is deprecated and will be removed in a future release SET GLOBAL innodb_flush_log_at_trx_commit= @flush; diff --git a/mysql-test/suite/innodb/r/ibuf_not_empty.result b/mysql-test/suite/innodb/r/ibuf_not_empty.result index dbb9814c111..1dc7f0324d3 100644 --- a/mysql-test/suite/innodb/r/ibuf_not_empty.result +++ b/mysql-test/suite/innodb/r/ibuf_not_empty.result @@ -6,6 +6,8 @@ INDEX(b)) ENGINE=InnoDB STATS_PERSISTENT=0; SET GLOBAL innodb_change_buffering_debug = 1; SET GLOBAL innodb_change_buffering=all; +Warnings: +Warning 1287 '@@innodb_change_buffering' is deprecated and will be removed in a future release INSERT INTO t1 SELECT 0,'x',1 FROM seq_1_to_1024; # restart: --innodb-force-recovery=6 --innodb-change-buffer-dump check table t1; diff --git a/mysql-test/suite/innodb/r/log_file_size_online.result b/mysql-test/suite/innodb/r/log_file_size_online.result new file mode 100644 index 00000000000..1db2fdde576 --- /dev/null +++ b/mysql-test/suite/innodb/r/log_file_size_online.result @@ -0,0 +1,47 @@ +SET GLOBAL innodb_log_file_size=4194304; +SHOW VARIABLES LIKE 'innodb_log_file_size'; +Variable_name Value +innodb_log_file_size 4194304 +SELECT global_value FROM information_schema.system_variables +WHERE variable_name = 'innodb_log_file_size'; +global_value +4194304 +CREATE TABLE t ( +a INT PRIMARY KEY AUTO_INCREMENT, +b CHAR(255) NOT NULL) +ENGINE=INNODB; +INSERT INTO t SELECT NULL, REPEAT('a', 255) FROM seq_1_to_20000; +# restart: --innodb-log-file-size=4194304 +SELECT COUNT(*) FROM t; +COUNT(*) +20000 +SHOW VARIABLES LIKE 'innodb_log_file_size'; +Variable_name Value +innodb_log_file_size 4194304 +FOUND 1 /InnoDB: Resized log to 4\.000MiB/ in mysqld.1.err +UPDATE t SET b='' WHERE a<10; +SET GLOBAL innodb_log_file_size=5242880; +SHOW VARIABLES LIKE 'innodb_log_file_size'; +Variable_name Value +innodb_log_file_size 5242880 +SELECT global_value FROM information_schema.system_variables +WHERE variable_name = 'innodb_log_file_size'; +global_value +5242880 +# restart +SELECT * FROM t WHERE a<10; +a b +1 +2 +3 +4 +5 +6 +7 +8 +9 +SHOW VARIABLES LIKE 'innodb_log_file_size'; +Variable_name Value +innodb_log_file_size 5242880 +FOUND 1 /InnoDB: Resized log to 5\.000MiB/ in mysqld.1.err +DROP TABLE t; diff --git a/mysql-test/suite/innodb/t/log_file_size_online.combinations b/mysql-test/suite/innodb/t/log_file_size_online.combinations new file mode 100644 index 00000000000..846aff4c158 --- /dev/null +++ b/mysql-test/suite/innodb/t/log_file_size_online.combinations @@ -0,0 +1,11 @@ +[encrypted] +--plugin-load-add=$FILE_KEY_MANAGEMENT_SO +--loose-file-key-management +--loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/logkey.txt +--innodb-encrypt-log=ON +--innodb-log-file-size=5M + +[slow] +--innodb-flush-sync=OFF +--innodb-encrypt-log=OFF +--innodb-log-file-size=5M diff --git a/mysql-test/suite/innodb/t/log_file_size_online.test b/mysql-test/suite/innodb/t/log_file_size_online.test new file mode 100644 index 00000000000..65551f13dbc --- /dev/null +++ b/mysql-test/suite/innodb/t/log_file_size_online.test @@ -0,0 +1,44 @@ +--source include/have_innodb.inc +--source include/have_sequence.inc +--source include/no_valgrind_without_big.inc + +let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err; + +SET GLOBAL innodb_log_file_size=4194304; +SHOW VARIABLES LIKE 'innodb_log_file_size'; +SELECT global_value FROM information_schema.system_variables +WHERE variable_name = 'innodb_log_file_size'; + +CREATE TABLE t ( + a INT PRIMARY KEY AUTO_INCREMENT, + b CHAR(255) NOT NULL) +ENGINE=INNODB; + +INSERT INTO t SELECT NULL, REPEAT('a', 255) FROM seq_1_to_20000; + +--let $restart_parameters=--innodb-log-file-size=4194304 +--source include/restart_mysqld.inc + +SELECT COUNT(*) FROM t; + +SHOW VARIABLES LIKE 'innodb_log_file_size'; +let SEARCH_PATTERN = InnoDB: Resized log to 4\\.000MiB; +--source include/search_pattern_in_file.inc + +UPDATE t SET b='' WHERE a<10; + +SET GLOBAL innodb_log_file_size=5242880; +SHOW VARIABLES LIKE 'innodb_log_file_size'; +SELECT global_value FROM information_schema.system_variables +WHERE variable_name = 'innodb_log_file_size'; + +--let $restart_parameters= +--source include/restart_mysqld.inc + +SELECT * FROM t WHERE a<10; + +SHOW VARIABLES LIKE 'innodb_log_file_size'; +let SEARCH_PATTERN = InnoDB: Resized log to 5\\.000MiB; +--source include/search_pattern_in_file.inc + +DROP TABLE t; diff --git a/mysql-test/suite/json/r/json_no_table.result b/mysql-test/suite/json/r/json_no_table.result index 10dd5d4b4ca..375b29d51de 100644 --- a/mysql-test/suite/json/r/json_no_table.result +++ b/mysql-test/suite/json/r/json_no_table.result @@ -402,7 +402,7 @@ select json_length( 'true', '$.*' ); json_length( 'true', '$.*' ) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_length' +Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_length' # wildcards not allowed in path expressions for this function error ER_INVALID_JSON_PATH_WILDCARD @@ -410,7 +410,7 @@ select json_length( 'true', '$.foo**.bar' ); json_length( 'true', '$.foo**.bar' ) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_length' +Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_length' select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[0]' ); json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[0]' ) 1 @@ -691,25 +691,25 @@ select json_remove( '[ 1, 2, 3 ]', '$[*]' ); json_remove( '[ 1, 2, 3 ]', '$[*]' ) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_remove' +Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_remove' error ER_INVALID_JSON_PATH_WILDCARD select json_remove( '[ 1, 2, 3 ]', '$**[2]' ); json_remove( '[ 1, 2, 3 ]', '$**[2]' ) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_remove' +Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_remove' error ER_INVALID_JSON_PATH_WILDCARD select json_remove( '[ 1, 2, 3 ]', '$[2]', '$[*]' ); json_remove( '[ 1, 2, 3 ]', '$[2]', '$[*]' ) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 3 to function 'json_remove' +Warning 4044 Wildcards or range in JSON path not allowed in argument 3 to function 'json_remove' error ER_INVALID_JSON_PATH_WILDCARD select json_remove( '[ 1, 2, 3 ]', '$[2]', '$**[2]' ); json_remove( '[ 1, 2, 3 ]', '$[2]', '$**[2]' ) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 3 to function 'json_remove' +Warning 4044 Wildcards or range in JSON path not allowed in argument 3 to function 'json_remove' select json_remove( '[ 1, 2, 3 ]', '$[0]' ); json_remove( '[ 1, 2, 3 ]', '$[0]' ) [2, 3] @@ -730,7 +730,7 @@ select json_remove( '[ { "a": { "a": true } } ]', '$**.a' ); json_remove( '[ { "a": { "a": true } } ]', '$**.a' ) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_remove' +Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_remove' select json_remove( '[ { "a": true }, { "b": false }, { "c": null }, { "a": null } ]', '$[0].a', '$[2].c' ); json_remove( '[ { "a": true }, { "b": false }, { "c": null }, { "a": null } ]', '$[0].a', '$[2].c' ) [{}, {"b": false}, {}, {"a": null}] @@ -739,7 +739,7 @@ select json_remove( '[ { "a": true }, { "b": [ { "c": { "a": true } } ] }, { "c json_remove( '[ { "a": true }, { "b": [ { "c": { "a": true } } ] }, { "c": null }, { "a": null } ]', '$**.a' ) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_remove' +Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_remove' select json_remove( '{"id": 123, "name": "systemQA", "array": [1, 2, 3]}', '$[0]' ); json_remove( '{"id": 123, "name": "systemQA", "array": [1, 2, 3]}', '$[0]' ) {"id": 123, "name": "systemQA", "array": [1, 2, 3]} @@ -1210,7 +1210,7 @@ select json_keys('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.*.b'); json_keys('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.*.b') NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_keys' +Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_keys' # returns [ "a", "b" ] SELECT JSON_KEYS('{ "a" : "foo", "b" : [ true, { "c" : "123" } ] }'); JSON_KEYS('{ "a" : "foo", "b" : [ true, { "c" : "123" } ] }') @@ -1637,7 +1637,7 @@ select json_array_append(json_compact('{"a": {"b": [3]}}'), '$**[0]', 6); json_array_append(json_compact('{"a": {"b": [3]}}'), '$**[0]', 6) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_array_append' +Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_array_append' # Auto-wrapping, since because the paths identify scalars. # should return {"a": "foo", "b": ["bar", 4], "c": ["wibble", "grape"]} SELECT JSON_ARRAY_APPEND('{"a": "foo", "b": "bar", "c": "wibble"}', @@ -1668,13 +1668,13 @@ select json_array_append( '[[], [], []]', '$[*]', 3, '$[*]', 4); json_array_append( '[[], [], []]', '$[*]', 3, '$[*]', 4) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_array_append' +Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_array_append' error ER_INVALID_JSON_PATH_WILDCARD select json_array_append( '[[], "not array", []]', '$[*]', 3, '$[*]', 4); json_array_append( '[[], "not array", []]', '$[*]', 3, '$[*]', 4) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_array_append' +Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_array_append' SELECT JSON_ARRAY_APPEND ( '{ "a" : "foo", "b" : "bar", "c" : "wibble" }', @@ -1775,73 +1775,73 @@ select json_insert(json_compact('{"a": [1], "b": 2}'), '$.*[1]', 6); json_insert(json_compact('{"a": [1], "b": 2}'), '$.*[1]', 6) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert' +Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert' error ER_INVALID_JSON_PATH_WILDCARD select json_insert(json_compact('{"a": 1, "b": 2}'), '$.*[1]', 6); json_insert(json_compact('{"a": 1, "b": 2}'), '$.*[1]', 6) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert' +Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert' error ER_INVALID_JSON_PATH_WILDCARD select json_insert(json_compact('{"a": {"b": 3}}'), '$.a.*[1]', 6); json_insert(json_compact('{"a": {"b": 3}}'), '$.a.*[1]', 6) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert' +Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert' error ER_INVALID_JSON_PATH_WILDCARD select json_insert(json_compact('{"a": {"b": [3]}}'), '$.a.*[1]', 6); json_insert(json_compact('{"a": {"b": [3]}}'), '$.a.*[1]', 6) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert' +Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert' error ER_INVALID_JSON_PATH_WILDCARD select json_insert(json_compact('{"a": {"b": 3}}'), '$**[1]', 6); json_insert(json_compact('{"a": {"b": 3}}'), '$**[1]', 6) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert' +Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert' error ER_INVALID_JSON_PATH_WILDCARD select json_insert(json_compact('{"a": {"b": [3]}}'), '$**[1]', 6); json_insert(json_compact('{"a": {"b": [3]}}'), '$**[1]', 6) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert' +Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert' error ER_INVALID_JSON_PATH_WILDCARD select json_insert(json_compact('[1]'), '$[*][1]', 6); json_insert(json_compact('[1]'), '$[*][1]', 6) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert' +Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert' error ER_INVALID_JSON_PATH_WILDCARD select json_insert(json_compact('[1]'), '$**[1]', 6); json_insert(json_compact('[1]'), '$**[1]', 6) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert' +Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert' error ER_INVALID_JSON_PATH_WILDCARD select json_insert(json_compact('[1, [2], 3]'), '$[*][1]', 6); json_insert(json_compact('[1, [2], 3]'), '$[*][1]', 6) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert' +Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert' error ER_INVALID_JSON_PATH_WILDCARD select json_insert(json_compact('[1, [2], 3]'), '$**[1]', 6); json_insert(json_compact('[1, [2], 3]'), '$**[1]', 6) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert' +Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert' error ER_INVALID_JSON_PATH_WILDCARD select json_insert(json_compact('[[1]]'), '$[*][1]', 6); json_insert(json_compact('[[1]]'), '$[*][1]', 6) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert' +Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert' error ER_INVALID_JSON_PATH_WILDCARD select json_insert(json_compact('[[1]]'), '$**[1]', 6); json_insert(json_compact('[[1]]'), '$**[1]', 6) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert' +Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert' select json_insert(json_compact('{"a": 3}'), '$[1]', 6); json_insert(json_compact('{"a": 3}'), '$[1]', 6) [{"a": 3}, 6] @@ -2053,19 +2053,19 @@ select json_insert('[]', '$.a.*[1]', 6); json_insert('[]', '$.a.*[1]', 6) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert' +Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert' error ER_INVALID_JSON_PATH_WILDCARD select json_insert('[]', '$**[1]', 6); json_insert('[]', '$**[1]', 6) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert' +Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert' error ER_INVALID_JSON_PATH_WILDCARD select json_insert('[]', '$[*][1]', 6); json_insert('[]', '$[*][1]', 6) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert' +Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert' select json_array_insert( '[ 1, 2, 3 ]', '$[1]', true, '$[1]', false ); json_array_insert( '[ 1, 2, 3 ]', '$[1]', true, '$[1]', false ) [1, false, true, 2, 3] @@ -2154,7 +2154,7 @@ select json_set(json_compact('{"a": {"b": [3]}}'), '$**[1]', 6); json_set(json_compact('{"a": {"b": [3]}}'), '$**[1]', 6) NULL Warnings: -Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_set' +Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_set' SELECT JSON_SET('{ "a" : "foo", "b" : [ 1, 2, 3 ] }', '$.a', JSON_OBJECT()); diff --git a/mysql-test/suite/json/r/json_table.result b/mysql-test/suite/json/r/json_table.result index b71cc95a4e3..44957352865 100644 --- a/mysql-test/suite/json/r/json_table.result +++ b/mysql-test/suite/json/r/json_table.result @@ -1017,3 +1017,129 @@ ERROR 21000: Operand should contain 1 column(s) # # End of 10.6 tests # +# +# Start of 10.9 tests +# +# +# MDEV-27743 Remove Lex::charset +# +SELECT collation(name) +FROM json_table('[{"name":"Jeans"}]', '$[*]' + COLUMNS( +name VARCHAR(10) PATH '$.name' + ) +) AS jt; +collation(name) +utf8mb4_general_ci +SELECT collation(name) +FROM json_table('[{"name":"Jeans"}]', '$[*]' + COLUMNS( +name VARCHAR(10) COLLATE DEFAULT PATH '$.name' + ) +) AS jt; +collation(name) +utf8mb4_general_ci +SELECT collation(name) +FROM json_table('[{"name":"Jeans"}]', '$[*]' + COLUMNS( +name VARCHAR(10) BINARY PATH '$.name' + ) +) AS jt; +collation(name) +utf8mb4_bin +CREATE VIEW v1 AS +SELECT * +FROM json_table('[{"name":"Jeans"}]', '$[*]' + COLUMNS( +name VARCHAR(10) PATH '$.name' + ) +) AS jt; +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `jt`.`name` AS `name` from JSON_TABLE('[{"name":"Jeans"}]', '$[*]' COLUMNS (`name` varchar(10) PATH '$.name')) `jt` latin1 latin1_swedish_ci +SELECT collation(name) FROM v1; +collation(name) +utf8mb4_general_ci +DROP VIEW v1; +CREATE VIEW v1 AS +SELECT * +FROM json_table('[{"name":"Jeans"}]', '$[*]' + COLUMNS( +name VARCHAR(10) COLLATE DEFAULT PATH '$.name' + ) +) AS jt; +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `jt`.`name` AS `name` from JSON_TABLE('[{"name":"Jeans"}]', '$[*]' COLUMNS (`name` varchar(10) PATH '$.name')) `jt` latin1 latin1_swedish_ci +SELECT collation(name) FROM v1; +collation(name) +utf8mb4_general_ci +DROP VIEW v1; +CREATE VIEW v1 AS +SELECT * +FROM json_table('[{"name":"Jeans"}]', '$[*]' + COLUMNS( +name VARCHAR(10) BINARY PATH '$.name' + ) +) AS jt; +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `jt`.`name` AS `name` from JSON_TABLE('[{"name":"Jeans"}]', '$[*]' COLUMNS (`name` varchar(10) CHARSET utf8mb4 COLLATE utf8mb4_bin PATH '$.name')) `jt` latin1 latin1_swedish_ci +SELECT collation(name) FROM v1; +collation(name) +utf8mb4_bin +DROP VIEW v1; +# +# MDEV-28319: Assertion `cur_step->type & JSON_PATH_KEY' failed in json_find_path +# +SELECT * FROM JSON_TABLE('{"foo":{"bar":1},"qux":2}', '$' COLUMNS(c1 VARCHAR(8) PATH '$[0]', c2 CHAR(8) PATH '$.*.x')) AS js; +c1 c2 +NULL NULL +# +# MDEV-29446 Change SHOW CREATE TABLE to display default collations +# +CREATE VIEW v1 AS +SELECT * FROM +JSON_TABLE('[{"name":"Laptop"}]', '$[*]' +COLUMNS +( +name VARCHAR(10) CHARACTER SET latin1 PATH '$.name') +) AS jt; +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `jt`.`name` AS `name` from JSON_TABLE('[{"name":"Laptop"}]', '$[*]' COLUMNS (`name` varchar(10) CHARSET latin1 COLLATE latin1_swedish_ci PATH '$.name')) `jt` latin1 latin1_swedish_ci +DROP VIEW v1; +CREATE VIEW v1 AS +SELECT * FROM +JSON_TABLE('[{"name":"Laptop"}]', '$[*]' +COLUMNS +( +name VARCHAR(10) CHARACTER SET utf8mb3 PATH '$.name') +) AS jt; +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `jt`.`name` AS `name` from JSON_TABLE('[{"name":"Laptop"}]', '$[*]' COLUMNS (`name` varchar(10) CHARSET utf8mb3 COLLATE utf8mb3_general_ci PATH '$.name')) `jt` latin1 latin1_swedish_ci +DROP VIEW v1; +CREATE VIEW v1 AS +SELECT * FROM +JSON_TABLE('[{"name":"Laptop"}]', '$[*]' +COLUMNS +( +name VARCHAR(10) CHARACTER SET BINARY PATH '$.name') +) AS jt; +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `jt`.`name` AS `name` from JSON_TABLE('[{"name":"Laptop"}]', '$[*]' COLUMNS (`name` varbinary(10) PATH '$.name')) `jt` latin1 latin1_swedish_ci +DROP VIEW v1; +CREATE VIEW v1 AS +SELECT * FROM +JSON_TABLE('[{"name":"Laptop"}]', '$[*]' +COLUMNS +( +name ENUM('Laptop') CHARACTER SET BINARY PATH '$.name') +) AS jt; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ENUM('Laptop') CHARACTER SET BINARY PATH '$.name') +) AS jt' at line 6 +# +# End of 10.9 tests +# diff --git a/mysql-test/suite/json/t/json_table.test b/mysql-test/suite/json/t/json_table.test index ec330046f25..05db8f66a59 100644 --- a/mysql-test/suite/json/t/json_table.test +++ b/mysql-test/suite/json/t/json_table.test @@ -874,3 +874,124 @@ SELECT 1 FROM JSON_TABLE (row(1,2), '$' COLUMNS (o FOR ORDINALITY)) AS j; --echo # --echo # End of 10.6 tests --echo # + +--echo # +--echo # Start of 10.9 tests +--echo # + +--echo # +--echo # MDEV-27743 Remove Lex::charset +--echo # + +SELECT collation(name) +FROM json_table('[{"name":"Jeans"}]', '$[*]' + COLUMNS( + name VARCHAR(10) PATH '$.name' + ) +) AS jt; + +SELECT collation(name) +FROM json_table('[{"name":"Jeans"}]', '$[*]' + COLUMNS( + name VARCHAR(10) COLLATE DEFAULT PATH '$.name' + ) +) AS jt; + +SELECT collation(name) +FROM json_table('[{"name":"Jeans"}]', '$[*]' + COLUMNS( + name VARCHAR(10) BINARY PATH '$.name' + ) +) AS jt; + + +CREATE VIEW v1 AS +SELECT * +FROM json_table('[{"name":"Jeans"}]', '$[*]' + COLUMNS( + name VARCHAR(10) PATH '$.name' + ) +) AS jt; +SHOW CREATE VIEW v1; +SELECT collation(name) FROM v1; +DROP VIEW v1; + +CREATE VIEW v1 AS +SELECT * +FROM json_table('[{"name":"Jeans"}]', '$[*]' + COLUMNS( + name VARCHAR(10) COLLATE DEFAULT PATH '$.name' + ) +) AS jt; +SHOW CREATE VIEW v1; +SELECT collation(name) FROM v1; +DROP VIEW v1; + +CREATE VIEW v1 AS +SELECT * +FROM json_table('[{"name":"Jeans"}]', '$[*]' + COLUMNS( + name VARCHAR(10) BINARY PATH '$.name' + ) +) AS jt; +SHOW CREATE VIEW v1; +SELECT collation(name) FROM v1; +DROP VIEW v1; + +--echo # +--echo # MDEV-28319: Assertion `cur_step->type & JSON_PATH_KEY' failed in json_find_path +--echo # + +SELECT * FROM JSON_TABLE('{"foo":{"bar":1},"qux":2}', '$' COLUMNS(c1 VARCHAR(8) PATH '$[0]', c2 CHAR(8) PATH '$.*.x')) AS js; + + +--echo # +--echo # MDEV-29446 Change SHOW CREATE TABLE to display default collations +--echo # + +CREATE VIEW v1 AS +SELECT * FROM +JSON_TABLE('[{"name":"Laptop"}]', '$[*]' +COLUMNS +( + name VARCHAR(10) CHARACTER SET latin1 PATH '$.name') +) AS jt; +SHOW CREATE VIEW v1; +DROP VIEW v1; + +CREATE VIEW v1 AS +SELECT * FROM +JSON_TABLE('[{"name":"Laptop"}]', '$[*]' +COLUMNS +( + name VARCHAR(10) CHARACTER SET utf8mb3 PATH '$.name') +) AS jt; +SHOW CREATE VIEW v1; +DROP VIEW v1; + +CREATE VIEW v1 AS +SELECT * FROM +JSON_TABLE('[{"name":"Laptop"}]', '$[*]' +COLUMNS +( + name VARCHAR(10) CHARACTER SET BINARY PATH '$.name') +) AS jt; +SHOW CREATE VIEW v1; +DROP VIEW v1; + +# ENUM is not supported yet in JSON_TABLE. +# But if it is eventually supported, the below +# test should be modified to make sure that "CHARACTER SET BINARY" +# is not followed by "COLLATE BINARY". +--error ER_PARSE_ERROR +CREATE VIEW v1 AS +SELECT * FROM +JSON_TABLE('[{"name":"Laptop"}]', '$[*]' +COLUMNS +( + name ENUM('Laptop') CHARACTER SET BINARY PATH '$.name') +) AS jt; + +--echo # +--echo # End of 10.9 tests +--echo # diff --git a/mysql-test/suite/perfschema/r/max_program_zero.result b/mysql-test/suite/perfschema/r/max_program_zero.result index f236f149a77..5435efb34ae 100644 --- a/mysql-test/suite/perfschema/r/max_program_zero.result +++ b/mysql-test/suite/perfschema/r/max_program_zero.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 1 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/nesting.result b/mysql-test/suite/perfschema/r/nesting.result index ba655d3c329..9e18e5ac272 100644 --- a/mysql-test/suite/perfschema/r/nesting.result +++ b/mysql-test/suite/perfschema/r/nesting.result @@ -128,12 +128,12 @@ relative_event_id relative_end_event_id event_name comment nesting_event_type re 11 11 stage/sql/Executing (stage) STATEMENT 0 12 12 stage/sql/End of update loop (stage) STATEMENT 0 13 13 stage/sql/Query end (stage) STATEMENT 0 -14 14 stage/sql/Commit (stage) STATEMENT 0 -15 15 stage/sql/closing tables (stage) STATEMENT 0 -16 16 stage/sql/Starting cleanup (stage) STATEMENT 0 -17 17 stage/sql/Freeing items (stage) STATEMENT 0 -18 18 wait/io/socket/sql/client_connection send STATEMENT 0 -19 19 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STATEMENT 0 +14 15 stage/sql/Commit (stage) STATEMENT 0 +15 15 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STAGE 14 +16 16 stage/sql/closing tables (stage) STATEMENT 0 +17 17 stage/sql/Starting cleanup (stage) STATEMENT 0 +18 18 stage/sql/Freeing items (stage) STATEMENT 0 +19 19 wait/io/socket/sql/client_connection send STATEMENT 0 20 21 stage/sql/Reset for next command (stage) STATEMENT 0 21 21 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 20 22 22 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 0 @@ -152,12 +152,12 @@ relative_event_id relative_end_event_id event_name comment nesting_event_type re 35 35 stage/sql/Executing (stage) STATEMENT 24 36 36 stage/sql/End of update loop (stage) STATEMENT 24 37 37 stage/sql/Query end (stage) STATEMENT 24 -38 38 stage/sql/Commit (stage) STATEMENT 24 -39 39 stage/sql/closing tables (stage) STATEMENT 24 -40 40 stage/sql/Starting cleanup (stage) STATEMENT 24 -41 41 stage/sql/Freeing items (stage) STATEMENT 24 -42 42 wait/io/socket/sql/client_connection send STATEMENT 24 -43 43 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STATEMENT 24 +38 39 stage/sql/Commit (stage) STATEMENT 24 +39 39 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STAGE 38 +40 40 stage/sql/closing tables (stage) STATEMENT 24 +41 41 stage/sql/Starting cleanup (stage) STATEMENT 24 +42 42 stage/sql/Freeing items (stage) STATEMENT 24 +43 43 wait/io/socket/sql/client_connection send STATEMENT 24 44 45 stage/sql/Reset for next command (stage) STATEMENT 24 45 45 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 44 46 46 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 24 @@ -176,12 +176,12 @@ relative_event_id relative_end_event_id event_name comment nesting_event_type re 59 59 stage/sql/Executing (stage) STATEMENT 48 60 60 stage/sql/End of update loop (stage) STATEMENT 48 61 61 stage/sql/Query end (stage) STATEMENT 48 -62 62 stage/sql/Commit (stage) STATEMENT 48 -63 63 stage/sql/closing tables (stage) STATEMENT 48 -64 64 stage/sql/Starting cleanup (stage) STATEMENT 48 -65 65 stage/sql/Freeing items (stage) STATEMENT 48 -66 66 wait/io/socket/sql/client_connection send STATEMENT 48 -67 67 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STATEMENT 48 +62 63 stage/sql/Commit (stage) STATEMENT 48 +63 63 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STAGE 62 +64 64 stage/sql/closing tables (stage) STATEMENT 48 +65 65 stage/sql/Starting cleanup (stage) STATEMENT 48 +66 66 stage/sql/Freeing items (stage) STATEMENT 48 +67 67 wait/io/socket/sql/client_connection send STATEMENT 48 68 69 stage/sql/Reset for next command (stage) STATEMENT 48 69 69 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 68 70 70 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 48 @@ -203,12 +203,12 @@ select "With a third part to make things complete" as payload NULL NULL 84 84 stage/sql/Executing (stage) STATEMENT 72 85 85 stage/sql/End of update loop (stage) STATEMENT 72 86 86 stage/sql/Query end (stage) STATEMENT 72 -87 87 stage/sql/Commit (stage) STATEMENT 72 -88 88 stage/sql/closing tables (stage) STATEMENT 72 -89 89 stage/sql/Starting cleanup (stage) STATEMENT 72 -90 92 stage/sql/Freeing items (stage) STATEMENT 72 -91 91 wait/io/socket/sql/client_connection send STAGE 90 -92 92 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STAGE 90 +87 88 stage/sql/Commit (stage) STATEMENT 72 +88 88 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STAGE 87 +89 89 stage/sql/closing tables (stage) STATEMENT 72 +90 90 stage/sql/Starting cleanup (stage) STATEMENT 72 +91 92 stage/sql/Freeing items (stage) STATEMENT 72 +92 92 wait/io/socket/sql/client_connection send STAGE 91 93 110 statement/sql/select select "And this is the second part of a multi query" as payload; select "With a third part to make things complete" as payload NULL NULL 94 96 stage/sql/starting (stage) STATEMENT 93 @@ -222,12 +222,12 @@ select "With a third part to make things complete" as payload NULL NULL 102 102 stage/sql/Executing (stage) STATEMENT 93 103 103 stage/sql/End of update loop (stage) STATEMENT 93 104 104 stage/sql/Query end (stage) STATEMENT 93 -105 105 stage/sql/Commit (stage) STATEMENT 93 -106 106 stage/sql/closing tables (stage) STATEMENT 93 -107 107 stage/sql/Starting cleanup (stage) STATEMENT 93 -108 110 stage/sql/Freeing items (stage) STATEMENT 93 -109 109 wait/io/socket/sql/client_connection send STAGE 108 -110 110 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STAGE 108 +105 106 stage/sql/Commit (stage) STATEMENT 93 +106 106 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STAGE 105 +107 107 stage/sql/closing tables (stage) STATEMENT 93 +108 108 stage/sql/Starting cleanup (stage) STATEMENT 93 +109 110 stage/sql/Freeing items (stage) STATEMENT 93 +110 110 wait/io/socket/sql/client_connection send STAGE 109 111 129 statement/sql/select select "With a third part to make things complete" as payload NULL NULL 112 113 stage/sql/starting (stage) STATEMENT 111 113 113 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 112 @@ -239,12 +239,12 @@ select "With a third part to make things complete" as payload NULL NULL 119 119 stage/sql/Executing (stage) STATEMENT 111 120 120 stage/sql/End of update loop (stage) STATEMENT 111 121 121 stage/sql/Query end (stage) STATEMENT 111 -122 122 stage/sql/Commit (stage) STATEMENT 111 -123 123 stage/sql/closing tables (stage) STATEMENT 111 -124 124 stage/sql/Starting cleanup (stage) STATEMENT 111 -125 125 stage/sql/Freeing items (stage) STATEMENT 111 -126 126 wait/io/socket/sql/client_connection send STATEMENT 111 -127 127 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STATEMENT 111 +122 123 stage/sql/Commit (stage) STATEMENT 111 +123 123 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STAGE 122 +124 124 stage/sql/closing tables (stage) STATEMENT 111 +125 125 stage/sql/Starting cleanup (stage) STATEMENT 111 +126 126 stage/sql/Freeing items (stage) STATEMENT 111 +127 127 wait/io/socket/sql/client_connection send STATEMENT 111 128 129 stage/sql/Reset for next command (stage) STATEMENT 111 129 129 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 128 130 130 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 111 @@ -263,12 +263,12 @@ select "With a third part to make things complete" as payload NULL NULL 143 143 stage/sql/Executing (stage) STATEMENT 132 144 144 stage/sql/End of update loop (stage) STATEMENT 132 145 145 stage/sql/Query end (stage) STATEMENT 132 -146 146 stage/sql/Commit (stage) STATEMENT 132 -147 147 stage/sql/closing tables (stage) STATEMENT 132 -148 148 stage/sql/Starting cleanup (stage) STATEMENT 132 -149 149 stage/sql/Freeing items (stage) STATEMENT 132 -150 150 wait/io/socket/sql/client_connection send STATEMENT 132 -151 151 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STATEMENT 132 +146 147 stage/sql/Commit (stage) STATEMENT 132 +147 147 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STAGE 146 +148 148 stage/sql/closing tables (stage) STATEMENT 132 +149 149 stage/sql/Starting cleanup (stage) STATEMENT 132 +150 150 stage/sql/Freeing items (stage) STATEMENT 132 +151 151 wait/io/socket/sql/client_connection send STATEMENT 132 152 153 stage/sql/Reset for next command (stage) STATEMENT 132 153 153 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 152 disconnect con1; diff --git a/mysql-test/suite/perfschema/r/ortho_iter.result b/mysql-test/suite/perfschema/r/ortho_iter.result index 4224c3e520d..9489c1049e5 100644 --- a/mysql-test/suite/perfschema/r/ortho_iter.result +++ b/mysql-test/suite/perfschema/r/ortho_iter.result @@ -255,7 +255,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/privilege_table_io.result b/mysql-test/suite/perfschema/r/privilege_table_io.result index ab0d18e3227..94cc2b33b49 100644 --- a/mysql-test/suite/perfschema/r/privilege_table_io.result +++ b/mysql-test/suite/perfschema/r/privilege_table_io.result @@ -57,7 +57,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_disable_idle.result b/mysql-test/suite/perfschema/r/start_server_disable_idle.result index fda05bf6df5..bfc49fd3480 100644 --- a/mysql-test/suite/perfschema/r/start_server_disable_idle.result +++ b/mysql-test/suite/perfschema/r/start_server_disable_idle.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_disable_stages.result b/mysql-test/suite/perfschema/r/start_server_disable_stages.result index 7db242f237f..e9f20398467 100644 --- a/mysql-test/suite/perfschema/r/start_server_disable_stages.result +++ b/mysql-test/suite/perfschema/r/start_server_disable_stages.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_disable_statements.result b/mysql-test/suite/perfschema/r/start_server_disable_statements.result index 31ddb4eb3cd..ffb45f4f55f 100644 --- a/mysql-test/suite/perfschema/r/start_server_disable_statements.result +++ b/mysql-test/suite/perfschema/r/start_server_disable_statements.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_disable_transactions.result b/mysql-test/suite/perfschema/r/start_server_disable_transactions.result index 2a2d42f4d51..e271d5a10e6 100644 --- a/mysql-test/suite/perfschema/r/start_server_disable_transactions.result +++ b/mysql-test/suite/perfschema/r/start_server_disable_transactions.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_disable_waits.result b/mysql-test/suite/perfschema/r/start_server_disable_waits.result index 2115c747755..833da22583e 100644 --- a/mysql-test/suite/perfschema/r/start_server_disable_waits.result +++ b/mysql-test/suite/perfschema/r/start_server_disable_waits.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_innodb.result b/mysql-test/suite/perfschema/r/start_server_innodb.result index 25b8a7b9c1f..e3ff0f514a7 100644 --- a/mysql-test/suite/perfschema/r/start_server_innodb.result +++ b/mysql-test/suite/perfschema/r/start_server_innodb.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_low_index.result b/mysql-test/suite/perfschema/r/start_server_low_index.result index b34f86da89f..ffdf9d65b87 100644 --- a/mysql-test/suite/perfschema/r/start_server_low_index.result +++ b/mysql-test/suite/perfschema/r/start_server_low_index.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_low_table_lock.result b/mysql-test/suite/perfschema/r/start_server_low_table_lock.result index e8bf9f48da8..dbb404f6129 100644 --- a/mysql-test/suite/perfschema/r/start_server_low_table_lock.result +++ b/mysql-test/suite/perfschema/r/start_server_low_table_lock.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_account.result b/mysql-test/suite/perfschema/r/start_server_no_account.result index 021ff9f9e3d..f92b0e6bec6 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_account.result +++ b/mysql-test/suite/perfschema/r/start_server_no_account.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result index 0a7f1c601ef..fefad55c209 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result index de4ff2f5a72..0c2f65f6ac9 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_class.result b/mysql-test/suite/perfschema/r/start_server_no_file_class.result index 997220d3169..c3f06b53425 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_file_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_file_class.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result index de81943afe8..fd39807d567 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_host.result b/mysql-test/suite/perfschema/r/start_server_no_host.result index ce156302b22..43111c5ec40 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_host.result +++ b/mysql-test/suite/perfschema/r/start_server_no_host.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_index.result b/mysql-test/suite/perfschema/r/start_server_no_index.result index d46095841c2..15d1184bcbe 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_index.result +++ b/mysql-test/suite/perfschema/r/start_server_no_index.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_mdl.result b/mysql-test/suite/perfschema/r/start_server_no_mdl.result index c1f7e656dc6..b8de90453ce 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_mdl.result +++ b/mysql-test/suite/perfschema/r/start_server_no_mdl.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_memory_class.result b/mysql-test/suite/perfschema/r/start_server_no_memory_class.result index 94c8a7da85a..60066264c90 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_memory_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_memory_class.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result index e44307fdbe6..3353b46bbcb 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result index 6647def50c1..d41da361733 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_prepared_stmts_instances.result b/mysql-test/suite/perfschema/r/start_server_no_prepared_stmts_instances.result index 9b5ad931858..4919de6bb6c 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_prepared_stmts_instances.result +++ b/mysql-test/suite/perfschema/r/start_server_no_prepared_stmts_instances.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result index fdd3fe48bf3..02a119bdc68 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result index 09faadaa4ce..ead01ce2d0e 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result b/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result index 2d93be52186..a99f1c0f9be 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result +++ b/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result b/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result index e9eff67712f..7c148889412 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result +++ b/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_socket_class.result b/mysql-test/suite/perfschema/r/start_server_no_socket_class.result index f5b00a114dd..dec0680c511 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_socket_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_socket_class.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 0 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result b/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result index d1b3e14d349..20adf1a9f64 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 0 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_stage_class.result b/mysql-test/suite/perfschema/r/start_server_no_stage_class.result index 136c54885bf..044f9475041 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_stage_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_stage_class.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 0 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_stages_history.result b/mysql-test/suite/perfschema/r/start_server_no_stages_history.result index 3e2d7acf4ec..350f2c6637d 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_stages_history.result +++ b/mysql-test/suite/perfschema/r/start_server_no_stages_history.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result index 5db6987834b..d2d7063c32f 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result +++ b/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_statements_history.result b/mysql-test/suite/perfschema/r/start_server_no_statements_history.result index 69a69986a72..8bcb3c56a00 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_statements_history.result +++ b/mysql-test/suite/perfschema/r/start_server_no_statements_history.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result index 2f68483cfae..2a2bf5d3f7c 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result +++ b/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result b/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result index 3d131f1a2e0..ec6e40acc00 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result +++ b/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 0 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_table_inst.result b/mysql-test/suite/perfschema/r/start_server_no_table_inst.result index 95f8f226c41..b3f1e4cbcf2 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_table_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_table_inst.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 0 diff --git a/mysql-test/suite/perfschema/r/start_server_no_table_lock.result b/mysql-test/suite/perfschema/r/start_server_no_table_lock.result index b54d6c762e1..baf9f761358 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_table_lock.result +++ b/mysql-test/suite/perfschema/r/start_server_no_table_lock.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result index 9182677d8b8..cd204f3d811 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result index ff90c471599..d083484cd7c 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_transactions_history.result b/mysql-test/suite/perfschema/r/start_server_no_transactions_history.result index 4535bcd02ed..f5a12e5473d 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_transactions_history.result +++ b/mysql-test/suite/perfschema/r/start_server_no_transactions_history.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_transactions_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_transactions_history_long.result index f3eefb98a43..76ae9d5fa4e 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_transactions_history_long.result +++ b/mysql-test/suite/perfschema/r/start_server_no_transactions_history_long.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_user.result b/mysql-test/suite/perfschema/r/start_server_no_user.result index 9ca79837845..4bd472a22a9 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_user.result +++ b/mysql-test/suite/perfschema/r/start_server_no_user.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_waits_history.result b/mysql-test/suite/perfschema/r/start_server_no_waits_history.result index ee22d5b5bed..f59b156ce1e 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_waits_history.result +++ b/mysql-test/suite/perfschema/r/start_server_no_waits_history.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result index adbad8d166f..cc70572c7ef 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result +++ b/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_off.result b/mysql-test/suite/perfschema/r/start_server_off.result index 022f7d1096e..a53d591938c 100644 --- a/mysql-test/suite/perfschema/r/start_server_off.result +++ b/mysql-test/suite/perfschema/r/start_server_off.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_on.result b/mysql-test/suite/perfschema/r/start_server_on.result index 25b8a7b9c1f..e3ff0f514a7 100644 --- a/mysql-test/suite/perfschema/r/start_server_on.result +++ b/mysql-test/suite/perfschema/r/start_server_on.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_variables.result b/mysql-test/suite/perfschema/r/start_server_variables.result index 65d3a7b55b5..7d1d1e05375 100644 --- a/mysql-test/suite/perfschema/r/start_server_variables.result +++ b/mysql-test/suite/perfschema/r/start_server_variables.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/statement_program_lost_inst.result b/mysql-test/suite/perfschema/r/statement_program_lost_inst.result index 264778c06e4..05ec7b0b2b5 100644 --- a/mysql-test/suite/perfschema/r/statement_program_lost_inst.result +++ b/mysql-test/suite/perfschema/r/statement_program_lost_inst.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 2 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.result b/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.result index 55cbbd8843d..dfad83e4b75 100644 --- a/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.result +++ b/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.result @@ -18,7 +18,7 @@ grant test_role to test_user@localhost; set default role test_role for root@localhost; drop role test_role; drop user test_user@localhost; -alter table user add column default_role char(80) binary default '' not null +alter table user add column default_role char(80) default '' not null COLLATE utf8_general_ci after is_role; alter table user add max_statement_time decimal(12,6) default 0 not null diff --git a/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.test b/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.test index 9cf0d7b4aff..dac6eab21e9 100644 --- a/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.test +++ b/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.test @@ -36,7 +36,7 @@ set default role test_role for root@localhost; drop role test_role; drop user test_user@localhost; -alter table user add column default_role char(80) binary default '' not null +alter table user add column default_role char(80) default '' not null COLLATE utf8_general_ci after is_role; alter table user add max_statement_time decimal(12,6) default 0 not null diff --git a/mysql-test/suite/rpl/include/mysqlbinlog_slave_consistency.inc b/mysql-test/suite/rpl/include/mysqlbinlog_slave_consistency.inc new file mode 100644 index 00000000000..48e4399d162 --- /dev/null +++ b/mysql-test/suite/rpl/include/mysqlbinlog_slave_consistency.inc @@ -0,0 +1,194 @@ +# This file provides the structure to run a single test that ensures the +# mariadb-binlog command line tool is consistent with replicas for event +# filtering. The test is configured using the following input parameters, where +# each is nullable (i.e. it will not be used to configure mariadb-binlog or +# the replica). +# +# param $do_domain_ids : A list of domain ids to include in replication +# param $ignore_domain_ids : A list of domain ids to exclude from replication +# param $ignore_server_ids : A list of server ids to exclude from replication +# param $start_position : The GTID positions to begin replication from in +# the specified domains +# param $stop_position : The GTID positions that mark the end of an event +# stream in a particular domain +# +# param $con1 : The connection name of the primary server +# param $con2 : The connection name of the replica server +# param $strict_mode : Uses input and checks for out of order GTIDs +# param $strict_mode_err : A boolean that provides expectations for strict +# mode to error +# param $slave_sql_errno : Expected error number of the slave SQL thread + + +--let $include_filename= mysqlbinlog_slave_consistency.inc +--source include/begin_include_file.inc + +--enable_query_log + +if (!$con1) +{ + --let $con1=master +} +if (!$con2) +{ + --let $con2=slave +} + +if (!$strict_mode) +{ + --connection $con2 + set @@global.gtid_strict_mode=0; + --let $sql_input_file=include/sql_multisource.inc +} + +if ($strict_mode) +{ + --connection $con2 + set @@global.gtid_strict_mode=1; + --let $sql_input_file=include/sql_out_of_order_gtid.inc +} + +--connection $con2 +--source include/stop_slave.inc + +--connection $con1 +--echo # Populating $con1 data +--source $sql_input_file +--source include/save_master_gtid.inc + +--let $MYSQLD_DATADIR=`select @@datadir` +--let $MYSQLBINLOG_STDERR=$MYSQLD_DATADIR/mysqlbinlog_stderr.out +--let BINLOG_FILENAME= query_get_value(SHOW BINARY LOGS, Log_name, 1) +--let BINLOG_FILE_PARAM= $MYSQLD_DATADIR/$BINLOG_FILENAME.orig +--copy_file $MYSQLD_DATADIR/$BINLOG_FILENAME $BINLOG_FILE_PARAM + +--connection $con2 +--let $msbl_args= +if (`SELECT strcmp("$start_position","") != 0`) +{ + eval set global gtid_slave_pos="$start_position"; + --let $msbl_args= $msbl_args --start-position=$start_position +} + +--let $cm_args= MASTER_USE_GTID=slave_pos +if (`SELECT strcmp("$do_domain_ids","") != 0`) +{ + --let $cm_args= $cm_args, DO_DOMAIN_IDS=($do_domain_ids) + --let $msbl_args= $msbl_args --do-domain-ids=$do_domain_ids +} +if (`SELECT strcmp("$ignore_domain_ids","") != 0`) +{ + --let $cm_args= $cm_args, IGNORE_DOMAIN_IDS=($ignore_domain_ids) + --let $msbl_args= $msbl_args --ignore-domain-ids=$ignore_domain_ids +} +if (`SELECT strcmp("$ignore_server_ids","") != 0`) +{ + --let $cm_args= $cm_args, IGNORE_SERVER_IDS=($ignore_server_ids) + --let $msbl_args= $msbl_args --ignore-server-ids=$ignore_server_ids +} +if ($strict_mode) +{ + --let $msbl_args= $msbl_args --gtid-strict-mode +} +eval CHANGE MASTER TO $cm_args; + +--let $start_slave_args= +if (`SELECT strcmp("$stop_position","") != 0`) +{ + --let $start_slave_args= UNTIL master_gtid_pos="$stop_position" + --let $msbl_args= $msbl_args --stop-position=$stop_position +} + +eval START SLAVE $start_slave_args; + +if ($slave_sql_errno) +{ + --echo # $con2 SQL Thread error expected - waiting for errno $slave_sql_errno + --source include/wait_for_slave_sql_error.inc +} + +# If we are not expecting an error, wait for con2 to catch up +if (!$slave_sql_errno) +{ + --echo # No $con2 error expecting - waiting for $con2 to catch up to $con1 + + # Stop position was not specified + if (`SELECT strcmp("$stop_position","") = 0`) + { + --source include/sync_with_master_gtid.inc + } + + # Stop position was specified + if (`SELECT strcmp("$stop_position","") != 0`) + { + --echo # Because there is a stop position we wait for all events to process + --echo # and $con2 to automatically stop + --source include/wait_for_slave_to_stop.inc + } +} + +--echo # Stop $con2 so it stops receiving $con1 events. +--source include/stop_slave.inc + +--connection $con1 +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +RESET MASTER; +--echo # MYSQL_BINLOG BINLOG_FILE_PARAM $msbl_args 2> MYSQLBINLOG_STDERR | MYSQL +--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM $msbl_args 2> $MYSQLBINLOG_STDERR | $MYSQL + +--source include/rpl_check_table_consistency.inc + +if ($strict_mode) +{ + --echo # Strict mode enabled - checking mysqlbinlog error output for out + --echo # of order GTIDs + --let SEARCH_FILE=$MYSQLBINLOG_STDERR + --let SEARCH_PATTERN=Found out of order GTID + if ($strict_mode_err) + { + --echo # Expecting to find out of order GTID error.. + } + if (!$strict_mode_err) + { + --echo # Not expecting to find out of order GTID error.. + } + --source include/search_pattern_in_file.inc +} + +--echo # Test finished - resetting $con1 and $con2.. +--connection $con2 +RESET SLAVE; +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); + +--connection $con1 +RESET MASTER; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +--source include/save_master_gtid.inc + +--connection $con2 +--source include/start_slave.inc +--source include/wait_for_slave_to_start.inc +--source include/sync_with_master_gtid.inc +--source include/stop_slave.inc +RESET SLAVE; +set global gtid_slave_pos=""; +RESET MASTER; + +--connection $con1 +RESET MASTER; + +--connection $con2 +if ($strict_mode) +{ + set @@global.gtid_strict_mode=0; +} +--source include/start_slave.inc + +--connection $con1 +--remove_file $BINLOG_FILE_PARAM +--remove_file $MYSQLBINLOG_STDERR + +--let $include_filename= mysqlbinlog_slave_consistency.inc +--source include/end_include_file.inc diff --git a/mysql-test/suite/rpl/include/rpl_check_table_consistency.inc b/mysql-test/suite/rpl/include/rpl_check_table_consistency.inc new file mode 100644 index 00000000000..957a5d525a7 --- /dev/null +++ b/mysql-test/suite/rpl/include/rpl_check_table_consistency.inc @@ -0,0 +1,63 @@ +# This file provides logic to ensure that all tables in a database are the +# same between two connections. +# +# param $check_db : The name of the database to validate all tables are the +# same within (test by default) +# param $con1 : The connection name of the primary server, defaults to +# master +# param $con2 : The connection name of the replica server, defaults to +# slave + +--let $include_filename= rpl_check_table_consistency.inc +--source include/begin_include_file.inc + +if (!$con1) +{ + --let $con1= master +} +if (!$con2) +{ + --let $con2= slave +} +if (!$check_db) +{ + --let $check_db= test +} + +--connection $con2 +--let $n_tables= `select count(*) from information_schema.tables WHERE table_schema = '$check_db'` + +--echo # Checking consistency of '$check_db' database tables between $con1 and $con2 + +--connection $con1 +--let $c1_n_tables= `select count(*) from information_schema.tables WHERE table_schema = '$check_db'` +if (`SELECT $c1_n_tables != $n_tables`) +{ + die "$con1 had $c1_n_tables tables but $con2 had $n_tables after binlog replay"; +} +--echo # Both servers have $n_tables tables + +--let $ctr= 1 +--echo # Verifying integrity of tables.. +while($ctr <= $n_tables) +{ + --let $cksum_tbl= query_get_value(SELECT table_name FROM information_schema.tables WHERE table_schema = 'test' ORDER BY table_name ASC, table_name, $ctr) + --connection $con1 + --let $c1_cksum= `CHECKSUM TABLE $cksum_tbl` + --connection $con2 + --let $c2_cksum= `CHECKSUM TABLE $cksum_tbl` + + if ($c1_cksum != $c2_cksum) + { + die "Table $cksum_tbl differs between connections $con1 and $con2"; + } + if ($c1_cksum == $c2_cksum) + { + --echo # $cksum_tbl is equivalent on $con1 and $con2 + } + --let $ctr= `SELECT $ctr+1` +} +--echo # All tables are consistent + +--let $include_filename= rpl_check_table_consistency.inc +--source include/end_include_file.inc diff --git a/mysql-test/suite/rpl/include/sql_multisource.inc b/mysql-test/suite/rpl/include/sql_multisource.inc new file mode 100644 index 00000000000..761b68421d9 --- /dev/null +++ b/mysql-test/suite/rpl/include/sql_multisource.inc @@ -0,0 +1,45 @@ +# Populate the active connection server with events that come from varying +# domain and server ids + +--disable_query_log + +# Save old state +let $ORIG_GTID_DOMAIN_ID = `select @@session.gtid_domain_id`; +let $ORIG_SERVER_ID = `select @@session.server_id`; + +SET @@session.gtid_domain_id= 0; +SET @@session.server_id= 1; +CREATE TABLE t1 (a int); + +SET @@session.server_id= 3; +CREATE TABLE t2 (a int); +INSERT INTO t2 values (3); + +SET @@session.gtid_domain_id= 1; +SET @@session.server_id= 1; +CREATE TABLE t3 (a int); +INSERT INTO t3 values (4); + +SET @@session.server_id= 4; +CREATE TABLE t4 (a int); +INSERT INTO t4 values (5); + +SET @@session.gtid_domain_id= 0; +SET @@session.server_id= 1; +INSERT INTO t1 values (1); + +SET @@session.gtid_domain_id= 2; +SET @@session.server_id= 1; +CREATE TABLE t5 (a int); +INSERT INTO t5 values (6); + +SET @@session.gtid_domain_id= 0; +SET @@session.server_id= 1; +INSERT INTO t1 values (2); + +FLUSH LOGS; + +--eval SET @@session.gtid_domain_id= $ORIG_GTID_DOMAIN_ID +--eval SET @@session.server_id= $ORIG_SERVER_ID + +--enable_query_log diff --git a/mysql-test/suite/rpl/include/sql_out_of_order_gtid.inc b/mysql-test/suite/rpl/include/sql_out_of_order_gtid.inc new file mode 100644 index 00000000000..82291a887e9 --- /dev/null +++ b/mysql-test/suite/rpl/include/sql_out_of_order_gtid.inc @@ -0,0 +1,43 @@ +# SQL file with out of order GTIDs coming from various domains and servers + +--disable_query_log + +# Save old state +let $ORIG_GTID_DOMAIN_ID = `select @@session.gtid_domain_id`; +let $ORIG_SERVER_ID = `select @@session.server_id`; + +SET @@session.gtid_domain_id= 0; +SET @@session.server_id= 1; +CREATE TABLE t1 (a int); +INSERT INTO t1 values (1); + +SET @@session.server_id= 3; +CREATE TABLE t2 (a int); +SET @@session.gtid_seq_no= 6; +INSERT INTO t2 values (2); +SET @@session.gtid_seq_no= 5; +INSERT INTO t2 values (1); +SET @@session.gtid_seq_no= 7; +INSERT INTO t2 values (3); + +SET @@session.gtid_domain_id= 1; +SET @@session.server_id= 1; +CREATE TABLE t3 (a int); +INSERT INTO t3 values (1); +SET @@session.gtid_seq_no= 4; +INSERT INTO t3 values (3); +SET @@session.gtid_seq_no= 3; +INSERT INTO t3 values (2); +SET @@session.gtid_seq_no= 5; +INSERT INTO t3 values (4); + +SET @@session.gtid_domain_id= 0; +SET @@session.server_id= 1; +INSERT INTO t1 values (2); + +FLUSH LOGS; + +--eval SET @@session.gtid_domain_id= $ORIG_GTID_DOMAIN_ID +--eval SET @@session.server_id= $ORIG_SERVER_ID + +--enable_query_log diff --git a/mysql-test/suite/rpl/r/rpl_mysqlbinlog_slave_consistency.result b/mysql-test/suite/rpl/r/rpl_mysqlbinlog_slave_consistency.result new file mode 100644 index 00000000000..e69fb2fc62d --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_mysqlbinlog_slave_consistency.result @@ -0,0 +1,1343 @@ +include/master-slave.inc +[connection master] +connection slave; +SET sql_log_bin=0; +call mtr.add_suppression("Slave: An attempt was made.*"); +call mtr.add_suppression("Both DO_DOMAIN_IDS & IGNORE_DOMAIN_IDS lists can't be non-empty at the same time"); +SET sql_log_bin=1; +include/stop_slave.inc +connection master; +RESET MASTER; +connection slave; +include/start_slave.inc +# +# +# Test Case 1: Base case to ensure that mariadb-binlog and replica +# are consistent without any filtering +# +include/mysqlbinlog_slave_consistency.inc +connection slave; +set @@global.gtid_strict_mode=0; +connection slave; +connection master; +# Populating master data +connection slave; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos; +START SLAVE ; +# No slave error expecting - waiting for slave to catch up to master +# Stop slave so it stops receiving master events. +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +RESET MASTER; +# MYSQL_BINLOG BINLOG_FILE_PARAM 2> MYSQLBINLOG_STDERR | MYSQL +connection slave; +# Checking consistency of 'test' database tables between master and slave +connection master; +# Both servers have 5 tables +# Verifying integrity of tables.. +connection master; +connection slave; +# t1 is equivalent on master and slave +connection master; +connection slave; +# t2 is equivalent on master and slave +connection master; +connection slave; +# t3 is equivalent on master and slave +connection master; +connection slave; +# t4 is equivalent on master and slave +connection master; +connection slave; +# t5 is equivalent on master and slave +# All tables are consistent +# Test finished - resetting master and slave.. +connection slave; +RESET SLAVE; +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); +connection master; +RESET MASTER; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +connection slave; +RESET SLAVE; +set global gtid_slave_pos=""; +RESET MASTER; +connection master; +RESET MASTER; +connection slave; +connection master; +# +# +# Test Case 2: Ensure filtering by a single id in --do-domain-ids is +# consistent between mariadb-binlog and replica +# +include/mysqlbinlog_slave_consistency.inc +connection slave; +set @@global.gtid_strict_mode=0; +connection slave; +connection master; +# Populating master data +connection slave; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos, DO_DOMAIN_IDS=(0); +START SLAVE ; +# No slave error expecting - waiting for slave to catch up to master +# Stop slave so it stops receiving master events. +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +RESET MASTER; +# MYSQL_BINLOG BINLOG_FILE_PARAM --do-domain-ids=0 2> MYSQLBINLOG_STDERR | MYSQL +connection slave; +# Checking consistency of 'test' database tables between master and slave +connection master; +# Both servers have 2 tables +# Verifying integrity of tables.. +connection master; +connection slave; +# t1 is equivalent on master and slave +connection master; +connection slave; +# t2 is equivalent on master and slave +# All tables are consistent +# Test finished - resetting master and slave.. +connection slave; +RESET SLAVE; +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); +connection master; +RESET MASTER; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t3,test.t4,test.t5' +connection slave; +RESET SLAVE; +set global gtid_slave_pos=""; +RESET MASTER; +connection master; +RESET MASTER; +connection slave; +connection master; +# +# +# Test Case 3: Ensure filtering by multiple ids in --do-domain-ids is +# consistent between mariadb-binlog and replica +# +include/mysqlbinlog_slave_consistency.inc +connection slave; +set @@global.gtid_strict_mode=0; +connection slave; +connection master; +# Populating master data +connection slave; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos, DO_DOMAIN_IDS=(0,1); +START SLAVE ; +# No slave error expecting - waiting for slave to catch up to master +# Stop slave so it stops receiving master events. +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +RESET MASTER; +# MYSQL_BINLOG BINLOG_FILE_PARAM --do-domain-ids=0,1 2> MYSQLBINLOG_STDERR | MYSQL +connection slave; +# Checking consistency of 'test' database tables between master and slave +connection master; +# Both servers have 4 tables +# Verifying integrity of tables.. +connection master; +connection slave; +# t1 is equivalent on master and slave +connection master; +connection slave; +# t2 is equivalent on master and slave +connection master; +connection slave; +# t3 is equivalent on master and slave +connection master; +connection slave; +# t4 is equivalent on master and slave +# All tables are consistent +# Test finished - resetting master and slave.. +connection slave; +RESET SLAVE; +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); +connection master; +RESET MASTER; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t5' +connection slave; +RESET SLAVE; +set global gtid_slave_pos=""; +RESET MASTER; +connection master; +RESET MASTER; +connection slave; +connection master; +# +# Test Case 4: Ensure filtering by a single id in --ignore-domain-ids +# is consistent between mariadb-binlog and replica +# +include/mysqlbinlog_slave_consistency.inc +connection slave; +set @@global.gtid_strict_mode=0; +connection slave; +connection master; +# Populating master data +connection slave; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos, IGNORE_DOMAIN_IDS=(0); +START SLAVE ; +# No slave error expecting - waiting for slave to catch up to master +# Stop slave so it stops receiving master events. +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +RESET MASTER; +# MYSQL_BINLOG BINLOG_FILE_PARAM --ignore-domain-ids=0 2> MYSQLBINLOG_STDERR | MYSQL +connection slave; +# Checking consistency of 'test' database tables between master and slave +connection master; +# Both servers have 3 tables +# Verifying integrity of tables.. +connection master; +connection slave; +# t3 is equivalent on master and slave +connection master; +connection slave; +# t4 is equivalent on master and slave +connection master; +connection slave; +# t5 is equivalent on master and slave +# All tables are consistent +# Test finished - resetting master and slave.. +connection slave; +RESET SLAVE; +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); +connection master; +RESET MASTER; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t1,test.t2' +connection slave; +RESET SLAVE; +set global gtid_slave_pos=""; +RESET MASTER; +connection master; +RESET MASTER; +connection slave; +connection master; +# +# +# Test Case 5: Ensure filtering by multiple ids in --ignore-domain-ids +# is consistent between mariadb-binlog and replica +# +include/mysqlbinlog_slave_consistency.inc +connection slave; +set @@global.gtid_strict_mode=0; +connection slave; +connection master; +# Populating master data +connection slave; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos, IGNORE_DOMAIN_IDS=(0,1); +START SLAVE ; +# No slave error expecting - waiting for slave to catch up to master +# Stop slave so it stops receiving master events. +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +RESET MASTER; +# MYSQL_BINLOG BINLOG_FILE_PARAM --ignore-domain-ids=0,1 2> MYSQLBINLOG_STDERR | MYSQL +connection slave; +# Checking consistency of 'test' database tables between master and slave +connection master; +# Both servers have 1 tables +# Verifying integrity of tables.. +connection master; +connection slave; +# t5 is equivalent on master and slave +# All tables are consistent +# Test finished - resetting master and slave.. +connection slave; +RESET SLAVE; +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); +connection master; +RESET MASTER; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t1,test.t2,test.t3,test.t4' +connection slave; +RESET SLAVE; +set global gtid_slave_pos=""; +RESET MASTER; +connection master; +RESET MASTER; +connection slave; +connection master; +# +# Test Case 6: Ensure filtering by a single id in --ignore-server-ids +# is consistent between mariadb-binlog and replica +# +include/mysqlbinlog_slave_consistency.inc +connection slave; +set @@global.gtid_strict_mode=0; +connection slave; +connection master; +# Populating master data +connection slave; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos, IGNORE_SERVER_IDS=(1); +START SLAVE ; +# No slave error expecting - waiting for slave to catch up to master +# Stop slave so it stops receiving master events. +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +RESET MASTER; +# MYSQL_BINLOG BINLOG_FILE_PARAM --ignore-server-ids=1 2> MYSQLBINLOG_STDERR | MYSQL +connection slave; +# Checking consistency of 'test' database tables between master and slave +connection master; +# Both servers have 2 tables +# Verifying integrity of tables.. +connection master; +connection slave; +# t2 is equivalent on master and slave +connection master; +connection slave; +# t4 is equivalent on master and slave +# All tables are consistent +# Test finished - resetting master and slave.. +connection slave; +RESET SLAVE; +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); +connection master; +RESET MASTER; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t1,test.t3,test.t5' +connection slave; +RESET SLAVE; +set global gtid_slave_pos=""; +RESET MASTER; +connection master; +RESET MASTER; +connection slave; +connection master; +# +# +# Test Case 7: Ensure filtering by multiple ids in --ignore-server-ids +# is consistent between mariadb-binlog and replica +# +include/mysqlbinlog_slave_consistency.inc +connection slave; +set @@global.gtid_strict_mode=0; +connection slave; +connection master; +# Populating master data +connection slave; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos, IGNORE_SERVER_IDS=(0,1); +START SLAVE ; +# No slave error expecting - waiting for slave to catch up to master +# Stop slave so it stops receiving master events. +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +RESET MASTER; +# MYSQL_BINLOG BINLOG_FILE_PARAM --ignore-server-ids=0,1 2> MYSQLBINLOG_STDERR | MYSQL +connection slave; +# Checking consistency of 'test' database tables between master and slave +connection master; +# Both servers have 2 tables +# Verifying integrity of tables.. +connection master; +connection slave; +# t2 is equivalent on master and slave +connection master; +connection slave; +# t4 is equivalent on master and slave +# All tables are consistent +# Test finished - resetting master and slave.. +connection slave; +RESET SLAVE; +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); +connection master; +RESET MASTER; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t1,test.t3,test.t5' +connection slave; +RESET SLAVE; +set global gtid_slave_pos=""; +RESET MASTER; +connection master; +RESET MASTER; +connection slave; +connection master; +# +# +# Test Case 8: Ensure stop position consistency +# +include/mysqlbinlog_slave_consistency.inc +connection slave; +set @@global.gtid_strict_mode=0; +connection slave; +connection master; +# Populating master data +connection slave; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos; +START SLAVE UNTIL master_gtid_pos="1-1-2"; +# No slave error expecting - waiting for slave to catch up to master +# Because there is a stop position we wait for all events to process +# and slave to automatically stop +# Stop slave so it stops receiving master events. +Warnings: +Note 1255 Slave already has been stopped +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +RESET MASTER; +# MYSQL_BINLOG BINLOG_FILE_PARAM --stop-position=1-1-2 2> MYSQLBINLOG_STDERR | MYSQL +connection slave; +# Checking consistency of 'test' database tables between master and slave +connection master; +# Both servers have 1 tables +# Verifying integrity of tables.. +connection master; +connection slave; +# t3 is equivalent on master and slave +# All tables are consistent +# Test finished - resetting master and slave.. +connection slave; +RESET SLAVE; +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); +connection master; +RESET MASTER; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t1,test.t2,test.t4,test.t5' +connection slave; +RESET SLAVE; +set global gtid_slave_pos=""; +RESET MASTER; +connection master; +RESET MASTER; +connection slave; +connection master; +# +# +# Test Case 9: Ensure start position consistency +# +include/mysqlbinlog_slave_consistency.inc +connection slave; +set @@global.gtid_strict_mode=0; +connection slave; +connection master; +# Populating master data +connection slave; +set global gtid_slave_pos="1-4-2"; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos; +START SLAVE ; +# No slave error expecting - waiting for slave to catch up to master +# Stop slave so it stops receiving master events. +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +RESET MASTER; +# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=1-4-2 2> MYSQLBINLOG_STDERR | MYSQL +connection slave; +# Checking consistency of 'test' database tables between master and slave +connection master; +# Both servers have 4 tables +# Verifying integrity of tables.. +connection master; +connection slave; +# t1 is equivalent on master and slave +connection master; +connection slave; +# t2 is equivalent on master and slave +connection master; +connection slave; +# t4 is equivalent on master and slave +connection master; +connection slave; +# t5 is equivalent on master and slave +# All tables are consistent +# Test finished - resetting master and slave.. +connection slave; +RESET SLAVE; +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); +connection master; +RESET MASTER; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t3' +connection slave; +RESET SLAVE; +set global gtid_slave_pos=""; +RESET MASTER; +connection master; +RESET MASTER; +connection slave; +connection master; +# +# +# Test Case 10: Ensure consistency when filtering by both +# --do-domain-ids and --ignore-server-ids +# +include/mysqlbinlog_slave_consistency.inc +connection slave; +set @@global.gtid_strict_mode=0; +connection slave; +connection master; +# Populating master data +connection slave; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos, DO_DOMAIN_IDS=(0), IGNORE_SERVER_IDS=(1); +START SLAVE ; +# No slave error expecting - waiting for slave to catch up to master +# Stop slave so it stops receiving master events. +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +RESET MASTER; +# MYSQL_BINLOG BINLOG_FILE_PARAM --do-domain-ids=0 --ignore-server-ids=1 2> MYSQLBINLOG_STDERR | MYSQL +connection slave; +# Checking consistency of 'test' database tables between master and slave +connection master; +# Both servers have 1 tables +# Verifying integrity of tables.. +connection master; +connection slave; +# t2 is equivalent on master and slave +# All tables are consistent +# Test finished - resetting master and slave.. +connection slave; +RESET SLAVE; +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); +connection master; +RESET MASTER; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t1,test.t3,test.t4,test.t5' +connection slave; +RESET SLAVE; +set global gtid_slave_pos=""; +RESET MASTER; +connection master; +RESET MASTER; +connection slave; +connection master; +# +# +# Test Case 11: Ensure consistency when filtering by both +# --ignore-domain-ids and --ignore-server-ids +# +include/mysqlbinlog_slave_consistency.inc +connection slave; +set @@global.gtid_strict_mode=0; +connection slave; +connection master; +# Populating master data +connection slave; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos, IGNORE_DOMAIN_IDS=(1,2), IGNORE_SERVER_IDS=(1); +START SLAVE ; +# No slave error expecting - waiting for slave to catch up to master +# Stop slave so it stops receiving master events. +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +RESET MASTER; +# MYSQL_BINLOG BINLOG_FILE_PARAM --ignore-domain-ids=1,2 --ignore-server-ids=1 2> MYSQLBINLOG_STDERR | MYSQL +connection slave; +# Checking consistency of 'test' database tables between master and slave +connection master; +# Both servers have 1 tables +# Verifying integrity of tables.. +connection master; +connection slave; +# t2 is equivalent on master and slave +# All tables are consistent +# Test finished - resetting master and slave.. +connection slave; +RESET SLAVE; +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); +connection master; +RESET MASTER; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t1,test.t3,test.t4,test.t5' +connection slave; +RESET SLAVE; +set global gtid_slave_pos=""; +RESET MASTER; +connection master; +RESET MASTER; +connection slave; +connection master; +# +# +# Test Case 12: Ensure consistency when filtering by +# --do-domain-ids with a stop position +# +include/mysqlbinlog_slave_consistency.inc +connection slave; +set @@global.gtid_strict_mode=0; +connection slave; +connection master; +# Populating master data +connection slave; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos, DO_DOMAIN_IDS=(0); +START SLAVE UNTIL master_gtid_pos="0-1-4"; +# No slave error expecting - waiting for slave to catch up to master +# Because there is a stop position we wait for all events to process +# and slave to automatically stop +# Stop slave so it stops receiving master events. +Warnings: +Note 1255 Slave already has been stopped +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +RESET MASTER; +# MYSQL_BINLOG BINLOG_FILE_PARAM --do-domain-ids=0 --stop-position=0-1-4 2> MYSQLBINLOG_STDERR | MYSQL +connection slave; +# Checking consistency of 'test' database tables between master and slave +connection master; +# Both servers have 2 tables +# Verifying integrity of tables.. +connection master; +connection slave; +# t1 is equivalent on master and slave +connection master; +connection slave; +# t2 is equivalent on master and slave +# All tables are consistent +# Test finished - resetting master and slave.. +connection slave; +RESET SLAVE; +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); +connection master; +RESET MASTER; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t3,test.t4,test.t5' +connection slave; +RESET SLAVE; +set global gtid_slave_pos=""; +RESET MASTER; +connection master; +RESET MASTER; +connection slave; +connection master; +# +# +# Test Case 13: Ensure consistency when filtering by +# --ignore-domain-ids with a stop position +# +include/mysqlbinlog_slave_consistency.inc +connection slave; +set @@global.gtid_strict_mode=0; +connection slave; +connection master; +# Populating master data +connection slave; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos, IGNORE_DOMAIN_IDS=(0); +START SLAVE UNTIL master_gtid_pos="0-1-4"; +# No slave error expecting - waiting for slave to catch up to master +# Because there is a stop position we wait for all events to process +# and slave to automatically stop +# Stop slave so it stops receiving master events. +Warnings: +Note 1255 Slave already has been stopped +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +RESET MASTER; +# MYSQL_BINLOG BINLOG_FILE_PARAM --ignore-domain-ids=0 --stop-position=0-1-4 2> MYSQLBINLOG_STDERR | MYSQL +connection slave; +# Checking consistency of 'test' database tables between master and slave +connection master; +# Both servers have 0 tables +# Verifying integrity of tables.. +# All tables are consistent +# Test finished - resetting master and slave.. +connection slave; +RESET SLAVE; +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); +connection master; +RESET MASTER; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t1,test.t2,test.t3,test.t4,test.t5' +connection slave; +RESET SLAVE; +set global gtid_slave_pos=""; +RESET MASTER; +connection master; +RESET MASTER; +connection slave; +connection master; +# +# +# Test Case 14: Ensure consistency when filtering by +# --ignore-server-ids with a stop position +# +include/mysqlbinlog_slave_consistency.inc +connection slave; +set @@global.gtid_strict_mode=0; +connection slave; +connection master; +# Populating master data +connection slave; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos, IGNORE_SERVER_IDS=(3); +START SLAVE UNTIL master_gtid_pos="0-1-4"; +# No slave error expecting - waiting for slave to catch up to master +# Because there is a stop position we wait for all events to process +# and slave to automatically stop +# Stop slave so it stops receiving master events. +Warnings: +Note 1255 Slave already has been stopped +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +RESET MASTER; +# MYSQL_BINLOG BINLOG_FILE_PARAM --ignore-server-ids=3 --stop-position=0-1-4 2> MYSQLBINLOG_STDERR | MYSQL +connection slave; +# Checking consistency of 'test' database tables between master and slave +connection master; +# Both servers have 1 tables +# Verifying integrity of tables.. +connection master; +connection slave; +# t1 is equivalent on master and slave +# All tables are consistent +# Test finished - resetting master and slave.. +connection slave; +RESET SLAVE; +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); +connection master; +RESET MASTER; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t2,test.t3,test.t4,test.t5' +connection slave; +RESET SLAVE; +set global gtid_slave_pos=""; +RESET MASTER; +connection master; +RESET MASTER; +connection slave; +connection master; +# +# +# Test Case 15: Ensure consistency when filtering by +# --do-domain-ids with a start position +# +include/mysqlbinlog_slave_consistency.inc +connection slave; +set @@global.gtid_strict_mode=0; +connection slave; +connection master; +# Populating master data +connection slave; +set global gtid_slave_pos="1-1-2"; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos, DO_DOMAIN_IDS=(2); +START SLAVE ; +# No slave error expecting - waiting for slave to catch up to master +# Stop slave so it stops receiving master events. +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +RESET MASTER; +# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=1-1-2 --do-domain-ids=2 2> MYSQLBINLOG_STDERR | MYSQL +connection slave; +# Checking consistency of 'test' database tables between master and slave +connection master; +# Both servers have 1 tables +# Verifying integrity of tables.. +connection master; +connection slave; +# t5 is equivalent on master and slave +# All tables are consistent +# Test finished - resetting master and slave.. +connection slave; +RESET SLAVE; +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); +connection master; +RESET MASTER; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t1,test.t2,test.t3,test.t4' +connection slave; +RESET SLAVE; +set global gtid_slave_pos=""; +RESET MASTER; +connection master; +RESET MASTER; +connection slave; +connection master; +# +# +# Test Case 16: Ensure consistency when filtering by +# --ignore-domain-ids with a start position +# +include/mysqlbinlog_slave_consistency.inc +connection slave; +set @@global.gtid_strict_mode=0; +connection slave; +connection master; +# Populating master data +connection slave; +set global gtid_slave_pos="0-1-1"; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos, IGNORE_DOMAIN_IDS=(0); +START SLAVE ; +# No slave error expecting - waiting for slave to catch up to master +# Stop slave so it stops receiving master events. +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +RESET MASTER; +# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-1 --ignore-domain-ids=0 2> MYSQLBINLOG_STDERR | MYSQL +connection slave; +# Checking consistency of 'test' database tables between master and slave +connection master; +# Both servers have 3 tables +# Verifying integrity of tables.. +connection master; +connection slave; +# t3 is equivalent on master and slave +connection master; +connection slave; +# t4 is equivalent on master and slave +connection master; +connection slave; +# t5 is equivalent on master and slave +# All tables are consistent +# Test finished - resetting master and slave.. +connection slave; +RESET SLAVE; +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); +connection master; +RESET MASTER; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t1,test.t2' +connection slave; +RESET SLAVE; +set global gtid_slave_pos=""; +RESET MASTER; +connection master; +RESET MASTER; +connection slave; +connection master; +# +# +# Test Case 17: Ensure consistency when filtering by +# --ignore-server-ids with a start position +# +include/mysqlbinlog_slave_consistency.inc +connection slave; +set @@global.gtid_strict_mode=0; +connection slave; +connection master; +# Populating master data +connection slave; +set global gtid_slave_pos="0-1-1"; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos, IGNORE_SERVER_IDS=(1); +START SLAVE ; +# No slave error expecting - waiting for slave to catch up to master +# Stop slave so it stops receiving master events. +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +RESET MASTER; +# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-1 --ignore-server-ids=1 2> MYSQLBINLOG_STDERR | MYSQL +connection slave; +# Checking consistency of 'test' database tables between master and slave +connection master; +# Both servers have 2 tables +# Verifying integrity of tables.. +connection master; +connection slave; +# t2 is equivalent on master and slave +connection master; +connection slave; +# t4 is equivalent on master and slave +# All tables are consistent +# Test finished - resetting master and slave.. +connection slave; +RESET SLAVE; +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); +connection master; +RESET MASTER; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t1,test.t3,test.t5' +connection slave; +RESET SLAVE; +set global gtid_slave_pos=""; +RESET MASTER; +connection master; +RESET MASTER; +connection slave; +connection master; +# +# +# Test Case 18: Ensure consistency when filtering by +# --do-domain-ids with both a start position and stop position that +# all have the same domain id +# +include/mysqlbinlog_slave_consistency.inc +connection slave; +set @@global.gtid_strict_mode=0; +connection slave; +connection master; +# Populating master data +connection slave; +set global gtid_slave_pos="0-1-1"; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos, DO_DOMAIN_IDS=(0); +START SLAVE UNTIL master_gtid_pos="0-3-3"; +# No slave error expecting - waiting for slave to catch up to master +# Because there is a stop position we wait for all events to process +# and slave to automatically stop +# Stop slave so it stops receiving master events. +Warnings: +Note 1255 Slave already has been stopped +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +RESET MASTER; +# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-1 --do-domain-ids=0 --stop-position=0-3-3 2> MYSQLBINLOG_STDERR | MYSQL +connection slave; +# Checking consistency of 'test' database tables between master and slave +connection master; +# Both servers have 1 tables +# Verifying integrity of tables.. +connection master; +connection slave; +# t2 is equivalent on master and slave +# All tables are consistent +# Test finished - resetting master and slave.. +connection slave; +RESET SLAVE; +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); +connection master; +RESET MASTER; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t1,test.t3,test.t4,test.t5' +connection slave; +RESET SLAVE; +set global gtid_slave_pos=""; +RESET MASTER; +connection master; +RESET MASTER; +connection slave; +connection master; +# +# +# Test Case 19: Ensure consistency when filtering by +# --do-domain-ids with both a start position and stop position that +# have differing domain ids. Due to the implicit filtering in stop +# position, the result should be empty (no tables replicated). +# +include/mysqlbinlog_slave_consistency.inc +connection slave; +set @@global.gtid_strict_mode=0; +connection slave; +connection master; +# Populating master data +connection slave; +set global gtid_slave_pos="0-1-1"; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos, DO_DOMAIN_IDS=(1); +START SLAVE UNTIL master_gtid_pos="0-3-3"; +# No slave error expecting - waiting for slave to catch up to master +# Because there is a stop position we wait for all events to process +# and slave to automatically stop +# Stop slave so it stops receiving master events. +Warnings: +Note 1255 Slave already has been stopped +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +RESET MASTER; +# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-1 --do-domain-ids=1 --stop-position=0-3-3 2> MYSQLBINLOG_STDERR | MYSQL +connection slave; +# Checking consistency of 'test' database tables between master and slave +connection master; +# Both servers have 0 tables +# Verifying integrity of tables.. +# All tables are consistent +# Test finished - resetting master and slave.. +connection slave; +RESET SLAVE; +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); +connection master; +RESET MASTER; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t1,test.t2,test.t3,test.t4,test.t5' +connection slave; +RESET SLAVE; +set global gtid_slave_pos=""; +RESET MASTER; +connection master; +RESET MASTER; +connection slave; +connection master; +# +# +# Test Case 20: Ensure consistency when filtering by +# --ignore-domain-ids with both a start position and stop position that +# all have the same domain id. The result set should be empty due to +# implicit filtering from stop position and ignoring that same domain. +# +include/mysqlbinlog_slave_consistency.inc +connection slave; +set @@global.gtid_strict_mode=0; +connection slave; +connection master; +# Populating master data +connection slave; +set global gtid_slave_pos="0-1-1"; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos, IGNORE_DOMAIN_IDS=(0); +START SLAVE UNTIL master_gtid_pos="0-3-3"; +# No slave error expecting - waiting for slave to catch up to master +# Because there is a stop position we wait for all events to process +# and slave to automatically stop +# Stop slave so it stops receiving master events. +Warnings: +Note 1255 Slave already has been stopped +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +RESET MASTER; +# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-1 --ignore-domain-ids=0 --stop-position=0-3-3 2> MYSQLBINLOG_STDERR | MYSQL +connection slave; +# Checking consistency of 'test' database tables between master and slave +connection master; +# Both servers have 0 tables +# Verifying integrity of tables.. +# All tables are consistent +# Test finished - resetting master and slave.. +connection slave; +RESET SLAVE; +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); +connection master; +RESET MASTER; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t1,test.t2,test.t3,test.t4,test.t5' +connection slave; +RESET SLAVE; +set global gtid_slave_pos=""; +RESET MASTER; +connection master; +RESET MASTER; +connection slave; +connection master; +# +# +# Test Case 21: Ensure consistency when filtering by +# --ignore-domain-ids with both a start position and stop position that +# have differing domain ids. The ignore domain ids should take no +# effect due to the implicit filtering by stop position, i.e. the +# specified domain to ignore is already being filtered. +# +include/mysqlbinlog_slave_consistency.inc +connection slave; +set @@global.gtid_strict_mode=0; +connection slave; +connection master; +# Populating master data +connection slave; +set global gtid_slave_pos="0-1-1"; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos, IGNORE_DOMAIN_IDS=(1); +START SLAVE UNTIL master_gtid_pos="0-3-3"; +# No slave error expecting - waiting for slave to catch up to master +# Because there is a stop position we wait for all events to process +# and slave to automatically stop +# Stop slave so it stops receiving master events. +Warnings: +Note 1255 Slave already has been stopped +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +RESET MASTER; +# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-1 --ignore-domain-ids=1 --stop-position=0-3-3 2> MYSQLBINLOG_STDERR | MYSQL +connection slave; +# Checking consistency of 'test' database tables between master and slave +connection master; +# Both servers have 1 tables +# Verifying integrity of tables.. +connection master; +connection slave; +# t2 is equivalent on master and slave +# All tables are consistent +# Test finished - resetting master and slave.. +connection slave; +RESET SLAVE; +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); +connection master; +RESET MASTER; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t1,test.t3,test.t4,test.t5' +connection slave; +RESET SLAVE; +set global gtid_slave_pos=""; +RESET MASTER; +connection master; +RESET MASTER; +connection slave; +connection master; +# +# +# Test Case 22: Ensure consistency when filtering by +# --ignore-server-ids with both a start position and stop position. +# +include/mysqlbinlog_slave_consistency.inc +connection slave; +set @@global.gtid_strict_mode=0; +connection slave; +connection master; +# Populating master data +connection slave; +set global gtid_slave_pos="0-1-0"; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos, IGNORE_SERVER_IDS=(3); +START SLAVE UNTIL master_gtid_pos="0-3-3"; +# No slave error expecting - waiting for slave to catch up to master +# Because there is a stop position we wait for all events to process +# and slave to automatically stop +# Stop slave so it stops receiving master events. +Warnings: +Note 1255 Slave already has been stopped +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +RESET MASTER; +# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --ignore-server-ids=3 --stop-position=0-3-3 2> MYSQLBINLOG_STDERR | MYSQL +connection slave; +# Checking consistency of 'test' database tables between master and slave +connection master; +# Both servers have 1 tables +# Verifying integrity of tables.. +connection master; +connection slave; +# t1 is equivalent on master and slave +# All tables are consistent +# Test finished - resetting master and slave.. +connection slave; +RESET SLAVE; +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); +connection master; +RESET MASTER; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t2,test.t3,test.t4,test.t5' +connection slave; +RESET SLAVE; +set global gtid_slave_pos=""; +RESET MASTER; +connection master; +RESET MASTER; +connection slave; +connection master; +# +# +# Test Case 23: Out of order GTIDs from domains or servers which are +# filtered out should not error +# +include/mysqlbinlog_slave_consistency.inc +connection slave; +set @@global.gtid_strict_mode=1; +connection slave; +connection master; +# Populating master data +connection slave; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos, DO_DOMAIN_IDS=(0), IGNORE_SERVER_IDS=(3); +START SLAVE ; +# No slave error expecting - waiting for slave to catch up to master +# Stop slave so it stops receiving master events. +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t4,test.t5' +RESET MASTER; +# MYSQL_BINLOG BINLOG_FILE_PARAM --do-domain-ids=0 --ignore-server-ids=3 --gtid-strict-mode 2> MYSQLBINLOG_STDERR | MYSQL +connection slave; +# Checking consistency of 'test' database tables between master and slave +connection master; +# Both servers have 1 tables +# Verifying integrity of tables.. +connection master; +connection slave; +# t1 is equivalent on master and slave +# All tables are consistent +# Strict mode enabled - checking mysqlbinlog error output for out +# of order GTIDs +# Not expecting to find out of order GTID error.. +NOT FOUND /Found out of order GTID/ in mysqlbinlog_stderr.out +# Test finished - resetting master and slave.. +connection slave; +RESET SLAVE; +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); +connection master; +RESET MASTER; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t2,test.t3,test.t4,test.t5' +connection slave; +RESET SLAVE; +set global gtid_slave_pos=""; +RESET MASTER; +connection master; +RESET MASTER; +connection slave; +set @@global.gtid_strict_mode=0; +connection master; +# +# +# Test Case 24: Out of order GTIDs from included domains should error +# +include/mysqlbinlog_slave_consistency.inc +connection slave; +set @@global.gtid_strict_mode=1; +connection slave; +connection master; +# Populating master data +connection slave; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos, DO_DOMAIN_IDS=(1); +START SLAVE ; +# slave SQL Thread error expected - waiting for errno 1950 +# Stop slave so it stops receiving master events. +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t4,test.t5' +RESET MASTER; +# MYSQL_BINLOG BINLOG_FILE_PARAM --do-domain-ids=1 --gtid-strict-mode 2> MYSQLBINLOG_STDERR | MYSQL +connection slave; +# Checking consistency of 'test' database tables between master and slave +connection master; +# Both servers have 1 tables +# Verifying integrity of tables.. +connection master; +connection slave; +# t3 is equivalent on master and slave +# All tables are consistent +# Strict mode enabled - checking mysqlbinlog error output for out +# of order GTIDs +# Expecting to find out of order GTID error.. +FOUND 1 /Found out of order GTID/ in mysqlbinlog_stderr.out +# Test finished - resetting master and slave.. +connection slave; +RESET SLAVE; +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); +connection master; +RESET MASTER; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t1,test.t2,test.t4,test.t5' +connection slave; +RESET SLAVE; +set global gtid_slave_pos=""; +RESET MASTER; +connection master; +RESET MASTER; +connection slave; +set @@global.gtid_strict_mode=0; +connection master; +# +# +# Test Case 25: Out of order GTIDs from included servers should error +# +include/mysqlbinlog_slave_consistency.inc +connection slave; +set @@global.gtid_strict_mode=1; +connection slave; +connection master; +# Populating master data +connection slave; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos, IGNORE_SERVER_IDS=(1); +START SLAVE ; +# slave SQL Thread error expected - waiting for errno 1950 +# Stop slave so it stops receiving master events. +connection master; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t4,test.t5' +RESET MASTER; +# MYSQL_BINLOG BINLOG_FILE_PARAM --ignore-server-ids=1 --gtid-strict-mode 2> MYSQLBINLOG_STDERR | MYSQL +connection slave; +# Checking consistency of 'test' database tables between master and slave +connection master; +# Both servers have 1 tables +# Verifying integrity of tables.. +connection master; +connection slave; +# t2 is equivalent on master and slave +# All tables are consistent +# Strict mode enabled - checking mysqlbinlog error output for out +# of order GTIDs +# Expecting to find out of order GTID error.. +FOUND 1 /Found out of order GTID/ in mysqlbinlog_stderr.out +# Test finished - resetting master and slave.. +connection slave; +RESET SLAVE; +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=(); +connection master; +RESET MASTER; +DROP TABLE IF EXISTS t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 'test.t1,test.t3,test.t4,test.t5' +connection slave; +RESET SLAVE; +set global gtid_slave_pos=""; +RESET MASTER; +connection master; +RESET MASTER; +connection slave; +set @@global.gtid_strict_mode=0; +connection master; +# +# +# Test Case 26: Neither mysqlbinlog nor CHANGE MASTER TO should allow +# both do domain ids and ignore domain ids to be set together +# +connection slave; +include/stop_slave.inc +CHANGE MASTER TO MASTER_USE_GTID=slave_pos, DO_DOMAIN_IDS=(0), IGNORE_DOMAIN_IDS=(1); +ERROR HY000: Could not initialize master info structure for ''; more error messages can be found in the MariaDB error log +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos, DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(); +include/start_slave.inc +connection master; +RESET MASTER; +include/rpl_end.inc +# End of tests (rpl.rpl_mysqlbinlog_slave_consistency) diff --git a/mysql-test/suite/rpl/t/rpl_mysqlbinlog_slave_consistency.test b/mysql-test/suite/rpl/t/rpl_mysqlbinlog_slave_consistency.test new file mode 100644 index 00000000000..d2918e3a890 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_mysqlbinlog_slave_consistency.test @@ -0,0 +1,401 @@ +# +# Purpose: +# +# This test ensures the mariadb-binlog command line tool filters events +# by domain id (via --do-domain-ids and --ignore-domain-ids) and server id (via +# --ignore-server-ids) in the same way that a replica server does. +# +# +# Methodology: +# +# This test validates that the domain and server id filtering logic of +# mariadb-binlog matches that of a replica server. In particular, it validates +# a mariadb-binlog replay of a master's binary log is consistent with a +# replica's state which is configured using the same filtering configuration. +# +# It uses a repeatable process to allow for multiple test cases that span +# different filtering configurations. First, a master is seeded with an initial +# set of SQL statements with varying domain and server ids. Then, a set of +# filtering parameters supported by both mariadb-binlog and replica +# capabilities are defined. The replica is configured using these parameters +# and run it until it has processed all events from the primary server; it is +# stopped afterward. For mariadb-binlog validation, the binary log of the +# primary server is copied to a different location for later replay. The +# primary is then reset to its initial state (i.e. the tables are dropped and +# the logs are reset). The mariadb-binlog tool is then used to replay the +# copied binary log file back onto the clean primary server under the same +# filtering conditions as the replica. At this point, the data on the primary +# and replica should be exactly the same because the filtering conditions were +# the same, and all existing tables on both servers are compared using. +# checksums. +# +# +# References: +# +# MDEV-20119: Implement the --do-domain-ids, --ignore-domain-ids, and +# --ignore-server-ids options for mysqlbinlog +# +--source include/master-slave.inc + +--connection slave +SET sql_log_bin=0; +call mtr.add_suppression("Slave: An attempt was made.*"); +call mtr.add_suppression("Both DO_DOMAIN_IDS & IGNORE_DOMAIN_IDS lists can't be non-empty at the same time"); +SET sql_log_bin=1; + +--source include/stop_slave.inc + +--connection master +RESET MASTER; + +# Save old state +let $ORIG_GTID_DOMAIN_ID = `select @@session.gtid_domain_id`; +let $ORIG_SERVER_ID = `select @@session.server_id`; + +--connection slave +--source include/start_slave.inc + +# Initial tests do not use strict mode +--let $strict_mode=0 +--let $slave_sql_errno=0 + +--echo # +--echo # +--echo # Test Case 1: Base case to ensure that mariadb-binlog and replica +--echo # are consistent without any filtering +--echo # +--let $do_domain_ids= +--let $ignore_domain_ids= +--let $ignore_server_ids= +--let $stop_position= +--let $start_position= +--source include/mysqlbinlog_slave_consistency.inc + +--echo # +--echo # +--echo # Test Case 2: Ensure filtering by a single id in --do-domain-ids is +--echo # consistent between mariadb-binlog and replica +--echo # +--let $do_domain_ids=0 +--let $ignore_domain_ids= +--let $ignore_server_ids= +--let $stop_position= +--let $start_position= +--source include/mysqlbinlog_slave_consistency.inc + +--echo # +--echo # +--echo # Test Case 3: Ensure filtering by multiple ids in --do-domain-ids is +--echo # consistent between mariadb-binlog and replica +--echo # +--let $do_domain_ids=0,1 +--let $ignore_domain_ids= +--let $ignore_server_ids= +--let $stop_position= +--let $start_position= +--source include/mysqlbinlog_slave_consistency.inc + +--echo # +--echo # Test Case 4: Ensure filtering by a single id in --ignore-domain-ids +--echo # is consistent between mariadb-binlog and replica +--echo # +--let $do_domain_ids= +--let $ignore_domain_ids=0 +--let $ignore_server_ids= +--let $stop_position= +--let $start_position= +--source include/mysqlbinlog_slave_consistency.inc + +--echo # +--echo # +--echo # Test Case 5: Ensure filtering by multiple ids in --ignore-domain-ids +--echo # is consistent between mariadb-binlog and replica +--echo # +--let $do_domain_ids= +--let $ignore_domain_ids=0,1 +--let $ignore_server_ids= +--let $stop_position= +--let $start_position= +--source include/mysqlbinlog_slave_consistency.inc + +--echo # +--echo # Test Case 6: Ensure filtering by a single id in --ignore-server-ids +--echo # is consistent between mariadb-binlog and replica +--echo # +--let $do_domain_ids= +--let $ignore_domain_ids= +--let $ignore_server_ids=1 +--let $stop_position= +--let $start_position= +--source include/mysqlbinlog_slave_consistency.inc + +--echo # +--echo # +--echo # Test Case 7: Ensure filtering by multiple ids in --ignore-server-ids +--echo # is consistent between mariadb-binlog and replica +--echo # +--let $do_domain_ids= +--let $ignore_domain_ids= +--let $ignore_server_ids=0,1 +--let $stop_position= +--let $start_position= +--source include/mysqlbinlog_slave_consistency.inc + +--echo # +--echo # +--echo # Test Case 8: Ensure stop position consistency +--echo # +--let $do_domain_ids= +--let $ignore_domain_ids= +--let $ignore_server_ids= +--let $stop_position=1-1-2 +--let $start_position= +--source include/mysqlbinlog_slave_consistency.inc + +--echo # +--echo # +--echo # Test Case 9: Ensure start position consistency +--echo # +--let $do_domain_ids= +--let $ignore_domain_ids= +--let $ignore_server_ids= +--let $stop_position= +--let $start_position=1-4-2 +--source include/mysqlbinlog_slave_consistency.inc + +--echo # +--echo # +--echo # Test Case 10: Ensure consistency when filtering by both +--echo # --do-domain-ids and --ignore-server-ids +--echo # +--let $do_domain_ids=0 +--let $ignore_domain_ids= +--let $ignore_server_ids=1 +--let $stop_position= +--let $start_position= +--source include/mysqlbinlog_slave_consistency.inc + +--echo # +--echo # +--echo # Test Case 11: Ensure consistency when filtering by both +--echo # --ignore-domain-ids and --ignore-server-ids +--echo # +--let $do_domain_ids= +--let $ignore_domain_ids=1,2 +--let $ignore_server_ids=1 +--let $stop_position= +--let $start_position= +--source include/mysqlbinlog_slave_consistency.inc + +--echo # +--echo # +--echo # Test Case 12: Ensure consistency when filtering by +--echo # --do-domain-ids with a stop position +--echo # +--let $do_domain_ids=0 +--let $ignore_domain_ids= +--let $ignore_server_ids= +--let $stop_position=0-1-4 +--let $start_position= +--source include/mysqlbinlog_slave_consistency.inc + +--echo # +--echo # +--echo # Test Case 13: Ensure consistency when filtering by +--echo # --ignore-domain-ids with a stop position +--echo # +--let $do_domain_ids= +--let $ignore_domain_ids=0 +--let $ignore_server_ids= +--let $stop_position=0-1-4 +--let $start_position= +--source include/mysqlbinlog_slave_consistency.inc + +--echo # +--echo # +--echo # Test Case 14: Ensure consistency when filtering by +--echo # --ignore-server-ids with a stop position +--echo # +--let $do_domain_ids= +--let $ignore_domain_ids= +--let $ignore_server_ids=3 +--let $stop_position=0-1-4 +--let $start_position= +--source include/mysqlbinlog_slave_consistency.inc + +--echo # +--echo # +--echo # Test Case 15: Ensure consistency when filtering by +--echo # --do-domain-ids with a start position +--echo # +--let $do_domain_ids=2 +--let $ignore_domain_ids= +--let $ignore_server_ids= +--let $stop_position= +--let $start_position=1-1-2 +--source include/mysqlbinlog_slave_consistency.inc + +--echo # +--echo # +--echo # Test Case 16: Ensure consistency when filtering by +--echo # --ignore-domain-ids with a start position +--echo # +--let $do_domain_ids= +--let $ignore_domain_ids=0 +--let $ignore_server_ids= +--let $stop_position= +--let $start_position=0-1-1 +--source include/mysqlbinlog_slave_consistency.inc + +--echo # +--echo # +--echo # Test Case 17: Ensure consistency when filtering by +--echo # --ignore-server-ids with a start position +--echo # +--let $do_domain_ids= +--let $ignore_domain_ids= +--let $ignore_server_ids=1 +--let $stop_position= +--let $start_position=0-1-1 +--source include/mysqlbinlog_slave_consistency.inc + +--echo # +--echo # +--echo # Test Case 18: Ensure consistency when filtering by +--echo # --do-domain-ids with both a start position and stop position that +--echo # all have the same domain id +--echo # +--let $do_domain_ids=0 +--let $ignore_domain_ids= +--let $ignore_server_ids= +--let $stop_position=0-3-3 +--let $start_position=0-1-1 +--source include/mysqlbinlog_slave_consistency.inc + +--echo # +--echo # +--echo # Test Case 19: Ensure consistency when filtering by +--echo # --do-domain-ids with both a start position and stop position that +--echo # have differing domain ids. Due to the implicit filtering in stop +--echo # position, the result should be empty (no tables replicated). +--echo # +--let $do_domain_ids=1 +--let $ignore_domain_ids= +--let $ignore_server_ids= +--let $stop_position=0-3-3 +--let $start_position=0-1-1 +--source include/mysqlbinlog_slave_consistency.inc + +--echo # +--echo # +--echo # Test Case 20: Ensure consistency when filtering by +--echo # --ignore-domain-ids with both a start position and stop position that +--echo # all have the same domain id. The result set should be empty due to +--echo # implicit filtering from stop position and ignoring that same domain. +--echo # +--let $do_domain_ids= +--let $ignore_domain_ids=0 +--let $ignore_server_ids= +--let $stop_position=0-3-3 +--let $start_position=0-1-1 +--source include/mysqlbinlog_slave_consistency.inc + +--echo # +--echo # +--echo # Test Case 21: Ensure consistency when filtering by +--echo # --ignore-domain-ids with both a start position and stop position that +--echo # have differing domain ids. The ignore domain ids should take no +--echo # effect due to the implicit filtering by stop position, i.e. the +--echo # specified domain to ignore is already being filtered. +--echo # +--let $do_domain_ids= +--let $ignore_domain_ids=1 +--let $ignore_server_ids= +--let $stop_position=0-3-3 +--let $start_position=0-1-1 +--source include/mysqlbinlog_slave_consistency.inc + +--echo # +--echo # +--echo # Test Case 22: Ensure consistency when filtering by +--echo # --ignore-server-ids with both a start position and stop position. +--echo # +--let $do_domain_ids= +--let $ignore_domain_ids= +--let $ignore_server_ids=3 +--let $stop_position=0-3-3 +--let $start_position=0-1-0 +--source include/mysqlbinlog_slave_consistency.inc + +--echo # +--echo # +--echo # Test Case 23: Out of order GTIDs from domains or servers which are +--echo # filtered out should not error +--echo # +--let $strict_mode=1 +--let $strict_mode_err=0 +--let $slave_sql_errno=0 +--let $do_domain_ids=0 +--let $ignore_domain_ids= +--let $ignore_server_ids=3 +--let $stop_position= +--let $start_position= +--source include/mysqlbinlog_slave_consistency.inc + +--echo # +--echo # +--echo # Test Case 24: Out of order GTIDs from included domains should error +--echo # +--let $strict_mode=1 +--let $strict_mode_err=1 +--let $slave_sql_errno=1950 +--let $do_domain_ids=1 +--let $ignore_domain_ids= +--let $ignore_server_ids= +--let $stop_position= +--let $start_position= +--source include/mysqlbinlog_slave_consistency.inc + +--echo # +--echo # +--echo # Test Case 25: Out of order GTIDs from included servers should error +--echo # +--let $strict_mode=1 +--let $strict_mode_err=1 +--let $slave_sql_errno=1950 +--let $do_domain_ids= +--let $ignore_domain_ids= +--let $ignore_server_ids=1 +--let $stop_position= +--let $start_position= +--source include/mysqlbinlog_slave_consistency.inc + +--echo # +--echo # +--echo # Test Case 26: Neither mysqlbinlog nor CHANGE MASTER TO should allow +--echo # both do domain ids and ignore domain ids to be set together +--echo # +--connection slave +--source include/stop_slave.inc + +--error 1201 +CHANGE MASTER TO MASTER_USE_GTID=slave_pos, DO_DOMAIN_IDS=(0), IGNORE_DOMAIN_IDS=(1); + +--let $MYSQLD_DATADIR=`select @@datadir` +--let BINLOG_FILENAME= query_get_value(SHOW BINARY LOGS, Log_name, 1) +--let BINLOG_FILE_PARAM= $MYSQLD_DATADIR/$BINLOG_FILENAME.orig +--error 1 +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/$BINLOG_FILENAME --do-domain-ids=0 --ignore-domain-ids=1 + +RESET MASTER; +set global gtid_slave_pos=""; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos, DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(); +--source include/start_slave.inc + +# Cleanup +--connection master +RESET MASTER; + +--source include/rpl_end.inc + +--echo # End of tests (rpl.rpl_mysqlbinlog_slave_consistency) diff --git a/mysql-test/suite/sys_vars/r/character_set_client_basic.result b/mysql-test/suite/sys_vars/r/character_set_client_basic.result index a15e1d10b79..d62d88027c7 100644 --- a/mysql-test/suite/sys_vars/r/character_set_client_basic.result +++ b/mysql-test/suite/sys_vars/r/character_set_client_basic.result @@ -383,10 +383,9 @@ SET @@character_set_client = 1; SELECT @@character_set_client; @@character_set_client big5 +# latin2_czech_cs is not a default collation SET @@character_set_client = 2; -SELECT @@character_set_client; -@@character_set_client -latin2 +ERROR 42000: Unknown character set: '2' SET @@character_set_client = 3; SELECT @@character_set_client; @@character_set_client @@ -395,20 +394,19 @@ SET @@character_set_client = 36; SELECT @@character_set_client; @@character_set_client cp866 +# cp1250_polish_ci is not a default collation SET @@character_set_client = 99; -SELECT @@character_set_client; -@@character_set_client -cp1250 +ERROR 42000: Unknown character set: '99' +# Collation ID 100 does not exist SET @@character_set_client = 100; ERROR 42000: Unknown character set: '100' SET @@global.character_set_client = 1; SELECT @@global.character_set_client; @@global.character_set_client big5 +# latin2_czech_cs is not a default collation SET @@global.character_set_client = 2; -SELECT @@global.character_set_client; -@@global.character_set_client -latin2 +ERROR 42000: Unknown character set: '2' SET @@global.character_set_client = 3; SELECT @@global.character_set_client; @@global.character_set_client @@ -417,10 +415,10 @@ SET @@global.character_set_client = 36; SELECT @@global.character_set_client; @@global.character_set_client cp866 +# cp1250_polish_ci is not a default collation SET @@global.character_set_client = 99; -SELECT @@global.character_set_client; -@@global.character_set_client -cp1250 +ERROR 42000: Unknown character set: '99' +# Collation ID 100 does not exist SET @@global.character_set_client = 100; ERROR 42000: Unknown character set: '100' SET @total_charset = (SELECT count(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS); @@ -497,5 +495,10 @@ SELECT @@session.character_set_client = WHERE VARIABLE_NAME='character_set_client') AS res; res 1 +# +# MDEV-28769 Assertion `(m_ci->state & 32) || m_with_collate' failed in Lex_exact_charset_opt_extended_collate::Lex_exact_charset_opt_extended_collate on SET NAMES +# +SET GLOBAL character_set_client=2; +ERROR 42000: Unknown character set: '2' SET @@global.character_set_client = @global_start_value; SET @@session.character_set_client = @session_start_value; diff --git a/mysql-test/suite/sys_vars/r/character_set_connection_basic.result b/mysql-test/suite/sys_vars/r/character_set_connection_basic.result index 6d098f37bd1..e356d62ed2b 100644 --- a/mysql-test/suite/sys_vars/r/character_set_connection_basic.result +++ b/mysql-test/suite/sys_vars/r/character_set_connection_basic.result @@ -378,10 +378,9 @@ SET @@character_set_connection = 1; SELECT @@character_set_connection; @@character_set_connection big5 +# latin2_czech_cs is not a default collation SET @@character_set_connection = 2; -SELECT @@character_set_connection; -@@character_set_connection -latin2 +ERROR 42000: Unknown character set: '2' SET @@character_set_connection = 3; SELECT @@character_set_connection; @@character_set_connection @@ -390,20 +389,19 @@ SET @@character_set_connection = 36; SELECT @@character_set_connection; @@character_set_connection cp866 +# cp1250_polish_ci is not a default collation SET @@character_set_connection = 99; -SELECT @@character_set_connection; -@@character_set_connection -cp1250 +ERROR 42000: Unknown character set: '99' +# Collation ID 100 does not exist SET @@character_set_connection = 100; ERROR 42000: Unknown character set: '100' SET @@global.character_set_connection = 1; SELECT @@global.character_set_connection; @@global.character_set_connection big5 +# latin2_czech_cs is not a default collation SET @@global.character_set_connection = 2; -SELECT @@global.character_set_connection; -@@global.character_set_connection -latin2 +ERROR 42000: Unknown character set: '2' SET @@global.character_set_connection = 3; SELECT @@global.character_set_connection; @@global.character_set_connection @@ -412,10 +410,10 @@ SET @@global.character_set_connection = 36; SELECT @@global.character_set_connection; @@global.character_set_connection cp866 +# cp1250_polish_ci is not a default collation SET @@global.character_set_connection = 99; -SELECT @@global.character_set_connection; -@@global.character_set_connection -cp1250 +ERROR 42000: Unknown character set: '99' +# Collation ID 100 does not exist SET @@global.character_set_connection = 100; ERROR 42000: Unknown character set: '100' SET @total_charset = (SELECT count(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS); @@ -435,8 +433,12 @@ SET @@character_set_connection = -1; ERROR 42000: Unknown character set: '-1' SET @@character_set_connection = 'utf8 '; ERROR 42000: Unknown character set: 'utf8 ' +SET @@character_set_connection=cp1250; SET @@character_set_connection = 'lätin2'; ERROR 42000: Unknown character set: 'lätin2' +SET @@character_set_connection=cp866; +SET @@character_set_connection = 'lätin2'; +ERROR 42000: Unknown character set: 'l?tin2' SET @@character_set_connection = true; SELECT @@character_set_connection AS res_with_true; res_with_true diff --git a/mysql-test/suite/sys_vars/r/character_set_database_basic.result b/mysql-test/suite/sys_vars/r/character_set_database_basic.result index 752dad8500e..c15e0531efc 100644 --- a/mysql-test/suite/sys_vars/r/character_set_database_basic.result +++ b/mysql-test/suite/sys_vars/r/character_set_database_basic.result @@ -380,10 +380,9 @@ SET @@character_set_database = 1; SELECT @@character_set_database; @@character_set_database big5 +# latin2_czech_cs is not a default collation SET @@character_set_database = 2; -SELECT @@character_set_database; -@@character_set_database -latin2 +ERROR 42000: Unknown character set: '2' SET @@character_set_database = 3; SELECT @@character_set_database; @@character_set_database @@ -392,20 +391,19 @@ SET @@character_set_database = 36; SELECT @@character_set_database; @@character_set_database cp866 +# cp1250_polish_ci is not a default collation SET @@character_set_database = 99; -SELECT @@character_set_database; -@@character_set_database -cp1250 +ERROR 42000: Unknown character set: '99' +# Collation ID 100 does not exist SET @@character_set_database = 100; ERROR 42000: Unknown character set: '100' SET @@global.character_set_database = 1; SELECT @@global.character_set_database; @@global.character_set_database big5 +# latin2_czech_cs is not a default collation SET @@global.character_set_database = 2; -SELECT @@global.character_set_database; -@@global.character_set_database -latin2 +ERROR 42000: Unknown character set: '2' SET @@global.character_set_database = 3; SELECT @@global.character_set_database; @@global.character_set_database @@ -414,10 +412,10 @@ SET @@global.character_set_database = 36; SELECT @@global.character_set_database; @@global.character_set_database cp866 +# cp1250_polish_ci is not a default collation SET @@global.character_set_database = 99; -SELECT @@global.character_set_database; -@@global.character_set_database -cp1250 +ERROR 42000: Unknown character set: '99' +# Collation ID 100 does not exist SET @@global.character_set_database = 100; ERROR 42000: Unknown character set: '100' SET @total_charset = (SELECT count(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS); diff --git a/mysql-test/suite/sys_vars/r/character_set_filesystem_basic.result b/mysql-test/suite/sys_vars/r/character_set_filesystem_basic.result index 8c5b5e524ba..da85a7dee54 100644 --- a/mysql-test/suite/sys_vars/r/character_set_filesystem_basic.result +++ b/mysql-test/suite/sys_vars/r/character_set_filesystem_basic.result @@ -379,10 +379,9 @@ SET @@character_set_filesystem = 1; SELECT @@character_set_filesystem; @@character_set_filesystem big5 +# latin2_czech_cs is not a default collation SET @@character_set_filesystem = 2; -SELECT @@character_set_filesystem; -@@character_set_filesystem -latin2 +ERROR 42000: Unknown character set: '2' SET @@character_set_filesystem = 3; SELECT @@character_set_filesystem; @@character_set_filesystem @@ -391,10 +390,10 @@ SET @@character_set_filesystem = 36; SELECT @@character_set_filesystem; @@character_set_filesystem cp866 +# cp1250_polish_ci is not a default collation SET @@character_set_filesystem = 99; -SELECT @@character_set_filesystem; -@@character_set_filesystem -cp1250 +ERROR 42000: Unknown character set: '99' +# Collation ID 100 does not exist SET @@character_set_filesystem = 100; ERROR 42000: Unknown character set: '100' SET @total_charset = (SELECT count(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS); diff --git a/mysql-test/suite/sys_vars/r/character_set_results_basic.result b/mysql-test/suite/sys_vars/r/character_set_results_basic.result Binary files differindex 86cd9265efb..d1c6a52ba17 100644 --- a/mysql-test/suite/sys_vars/r/character_set_results_basic.result +++ b/mysql-test/suite/sys_vars/r/character_set_results_basic.result diff --git a/mysql-test/suite/sys_vars/r/character_set_server_basic.result b/mysql-test/suite/sys_vars/r/character_set_server_basic.result index e395b048f42..e0a13c729fe 100644 --- a/mysql-test/suite/sys_vars/r/character_set_server_basic.result +++ b/mysql-test/suite/sys_vars/r/character_set_server_basic.result @@ -382,10 +382,9 @@ SET @@character_set_server = 1; SELECT @@character_set_server; @@character_set_server big5 +# latin2_czech_cs is not a default collation SET @@character_set_server = 2; -SELECT @@character_set_server; -@@character_set_server -latin2 +ERROR 42000: Unknown character set: '2' SET @@character_set_server = 3; SELECT @@character_set_server; @@character_set_server @@ -394,28 +393,27 @@ SET @@character_set_server = 36; SELECT @@character_set_server; @@character_set_server cp866 +# cp1250_polish_ci is not a default collation SET @@character_set_server = 99; -SELECT @@character_set_server; -@@character_set_server -cp1250 +ERROR 42000: Unknown character set: '99' +# Collation ID 100 does not exist SET @@character_set_server = 100; ERROR 42000: Unknown character set: '100' SET @@global.character_set_server = 1; SELECT @@global.character_set_server; @@global.character_set_server big5 +# latin2_czech_cs is not a default collation SET @@global.character_set_server = 2; -SELECT @@global.character_set_server; -@@global.character_set_server -latin2 +ERROR 42000: Unknown character set: '2' SET @@global.character_set_server = 36; SELECT @@global.character_set_server; @@global.character_set_server cp866 +# cp1250_polish_ci is not a default collation SET @@global.character_set_server = 99; -SELECT @@global.character_set_server; -@@global.character_set_server -cp1250 +ERROR 42000: Unknown character set: '99' +# Collation ID 100 does not exist SET @@global.character_set_server = 100; ERROR 42000: Unknown character set: '100' '#--------------------FN_DYNVARS_009_10-------------------------#' diff --git a/mysql-test/suite/sys_vars/r/innodb_change_buffering_basic.result b/mysql-test/suite/sys_vars/r/innodb_change_buffering_basic.result index c11f4ee617c..f3b7ac80523 100644 --- a/mysql-test/suite/sys_vars/r/innodb_change_buffering_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_change_buffering_basic.result @@ -24,6 +24,8 @@ select * from information_schema.session_variables where variable_name='innodb_c VARIABLE_NAME VARIABLE_VALUE INNODB_CHANGE_BUFFERING none set global innodb_change_buffering='none'; +Warnings: +Warning 1287 '@@innodb_change_buffering' is deprecated and will be removed in a future release select @@global.innodb_change_buffering; @@global.innodb_change_buffering none @@ -34,6 +36,8 @@ select * from information_schema.session_variables where variable_name='innodb_c VARIABLE_NAME VARIABLE_VALUE INNODB_CHANGE_BUFFERING none set @@global.innodb_change_buffering='inserts'; +Warnings: +Warning 1287 '@@innodb_change_buffering' is deprecated and will be removed in a future release select @@global.innodb_change_buffering; @@global.innodb_change_buffering inserts @@ -50,6 +54,8 @@ ERROR HY000: Variable 'innodb_change_buffering' is a GLOBAL variable and should set global innodb_change_buffering=1.1; ERROR 42000: Incorrect argument type to variable 'innodb_change_buffering' set global innodb_change_buffering=1; +Warnings: +Warning 1287 '@@innodb_change_buffering' is deprecated and will be removed in a future release SELECT @@global.innodb_change_buffering; @@global.innodb_change_buffering inserts @@ -60,6 +66,8 @@ ERROR 42000: Incorrect argument type to variable 'innodb_change_buffering' set global innodb_change_buffering='some'; ERROR 42000: Variable 'innodb_change_buffering' can't be set to the value of 'some' SET @@global.innodb_change_buffering = @start_global_value; +Warnings: +Warning 1287 '@@innodb_change_buffering' is deprecated and will be removed in a future release SELECT @@global.innodb_change_buffering; @@global.innodb_change_buffering none diff --git a/mysql-test/suite/sys_vars/r/innodb_log_file_size_basic.result b/mysql-test/suite/sys_vars/r/innodb_log_file_size_basic.result index 119e95df1e1..0c83f03d35a 100644 --- a/mysql-test/suite/sys_vars/r/innodb_log_file_size_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_log_file_size_basic.result @@ -4,9 +4,7 @@ COUNT(@@GLOBAL.innodb_log_file_size) 1 1 Expected '#---------------------BS_STVARS_035_02----------------------#' -SET @@GLOBAL.innodb_log_file_size=1; -ERROR HY000: Variable 'innodb_log_file_size' is a read only variable -Expected error 'Read only variable' +SET @@GLOBAL.innodb_log_file_size=10485760; SELECT COUNT(@@GLOBAL.innodb_log_file_size); COUNT(@@GLOBAL.innodb_log_file_size) 1 diff --git a/mysql-test/suite/sys_vars/r/old_basic.result b/mysql-test/suite/sys_vars/r/old_basic.result index bafe7128821..1eba60ed4a7 100644 --- a/mysql-test/suite/sys_vars/r/old_basic.result +++ b/mysql-test/suite/sys_vars/r/old_basic.result @@ -17,7 +17,11 @@ select * from information_schema.session_variables where variable_name='old'; VARIABLE_NAME VARIABLE_VALUE OLD OFF set global old=1; +Warnings: +Warning 1287 '@@old' is deprecated and will be removed in a future release. Please use '@@old_mode' instead set session old=1; +Warnings: +Warning 1287 '@@old' is deprecated and will be removed in a future release. Please use '@@old_mode' instead select @@global.old; @@global.old 1 @@ -25,3 +29,5 @@ select @@session.old; @@session.old 1 set @@global.old=DEFAULT; +Warnings: +Warning 1287 '@@old' is deprecated and will be removed in a future release. Please use '@@old_mode' instead diff --git a/mysql-test/suite/sys_vars/r/old_mode_basic.result b/mysql-test/suite/sys_vars/r/old_mode_basic.result index a6b95f1c60c..252316dc1cb 100644 --- a/mysql-test/suite/sys_vars/r/old_mode_basic.result +++ b/mysql-test/suite/sys_vars/r/old_mode_basic.result @@ -114,8 +114,8 @@ SET @@global.old_mode = 4; SELECT @@global.old_mode; @@global.old_mode ZERO_DATE_TIME_CAST -SET @@global.old_mode = 16; -ERROR 42000: Variable 'old_mode' can't be set to the value of '16' +SET @@global.old_mode = 64; +ERROR 42000: Variable 'old_mode' can't be set to the value of '64' SELECT @@global.old_mode; @@global.old_mode ZERO_DATE_TIME_CAST @@ -264,3 +264,42 @@ SET @@collation_database = @save_collation_database; # # End of 10.6 test # +# +# Beginning of 10.9 test +# +# +# MDEV-24920: Merge "old" SQL variable to "old_mode" sql variable +# +# Checking that setting old will also set old_mode +SELECT @@OLD_MODE; +@@OLD_MODE +UTF8_IS_UTF8MB3 +SET old= 1; +Warnings: +Warning 1287 '@@old' is deprecated and will be removed in a future release. Please use '@@old_mode' instead +SELECT @@OLD_MODE; +@@OLD_MODE +NO_PROGRESS_INFO,UTF8_IS_UTF8MB3,IGNORE_INDEX_ONLY_FOR_JOIN,COMPAT_5_1_CHECKSUM +SET old= DEFAULT; +Warnings: +Warning 1287 '@@old' is deprecated and will be removed in a future release. Please use '@@old_mode' instead +SELECT @@OLD_MODE; +@@OLD_MODE +UTF8_IS_UTF8MB3 +# Checking that old_mode can be set independently as well +SELECT @@OLD_MODE; +@@OLD_MODE +UTF8_IS_UTF8MB3 +SET @save_old_mode = @@OLD_MODE; +SET @@OLD_MODE= IGNORE_INDEX_ONLY_FOR_JOIN; +SELECT @@OLD_MODE; +@@OLD_MODE +IGNORE_INDEX_ONLY_FOR_JOIN +SET @@OLD_MODE= COMPAT_5_1_CHECKSUM; +SELECT @@OLD_MODE; +@@OLD_MODE +COMPAT_5_1_CHECKSUM +SET @@OLD_MODE= @save_old_mode; +# +# End of 10.9 test +# diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index c3dd970f6e3..8b95878c347 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -1014,7 +1014,7 @@ NUMERIC_MIN_VALUE 4194304 NUMERIC_MAX_VALUE 18446744073709551615 NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL -READ_ONLY YES +READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_LOG_GROUP_HOME_DIR SESSION_VALUE NULL diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index 29e5d03dd98..4d0f34bf451 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -2219,7 +2219,7 @@ VARIABLE_COMMENT Used to emulate old behavior from earlier MariaDB or MySQL vers NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NO_DUP_KEY_WARNINGS_WITH_IGNORE,NO_PROGRESS_INFO,ZERO_DATE_TIME_CAST,UTF8_IS_UTF8MB3 +ENUM_VALUE_LIST NO_DUP_KEY_WARNINGS_WITH_IGNORE,NO_PROGRESS_INFO,ZERO_DATE_TIME_CAST,UTF8_IS_UTF8MB3,IGNORE_INDEX_ONLY_FOR_JOIN,COMPAT_5_1_CHECKSUM READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OLD_PASSWORDS diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index f0dda77da15..abf738f5c15 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -2389,7 +2389,7 @@ VARIABLE_COMMENT Used to emulate old behavior from earlier MariaDB or MySQL vers NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NO_DUP_KEY_WARNINGS_WITH_IGNORE,NO_PROGRESS_INFO,ZERO_DATE_TIME_CAST,UTF8_IS_UTF8MB3 +ENUM_VALUE_LIST NO_DUP_KEY_WARNINGS_WITH_IGNORE,NO_PROGRESS_INFO,ZERO_DATE_TIME_CAST,UTF8_IS_UTF8MB3,IGNORE_INDEX_ONLY_FOR_JOIN,COMPAT_5_1_CHECKSUM READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OLD_PASSWORDS diff --git a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result index ae7cce823ef..df8b7c73f9d 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result +++ b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result @@ -706,6 +706,21 @@ ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED GLOBAL_VALUE_PATH NULL +VARIABLE_NAME WSREP_STATUS_FILE +SESSION_VALUE NULL +GLOBAL_VALUE +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE VARCHAR +VARIABLE_COMMENT wsrep status output filename +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST NULL +READ_ONLY YES +COMMAND_LINE_ARGUMENT REQUIRED +GLOBAL_VALUE_PATH NULL VARIABLE_NAME WSREP_SYNC_WAIT SESSION_VALUE 0 GLOBAL_VALUE 0 diff --git a/mysql-test/suite/sys_vars/t/character_set_client_basic.test b/mysql-test/suite/sys_vars/t/character_set_client_basic.test index e3461e4ac77..09f758a0316 100644 --- a/mysql-test/suite/sys_vars/t/character_set_client_basic.test +++ b/mysql-test/suite/sys_vars/t/character_set_client_basic.test @@ -229,33 +229,44 @@ SELECT @@global.character_set_client; ############################################################## SET @@character_set_client = 1; SELECT @@character_set_client; + +--echo # latin2_czech_cs is not a default collation +--error ER_UNKNOWN_CHARACTER_SET SET @@character_set_client = 2; -SELECT @@character_set_client; + SET @@character_set_client = 3; SELECT @@character_set_client; SET @@character_set_client = 36; SELECT @@character_set_client; + +--echo # cp1250_polish_ci is not a default collation +--error ER_UNKNOWN_CHARACTER_SET SET @@character_set_client = 99; -SELECT @@character_set_client; +--echo # Collation ID 100 does not exist --Error ER_UNKNOWN_CHARACTER_SET SET @@character_set_client = 100; SET @@global.character_set_client = 1; SELECT @@global.character_set_client; + +--echo # latin2_czech_cs is not a default collation +--error ER_UNKNOWN_CHARACTER_SET SET @@global.character_set_client = 2; -SELECT @@global.character_set_client; + SET @@global.character_set_client = 3; SELECT @@global.character_set_client; SET @@global.character_set_client = 36; SELECT @@global.character_set_client; + +--echo # cp1250_polish_ci is not a default collation +--error ER_UNKNOWN_CHARACTER_SET SET @@global.character_set_client = 99; -SELECT @@global.character_set_client; +--echo # Collation ID 100 does not exist --Error ER_UNKNOWN_CHARACTER_SET SET @@global.character_set_client = 100; - SET @total_charset = (SELECT count(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS); SELECT @total_charset; @@ -332,6 +343,13 @@ SELECT @@session.character_set_client = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='character_set_client') AS res; +--echo # +--echo # MDEV-28769 Assertion `(m_ci->state & 32) || m_with_collate' failed in Lex_exact_charset_opt_extended_collate::Lex_exact_charset_opt_extended_collate on SET NAMES +--echo # + +--error ER_UNKNOWN_CHARACTER_SET +SET GLOBAL character_set_client=2; + #################################### # Restore initial value # #################################### diff --git a/mysql-test/suite/sys_vars/t/character_set_connection_basic.test b/mysql-test/suite/sys_vars/t/character_set_connection_basic.test index 5d6412dd420..3d9094fca04 100644 --- a/mysql-test/suite/sys_vars/t/character_set_connection_basic.test +++ b/mysql-test/suite/sys_vars/t/character_set_connection_basic.test @@ -155,30 +155,42 @@ SELECT @@global.character_set_connection; ############################################################## SET @@character_set_connection = 1; SELECT @@character_set_connection; + +--echo # latin2_czech_cs is not a default collation +--error ER_UNKNOWN_CHARACTER_SET SET @@character_set_connection = 2; -SELECT @@character_set_connection; + SET @@character_set_connection = 3; SELECT @@character_set_connection; SET @@character_set_connection = 36; SELECT @@character_set_connection; + +--echo # cp1250_polish_ci is not a default collation +--error ER_UNKNOWN_CHARACTER_SET SET @@character_set_connection = 99; -SELECT @@character_set_connection; +--echo # Collation ID 100 does not exist --Error ER_UNKNOWN_CHARACTER_SET SET @@character_set_connection = 100; SET @@global.character_set_connection = 1; SELECT @@global.character_set_connection; + +--echo # latin2_czech_cs is not a default collation +--error ER_UNKNOWN_CHARACTER_SET SET @@global.character_set_connection = 2; -SELECT @@global.character_set_connection; + SET @@global.character_set_connection = 3; SELECT @@global.character_set_connection; SET @@global.character_set_connection = 36; SELECT @@global.character_set_connection; + +--echo # cp1250_polish_ci is not a default collation +--error ER_UNKNOWN_CHARACTER_SET SET @@global.character_set_connection = 99; -SELECT @@global.character_set_connection; +--echo # Collation ID 100 does not exist --Error ER_UNKNOWN_CHARACTER_SET SET @@global.character_set_connection = 100; @@ -201,6 +213,10 @@ SET @@character_set_connection = 1.1; SET @@character_set_connection = -1; --Error ER_UNKNOWN_CHARACTER_SET SET @@character_set_connection = 'utf8 '; +SET @@character_set_connection=cp1250; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_connection = 'lätin2'; +SET @@character_set_connection=cp866; --Error ER_UNKNOWN_CHARACTER_SET SET @@character_set_connection = 'lätin2'; SET @@character_set_connection = true; diff --git a/mysql-test/suite/sys_vars/t/character_set_database_basic.test b/mysql-test/suite/sys_vars/t/character_set_database_basic.test index 54ccc5afddb..95ffa83950f 100644 --- a/mysql-test/suite/sys_vars/t/character_set_database_basic.test +++ b/mysql-test/suite/sys_vars/t/character_set_database_basic.test @@ -154,30 +154,42 @@ SELECT @@global.character_set_database; ############################################################## SET @@character_set_database = 1; SELECT @@character_set_database; + +--echo # latin2_czech_cs is not a default collation +--error ER_UNKNOWN_CHARACTER_SET SET @@character_set_database = 2; -SELECT @@character_set_database; + SET @@character_set_database = 3; SELECT @@character_set_database; SET @@character_set_database = 36; SELECT @@character_set_database; + +--echo # cp1250_polish_ci is not a default collation +--error ER_UNKNOWN_CHARACTER_SET SET @@character_set_database = 99; -SELECT @@character_set_database; +--echo # Collation ID 100 does not exist --Error ER_UNKNOWN_CHARACTER_SET SET @@character_set_database = 100; SET @@global.character_set_database = 1; SELECT @@global.character_set_database; + +--echo # latin2_czech_cs is not a default collation +--error ER_UNKNOWN_CHARACTER_SET SET @@global.character_set_database = 2; -SELECT @@global.character_set_database; + SET @@global.character_set_database = 3; SELECT @@global.character_set_database; SET @@global.character_set_database = 36; SELECT @@global.character_set_database; + +--echo # cp1250_polish_ci is not a default collation +--error ER_UNKNOWN_CHARACTER_SET SET @@global.character_set_database = 99; -SELECT @@global.character_set_database; +--echo # Collation ID 100 does not exist --Error ER_UNKNOWN_CHARACTER_SET SET @@global.character_set_database = 100; diff --git a/mysql-test/suite/sys_vars/t/character_set_filesystem_basic.test b/mysql-test/suite/sys_vars/t/character_set_filesystem_basic.test index 33b77eede06..b3ebb38360e 100644 --- a/mysql-test/suite/sys_vars/t/character_set_filesystem_basic.test +++ b/mysql-test/suite/sys_vars/t/character_set_filesystem_basic.test @@ -151,15 +151,21 @@ SELECT @@character_set_filesystem; ############################################################## SET @@character_set_filesystem = 1; SELECT @@character_set_filesystem; + +--echo # latin2_czech_cs is not a default collation +--error ER_UNKNOWN_CHARACTER_SET SET @@character_set_filesystem = 2; -SELECT @@character_set_filesystem; + SET @@character_set_filesystem = 3; SELECT @@character_set_filesystem; SET @@character_set_filesystem = 36; SELECT @@character_set_filesystem; + +--echo # cp1250_polish_ci is not a default collation +--error ER_UNKNOWN_CHARACTER_SET SET @@character_set_filesystem = 99; -SELECT @@character_set_filesystem; +--echo # Collation ID 100 does not exist --Error ER_UNKNOWN_CHARACTER_SET SET @@character_set_filesystem = 100; diff --git a/mysql-test/suite/sys_vars/t/character_set_results_basic.test b/mysql-test/suite/sys_vars/t/character_set_results_basic.test index cca2277713e..617332b9780 100644 --- a/mysql-test/suite/sys_vars/t/character_set_results_basic.test +++ b/mysql-test/suite/sys_vars/t/character_set_results_basic.test @@ -153,29 +153,42 @@ SELECT @@global.character_set_results; ############################################################## SET @@character_set_results = 1; SELECT @@character_set_results; + +--echo # latin2_czech_cs is not a default collation +--error ER_UNKNOWN_CHARACTER_SET SET @@character_set_results = 2; -SELECT @@character_set_results; + SET @@character_set_results = 3; SELECT @@character_set_results; SET @@character_set_results = 36; SELECT @@character_set_results; + +--echo # cp1250_polish_ci is not a default collation +--error ER_UNKNOWN_CHARACTER_SET SET @@character_set_results = 99; -SELECT @@character_set_results; +--echo # Collation ID 100 does not exist --Error ER_UNKNOWN_CHARACTER_SET SET @@character_set_results = 100; + SET @@global.character_set_results = 1; SELECT @@global.character_set_results; + +--echo # latin2_czech_cs is not a default collation +--error ER_UNKNOWN_CHARACTER_SET SET @@global.character_set_results = 2; -SELECT @@global.character_set_results; + SET @@global.character_set_results = 3; SELECT @@global.character_set_results; SET @@global.character_set_results = 36; SELECT @@global.character_set_results; + +--echo # cp1250_polish_ci is not a default collation +--error ER_UNKNOWN_CHARACTER_SET SET @@global.character_set_results = 99; -SELECT @@global.character_set_results; +--echo # Collation ID 100 does not exist --Error ER_UNKNOWN_CHARACTER_SET SET @@global.character_set_results = 100; diff --git a/mysql-test/suite/sys_vars/t/character_set_server_basic.test b/mysql-test/suite/sys_vars/t/character_set_server_basic.test index de090348307..b2f4788fdae 100644 --- a/mysql-test/suite/sys_vars/t/character_set_server_basic.test +++ b/mysql-test/suite/sys_vars/t/character_set_server_basic.test @@ -155,27 +155,39 @@ SELECT @@global.character_set_server; ############################################################## SET @@character_set_server = 1; SELECT @@character_set_server; + +--echo # latin2_czech_cs is not a default collation +--error ER_UNKNOWN_CHARACTER_SET SET @@character_set_server = 2; -SELECT @@character_set_server; + SET @@character_set_server = 3; SELECT @@character_set_server; SET @@character_set_server = 36; SELECT @@character_set_server; + +--echo # cp1250_polish_ci is not a default collation +--error ER_UNKNOWN_CHARACTER_SET SET @@character_set_server = 99; -SELECT @@character_set_server; +--echo # Collation ID 100 does not exist --Error ER_UNKNOWN_CHARACTER_SET SET @@character_set_server = 100; SET @@global.character_set_server = 1; SELECT @@global.character_set_server; + +--echo # latin2_czech_cs is not a default collation +--error ER_UNKNOWN_CHARACTER_SET SET @@global.character_set_server = 2; -SELECT @@global.character_set_server; + SET @@global.character_set_server = 36; SELECT @@global.character_set_server; + +--echo # cp1250_polish_ci is not a default collation +--error ER_UNKNOWN_CHARACTER_SET SET @@global.character_set_server = 99; -SELECT @@global.character_set_server; +--echo # Collation ID 100 does not exist --Error ER_UNKNOWN_CHARACTER_SET SET @@global.character_set_server = 100; diff --git a/mysql-test/suite/sys_vars/t/innodb_log_file_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_log_file_size_basic.test index 21fd2a80021..4d67c22e619 100644 --- a/mysql-test/suite/sys_vars/t/innodb_log_file_size_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_log_file_size_basic.test @@ -37,9 +37,8 @@ SELECT COUNT(@@GLOBAL.innodb_log_file_size); # Check if Value can set # #################################################################### ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SET @@GLOBAL.innodb_log_file_size=1; ---echo Expected error 'Read only variable' +#--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.innodb_log_file_size=10485760; SELECT COUNT(@@GLOBAL.innodb_log_file_size); --echo 1 Expected diff --git a/mysql-test/suite/sys_vars/t/old_mode_basic.test b/mysql-test/suite/sys_vars/t/old_mode_basic.test index f2fba791859..631d638767f 100644 --- a/mysql-test/suite/sys_vars/t/old_mode_basic.test +++ b/mysql-test/suite/sys_vars/t/old_mode_basic.test @@ -172,7 +172,7 @@ SET @@global.old_mode = 4; SELECT @@global.old_mode; --Error ER_WRONG_VALUE_FOR_VAR -SET @@global.old_mode = 16; +SET @@global.old_mode = 64; SELECT @@global.old_mode; # use of decimal values @@ -314,6 +314,39 @@ SET @@collation_database = @save_collation_database; --echo # End of 10.6 test --echo # +--echo # +--echo # Beginning of 10.9 test +--echo # +--echo # +--echo # MDEV-24920: Merge "old" SQL variable to "old_mode" sql variable +--echo # + +--echo # Checking that setting old will also set old_mode +SELECT @@OLD_MODE; + +SET old= 1; +SELECT @@OLD_MODE; + +SET old= DEFAULT; +SELECT @@OLD_MODE; + +--echo # Checking that old_mode can be set independently as well + +SELECT @@OLD_MODE; + +SET @save_old_mode = @@OLD_MODE; + +SET @@OLD_MODE= IGNORE_INDEX_ONLY_FOR_JOIN; +SELECT @@OLD_MODE; + +SET @@OLD_MODE= COMPAT_5_1_CHECKSUM; +SELECT @@OLD_MODE; + +SET @@OLD_MODE= @save_old_mode; + +--echo # +--echo # End of 10.9 test +--echo # ################################################################ # END OF old_mode TESTS # ################################################################ diff --git a/mysql-test/suite/versioning/common.inc b/mysql-test/suite/versioning/common.inc index 0c65720fa1a..aff6b9fbc2d 100644 --- a/mysql-test/suite/versioning/common.inc +++ b/mysql-test/suite/versioning/common.inc @@ -6,6 +6,7 @@ source include/have_innodb.inc; --disable_query_log set @@session.time_zone='+00:00'; +set @@global.time_zone='+00:00'; select ifnull(max(transaction_id), 0) into @start_trx_id from mysql.transaction_registry; set @test_start=now(6); diff --git a/mysql-test/suite/versioning/common_finish.inc b/mysql-test/suite/versioning/common_finish.inc index 3c4e7b66ff3..255daa1963a 100644 --- a/mysql-test/suite/versioning/common_finish.inc +++ b/mysql-test/suite/versioning/common_finish.inc @@ -6,5 +6,6 @@ drop function if exists current_row; drop function if exists check_row; drop function if exists current_row_ts; drop function if exists check_row_ts; +set @@global.time_zone= default; --enable_warnings --enable_query_log diff --git a/mysql-test/suite/versioning/r/debug.result b/mysql-test/suite/versioning/r/debug.result index 3efddd40275..2c944f75436 100644 --- a/mysql-test/suite/versioning/r/debug.result +++ b/mysql-test/suite/versioning/r/debug.result @@ -51,6 +51,8 @@ t4 CREATE TABLE `t4` ( PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING drop table t1, t2, t3, t4; +set debug_dbug= @old_dbug; +set global debug_dbug= @old_dbug; # # MDEV-19525 remove ER_VERS_FIELD_WRONG_TYPE from init_from_binary_frm_image() # @@ -63,4 +65,42 @@ Level Code Message Warning 4110 `row_start` must be of type TIMESTAMP(6) for system-versioned table `t1` Error 1033 Incorrect information in file: './test/t1.frm' drop table t1; -set global debug_dbug=@old_dbug; +set debug_dbug= @old_dbug; +# +# MDEV-17554 Auto-create new partition for system versioned tables +# with history partitioned by INTERVAL/LIMIT +# +call mtr.add_suppression("need more HISTORY partitions"); +create or replace table t1 (x int) with system versioning +partition by system_time limit 1 auto partitions 2; +insert into t1 values (1); +update t1 set x= x + 1; +connect con2, localhost, root; +connect con1, localhost, root; +# Both threads create partition simultaneously +connection con1; +set debug_sync= 'add_history_partition signal s1 wait_for s2'; +update t1 set x= x + 10; +connection con2; +set debug_sync= 'now wait_for s1'; +flush tables t1; +set debug_sync= 'add_history_partition signal s2'; +update t1 set x= x + 20; +connection con1; +connection default; +update t1 set x= x + 2; +# Second thread skips to reopen 3 times until first thread creates partition +connection con1; +set debug_sync= 'add_history_partition SIGNAL s1 WAIT_FOR s2'; +update t1 set x= x + 30; +connection con2; +set debug_sync= 'now WAIT_FOR s1'; +set debug_sync= 'reopen_history_partition SIGNAL s2 EXECUTE 3'; +update t1 set x= x + 40; +connection con1; +connection default; +disconnect con1; +disconnect con2; +set @@timestamp= default; +drop tables t1; +set debug_sync= 'reset'; diff --git a/mysql-test/suite/versioning/r/delete_history.result b/mysql-test/suite/versioning/r/delete_history.result index cf68536d4a6..3681b25f592 100644 --- a/mysql-test/suite/versioning/r/delete_history.result +++ b/mysql-test/suite/versioning/r/delete_history.result @@ -222,3 +222,22 @@ ERROR HY000: The target table v1 of the DELETE is not updatable DROP VIEW v1; DROP TABLE t1; # End of 10.4 tests +# +# MDEV-17554 Auto-create new partition for system versioned tables with history partitioned by INTERVAL/LIMIT +# +# Don't auto-create new partition on DELETE HISTORY: +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t (a int) with system versioning +partition by system_time interval 1 hour auto; +set timestamp= unix_timestamp('2000-01-01 10:00:00'); +delete history from t; +set timestamp= default; +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 2 +drop table t; +# End of 10.9 tests diff --git a/mysql-test/suite/versioning/r/not_embedded.result b/mysql-test/suite/versioning/r/not_embedded.result index b8972a48370..23574f34da9 100644 --- a/mysql-test/suite/versioning/r/not_embedded.result +++ b/mysql-test/suite/versioning/r/not_embedded.result @@ -70,3 +70,26 @@ drop database mysqltest; disconnect user1; disconnect root; connection default; +# +# MDEV-25559 Auto-create: infinite loop after interrupted lock wait +# +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create table t (pk int primary key, a int) engine innodb with system versioning +partition by system_time interval 1 hour auto; +insert into t values (1, 0); +begin; +update t set a= a + 1; +connect con1,localhost,root,,; +set max_statement_time= 1; +set timestamp= unix_timestamp('2000-01-01 01:00:00'); +update t set a= a + 2; +connection default; +set timestamp= unix_timestamp('2000-01-01 01:00:00'); +update t set a= a + 3; +connection con1; +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +disconnect con1; +connection default; +commit; +drop table t; +set timestamp= default; diff --git a/mysql-test/suite/versioning/r/partition,heap.rdiff b/mysql-test/suite/versioning/r/partition,heap.rdiff index 361a74a4271..387a3cee754 100644 --- a/mysql-test/suite/versioning/r/partition,heap.rdiff +++ b/mysql-test/suite/versioning/r/partition,heap.rdiff @@ -1,4 +1,4 @@ -@@ -1969,85 +1969,6 @@ +@@ -2132,85 +2132,6 @@ (PARTITION `p0` HISTORY ENGINE = X, PARTITION `pn` CURRENT ENGINE = X) drop tables t1, tp1; @@ -84,3 +84,138 @@ # # End of 10.7 tests # +@@ -2765,134 +2686,6 @@ + Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p0`) is out of INTERVAL, need more HISTORY partitions + drop prepare s; + affected rows: 0 +-# Complex table +-set timestamp= unix_timestamp('2000-01-01 00:00:00'); +-affected rows: 0 +-create or replace table t1 ( +-x int primary key auto_increment, +-t timestamp(6) default '2001-11-11 11:11:11', +-b blob(4096) compressed null, +-c varchar(1033) character set utf8 not null, +-u int unique, +-m enum('a', 'b', 'c') not null default 'a' comment 'absolute', +-i1 tinyint, i2 smallint, i3 bigint, +-index three(i1, i2, i3), +-v1 timestamp(6) generated always as (t + interval 1 day), +-v2 timestamp(6) generated always as (t + interval 1 month) stored, +-s timestamp(6) as row start, +-e timestamp(6) as row end, +-period for system_time (s, e), +-ps date, pe date, +-period for app_time (ps, pe), +-constraint check_constr check (u > -1)) +-with system versioning default charset=ucs2 +-partition by system_time interval 1 hour auto ( +-partition p2 history, +-partition pn current); +-affected rows: 0 +-show create table t1; +-Table Create Table +-t1 CREATE TABLE `t1` ( +- `x` int(11) NOT NULL AUTO_INCREMENT, +- `t` timestamp(6) NOT NULL DEFAULT '2001-11-11 11:11:11.000000', +- `b` blob /*!100301 COMPRESSED*/ DEFAULT NULL, +- `c` varchar(1033) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, +- `u` int(11) DEFAULT NULL, +- `m` enum('a','b','c') NOT NULL DEFAULT 'a' COMMENT 'absolute', +- `i1` tinyint(4) DEFAULT NULL, +- `i2` smallint(6) DEFAULT NULL, +- `i3` bigint(20) DEFAULT NULL, +- `v1` timestamp(6) GENERATED ALWAYS AS (`t` + interval 1 day) VIRTUAL, +- `v2` timestamp(6) GENERATED ALWAYS AS (`t` + interval 1 month) STORED, +- `s` timestamp(6) GENERATED ALWAYS AS ROW START, +- `e` timestamp(6) GENERATED ALWAYS AS ROW END, +- `ps` date NOT NULL, +- `pe` date NOT NULL, +- PERIOD FOR `app_time` (`ps`, `pe`), +- PRIMARY KEY (`x`,`e`), +- UNIQUE KEY `u` (`u`,`e`), +- KEY `three` (`i1`,`i2`,`i3`), +- PERIOD FOR SYSTEM_TIME (`s`, `e`), +- CONSTRAINT `check_constr` CHECK (`u` > -1) +-) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci WITH SYSTEM VERSIONING +- PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +-(PARTITION `p2` HISTORY ENGINE = DEFAULT_ENGINE, +- PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE) +-affected rows: 1 +-insert into t1 (x, c, u, i1, i2, i3, ps, pe) +-values (1, 'cc', 0, 1, 2, 3, '1999-01-01', '2000-01-01'); +-affected rows: 1 +-set timestamp= unix_timestamp('2000-01-01 01:00:00'); +-affected rows: 0 +-update t1 set x= x + 8; +-affected rows: 1 +-info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0 +-show create table t1; +-Table Create Table +-t1 CREATE TABLE `t1` ( +- `x` int(11) NOT NULL AUTO_INCREMENT, +- `t` timestamp(6) NOT NULL DEFAULT '2001-11-11 11:11:11.000000', +- `b` blob /*!100301 COMPRESSED*/ DEFAULT NULL, +- `c` varchar(1033) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, +- `u` int(11) DEFAULT NULL, +- `m` enum('a','b','c') NOT NULL DEFAULT 'a' COMMENT 'absolute', +- `i1` tinyint(4) DEFAULT NULL, +- `i2` smallint(6) DEFAULT NULL, +- `i3` bigint(20) DEFAULT NULL, +- `v1` timestamp(6) GENERATED ALWAYS AS (`t` + interval 1 day) VIRTUAL, +- `v2` timestamp(6) GENERATED ALWAYS AS (`t` + interval 1 month) STORED, +- `s` timestamp(6) GENERATED ALWAYS AS ROW START, +- `e` timestamp(6) GENERATED ALWAYS AS ROW END, +- `ps` date NOT NULL, +- `pe` date NOT NULL, +- PERIOD FOR `app_time` (`ps`, `pe`), +- PRIMARY KEY (`x`,`e`), +- UNIQUE KEY `u` (`u`,`e`), +- KEY `three` (`i1`,`i2`,`i3`), +- PERIOD FOR SYSTEM_TIME (`s`, `e`), +- CONSTRAINT `check_constr` CHECK (`u` > -1) +-) ENGINE=DEFAULT_ENGINE AUTO_INCREMENT=10 DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci WITH SYSTEM VERSIONING +- PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +-(PARTITION `p2` HISTORY ENGINE = DEFAULT_ENGINE, +- PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE, +- PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE) +-affected rows: 1 +-set timestamp= unix_timestamp('2000-01-01 02:00:00'); +-affected rows: 0 +-update t1 set x= x - 8; +-affected rows: 1 +-info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0 +-show create table t1; +-Table Create Table +-t1 CREATE TABLE `t1` ( +- `x` int(11) NOT NULL AUTO_INCREMENT, +- `t` timestamp(6) NOT NULL DEFAULT '2001-11-11 11:11:11.000000', +- `b` blob /*!100301 COMPRESSED*/ DEFAULT NULL, +- `c` varchar(1033) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, +- `u` int(11) DEFAULT NULL, +- `m` enum('a','b','c') NOT NULL DEFAULT 'a' COMMENT 'absolute', +- `i1` tinyint(4) DEFAULT NULL, +- `i2` smallint(6) DEFAULT NULL, +- `i3` bigint(20) DEFAULT NULL, +- `v1` timestamp(6) GENERATED ALWAYS AS (`t` + interval 1 day) VIRTUAL, +- `v2` timestamp(6) GENERATED ALWAYS AS (`t` + interval 1 month) STORED, +- `s` timestamp(6) GENERATED ALWAYS AS ROW START, +- `e` timestamp(6) GENERATED ALWAYS AS ROW END, +- `ps` date NOT NULL, +- `pe` date NOT NULL, +- PERIOD FOR `app_time` (`ps`, `pe`), +- PRIMARY KEY (`x`,`e`), +- UNIQUE KEY `u` (`u`,`e`), +- KEY `three` (`i1`,`i2`,`i3`), +- PERIOD FOR SYSTEM_TIME (`s`, `e`), +- CONSTRAINT `check_constr` CHECK (`u` > -1) +-) ENGINE=DEFAULT_ENGINE AUTO_INCREMENT=10 DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci WITH SYSTEM VERSIONING +- PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +-(PARTITION `p2` HISTORY ENGINE = DEFAULT_ENGINE, +- PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE, +- PARTITION `p3` HISTORY ENGINE = DEFAULT_ENGINE, +- PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE) +-affected rows: 1 + # INSERT .. ON DUPLICATE KEY UPDATE (ODKU) + set timestamp= unix_timestamp('2000-01-01 00:00:00'); + create or replace table t1 (x int primary key) with system versioning diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result index 6feee27818b..0266464c5d6 100644 --- a/mysql-test/suite/versioning/r/partition.result +++ b/mysql-test/suite/versioning/r/partition.result @@ -247,7 +247,9 @@ select @ts0 = @ts1; select @ts2 = @ts3; @ts2 = @ts3 1 -## rotation by LIMIT +# +# Rotation by LIMIT +# create or replace table t1 (x int) with system versioning partition by system_time limit 0 partitions 3; @@ -301,7 +303,9 @@ x 6 7 8 -## rotation by INTERVAL +# +# Rotation by INTERVAL +# create or replace table t1 (x int) with system versioning partition by system_time interval 0 second partitions 3; @@ -361,19 +365,25 @@ delete from t1; set timestamp=unix_timestamp('2001-02-04 10:20:50'); insert t1 values (2); delete from t1; -select subpartition_name,partition_description,table_rows from information_schema.partitions where table_schema='test' and table_name='t1'; +Warnings: +Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions +select subpartition_name, partition_description, table_rows from information_schema.partitions where table_schema='test' and table_name='t1'; subpartition_name partition_description table_rows p1sp0 2001-02-04 00:00:00 1 p1sp1 2001-02-04 00:00:00 1 pnsp0 CURRENT 0 pnsp1 CURRENT 0 +select * from t1 partition (p1); +i +1 +2 set timestamp=unix_timestamp('2001-02-04 10:20:55'); alter table t1 add partition (partition p0 history, partition p2 history); set timestamp=unix_timestamp('2001-02-04 10:30:00'); insert t1 values (4),(5); set timestamp=unix_timestamp('2001-02-04 10:30:10'); update t1 set i=6 where i=5; -select subpartition_name,partition_description,table_rows from information_schema.partitions where table_schema='test' and table_name='t1'; +select subpartition_name, partition_description, table_rows from information_schema.partitions where table_schema='test' and table_name='t1'; subpartition_name partition_description table_rows p1sp0 2001-02-04 00:00:00 1 p1sp1 2001-02-04 00:00:00 0 @@ -383,6 +393,25 @@ p2sp0 2001-02-06 00:00:00 0 p2sp1 2001-02-06 00:00:00 0 pnsp0 CURRENT 0 pnsp1 CURRENT 2 +select * from t1 partition (p1); +i +1 +select * from t1 partition (p0); +i +5 +2 +select * from t1 partition (p2); +i +alter table t1 rebuild partition p0, p1, p2; +select * from t1 partition (p1); +i +1 +select * from t1 partition (p0); +i +5 +2 +select * from t1 partition (p2); +i ## pruning check set @ts=(select partition_description from information_schema.partitions where table_schema='test' and table_name='t1' and partition_name='p0' limit 1); @@ -566,12 +595,15 @@ set timestamp= unix_timestamp('2001-01-01 00:00:00'); create or replace table t1 (i int) with system versioning partition by system_time interval 1 day starts '2000-01-01 00:00:00' partitions 3; -# we are warned when we push to present: insert into t1 values (0); set timestamp= unix_timestamp('2001-01-01 00:00:01'); update t1 set i= i + 1; +Warnings: +Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions set timestamp= unix_timestamp('2001-01-01 00:00:02'); update t1 set i= i + 1; +Warnings: +Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions select *, row_end from t1 partition (p0); i row_end select *, row_end from t1 partition (p1); @@ -602,8 +634,8 @@ i row_end select *, row_end from t1 partition (p1); i row_end 3 2000-01-04 00:00:01.000000 -set timestamp= unix_timestamp('2000-01-01 00:00:00'); # and this is how it usually goes: +set timestamp= unix_timestamp('2000-01-01 00:00:00'); create or replace table t1 (i int) with system versioning partition by system_time interval 1 day partitions 3; @@ -614,8 +646,12 @@ set timestamp= unix_timestamp('2000-01-02 00:00:01'); update t1 set i= i + 1; set timestamp= unix_timestamp('2000-01-03 00:00:01'); update t1 set i= i + 1; +Warnings: +Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions set timestamp= unix_timestamp('2000-01-04 00:00:01'); update t1 set i= i + 1; +Warnings: +Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions alter table t1 add partition (partition p2 history, partition p3 history); select *, row_end from t1 partition (p0); i row_end @@ -646,7 +682,6 @@ select * from t1 partition (pnsp1); x 2 4 -### warn about full partition delete from t1 where x < 3; delete from t1; Warnings: @@ -1144,11 +1179,11 @@ f varchar(45000) partition by system_time interval 1 year (partition p1 history, partition pn current); insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(); -select * into outfile 'load.data' from t1; -load data infile 'load.data' replace into table t1; -load data infile 'load.data' replace into table t1; +select * into outfile 'MDEV-17891.data' from t1; +load data infile 'MDEV-17891.data' replace into table t1; +load data infile 'MDEV-17891.data' replace into table t1; ERROR HY000: The table 't1' is full -load data infile 'load.data' replace into table t1; +load data infile 'MDEV-17891.data' replace into table t1; ERROR HY000: The table 't1' is full set @@max_heap_table_size= 1048576; drop table t1; @@ -1170,6 +1205,8 @@ insert into t1 values (0); update t1 set x= x + 1; set timestamp= unix_timestamp('2000-01-01 02:00:01'); update t1 set x= x + 1; +Warnings: +Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions select *, row_start, row_end from t1 for system_time as of '2000-01-01 02:00:00'; x row_start row_end 1 2000-01-01 00:00:00.000000 2000-01-01 02:00:01.000000 @@ -1219,6 +1256,11 @@ delete from t1 partition (p0, pn); ERROR HY000: Not allowed for system-versioned table `test`.`t1` delete from t1 partition (p0, p1, pn); ERROR HY000: Not allowed for system-versioned table `test`.`t1` +lock tables t1 write; +delete from t1 partition (p0, pn); +ERROR HY000: Not allowed for system-versioned table `test`.`t1` +delete from t1; +unlock tables; drop table t1; set timestamp= default; # @@ -1792,8 +1834,129 @@ t1 CREATE TABLE `t1` ( PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE) drop tables t1; # -# End of 10.5 tests +# MDEV-27328 Change of SYSTEM_TIME partitioning options is not possible without data copy # +create or replace table t1 (f int) with system versioning +partition by hash(f); +alter table t1 partition by system_time; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME +PARTITIONS 2 +create or replace table t1 (f int) with system versioning +partition by system_time; +alter table t1 partition by hash(f); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY HASH (`f`) +create or replace table t1 (x int) with system versioning; +alter table t1 partition by system_time; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME +PARTITIONS 2 +create or replace table t1 (x int) with system versioning +partition by system_time limit 100 partitions 4; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME LIMIT 100 +PARTITIONS 4 +alter table t1 add partition partitions 2; +alter table t1 partition by system_time; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME +PARTITIONS 6 +alter table t1 partition by system_time limit 33; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME LIMIT 33 +PARTITIONS 6 +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +insert t1 values (0); +set timestamp= unix_timestamp('2000-01-01 00:10:00'); +update t1 set x= x + 1; +set timestamp= unix_timestamp('2000-01-01 01:00:00'); +update t1 set x= x + 1; +set timestamp= unix_timestamp('2000-01-01 01:30:00'); +update t1 set x= x + 1; +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +update t1 set x= x + 1; +alter table t1 partition by system_time interval 1 hour +starts '2000-01-01 00:00:00'; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' +PARTITIONS 6 +select * from t1 partition (p0); +x +0 +select * from t1 partition (p1); +x +1 +2 +select * from t1 partition (p2); +x +3 +select * from t1 partition (pn); +x +4 +set timestamp= default; +alter table t1 partition by system_time limit 1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME LIMIT 1 +PARTITIONS 6 +update t1 set x= x + 1; +update t1 set x= x + 1; +Warnings: +Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p4`) is out of LIMIT, need more HISTORY partitions +# You see warning above ^ +select * from t1 partition (p0); +x +0 +select * from t1 partition (p1); +x +1 +2 +select * from t1 partition (p2); +x +3 +select * from t1 partition (p3); +x +4 +select * from t1 partition (p4); +x +5 +select * from t1 partition (pn); +x +6 +drop table t1; +# End of 10.6 tests # # MDEV-22166 MIGRATE PARTITION: move out partition into a table # @@ -2172,4 +2335,1056 @@ drop tables t, tp; # # End of 10.7 tests # +# +# MDEV-17554 Auto-create new partition for system versioned tables +# with history partitioned by INTERVAL/LIMIT +# +create or replace table t1 (x int) with system versioning +partition by system_time limit 1 auto; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME LIMIT 1 AUTO +PARTITIONS 2 +# Turn off AUTO +alter table t1 partition by system_time limit 1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME LIMIT 1 +PARTITIONS 2 +# Get AUTO back +alter table t1 partition by system_time limit 1 auto; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME LIMIT 1 AUTO +PARTITIONS 2 +insert into t1 values (1); +create or replace table t2 (y int); +insert into t2 values (2); +insert into t1 select * from t2; +insert into t2 select * from t1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME LIMIT 1 AUTO +PARTITIONS 2 +# Too many partitions error +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 (x int) with system versioning +partition by system_time interval 1 hour auto; +set timestamp= unix_timestamp('2001-01-01 00:01:00'); +update t1 set x= x + 1; +ERROR HY000: Versioned table `test`.`t1`: adding HISTORY partition(s) failed +show warnings; +Level Code Message +Warning 1499 Too many partitions (including subpartitions) were defined +Error 4189 Versioned table `test`.`t1`: adding HISTORY partition(s) failed +# Auto-create failed error +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 (x int) with system versioning engine innodb +partition by system_time interval 1 hour auto; +insert into t1 values (1); +call mtr.add_suppression("rror number .*(File exists|file operation)"); +call mtr.add_suppression("InnoDB: Cannot create file"); +set timestamp= unix_timestamp('2000-01-01 01:00:00'); +update t1 set x= x + 2; +ERROR HY000: Got error 184 "Tablespace already exists" from storage engine InnoDB +show warnings; +Level Code Message +Error 1030 Got error 184 "Tablespace already exists" from storage engine InnoDB +Warning 4189 Versioned table `test`.`t1`: adding HISTORY partition(s) failed +# Partition overflow error and manual fix +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 (x int) with system versioning +partition by system_time interval 1 hour; +insert into t1 values (440); +set timestamp= unix_timestamp('2000-01-01 00:10:00'); +update t1 set x= x + 1; +# Check how pruning boundaries work +explain partitions select * from t1 for system_time as of '2000-01-01 00:59:58'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0,pn # NULL NULL NULL NULL # # +explain partitions select * from t1 for system_time as of '2000-01-01 00:59:59'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0,pn # NULL NULL NULL NULL # # +explain partitions select * from t1 for system_time as of '2000-01-01 01:00:00'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0,pn # NULL NULL NULL NULL # # +select * from t1 for system_time as of '2000-01-01 00:09:59'; +x +440 +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +update t1 set x= x + 1; +Warnings: +Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p0`) is out of INTERVAL, need more HISTORY partitions +select * from t1 for system_time as of '2000-01-01 01:00:00'; +x +441 +select * from t1 partition (p0) order by x; +x +440 +441 +# Here is how manual fix works: just add new partitions there +alter table t1 add partition partitions 3; +select * from t1 for system_time as of '2000-01-01 01:00:00'; +x +441 +select * from t1 partition (p0) order by x; +x +440 +# Check pruning after ALTER +explain partitions select * from t1 for system_time as of '2000-01-01 00:59:58'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0,p1,p2,p3,pn # NULL NULL NULL NULL # # +explain partitions select * from t1 for system_time as of '2000-01-01 00:59:59'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p1,p2,p3,pn # NULL NULL NULL NULL # # +explain partitions select * from t1 for system_time as of '2000-01-01 01:00:00'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p1,p2,p3,pn # NULL NULL NULL NULL # # +drop table t1; +create or replace table t1 (x int) with system versioning +partition by system_time interval 3600 second +starts '2000-01-01 00:00:00' auto partitions 3; +affected rows: 0 +insert into t1 values (1); +affected rows: 1 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 3600 SECOND STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 3 +affected rows: 1 +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +affected rows: 0 +update t1 set x= x + 1; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 3600 SECOND STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 4 +affected rows: 1 +set timestamp= unix_timestamp('2000-01-01 03:00:00'); +affected rows: 0 +update t1 set x= x + 2; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 3600 SECOND STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 5 +affected rows: 1 +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +affected rows: 0 +create or replace table t1 (x int) with system versioning +partition by system_time interval 1 hour auto ( +partition p1 history, +partition p3 history, +partition pn current); +affected rows: 0 +insert into t1 values (1); +affected rows: 1 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `p3` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE) +affected rows: 1 +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +affected rows: 0 +update t1 set x= x + 3; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `p3` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `p2` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE) +affected rows: 1 +set timestamp= unix_timestamp('2000-01-01 03:00:00'); +affected rows: 0 +update t1 set x= x + 4; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `p3` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `p2` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `p4` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE) +affected rows: 1 +set timestamp= unix_timestamp('2000-01-01 04:00:00'); +affected rows: 0 +lock tables t1 write; +affected rows: 0 +update t1 set x= x + 5; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `p3` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `p2` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `p4` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `p5` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE) +affected rows: 1 +unlock tables; +affected rows: 0 +set timestamp= default; +affected rows: 0 +# Couple of more LOCK TABLES cases +create or replace table t1 (x int) with system versioning +partition by system_time limit 1 auto; +affected rows: 0 +lock tables t1 write; +affected rows: 0 +insert into t1 values (1); +affected rows: 1 +update t1 set x= x + 1; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0 +update t1 set x= x + 2; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0 +update t1 set x= x + 3; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME LIMIT 1 AUTO +PARTITIONS 4 +affected rows: 1 +unlock tables; +affected rows: 0 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME LIMIT 1 AUTO +PARTITIONS 4 +affected rows: 1 +# Overflow prevention under LOCK TABLES +create or replace table t1 (x int) +with system versioning partition by system_time +limit 10 auto; +affected rows: 0 +insert into t1 values (1), (2), (3), (4), (5), (6), (7), (8), (9); +affected rows: 9 +info: Records: 9 Duplicates: 0 Warnings: 0 +update t1 set x= x + 10; +affected rows: 9 +info: Rows matched: 9 Changed: 9 Inserted: 9 Warnings: 0 +lock tables t1 write; +affected rows: 0 +update t1 set x= 1 where x = 11; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0 +update t1 set x= 2 where x = 12; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0 +update t1 set x= 3 where x = 13; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0 +unlock tables; +affected rows: 0 +select count(x) from t1 partition (p0); +count(x) +10 +affected rows: 1 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME LIMIT 10 AUTO +PARTITIONS 3 +affected rows: 1 +drop tables t1; +affected rows: 0 +# Test VIEW, LOCK TABLES +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +affected rows: 0 +create or replace table t1 (x int) with system versioning +partition by system_time interval 1 hour auto; +affected rows: 0 +create or replace view v1 as select * from t1; +affected rows: 0 +insert into t1 values (1); +affected rows: 1 +set timestamp= unix_timestamp('2000-01-01 01:00:00'); +affected rows: 0 +update v1 set x= x + 2; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 3 +affected rows: 1 +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +affected rows: 0 +lock tables v1 write; +affected rows: 0 +update v1 set x= x + 3; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 4 +affected rows: 1 +unlock tables; +affected rows: 0 +drop view v1; +affected rows: 0 +drop tables t1; +affected rows: 0 +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +affected rows: 0 +create or replace table t1 (x int) with system versioning +partition by system_time interval 1 hour auto partitions 3; +affected rows: 0 +create or replace table t2 (y int) with system versioning +partition by system_time interval 1 hour auto; +affected rows: 0 +insert into t1 values (1); +affected rows: 1 +insert into t2 values (2); +affected rows: 1 +set timestamp= unix_timestamp('2000-01-01 01:00:00'); +affected rows: 0 +update t1, t2 set x= x + 1, y= y + 1; +affected rows: 2 +info: Rows matched: 2 Changed: 2 Warnings: 0 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 3 +affected rows: 1 +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `y` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 3 +affected rows: 1 +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +affected rows: 0 +update t1, t2 set x= x + 1, y= y + 1; +affected rows: 2 +info: Rows matched: 2 Changed: 2 Warnings: 0 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 4 +affected rows: 1 +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `y` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 4 +affected rows: 1 +set timestamp= unix_timestamp('2000-01-01 03:00:00'); +affected rows: 0 +update t1, t2 set t1.x= 0 where t1.x< t2.y; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 5 +affected rows: 1 +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `y` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS ok +affected rows: 1 +drop tables t1, t2; +affected rows: 0 +# PS, SP, LOCK TABLES +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +affected rows: 0 +create or replace table t1 (x int) with system versioning +partition by system_time interval 1 hour auto; +affected rows: 0 +insert into t1 values (1); +affected rows: 1 +set timestamp= unix_timestamp('2000-01-01 01:00:00'); +affected rows: 0 +execute immediate 'update t1 set x= x + 5'; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 3 +affected rows: 1 +prepare s from 'update t1 set x= x + 6'; +affected rows: 0 +info: Statement prepared +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +affected rows: 0 +execute s; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0 +execute s; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 4 +affected rows: 1 +set timestamp= unix_timestamp('2000-01-01 03:00:00'); +affected rows: 0 +lock tables t1 write; +affected rows: 0 +execute s; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0 +execute s; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 5 +affected rows: 1 +unlock tables; +affected rows: 0 +drop prepare s; +affected rows: 0 +create procedure sp() update t1 set x= x + 7; +affected rows: 0 +set timestamp= unix_timestamp('2000-01-01 04:00:00'); +affected rows: 0 +call sp; +affected rows: 1 +call sp; +affected rows: 1 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 6 +affected rows: 1 +set timestamp= unix_timestamp('2000-01-01 05:00:00'); +affected rows: 0 +lock tables t1 write; +affected rows: 0 +call sp; +affected rows: 1 +call sp; +affected rows: 1 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 7 +affected rows: 1 +unlock tables; +affected rows: 0 +drop procedure sp; +affected rows: 0 +set timestamp= unix_timestamp('2001-01-01 00:00:00'); +affected rows: 0 +create or replace table t1 (i int) with system versioning +partition by system_time interval 1 day starts '2001-01-01 00:00:00'; +affected rows: 0 +insert into t1 values (0); +affected rows: 1 +set timestamp= unix_timestamp('2001-01-01 00:00:01'); +affected rows: 0 +prepare s from 'update t1 set i= i + 1'; +affected rows: 0 +info: Statement prepared +execute s; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0 +set timestamp= unix_timestamp('2001-01-02 00:00:01'); +affected rows: 0 +execute s; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 1 +Warnings: +Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p0`) is out of INTERVAL, need more HISTORY partitions +drop prepare s; +affected rows: 0 +# Complex table +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +affected rows: 0 +create or replace table t1 ( +x int primary key auto_increment, +t timestamp(6) default '2001-11-11 11:11:11', +b blob(4096) compressed null, +c varchar(1033) character set utf8 not null, +u int unique, +m enum('a', 'b', 'c') not null default 'a' comment 'absolute', +i1 tinyint, i2 smallint, i3 bigint, +index three(i1, i2, i3), +v1 timestamp(6) generated always as (t + interval 1 day), +v2 timestamp(6) generated always as (t + interval 1 month) stored, +s timestamp(6) as row start, +e timestamp(6) as row end, +period for system_time (s, e), +ps date, pe date, +period for app_time (ps, pe), +constraint check_constr check (u > -1)) +with system versioning default charset=ucs2 +partition by system_time interval 1 hour auto ( +partition p2 history, +partition pn current); +affected rows: 0 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) NOT NULL AUTO_INCREMENT, + `t` timestamp(6) NOT NULL DEFAULT '2001-11-11 11:11:11.000000', + `b` blob /*!100301 COMPRESSED*/ DEFAULT NULL, + `c` varchar(1033) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `u` int(11) DEFAULT NULL, + `m` enum('a','b','c') NOT NULL DEFAULT 'a' COMMENT 'absolute', + `i1` tinyint(4) DEFAULT NULL, + `i2` smallint(6) DEFAULT NULL, + `i3` bigint(20) DEFAULT NULL, + `v1` timestamp(6) GENERATED ALWAYS AS (`t` + interval 1 day) VIRTUAL, + `v2` timestamp(6) GENERATED ALWAYS AS (`t` + interval 1 month) STORED, + `s` timestamp(6) GENERATED ALWAYS AS ROW START, + `e` timestamp(6) GENERATED ALWAYS AS ROW END, + `ps` date NOT NULL, + `pe` date NOT NULL, + PERIOD FOR `app_time` (`ps`, `pe`), + PRIMARY KEY (`x`,`e`), + UNIQUE KEY `u` (`u`,`e`), + KEY `three` (`i1`,`i2`,`i3`), + PERIOD FOR SYSTEM_TIME (`s`, `e`), + CONSTRAINT `check_constr` CHECK (`u` > -1) +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +(PARTITION `p2` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE) +affected rows: 1 +insert into t1 (x, c, u, i1, i2, i3, ps, pe) +values (1, 'cc', 0, 1, 2, 3, '1999-01-01', '2000-01-01'); +affected rows: 1 +set timestamp= unix_timestamp('2000-01-01 01:00:00'); +affected rows: 0 +update t1 set x= x + 8; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) NOT NULL AUTO_INCREMENT, + `t` timestamp(6) NOT NULL DEFAULT '2001-11-11 11:11:11.000000', + `b` blob /*!100301 COMPRESSED*/ DEFAULT NULL, + `c` varchar(1033) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `u` int(11) DEFAULT NULL, + `m` enum('a','b','c') NOT NULL DEFAULT 'a' COMMENT 'absolute', + `i1` tinyint(4) DEFAULT NULL, + `i2` smallint(6) DEFAULT NULL, + `i3` bigint(20) DEFAULT NULL, + `v1` timestamp(6) GENERATED ALWAYS AS (`t` + interval 1 day) VIRTUAL, + `v2` timestamp(6) GENERATED ALWAYS AS (`t` + interval 1 month) STORED, + `s` timestamp(6) GENERATED ALWAYS AS ROW START, + `e` timestamp(6) GENERATED ALWAYS AS ROW END, + `ps` date NOT NULL, + `pe` date NOT NULL, + PERIOD FOR `app_time` (`ps`, `pe`), + PRIMARY KEY (`x`,`e`), + UNIQUE KEY `u` (`u`,`e`), + KEY `three` (`i1`,`i2`,`i3`), + PERIOD FOR SYSTEM_TIME (`s`, `e`), + CONSTRAINT `check_constr` CHECK (`u` > -1) +) ENGINE=DEFAULT_ENGINE AUTO_INCREMENT=10 DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +(PARTITION `p2` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE) +affected rows: 1 +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +affected rows: 0 +update t1 set x= x - 8; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) NOT NULL AUTO_INCREMENT, + `t` timestamp(6) NOT NULL DEFAULT '2001-11-11 11:11:11.000000', + `b` blob /*!100301 COMPRESSED*/ DEFAULT NULL, + `c` varchar(1033) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `u` int(11) DEFAULT NULL, + `m` enum('a','b','c') NOT NULL DEFAULT 'a' COMMENT 'absolute', + `i1` tinyint(4) DEFAULT NULL, + `i2` smallint(6) DEFAULT NULL, + `i3` bigint(20) DEFAULT NULL, + `v1` timestamp(6) GENERATED ALWAYS AS (`t` + interval 1 day) VIRTUAL, + `v2` timestamp(6) GENERATED ALWAYS AS (`t` + interval 1 month) STORED, + `s` timestamp(6) GENERATED ALWAYS AS ROW START, + `e` timestamp(6) GENERATED ALWAYS AS ROW END, + `ps` date NOT NULL, + `pe` date NOT NULL, + PERIOD FOR `app_time` (`ps`, `pe`), + PRIMARY KEY (`x`,`e`), + UNIQUE KEY `u` (`u`,`e`), + KEY `three` (`i1`,`i2`,`i3`), + PERIOD FOR SYSTEM_TIME (`s`, `e`), + CONSTRAINT `check_constr` CHECK (`u` > -1) +) ENGINE=DEFAULT_ENGINE AUTO_INCREMENT=10 DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +(PARTITION `p2` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `p3` HISTORY ENGINE = DEFAULT_ENGINE, + PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE) +affected rows: 1 +# INSERT .. ON DUPLICATE KEY UPDATE (ODKU) +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 (x int primary key) with system versioning +partition by system_time interval 1 hour auto; +insert into t1 values (1); +set timestamp= unix_timestamp('2000-01-01 01:00:00'); +insert into t1 values (1) on duplicate key update x= x + 1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) NOT NULL, + PRIMARY KEY (`x`) +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 3 +# LOAD DATA .. REPLACE +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 (x int primary key) with system versioning +partition by system_time interval 1 hour auto; +insert t1 values (1), (2), (3); +select x into outfile 'MDEV-17554.data' from t1; +set timestamp= unix_timestamp('2000-01-01 01:00:00'); +load data infile 'MDEV-17554.data' replace into table t1 (x); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) NOT NULL, + PRIMARY KEY (`x`) +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 3 +# Concurrent DML +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 (x int) with system versioning +partition by system_time interval 1 hour auto partitions 3; +insert into t1 values (1); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 3 +connect con8, localhost, root; +connect con7, localhost, root; +connect con6, localhost, root; +connect con5, localhost, root; +connect con4, localhost, root; +connect con3, localhost, root; +connect con2, localhost, root; +connect con1, localhost, root; +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +update t1 set x= x + 10; +connection con2; +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +update t1 set x= x + 20; +connection con3; +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +update t1 set x= x + 30; +connection con4; +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +update t1 set x= x + 40; +connection con5; +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +update t1 set x= x + 50; +connection con6; +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +update t1 set x= x + 60; +connection con7; +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +update t1 set x= x + 70; +connection con8; +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +update t1 set x= x + 80; +connection con1; +disconnect con1; +connection con2; +disconnect con2; +connection con3; +disconnect con3; +connection con4; +disconnect con4; +connection con5; +disconnect con5; +connection con6; +disconnect con6; +connection con7; +disconnect con7; +disconnect con8; +connection default; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 4 +drop tables t1; +set timestamp= default; +# Concurrent DML (LIMIT) +create or replace table t1 (x int) with system versioning engine heap +partition by system_time limit 1 auto partitions 3; +insert into t1 values (1); +update t1 set x= x + N; # (running multithreaded for 3 times) +drop tables t1; +# Transaction +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 (x int) with system versioning engine innodb +partition by system_time interval 1 hour auto; +insert into t1 values (1); +set timestamp= unix_timestamp('2000-01-01 01:00:00'); +start transaction; +update t1 set x= 0; +connect con1, localhost, root; +select * from t1; +x +1 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 3 +connection default; +commit; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 3 +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +start transaction; +update t1 set x= 1; +connection con1; +select * from t1; +x +0 +connection default; +rollback; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 4 +disconnect con1; +connection default; +drop table t1; +# +# MDEV-25479 Auto-create: 2nd and further executions of PS or SP fail to create partition +# +create table t (a int) with system versioning +partition by system_time interval 1 hour auto; +insert into t values (1), (2); +prepare stmt from "update t set a= a + 1"; +set @@timestamp= @@timestamp + 3601; +execute stmt; +set @@timestamp= @@timestamp + 3601; +execute stmt; +drop prepare stmt; +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 02:00:00' AUTO +PARTITIONS 4 +create procedure sp() update t set a= a + 1; +set @@timestamp= @@timestamp + 3601; +call sp(); +set @@timestamp= @@timestamp + 3601; +call sp(); +drop procedure sp; +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 02:00:00' AUTO +PARTITIONS 6 +drop table t; +# +# MDEV-23639 Auto-create does not work under LOCK TABLES or inside triggers +# +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 (x int) with system versioning +partition by system_time interval 1 hour auto +partitions 3; +create table t2 (x int); +create table t3 (x int); +insert into t3 values (3); +create trigger tr after insert on t2 for each row update t1 set x= x + 11; +create or replace procedure sp() update t1 set x= x + 5; +create or replace procedure sp2() insert into t2 values (5); +prepare ps from 'update t1 set x= x + 6'; +prepare ps2 from 'insert into t2 values (6)'; +insert into t1 values (1); +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 3 +insert into t2 values (2); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 4 +set timestamp= unix_timestamp('2000-01-01 03:00:00'); +call sp; +call sp; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 5 +set timestamp= unix_timestamp('2000-01-01 04:00:00'); +call sp2; +call sp2; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 6 +set timestamp= unix_timestamp('2000-01-01 05:00:00'); +execute ps; +execute ps; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 7 +set timestamp= unix_timestamp('2000-01-01 06:00:00'); +execute ps2; +execute ps2; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 8 +set timestamp= unix_timestamp('2000-01-01 08:00:00'); +lock tables t1 write, t2 write; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 10 +set timestamp= unix_timestamp('2000-01-01 09:00:00'); +update t1 set x= x + 1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 11 +set timestamp= unix_timestamp('2000-01-01 10:00:00'); +update t1 set x= x + 2; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 12 +update t2 set x= x + 1; +set timestamp= unix_timestamp('2000-01-01 11:00:00'); +insert into t2 values (4); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 13 +update t3 set x= x + 1; +ERROR HY000: Table 't3' was not locked with LOCK TABLES +set timestamp= unix_timestamp('2000-01-01 12:00:00'); +call sp; +call sp; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 14 +set timestamp= unix_timestamp('2000-01-01 13:00:00'); +call sp2; +call sp2; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 15 +set timestamp= unix_timestamp('2000-01-01 14:00:00'); +execute ps; +execute ps; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 16 +set timestamp= unix_timestamp('2000-01-01 15:00:00'); +execute ps2; +execute ps2; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 17 +unlock tables; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 17 +drop tables t1, t2, t3; +drop procedure sp; +drop procedure sp2; +drop prepare ps; +drop prepare ps2; +# +# MDEV-27456 Assertion `!thd->is_error()' fails in vers_create_partitions upon DML with ER_UNKNOWN_PARTITION +# +create table t (a int) with system versioning +partition by system_time interval 1 minute auto; +set @@timestamp= @@timestamp + 61; +select * from t; +a +delete from t partition (px); +ERROR HY000: Unknown partition 'px' in table 't' +lock tables t write; +delete from t partition (px); +ERROR HY000: Unknown partition 'px' in table 't' +unlock tables; +drop table t; +# +# MDEV-28978 Assertion failure in THD::binlog_query or unexpected +# ER_ERROR_ON_WRITE with auto-partitioning +# +create table t (a int) with system versioning partition by system_time limit 6 auto; +insert into t () values (),(),(),(),(),(); +update t set a = 1; +update t set a = 2 limit 0; +drop table t; set global innodb_stats_persistent= @save_persistent; diff --git a/mysql-test/suite/versioning/r/rpl.result b/mysql-test/suite/versioning/r/rpl.result index a6fa6b3fca7..3e0bc85cea7 100644 --- a/mysql-test/suite/versioning/r/rpl.result +++ b/mysql-test/suite/versioning/r/rpl.result @@ -164,4 +164,224 @@ update t1 set i = 0; connection slave; connection master; drop table t1; +# +# MDEV-17554 Auto-create new partition for system versioned tables +# with history partitioned by INTERVAL/LIMIT +# +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 (x int) with system versioning +partition by system_time interval 1 hour auto; +insert t1 values (); +set timestamp= unix_timestamp('2000-01-01 01:00:00'); +delete from t1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 3 +connection slave; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO +PARTITIONS 3 +connection master; +drop table t1; +set timestamp= default; +# +# MDEV-25477 Auto-create breaks replication when triggering event was not replicated +# +set timestamp= unix_timestamp('2001-01-01 01:00:00'); +# ROLLBACK +create table t (a int) with system versioning +partition by system_time interval 1 hour auto; +insert into t values (1), (2); +set @@timestamp= @@timestamp + 3601; +start transaction; +delete from t; +rollback; +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 01:00:00' AUTO +PARTITIONS 3 +connection slave; +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 01:00:00' AUTO +PARTITIONS 3 +connection master; +alter table t drop partition p0; +connection slave; +# INSERT .. ODKU +connection master; +create or replace table t (a int primary key) with system versioning +partition by system_time interval 1 hour auto; +insert into t values (1), (2); +set @@timestamp= @@timestamp + 3601; +insert into t values (1) on duplicate key update a= a; +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 02:00:00' AUTO +PARTITIONS 3 +connection slave; +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 02:00:00' AUTO +PARTITIONS 3 +connection master; +alter table t drop partition p0; +connection slave; +# INSERT .. SELECT .. ODKU +connection master; +create or replace table t (a int primary key) with system versioning +partition by system_time interval 1 hour auto; +insert into t values (1), (2); +set @@timestamp= @@timestamp + 3601; +call mtr.add_suppression("Unsafe statement written to the binary log"); +insert t select a from t where a = 1 limit 0 on duplicate key update a= 1; +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 03:00:00' AUTO +PARTITIONS 3 +connection slave; +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 03:00:00' AUTO +PARTITIONS 3 +connection master; +alter table t drop partition p0; +connection slave; +# UPDATE +connection master; +create or replace table t (a int) with system versioning +partition by system_time interval 1 hour auto; +insert into t values (1), (2); +set @@timestamp= @@timestamp + 3601; +update t set a= 3 limit 0; +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 04:00:00' AUTO +PARTITIONS 3 +connection slave; +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 04:00:00' AUTO +PARTITIONS 3 +connection master; +alter table t drop partition p0; +connection slave; +# DELETE +connection master; +create or replace table t (a int) with system versioning +partition by system_time interval 1 hour auto; +insert into t values (1), (2); +set @@timestamp= @@timestamp + 3601; +delete from t limit 0; +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 05:00:00' AUTO +PARTITIONS 3 +connection slave; +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 05:00:00' AUTO +PARTITIONS 3 +connection master; +alter table t drop partition p0; +connection slave; +# Multi-update +connection master; +create or replace table t (a int) with system versioning +partition by system_time interval 1 hour auto; +create or replace table t2 (b int); +insert into t values (0), (1); +insert into t2 values (10), (20); +set @@timestamp= @@timestamp + 3601; +update t left join t2 on a > b set a= 4; +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 06:00:00' AUTO +PARTITIONS 3 +connection slave; +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 06:00:00' AUTO +PARTITIONS 3 +connection master; +alter table t drop partition p0; +connection slave; +# Multi-delete +connection master; +create or replace table t (a int) with system versioning +partition by system_time interval 1 hour auto; +create or replace table t2 (b int); +insert into t values (0), (1); +insert into t2 values (10), (20); +set @@timestamp= @@timestamp + 3601; +delete t, t2 from t join t2 where a > b; +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 07:00:00' AUTO +PARTITIONS 3 +connection slave; +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 07:00:00' AUTO +PARTITIONS 3 +connection master; +alter table t drop partition p0; +connection slave; +connection master; +drop tables t, t2; +set timestamp= default; include/rpl_end.inc diff --git a/mysql-test/suite/versioning/r/rpl_mix.result b/mysql-test/suite/versioning/r/rpl_mix.result index 68eded0faf7..856678ae373 100644 --- a/mysql-test/suite/versioning/r/rpl_mix.result +++ b/mysql-test/suite/versioning/r/rpl_mix.result @@ -8,4 +8,59 @@ DELETE HISTORY FROM t1; connection slave; connection master; drop table t1; +# +# MDEV-25347 DML events for auto-partitioned tables are written into binary log twice +# +flush binary logs; +create table t1 (a int) with system versioning +partition by system_time limit 1 auto; +insert into t1 values (1); +update t1 set a= a + 1; +update t1 set a= a + 2; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME LIMIT 1 AUTO +PARTITIONS 3 +select * from t1; +a +4 +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Binlog_checkpoint # # master-bin.000002 +master-bin.000002 # Gtid # # GTID #-#-# +master-bin.000002 # Query # # use `test`; create table t1 (a int) with system versioning +partition by system_time limit 1 auto +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Annotate_rows # # insert into t1 values (1) +master-bin.000002 # Table_map # # table_id: # (test.t1) +master-bin.000002 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Annotate_rows # # update t1 set a= a + 1 +master-bin.000002 # Table_map # # table_id: # (test.t1) +master-bin.000002 # Update_rows_v1 # # table_id: # +master-bin.000002 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Annotate_rows # # update t1 set a= a + 2 +master-bin.000002 # Table_map # # table_id: # (test.t1) +master-bin.000002 # Update_rows_v1 # # table_id: # +master-bin.000002 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000002 # Query # # COMMIT +connection slave; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME LIMIT 1 AUTO +PARTITIONS 3 +select * from t1; +a +4 +connection master; +drop table t1; include/rpl_end.inc diff --git a/mysql-test/suite/versioning/r/rpl_row.result b/mysql-test/suite/versioning/r/rpl_row.result index 89c3ce21033..c161f68d0bd 100644 --- a/mysql-test/suite/versioning/r/rpl_row.result +++ b/mysql-test/suite/versioning/r/rpl_row.result @@ -49,4 +49,59 @@ x y 1 1 connection master; drop table t1; +# +# MDEV-25347 DML events for auto-partitioned tables are written into binary log twice +# +flush binary logs; +create table t1 (a int) with system versioning +partition by system_time limit 1 auto; +insert into t1 values (1); +update t1 set a= a + 1; +update t1 set a= a + 2; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME LIMIT 1 AUTO +PARTITIONS 3 +select * from t1; +a +4 +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Binlog_checkpoint # # master-bin.000002 +master-bin.000002 # Gtid # # GTID #-#-# +master-bin.000002 # Query # # use `test`; create table t1 (a int) with system versioning +partition by system_time limit 1 auto +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Annotate_rows # # insert into t1 values (1) +master-bin.000002 # Table_map # # table_id: # (test.t1) +master-bin.000002 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Annotate_rows # # update t1 set a= a + 1 +master-bin.000002 # Table_map # # table_id: # (test.t1) +master-bin.000002 # Update_rows_v1 # # table_id: # +master-bin.000002 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Annotate_rows # # update t1 set a= a + 2 +master-bin.000002 # Table_map # # table_id: # (test.t1) +master-bin.000002 # Update_rows_v1 # # table_id: # +master-bin.000002 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000002 # Query # # COMMIT +connection slave; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME LIMIT 1 AUTO +PARTITIONS 3 +select * from t1; +a +4 +connection master; +drop table t1; include/rpl_end.inc diff --git a/mysql-test/suite/versioning/r/rpl_stmt.result b/mysql-test/suite/versioning/r/rpl_stmt.result new file mode 100644 index 00000000000..97ce2265ac0 --- /dev/null +++ b/mysql-test/suite/versioning/r/rpl_stmt.result @@ -0,0 +1,50 @@ +include/master-slave.inc +[connection master] +# +# MDEV-25347 DML events for auto-partitioned tables are written into binary log twice +# +flush binary logs; +create table t1 (a int) with system versioning +partition by system_time limit 1 auto; +insert into t1 values (1); +update t1 set a= a + 1; +update t1 set a= a + 2; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME LIMIT 1 AUTO +PARTITIONS 3 +select * from t1; +a +4 +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Binlog_checkpoint # # master-bin.000002 +master-bin.000002 # Gtid # # GTID #-#-# +master-bin.000002 # Query # # use `test`; create table t1 (a int) with system versioning +partition by system_time limit 1 auto +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Query # # use `test`; insert into t1 values (1) +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Query # # use `test`; update t1 set a= a + 1 +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Query # # use `test`; update t1 set a= a + 2 +master-bin.000002 # Query # # COMMIT +connection slave; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME LIMIT 1 AUTO +PARTITIONS 3 +select * from t1; +a +4 +connection master; +drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/versioning/r/update-big.result b/mysql-test/suite/versioning/r/update-big.result index 89297fe5d89..506d1d23c5d 100644 --- a/mysql-test/suite/versioning/r/update-big.result +++ b/mysql-test/suite/versioning/r/update-big.result @@ -22,4 +22,78 @@ update t1 set a= 1 where a = 5; update t1 set a= 8 where a = 1; update t1 set a= 4 where a = 8; update t1 set a= 6; +disconnect con1; drop table t1; +call mtr.add_suppression("need more HISTORY partitions"); +# +# MDEV-23642 Locking timeout caused by auto-creation affects original DML +# +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 (x int primary key) with system versioning engine innodb +partition by system_time interval 1 hour auto; +insert into t1 values (1); +start transaction; +insert into t1 values (2); +connect con1, localhost, root; +set lock_wait_timeout= 1; +set innodb_lock_wait_timeout= 1; +set timestamp= unix_timestamp('2000-01-01 01:00:01'); +update t1 set x= x + 122 where x = 1; +Warnings: +Error 1205 Lock wait timeout exceeded; try restarting transaction +Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p0`) is out of INTERVAL, need more HISTORY partitions +disconnect con1; +connection default; +select * from t1; +x +2 +123 +drop table t1; +set timestamp= default; +# +# MDEV-25339 Assertion `thd->transaction.stmt.is_empty() || thd->in_sub_stmt' failed +# +create or replace table t1 (x int) with system versioning engine innodb +partition by system_time interval 1 hour auto; +start transaction; +insert into t1 values (1); +select * from t1; +x +1 +connect con1, localhost, root; +set lock_wait_timeout= 1; +set innodb_lock_wait_timeout= 1; +update t1 set x= x + 111; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +select * from t1; +x +disconnect con1; +connection default; +drop table t1; +# +# MDEV-25482 Auto-create: Server hangs after a failed attempt to create partition +# +set timestamp= default; +create table t (pk int primary key, a int) engine=InnoDB +with system versioning partition by system_time interval 1 hour auto; +insert into t values (1,1),(2,2),(3,3),(4,4),(5,5); +start transaction; +update t set a= 20 where pk = 2; +connect con1,localhost,root,,; +set lock_wait_timeout= 1; +set @@timestamp= @@timestamp+3601; +update t set a= 40 where pk = 4; +Warnings: +Error 1205 Lock wait timeout exceeded; try restarting transaction +Warning 4114 Versioned table `test`.`t`: last HISTORY partition (`p0`) is out of INTERVAL, need more HISTORY partitions +update t set a= 400 where pk = 4; +Warnings: +Error 1205 Lock wait timeout exceeded; try restarting transaction +Warning 4114 Versioned table `test`.`t`: last HISTORY partition (`p0`) is out of INTERVAL, need more HISTORY partitions +disconnect con1; +connection default; +select * from t where pk = 4; +pk a +4 400 +rollback; +drop tables t; diff --git a/mysql-test/suite/versioning/t/debug.test b/mysql-test/suite/versioning/t/debug.test index be58b67546d..94917f01389 100644 --- a/mysql-test/suite/versioning/t/debug.test +++ b/mysql-test/suite/versioning/t/debug.test @@ -1,4 +1,5 @@ --source include/have_debug.inc +--source include/have_partition.inc --let $datadir=`select @@datadir` @@ -33,7 +34,8 @@ show create table t3; create table t4 (a int); show create table t4; drop table t1, t2, t3, t4; - +set debug_dbug= @old_dbug; +set global debug_dbug= @old_dbug; --echo # --echo # MDEV-19525 remove ER_VERS_FIELD_WRONG_TYPE from init_from_binary_frm_image() @@ -46,4 +48,61 @@ show create table t1; --replace_result $datadir ./ show warnings; drop table t1; -set global debug_dbug=@old_dbug; +set debug_dbug= @old_dbug; + + +--echo # +--echo # MDEV-17554 Auto-create new partition for system versioned tables +--echo # with history partitioned by INTERVAL/LIMIT +--echo # +call mtr.add_suppression("need more HISTORY partitions"); +create or replace table t1 (x int) with system versioning +partition by system_time limit 1 auto partitions 2; +insert into t1 values (1); +update t1 set x= x + 1; + +--connect con2, localhost, root +--connect con1, localhost, root + +--disable_warnings +--echo # Both threads create partition simultaneously +--connection con1 +set debug_sync= 'add_history_partition signal s1 wait_for s2'; +send update t1 set x= x + 10; +--connection con2 +set debug_sync= 'now wait_for s1'; +flush tables t1; +set debug_sync= 'add_history_partition signal s2'; +update t1 set x= x + 20; +--connection con1 +reap; +--connection default +# 1 or 2 history rows may be created depending on which UPDATE finishes first (MDEV-28459) +# select partition_name, table_rows from information_schema.partitions +# where table_name = 't1'; + +# Fill empty partition for next UPDATE to trigger auto-create +update t1 set x= x + 2; + +--echo # Second thread skips to reopen 3 times until first thread creates partition +--connection con1 +set debug_sync= 'add_history_partition SIGNAL s1 WAIT_FOR s2'; +send update t1 set x= x + 30; +--connection con2 +set debug_sync= 'now WAIT_FOR s1'; +set debug_sync= 'reopen_history_partition SIGNAL s2 EXECUTE 3'; +update t1 set x= x + 40; +--connection con1 +reap; +--connection default +# Same here (MDEV-28459) +# select partition_name, table_rows from information_schema.partitions +# where table_name = 't1'; +--enable_warnings + +--disconnect con1 +--disconnect con2 +set @@timestamp= default; + +drop tables t1; +set debug_sync= 'reset'; diff --git a/mysql-test/suite/versioning/t/delete_history.test b/mysql-test/suite/versioning/t/delete_history.test index 042670bcfec..c653405a61a 100644 --- a/mysql-test/suite/versioning/t/delete_history.test +++ b/mysql-test/suite/versioning/t/delete_history.test @@ -232,4 +232,20 @@ DROP TABLE t1; --echo # End of 10.4 tests +--echo # +--echo # MDEV-17554 Auto-create new partition for system versioned tables with history partitioned by INTERVAL/LIMIT +--echo # +--echo # Don't auto-create new partition on DELETE HISTORY: +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t (a int) with system versioning +partition by system_time interval 1 hour auto; +set timestamp= unix_timestamp('2000-01-01 10:00:00'); +delete history from t; +set timestamp= default; +--replace_result $default_engine DEFAULT_ENGINE +show create table t; +drop table t; + +--echo # End of 10.9 tests + --source suite/versioning/common_finish.inc diff --git a/mysql-test/suite/versioning/t/load_data.test b/mysql-test/suite/versioning/t/load_data.test index 3bac2942a81..d4a1fa1a736 100644 --- a/mysql-test/suite/versioning/t/load_data.test +++ b/mysql-test/suite/versioning/t/load_data.test @@ -1,6 +1,7 @@ # # MDEV-15330 Server crash or assertion `table->insert_values' failure in write_record upon LOAD DATA # +--let $datadir= `select @@datadir` CREATE TABLE t1 (a INT, b INT, c INT, vc INT AS (c), UNIQUE(a), UNIQUE(b)) WITH SYSTEM VERSIONING; INSERT IGNORE INTO t1 (a,b,c) VALUES (1,2,3); @@ -12,3 +13,4 @@ LOAD DATA INFILE '15330.data' REPLACE INTO TABLE t1 (a,b,c); # Cleanup DROP TABLE t1; +--remove_file $datadir/test/15330.data diff --git a/mysql-test/suite/versioning/t/not_embedded.test b/mysql-test/suite/versioning/t/not_embedded.test index 2afae013e70..80e936b02f3 100644 --- a/mysql-test/suite/versioning/t/not_embedded.test +++ b/mysql-test/suite/versioning/t/not_embedded.test @@ -1,5 +1,6 @@ --source include/not_embedded.inc --source include/have_innodb.inc +--source include/have_partition.inc --echo # --echo # SYSTEM_VERSIONING_ASOF sysvar @@ -77,3 +78,30 @@ drop database mysqltest; --disconnect user1 --disconnect root --connection default + +--echo # +--echo # MDEV-25559 Auto-create: infinite loop after interrupted lock wait +--echo # + +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create table t (pk int primary key, a int) engine innodb with system versioning +partition by system_time interval 1 hour auto; +insert into t values (1, 0); +begin; +update t set a= a + 1; +--connect (con1,localhost,root,,) +set max_statement_time= 1; +set timestamp= unix_timestamp('2000-01-01 01:00:00'); +send update t set a= a + 2; +--connection default +set timestamp= unix_timestamp('2000-01-01 01:00:00'); +send update t set a= a + 3; +--connection con1 +--error ER_STATEMENT_TIMEOUT +reap; +--disconnect con1 +--connection default +reap; +commit; +drop table t; +set timestamp= default; diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test index 29de10e4738..e865ec3b9f6 100644 --- a/mysql-test/suite/versioning/t/partition.test +++ b/mysql-test/suite/versioning/t/partition.test @@ -11,6 +11,7 @@ call mtr.add_suppression("need more HISTORY partitions"); --enable_prepare_warnings set system_versioning_alter_history=keep; +--let $datadir= `select @@datadir` --echo # Check conventional partitioning on temporal tables --replace_result $sys_datatype_expl SYS_DATATYPE @@ -231,7 +232,9 @@ prepare stmt from @str; execute stmt; drop prepare stmt; select @ts0 = @ts1; select @ts2 = @ts3; ---echo ## rotation by LIMIT +--echo # +--echo # Rotation by LIMIT +--echo # --error ER_PART_WRONG_VALUE create or replace table t1 (x int) with system versioning @@ -261,8 +264,9 @@ delete from t1; --echo # You see warning above ^ select * from t1 partition (p1) order by x; - ---echo ## rotation by INTERVAL +--echo # +--echo # Rotation by INTERVAL +--echo # --error ER_PART_WRONG_VALUE create or replace table t1 (x int) with system versioning @@ -306,7 +310,8 @@ insert t1 values (1); delete from t1; set timestamp=unix_timestamp('2001-02-04 10:20:50'); insert t1 values (2); delete from t1; -select subpartition_name,partition_description,table_rows from information_schema.partitions where table_schema='test' and table_name='t1'; +select subpartition_name, partition_description, table_rows from information_schema.partitions where table_schema='test' and table_name='t1'; +select * from t1 partition (p1); set timestamp=unix_timestamp('2001-02-04 10:20:55'); alter table t1 add partition (partition p0 history, partition p2 history); @@ -315,7 +320,15 @@ insert t1 values (4),(5); set timestamp=unix_timestamp('2001-02-04 10:30:10'); update t1 set i=6 where i=5; -select subpartition_name,partition_description,table_rows from information_schema.partitions where table_schema='test' and table_name='t1'; +select subpartition_name, partition_description, table_rows from information_schema.partitions where table_schema='test' and table_name='t1'; +select * from t1 partition (p1); +select * from t1 partition (p0); +select * from t1 partition (p2); + +alter table t1 rebuild partition p0, p1, p2; +select * from t1 partition (p1); +select * from t1 partition (p0); +select * from t1 partition (p2); --echo ## pruning check set @ts=(select partition_description from information_schema.partitions @@ -446,7 +459,6 @@ create or replace table t1 (i int) with system versioning partition by system_time interval 1 day starts '2000-01-01 00:00:00' partitions 3; ---echo # we are warned when we push to present: insert into t1 values (0); set timestamp= unix_timestamp('2001-01-01 00:00:01'); update t1 set i= i + 1; @@ -475,8 +487,8 @@ update t1 set i= i + 1; select *, row_end from t1 partition (p0); select *, row_end from t1 partition (p1); -set timestamp= unix_timestamp('2000-01-01 00:00:00'); --echo # and this is how it usually goes: +set timestamp= unix_timestamp('2000-01-01 00:00:00'); create or replace table t1 (i int) with system versioning partition by system_time interval 1 day partitions 3; @@ -492,7 +504,6 @@ set timestamp= unix_timestamp('2000-01-04 00:00:01'); update t1 set i= i + 1; alter table t1 add partition (partition p2 history, partition p3 history); - select *, row_end from t1 partition (p0); select *, row_end from t1 partition (p1); select *, row_end from t1 partition (p2); @@ -511,7 +522,6 @@ insert into t1 (x) values (1), (2), (3), (4), (5); select * from t1 partition (pnsp0); select * from t1 partition (pnsp1); ---echo ### warn about full partition delete from t1 where x < 3; delete from t1; --echo # You see warning above ^ @@ -1009,16 +1019,15 @@ create or replace table t1 ( insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(); -select * into outfile 'load.data' from t1; -load data infile 'load.data' replace into table t1; +select * into outfile 'MDEV-17891.data' from t1; +load data infile 'MDEV-17891.data' replace into table t1; --error ER_RECORD_FILE_FULL -load data infile 'load.data' replace into table t1; +load data infile 'MDEV-17891.data' replace into table t1; --error ER_RECORD_FILE_FULL -load data infile 'load.data' replace into table t1; +load data infile 'MDEV-17891.data' replace into table t1; # Cleanup ---let $datadir= `select @@datadir` ---remove_file $datadir/test/load.data +--remove_file $datadir/test/MDEV-17891.data eval set @@max_heap_table_size= $max_heap_table_size_orig; drop table t1; @@ -1094,6 +1103,11 @@ insert t1 values (1); delete from t1 partition (p0, pn); --error ER_VERS_NOT_ALLOWED delete from t1 partition (p0, p1, pn); +lock tables t1 write; +--error ER_VERS_NOT_ALLOWED +delete from t1 partition (p0, pn); +delete from t1; +unlock tables; drop table t1; set timestamp= default; @@ -1559,11 +1573,79 @@ show create table t1; drop tables t1; ---disable_prepare_warnings - --echo # ---echo # End of 10.5 tests +--echo # MDEV-27328 Change of SYSTEM_TIME partitioning options is not possible without data copy --echo # +create or replace table t1 (f int) with system versioning +partition by hash(f); +alter table t1 partition by system_time; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; + +create or replace table t1 (f int) with system versioning +partition by system_time; +alter table t1 partition by hash(f); +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; + +create or replace table t1 (x int) with system versioning; +alter table t1 partition by system_time; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; + +create or replace table t1 (x int) with system versioning +partition by system_time limit 100 partitions 4; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +alter table t1 add partition partitions 2; +alter table t1 partition by system_time; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +alter table t1 partition by system_time limit 33; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +insert t1 values (0); +set timestamp= unix_timestamp('2000-01-01 00:10:00'); +update t1 set x= x + 1; +set timestamp= unix_timestamp('2000-01-01 01:00:00'); +update t1 set x= x + 1; +set timestamp= unix_timestamp('2000-01-01 01:30:00'); +update t1 set x= x + 1; +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +update t1 set x= x + 1; + +# When we switch to INTERVAL we must reorganize partitions. +# Otherwise pruning won't work correctly. +alter table t1 partition by system_time interval 1 hour +starts '2000-01-01 00:00:00'; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +select * from t1 partition (p0); +select * from t1 partition (p1); +select * from t1 partition (p2); +select * from t1 partition (pn); +set timestamp= default; + +# When we switch to LIMIT we probably don't want to reorganize old partitions. +# Note: reorganize for LIMIT is broken, it pushes all history into first partition. +# TODO: MDEV-27337 +alter table t1 partition by system_time limit 1; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +update t1 set x= x + 1; +update t1 set x= x + 1; +--echo # You see warning above ^ +select * from t1 partition (p0); +select * from t1 partition (p1); +select * from t1 partition (p2); +select * from t1 partition (p3); +select * from t1 partition (p4); +select * from t1 partition (pn); + +drop table t1; + +--echo # End of 10.6 tests --echo # --echo # MDEV-22166 MIGRATE PARTITION: move out partition into a table @@ -1778,6 +1860,751 @@ drop tables t, tp; --echo # End of 10.7 tests --echo # -set global innodb_stats_persistent= @save_persistent; +--echo # +--echo # MDEV-17554 Auto-create new partition for system versioned tables +--echo # with history partitioned by INTERVAL/LIMIT +--echo # +create or replace table t1 (x int) with system versioning +partition by system_time limit 1 auto; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +--echo # Turn off AUTO +alter table t1 partition by system_time limit 1; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +--echo # Get AUTO back +alter table t1 partition by system_time limit 1 auto; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; + +insert into t1 values (1); + +create or replace table t2 (y int); +insert into t2 values (2); + +insert into t1 select * from t2; +insert into t2 select * from t1; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; + +--echo # Too many partitions error +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 (x int) with system versioning +partition by system_time interval 1 hour auto; +set timestamp= unix_timestamp('2001-01-01 00:01:00'); +--error ER_VERS_HIST_PART_FAILED +update t1 set x= x + 1; +show warnings; + +--echo # Auto-create failed error +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 (x int) with system versioning engine innodb +partition by system_time interval 1 hour auto; + +insert into t1 values (1); + +call mtr.add_suppression("rror number .*(File exists|file operation)"); +call mtr.add_suppression("InnoDB: Cannot create file"); + +--let $datadir= `select @@datadir` +--let $dummy= $datadir/test/t1#P#p1.ibd +--write_file $dummy +EOF + +set timestamp= unix_timestamp('2000-01-01 01:00:00'); +--error ER_GET_ERRNO +update t1 set x= x + 2; +show warnings; +--remove_file $dummy + +--echo # Partition overflow error and manual fix +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 (x int) with system versioning +partition by system_time interval 1 hour; + +insert into t1 values (440); +set timestamp= unix_timestamp('2000-01-01 00:10:00'); +update t1 set x= x + 1; + +--echo # Check how pruning boundaries work +--replace_column 5 # 10 # 11 # +explain partitions select * from t1 for system_time as of '2000-01-01 00:59:58'; +--replace_column 5 # 10 # 11 # +explain partitions select * from t1 for system_time as of '2000-01-01 00:59:59'; +--replace_column 5 # 10 # 11 # +explain partitions select * from t1 for system_time as of '2000-01-01 01:00:00'; +select * from t1 for system_time as of '2000-01-01 00:09:59'; + +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +update t1 set x= x + 1; + +select * from t1 for system_time as of '2000-01-01 01:00:00'; +select * from t1 partition (p0) order by x; + +--echo # Here is how manual fix works: just add new partitions there +alter table t1 add partition partitions 3; +select * from t1 for system_time as of '2000-01-01 01:00:00'; +select * from t1 partition (p0) order by x; + +--echo # Check pruning after ALTER +--replace_column 5 # 10 # 11 # +explain partitions select * from t1 for system_time as of '2000-01-01 00:59:58'; +--replace_column 5 # 10 # 11 # +explain partitions select * from t1 for system_time as of '2000-01-01 00:59:59'; +--replace_column 5 # 10 # 11 # +explain partitions select * from t1 for system_time as of '2000-01-01 01:00:00'; + +drop table t1; + +--enable_info +create or replace table t1 (x int) with system versioning +partition by system_time interval 3600 second +starts '2000-01-01 00:00:00' auto partitions 3; + +insert into t1 values (1); +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; + +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +update t1 set x= x + 1; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; + +set timestamp= unix_timestamp('2000-01-01 03:00:00'); +update t1 set x= x + 2; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; + +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 (x int) with system versioning +partition by system_time interval 1 hour auto ( + partition p1 history, + partition p3 history, + partition pn current); + +insert into t1 values (1); +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; + +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +update t1 set x= x + 3; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; + +set timestamp= unix_timestamp('2000-01-01 03:00:00'); +update t1 set x= x + 4; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; + +set timestamp= unix_timestamp('2000-01-01 04:00:00'); +lock tables t1 write; +update t1 set x= x + 5; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +unlock tables; +set timestamp= default; + +--echo # Couple of more LOCK TABLES cases +create or replace table t1 (x int) with system versioning +partition by system_time limit 1 auto; +lock tables t1 write; +insert into t1 values (1); +update t1 set x= x + 1; +update t1 set x= x + 2; +update t1 set x= x + 3; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +unlock tables; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; + +--echo # Overflow prevention under LOCK TABLES +create or replace table t1 (x int) +with system versioning partition by system_time +limit 10 auto; + +insert into t1 values (1), (2), (3), (4), (5), (6), (7), (8), (9); +update t1 set x= x + 10; + +lock tables t1 write; +update t1 set x= 1 where x = 11; +update t1 set x= 2 where x = 12; +update t1 set x= 3 where x = 13; +unlock tables; + +select count(x) from t1 partition (p0); +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +drop tables t1; + +--echo # Test VIEW, LOCK TABLES +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 (x int) with system versioning +partition by system_time interval 1 hour auto; +create or replace view v1 as select * from t1; +insert into t1 values (1); +set timestamp= unix_timestamp('2000-01-01 01:00:00'); +update v1 set x= x + 2; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; + +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +lock tables v1 write; +update v1 set x= x + 3; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +unlock tables; + +drop view v1; +drop tables t1; + +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 (x int) with system versioning +partition by system_time interval 1 hour auto partitions 3; + +create or replace table t2 (y int) with system versioning +partition by system_time interval 1 hour auto; + +insert into t1 values (1); +insert into t2 values (2); + +set timestamp= unix_timestamp('2000-01-01 01:00:00'); +update t1, t2 set x= x + 1, y= y + 1; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +--replace_result $default_engine DEFAULT_ENGINE +show create table t2; + +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +update t1, t2 set x= x + 1, y= y + 1; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +--replace_result $default_engine DEFAULT_ENGINE +show create table t2; + +set timestamp= unix_timestamp('2000-01-01 03:00:00'); +update t1, t2 set t1.x= 0 where t1.x< t2.y; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +# Multiupdate_prelocking_strategy::handle_end() is processed after table open. +# For PS it is possible to skip unneeded auto-creation because the above happens at +# prepare stage and auto-creation is done at execute stage. +--replace_result $default_engine DEFAULT_ENGINE 'PARTITIONS 4' 'PARTITIONS ok' 'PARTITIONS 5' 'PARTITIONS ok' +show create table t2; + +drop tables t1, t2; + +--echo # PS, SP, LOCK TABLES +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 (x int) with system versioning +partition by system_time interval 1 hour auto; + +insert into t1 values (1); + +set timestamp= unix_timestamp('2000-01-01 01:00:00'); +execute immediate 'update t1 set x= x + 5'; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; + +prepare s from 'update t1 set x= x + 6'; +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +execute s; execute s; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; + +set timestamp= unix_timestamp('2000-01-01 03:00:00'); +lock tables t1 write; +execute s; execute s; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +unlock tables; +drop prepare s; + +create procedure sp() update t1 set x= x + 7; +set timestamp= unix_timestamp('2000-01-01 04:00:00'); +call sp; call sp; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +set timestamp= unix_timestamp('2000-01-01 05:00:00'); +lock tables t1 write; +call sp; call sp; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +unlock tables; +drop procedure sp; + +set timestamp= unix_timestamp('2001-01-01 00:00:00'); +create or replace table t1 (i int) with system versioning +partition by system_time interval 1 day starts '2001-01-01 00:00:00'; +insert into t1 values (0); +set timestamp= unix_timestamp('2001-01-01 00:00:01'); +prepare s from 'update t1 set i= i + 1'; +execute s; +set timestamp= unix_timestamp('2001-01-02 00:00:01'); +execute s; +drop prepare s; + +# Because of blobs: +if (!$MTR_COMBINATION_HEAP) +{ +--echo # Complex table +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 ( + x int primary key auto_increment, + t timestamp(6) default '2001-11-11 11:11:11', + b blob(4096) compressed null, + c varchar(1033) character set utf8 not null, + u int unique, + m enum('a', 'b', 'c') not null default 'a' comment 'absolute', + i1 tinyint, i2 smallint, i3 bigint, + index three(i1, i2, i3), + v1 timestamp(6) generated always as (t + interval 1 day), + v2 timestamp(6) generated always as (t + interval 1 month) stored, + s timestamp(6) as row start, + e timestamp(6) as row end, + period for system_time (s, e), + ps date, pe date, + period for app_time (ps, pe), + constraint check_constr check (u > -1)) +with system versioning default charset=ucs2 +partition by system_time interval 1 hour auto ( + partition p2 history, + partition pn current); +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; + +insert into t1 (x, c, u, i1, i2, i3, ps, pe) +values (1, 'cc', 0, 1, 2, 3, '1999-01-01', '2000-01-01'); +set timestamp= unix_timestamp('2000-01-01 01:00:00'); +update t1 set x= x + 8; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; + +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +update t1 set x= x - 8; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +} +--disable_info + +--echo # INSERT .. ON DUPLICATE KEY UPDATE (ODKU) +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 (x int primary key) with system versioning +partition by system_time interval 1 hour auto; +insert into t1 values (1); +set timestamp= unix_timestamp('2000-01-01 01:00:00'); +insert into t1 values (1) on duplicate key update x= x + 1; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; + +--echo # LOAD DATA .. REPLACE +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 (x int primary key) with system versioning +partition by system_time interval 1 hour auto; + +insert t1 values (1), (2), (3); +select x into outfile 'MDEV-17554.data' from t1; + +set timestamp= unix_timestamp('2000-01-01 01:00:00'); +load data infile 'MDEV-17554.data' replace into table t1 (x); +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +--remove_file $datadir/test/MDEV-17554.data + +--echo # Concurrent DML +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 (x int) with system versioning +partition by system_time interval 1 hour auto partitions 3; + +insert into t1 values (1); +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; + +--connect con8, localhost, root +--connect con7, localhost, root +--connect con6, localhost, root +--connect con5, localhost, root +--connect con4, localhost, root +--connect con3, localhost, root +--connect con2, localhost, root +--connect con1, localhost, root +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +send update t1 set x= x + 10; +--connection con2 +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +send update t1 set x= x + 20; +--connection con3 +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +send update t1 set x= x + 30; +--connection con4 +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +send update t1 set x= x + 40; +--connection con5 +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +send update t1 set x= x + 50; +--connection con6 +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +send update t1 set x= x + 60; +--connection con7 +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +send update t1 set x= x + 70; +--connection con8 +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +update t1 set x= x + 80; +--connection con1 +reap; +--disconnect con1 +--connection con2 +reap; +--disconnect con2 +--connection con3 +reap; +--disconnect con3 +--connection con4 +reap; +--disconnect con4 +--connection con5 +reap; +--disconnect con5 +--connection con6 +reap; +--disconnect con6 +--connection con7 +reap; +--disconnect con7 +--disconnect con8 +--connection default +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; + +drop tables t1; +set timestamp= default; + +--echo # Concurrent DML (LIMIT) +create or replace table t1 (x int) with system versioning engine heap +partition by system_time limit 1 auto partitions 3; + +insert into t1 values (1); + +--let $max_loop= 3 +# For more intensity use +# --let $max_loop= 30 +--echo update t1 set x= x + N; # (running multithreaded for $max_loop times) +--disable_query_log +--disable_result_log +--connect con9, localhost, root +--connect con10, localhost, root +--connect con11, localhost, root +--connect con12, localhost, root +--connect con13, localhost, root +--connect con14, localhost, root +--connect con15, localhost, root +--connect con16, localhost, root +--connect con17, localhost, root +--connect con18, localhost, root +--connect con19, localhost, root +--connect con20, localhost, root +--connect con8, localhost, root +--connect con7, localhost, root +--connect con6, localhost, root +--connect con5, localhost, root +--connect con4, localhost, root +--connect con3, localhost, root +--connect con2, localhost, root +--connect con1, localhost, root +--let $i= 0 +while ($i < $max_loop) +{ + --connection con1 + send update t1 set x= x + 100; + --connection con2 + send update t1 set x= x + 200; + --connection con3 + send update t1 set x= x + 300; + --connection con4 + send update t1 set x= x + 400; + --connection con5 + send update t1 set x= x + 500; + --connection con6 + send update t1 set x= x + 600; + --connection con7 + send update t1 set x= x + 700; + --connection con8 + send update t1 set x= x + 800; + --connection con9 + send update t1 set x= x + 900; + --connection con10 + send update t1 set x= x + 1000; + --connection con11 + send update t1 set x= x + 1100; + --connection con12 + send update t1 set x= x + 1200; + --connection con13 + send update t1 set x= x + 1300; + --connection con14 + send update t1 set x= x + 1400; + --connection con15 + send update t1 set x= x + 1500; + --connection con16 + send update t1 set x= x + 1600; + --connection con17 + send update t1 set x= x + 1700; + --connection con18 + send update t1 set x= x + 1800; + --connection con19 + send update t1 set x= x + 1900; + --connection con20 + send update t1 set x= x + 2000; + --connection con1 + reap; + --connection con2 + reap; + --connection con3 + reap; + --connection con4 + reap; + --connection con5 + reap; + --connection con6 + reap; + --connection con7 + reap; + --connection con8 + reap; + --connection con9 + reap; + --connection con10 + reap; + --connection con11 + reap; + --connection con12 + reap; + --connection con13 + reap; + --connection con14 + reap; + --connection con15 + reap; + --connection con16 + reap; + --connection con17 + reap; + --connection con18 + reap; + --connection con19 + reap; + --connection con20 + reap; + --inc $i +} + +--disconnect con1 +--disconnect con2 +--disconnect con3 +--disconnect con4 +--disconnect con5 +--disconnect con6 +--disconnect con7 +--disconnect con8 +--disconnect con9 +--disconnect con10 +--disconnect con11 +--disconnect con12 +--disconnect con13 +--disconnect con14 +--disconnect con15 +--disconnect con16 +--disconnect con17 +--disconnect con18 +--disconnect con19 +--disconnect con20 + +--connection default +# Result is undeterministic under LIMIT concurrency (MDEV-28459) +# show create table t1; + +--enable_query_log +--enable_result_log + +drop tables t1; + +--echo # Transaction +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 (x int) with system versioning engine innodb +partition by system_time interval 1 hour auto; + +insert into t1 values (1); +set timestamp= unix_timestamp('2000-01-01 01:00:00'); +start transaction; +update t1 set x= 0; +--connect con1, localhost, root +select * from t1; +show create table t1; +--connection default +commit; +show create table t1; + +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +start transaction; +update t1 set x= 1; +--connection con1 +select * from t1; +--connection default +rollback; +show create table t1; +--disconnect con1 +--connection default +drop table t1; + +--echo # +--echo # MDEV-25479 Auto-create: 2nd and further executions of PS or SP fail to create partition +--echo # +create table t (a int) with system versioning + partition by system_time interval 1 hour auto; + +insert into t values (1), (2); +prepare stmt from "update t set a= a + 1"; +set @@timestamp= @@timestamp + 3601; +execute stmt; +set @@timestamp= @@timestamp + 3601; +execute stmt; +drop prepare stmt; +--replace_result $default_engine DEFAULT_ENGINE +show create table t; + +create procedure sp() update t set a= a + 1; +set @@timestamp= @@timestamp + 3601; +call sp(); +set @@timestamp= @@timestamp + 3601; +call sp(); +drop procedure sp; +--replace_result $default_engine DEFAULT_ENGINE +show create table t; + +# Cleanup +drop table t; + +--echo # +--echo # MDEV-23639 Auto-create does not work under LOCK TABLES or inside triggers +--echo # +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 (x int) with system versioning +partition by system_time interval 1 hour auto +partitions 3; + +create table t2 (x int); +create table t3 (x int); +insert into t3 values (3); + +create trigger tr after insert on t2 for each row update t1 set x= x + 11; +create or replace procedure sp() update t1 set x= x + 5; +create or replace procedure sp2() insert into t2 values (5); +prepare ps from 'update t1 set x= x + 6'; +prepare ps2 from 'insert into t2 values (6)'; + +insert into t1 values (1); +set timestamp= unix_timestamp('2000-01-01 02:00:00'); +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +insert into t2 values (2); +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; + +set timestamp= unix_timestamp('2000-01-01 03:00:00'); +call sp; call sp; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +set timestamp= unix_timestamp('2000-01-01 04:00:00'); +call sp2; call sp2; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; + +set timestamp= unix_timestamp('2000-01-01 05:00:00'); +execute ps; execute ps; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +set timestamp= unix_timestamp('2000-01-01 06:00:00'); +execute ps2; execute ps2; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; + +set timestamp= unix_timestamp('2000-01-01 08:00:00'); +lock tables t1 write, t2 write; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +set timestamp= unix_timestamp('2000-01-01 09:00:00'); +update t1 set x= x + 1; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +set timestamp= unix_timestamp('2000-01-01 10:00:00'); +update t1 set x= x + 2; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +update t2 set x= x + 1; +set timestamp= unix_timestamp('2000-01-01 11:00:00'); +insert into t2 values (4); +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +--error ER_TABLE_NOT_LOCKED +update t3 set x= x + 1; + +set timestamp= unix_timestamp('2000-01-01 12:00:00'); +call sp; call sp; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +set timestamp= unix_timestamp('2000-01-01 13:00:00'); +call sp2; call sp2; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; + +set timestamp= unix_timestamp('2000-01-01 14:00:00'); +execute ps; execute ps; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +set timestamp= unix_timestamp('2000-01-01 15:00:00'); +execute ps2; execute ps2; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; + +unlock tables; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; + +# Cleanup +drop tables t1, t2, t3; +drop procedure sp; +drop procedure sp2; +drop prepare ps; +drop prepare ps2; + +--echo # +--echo # MDEV-27456 Assertion `!thd->is_error()' fails in vers_create_partitions upon DML with ER_UNKNOWN_PARTITION +--echo # +create table t (a int) with system versioning +partition by system_time interval 1 minute auto; +set @@timestamp= @@timestamp + 61; +select * from t; +--error ER_UNKNOWN_PARTITION +delete from t partition (px); +lock tables t write; +--error ER_UNKNOWN_PARTITION +delete from t partition (px); +unlock tables; +# cleanup +drop table t; + +--echo # +--echo # MDEV-28978 Assertion failure in THD::binlog_query or unexpected +--echo # ER_ERROR_ON_WRITE with auto-partitioning +--echo # +create table t (a int) with system versioning partition by system_time limit 6 auto; +insert into t () values (),(),(),(),(),(); +update t set a = 1; +update t set a = 2 limit 0; +# cleanup +drop table t; + +--disable_prepare_warnings +set global innodb_stats_persistent= @save_persistent; --source suite/versioning/common_finish.inc diff --git a/mysql-test/suite/versioning/t/rpl.test b/mysql-test/suite/versioning/t/rpl.test index b5be68feece..45ac3e62d7f 100644 --- a/mysql-test/suite/versioning/t/rpl.test +++ b/mysql-test/suite/versioning/t/rpl.test @@ -133,4 +133,167 @@ sync_slave_with_master; connection master; drop table t1; +--echo # +--echo # MDEV-17554 Auto-create new partition for system versioned tables +--echo # with history partitioned by INTERVAL/LIMIT +--echo # +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 (x int) with system versioning +partition by system_time interval 1 hour auto; +insert t1 values (); +set timestamp= unix_timestamp('2000-01-01 01:00:00'); +delete from t1; +--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE +show create table t1; +--sync_slave_with_master +--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE +show create table t1; +--connection master +drop table t1; +set timestamp= default; + +--echo # +--echo # MDEV-25477 Auto-create breaks replication when triggering event was not replicated +--echo # + +set timestamp= unix_timestamp('2001-01-01 01:00:00'); +--echo # ROLLBACK +create table t (a int) with system versioning +partition by system_time interval 1 hour auto; +insert into t values (1), (2); +set @@timestamp= @@timestamp + 3601; + +start transaction; +delete from t; +--disable_warnings +rollback; +# Warning: Some non-transactional changed tables couldn't be rolled back +--enable_warnings + +--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE +show create table t; +--sync_slave_with_master +--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE +show create table t; +--connection master +alter table t drop partition p0; +--sync_slave_with_master + +--echo # INSERT .. ODKU +--connection master +create or replace table t (a int primary key) with system versioning +partition by system_time interval 1 hour auto; +insert into t values (1), (2); + +set @@timestamp= @@timestamp + 3601; +insert into t values (1) on duplicate key update a= a; +--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE +show create table t; +--sync_slave_with_master +--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE +show create table t; +--connection master +alter table t drop partition p0; +--sync_slave_with_master + +--echo # INSERT .. SELECT .. ODKU +--connection master +create or replace table t (a int primary key) with system versioning +partition by system_time interval 1 hour auto; +insert into t values (1), (2); + +set @@timestamp= @@timestamp + 3601; +--disable_warnings +call mtr.add_suppression("Unsafe statement written to the binary log"); +insert t select a from t where a = 1 limit 0 on duplicate key update a= 1; +--enable_warnings +--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE +show create table t; +--sync_slave_with_master +--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE +show create table t; +--connection master +alter table t drop partition p0; +--sync_slave_with_master + +--echo # UPDATE +--connection master +create or replace table t (a int) with system versioning +partition by system_time interval 1 hour auto; +insert into t values (1), (2); + +set @@timestamp= @@timestamp + 3601; +update t set a= 3 limit 0; +--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE +show create table t; +--sync_slave_with_master +--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE +show create table t; +--connection master +alter table t drop partition p0; +--sync_slave_with_master + +--echo # DELETE +--connection master +create or replace table t (a int) with system versioning +partition by system_time interval 1 hour auto; +insert into t values (1), (2); + +set @@timestamp= @@timestamp + 3601; +delete from t limit 0; +--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE +show create table t; +--sync_slave_with_master +--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE +show create table t; +--connection master +alter table t drop partition p0; +--sync_slave_with_master + +--echo # Multi-update +--connection master +create or replace table t (a int) with system versioning +partition by system_time interval 1 hour auto; +create or replace table t2 (b int); + +insert into t values (0), (1); +insert into t2 values (10), (20); +set @@timestamp= @@timestamp + 3601; +# Note: limit 0 is not important for multi-update/delete because they work +# via mysql_select(). OTOH limit 0 makes unwanted "unsafe" warning. +update t left join t2 on a > b set a= 4; + +--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE +show create table t; +--sync_slave_with_master +--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE +show create table t; +--connection master +alter table t drop partition p0; +--sync_slave_with_master + +--echo # Multi-delete +--connection master +create or replace table t (a int) with system versioning +partition by system_time interval 1 hour auto; +create or replace table t2 (b int); + +insert into t values (0), (1); +insert into t2 values (10), (20); +set @@timestamp= @@timestamp + 3601; +delete t, t2 from t join t2 where a > b; + +--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE +show create table t; +--sync_slave_with_master +--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE +show create table t; +--connection master +alter table t drop partition p0; +--sync_slave_with_master + +--connection master +drop tables t, t2; +set timestamp= default; + --source include/rpl_end.inc diff --git a/mysql-test/suite/versioning/t/rpl_common.inc b/mysql-test/suite/versioning/t/rpl_common.inc new file mode 100644 index 00000000000..37e1d76cc09 --- /dev/null +++ b/mysql-test/suite/versioning/t/rpl_common.inc @@ -0,0 +1,30 @@ +--source include/have_partition.inc + +--echo # +--echo # MDEV-25347 DML events for auto-partitioned tables are written into binary log twice +--echo # +flush binary logs; +--source include/wait_for_binlog_checkpoint.inc +create table t1 (a int) with system versioning +partition by system_time limit 1 auto; + +insert into t1 values (1); +update t1 set a= a + 1; +update t1 set a= a + 2; +--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE +show create table t1; +select * from t1; + +--let $binlog_file=master-bin.000002 +--source include/show_binlog_events.inc + +--sync_slave_with_master +--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE +show create table t1; + +select * from t1; +--connection master +# cleanup +drop table t1; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/versioning/t/rpl_mix.test b/mysql-test/suite/versioning/t/rpl_mix.test index 64025c74625..bf4e0b93422 100644 --- a/mysql-test/suite/versioning/t/rpl_mix.test +++ b/mysql-test/suite/versioning/t/rpl_mix.test @@ -16,4 +16,4 @@ DELETE HISTORY FROM t1; connection master; drop table t1; ---source include/rpl_end.inc +--source rpl_common.inc diff --git a/mysql-test/suite/versioning/t/rpl_row.test b/mysql-test/suite/versioning/t/rpl_row.test index 2e5d4c76f4a..e36d77fc023 100644 --- a/mysql-test/suite/versioning/t/rpl_row.test +++ b/mysql-test/suite/versioning/t/rpl_row.test @@ -56,4 +56,4 @@ drop table t1; --remove_files_wildcard $TMP *.txt --remove_files_wildcard $TMP *.sql ---source include/rpl_end.inc +--source rpl_common.inc diff --git a/mysql-test/suite/versioning/t/rpl_stmt.test b/mysql-test/suite/versioning/t/rpl_stmt.test new file mode 100644 index 00000000000..dca4e8cb4a2 --- /dev/null +++ b/mysql-test/suite/versioning/t/rpl_stmt.test @@ -0,0 +1,4 @@ +--source include/have_binlog_format_statement.inc +--source include/master-slave.inc + +--source rpl_common.inc diff --git a/mysql-test/suite/versioning/t/update-big.test b/mysql-test/suite/versioning/t/update-big.test index 175bfc79a48..98767cefaad 100644 --- a/mysql-test/suite/versioning/t/update-big.test +++ b/mysql-test/suite/versioning/t/update-big.test @@ -1,6 +1,7 @@ source include/big_test.inc; source suite/versioning/engines.inc; source suite/versioning/common.inc; +source include/have_partition.inc; --echo # --echo # MDEV-15458 Segfault in heap_scan() upon UPDATE after ADD SYSTEM VERSIONING @@ -29,6 +30,79 @@ update t1 set a= 8 where a = 1; update t1 set a= 4 where a = 8; update t1 set a= 6; +--disconnect con1 drop table t1; +call mtr.add_suppression("need more HISTORY partitions"); + +--echo # +--echo # MDEV-23642 Locking timeout caused by auto-creation affects original DML +--echo # +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create or replace table t1 (x int primary key) with system versioning engine innodb +partition by system_time interval 1 hour auto; + +insert into t1 values (1); +start transaction; +insert into t1 values (2); + +--connect con1, localhost, root +set lock_wait_timeout= 1; +set innodb_lock_wait_timeout= 1; +set timestamp= unix_timestamp('2000-01-01 01:00:01'); +update t1 set x= x + 122 where x = 1; +--disconnect con1 +--connection default +select * from t1; + +# cleanup +drop table t1; +set timestamp= default; + +--echo # +--echo # MDEV-25339 Assertion `thd->transaction.stmt.is_empty() || thd->in_sub_stmt' failed +--echo # +create or replace table t1 (x int) with system versioning engine innodb +partition by system_time interval 1 hour auto; +start transaction; +insert into t1 values (1); +select * from t1; + +--connect con1, localhost, root +set lock_wait_timeout= 1; +set innodb_lock_wait_timeout= 1; +--error ER_LOCK_WAIT_TIMEOUT +update t1 set x= x + 111; +select * from t1; + +# cleanup +--disconnect con1 +--connection default +drop table t1; + +--echo # +--echo # MDEV-25482 Auto-create: Server hangs after a failed attempt to create partition +--echo # +set timestamp= default; +create table t (pk int primary key, a int) engine=InnoDB + with system versioning partition by system_time interval 1 hour auto; + +insert into t values (1,1),(2,2),(3,3),(4,4),(5,5); + +start transaction; +update t set a= 20 where pk = 2; + +--connect (con1,localhost,root,,) +set lock_wait_timeout= 1; +set @@timestamp= @@timestamp+3601; +update t set a= 40 where pk = 4; +update t set a= 400 where pk = 4; + +# Cleanup +--disconnect con1 +--connection default +select * from t where pk = 4; +rollback; +drop tables t; + source suite/versioning/common_finish.inc; diff --git a/mysql-test/suite/wsrep/r/variables.result b/mysql-test/suite/wsrep/r/variables.result index 8e1af35fd62..8df0210b2d1 100644 --- a/mysql-test/suite/wsrep/r/variables.result +++ b/mysql-test/suite/wsrep/r/variables.result @@ -135,6 +135,7 @@ WSREP_SST_DONOR_REJECTS_QUERIES WSREP_SST_METHOD WSREP_SST_RECEIVE_ADDRESS WSREP_START_POSITION +WSREP_STATUS_FILE WSREP_SYNC_WAIT WSREP_TRX_FRAGMENT_SIZE WSREP_TRX_FRAGMENT_UNIT diff --git a/mysql-test/suite/wsrep/r/variables_debug.result b/mysql-test/suite/wsrep/r/variables_debug.result index 0690f540a37..109b25cd898 100644 --- a/mysql-test/suite/wsrep/r/variables_debug.result +++ b/mysql-test/suite/wsrep/r/variables_debug.result @@ -136,6 +136,7 @@ WSREP_SST_DONOR_REJECTS_QUERIES WSREP_SST_METHOD WSREP_SST_RECEIVE_ADDRESS WSREP_START_POSITION +WSREP_STATUS_FILE WSREP_SYNC_WAIT WSREP_TRX_FRAGMENT_SIZE WSREP_TRX_FRAGMENT_UNIT |