From 178d32f03b84004af3611aab7c6fb9ce0b1388f4 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Tue, 1 Dec 2020 14:13:05 +0400 Subject: MDEV-24318 server_audit doesn't respect filters for PROXY_CONNECT events. The log line should be added behind the filters. --- mysql-test/suite/plugins/r/server_audit.result | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/plugins/r/server_audit.result b/mysql-test/suite/plugins/r/server_audit.result index 7c287b369b1..f309b6c95a3 100644 --- a/mysql-test/suite/plugins/r/server_audit.result +++ b/mysql-test/suite/plugins/r/server_audit.result @@ -440,8 +440,8 @@ TIME,HOSTNAME,plug,localhost,ID,0,DISCONNECT,,,0 TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user, TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv, TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'GRANT PROXY ON plug_dest TO plug',0 -TIME,HOSTNAME,plug,localhost,ID,0,PROXY_CONNECT,test,`plug_dest`@`%`,0 TIME,HOSTNAME,plug,localhost,ID,0,CONNECT,test,,0 +TIME,HOSTNAME,plug,localhost,ID,0,PROXY_CONNECT,test,`plug_dest`@`%`,0 TIME,HOSTNAME,plug,localhost,ID,0,DISCONNECT,test,,0 TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user, TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db, -- cgit v1.2.1 From bc2dc83cb56851144a8c15e73a83c7817dc705a2 Mon Sep 17 00:00:00 2001 From: Anel Husakovic Date: Tue, 1 Dec 2020 21:38:22 +0100 Subject: MDEV-22485: add the test case Closes PR #1649 --- mysql-test/main/mysqlslap.opt | 1 + mysql-test/main/mysqlslap.result | 100 +++++++++++++++++++++++++++++++++++++++ mysql-test/main/mysqlslap.test | 51 ++++++++++++++++++++ 3 files changed, 152 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/main/mysqlslap.opt b/mysql-test/main/mysqlslap.opt index 632f5b4c069..da7672849bb 100644 --- a/mysql-test/main/mysqlslap.opt +++ b/mysql-test/main/mysqlslap.opt @@ -1 +1,2 @@ --sql_mode='NO_ENGINE_SUBSTITUTION' +--log-output=TABLE,FILE --general-log=0 --slow-query-log=0 diff --git a/mysql-test/main/mysqlslap.result b/mysql-test/main/mysqlslap.result index 791cb5ac6b3..a83d4d38a16 100644 --- a/mysql-test/main/mysqlslap.result +++ b/mysql-test/main/mysqlslap.result @@ -258,3 +258,103 @@ DROP TABLE t1; # # Bug MDEV-15789 (Upstream: #80329): MYSQLSLAP OPTIONS --AUTO-GENERATE-SQL-GUID-PRIMARY and --AUTO-GENERATE-SQL-SECONDARY-INDEXES DONT WORK # +# +# MDEV-22485: mysqlslap does not use current user as default for connecting to server +# +set @old_general_log=@@global.general_log; +set @old_general_log_file=@@global.general_log_file; +select @old_general_log; +@old_general_log +0 +show global variables +where Variable_name = 'general_log' or Variable_name = 'slow_query_log'; +Variable_name Value +general_log OFF +slow_query_log OFF +truncate table mysql.general_log; +select * from mysql.general_log; +event_time user_host thread_id server_id command_type argument +set global general_log=ON; +current_user.log; +@@current_user.log +current_user.log +SET GLOBAL general_log_file=general_log.log; +show global variables +where Variable_name = 'general_log' or Variable_name = 'slow_query_log'; +Variable_name Value +general_log ON +slow_query_log OFF +flush logs; +create user anel@localhost; +grant all on *.* to anel@localhost; +connect con1,localhost,anel,,; +connection con1; +create table t(t int); +# Run mysqlslap user anel +Benchmark + Average number of seconds to run all queries: X seconds + Minimum number of seconds to run all queries: X seconds + Maximum number of seconds to run all queries: X seconds + Number of clients running queries: 1 + Average number of queries per client: 1 + +flush tables; +select user_host, command_type, argument from mysql.general_log; +user_host command_type argument +root[root] @ localhost [] Query select @@general_log_file +root[root] @ localhost [] Query SET GLOBAL general_log_file=current_user.log +root[root] @ localhost [] Query show global variables +where Variable_name = 'general_log' or Variable_name = 'slow_query_log' +root[root] @ localhost [] Query flush logs +root[root] @ localhost [] Query create user anel@localhost +root[root] @ localhost [] Query grant all on *.* to anel@localhost +[anel] @ localhost [] Connect anel@localhost as anonymous on test +anel[anel] @ localhost [] Query create table t(t int) +[root] @ localhost [] Connect root@localhost as anonymous on +[root] @ localhost [] Connect root@localhost as anonymous on test +root[root] @ localhost [] Query SELECT current_user() +root[root] @ localhost [] Quit +root[root] @ localhost [] Quit +anel[anel] @ localhost [] Query flush tables +anel[anel] @ localhost [] Query select user_host, command_type, argument from mysql.general_log +disconnect con1; +connection default; +# Run mysqlslap user root +Benchmark + Average number of seconds to run all queries: X seconds + Minimum number of seconds to run all queries: X seconds + Maximum number of seconds to run all queries: X seconds + Number of clients running queries: 1 + Average number of queries per client: 1 + +flush tables; +select user_host, command_type, argument from mysql.general_log; +user_host command_type argument +root[root] @ localhost [] Query select @@general_log_file +root[root] @ localhost [] Query SET GLOBAL general_log_file=current_user.log +root[root] @ localhost [] Query show global variables +where Variable_name = 'general_log' or Variable_name = 'slow_query_log' +root[root] @ localhost [] Query flush logs +root[root] @ localhost [] Query create user anel@localhost +root[root] @ localhost [] Query grant all on *.* to anel@localhost +[anel] @ localhost [] Connect anel@localhost as anonymous on test +anel[anel] @ localhost [] Query create table t(t int) +[root] @ localhost [] Connect root@localhost as anonymous on +[root] @ localhost [] Connect root@localhost as anonymous on test +root[root] @ localhost [] Query SELECT current_user() +root[root] @ localhost [] Quit +root[root] @ localhost [] Quit +anel[anel] @ localhost [] Query flush tables +anel[anel] @ localhost [] Query select user_host, command_type, argument from mysql.general_log +anel[anel] @ localhost [] Quit +[root] @ localhost [] Connect root@localhost as anonymous on +[root] @ localhost [] Connect root@localhost as anonymous on test +root[root] @ localhost [] Query SELECT current_user() +root[root] @ localhost [] Quit +root[root] @ localhost [] Quit +root[root] @ localhost [] Query flush tables +root[root] @ localhost [] Query select user_host, command_type, argument from mysql.general_log +drop user anel@localhost; +drop table t; +set global general_log= @old_general_log; +set global general_log_file= @old_general_log_file; diff --git a/mysql-test/main/mysqlslap.test b/mysql-test/main/mysqlslap.test index 81115d59d09..4e99b8f2cd2 100644 --- a/mysql-test/main/mysqlslap.test +++ b/mysql-test/main/mysqlslap.test @@ -88,3 +88,54 @@ DROP TABLE t1; --exec $MYSQL_SLAP --concurrency=1 --silent --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-guid-primary --create-schema=slap --exec $MYSQL_SLAP --concurrency=1 --silent --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-secondary-indexes=1 --create-schema=slap + +--echo # +--echo # MDEV-22485: mysqlslap does not use current user as default for connecting to server +--echo # +--disable_ps_protocol +set @old_general_log=@@global.general_log; +set @old_general_log_file=@@global.general_log_file; +select @old_general_log; + +show global variables +where Variable_name = 'general_log' or Variable_name = 'slow_query_log'; +truncate table mysql.general_log; +# empty log at the beginning +select * from mysql.general_log; + +set global general_log=ON; +--replace_regex /[\/\w:](?!.log).*/current_user.log/ +select @@general_log_file; +--replace_regex /=.+"/=general_log.log/ +--let $gen_log_file=$MYSQLTEST_VARDIR/tmp/general_log.log +--replace_regex /".+"/general_log.log/ +--eval SET GLOBAL general_log_file="$gen_log_file" +show global variables +where Variable_name = 'general_log' or Variable_name = 'slow_query_log'; +flush logs; +create user anel@localhost; +grant all on *.* to anel@localhost; +connect con1,localhost,anel,,; +connection con1; +create table t(t int); +--echo # Run mysqlslap user anel +--replace_regex /\d[.]\d+/X/ +--exec $MYSQL_SLAP --create-schema=test --query="SELECT current_user()" --concurrency=1 --iterations=1 +flush tables; +--replace_regex /".+/current_user.log/ /[::1]// +select user_host, command_type, argument from mysql.general_log; +disconnect con1; + +connection default; +--echo # Run mysqlslap user root +--replace_regex /\d[.]\d+/X/ +--exec $MYSQL_SLAP --create-schema=test --query="SELECT current_user()" --concurrency=1 --iterations=1 +flush tables; +#--exec $MYSQL_SLAP --concurrency=1 --silent --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-guid-primary --create-schema=slap +--replace_regex /".+/current_user.log/ /[::1]// +select user_host, command_type, argument from mysql.general_log; +drop user anel@localhost; +drop table t; +set global general_log= @old_general_log; +set global general_log_file= @old_general_log_file; +--enable_ps_protocol -- cgit v1.2.1 From 86fc37b66877e45c38593e7af15159c32f81eb7c Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Sun, 22 Mar 2020 11:33:53 +0100 Subject: MDEV-19273: Server crash in MDL_ticket::has_stronger_or_equal_type or Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db.str, table->table_name.str, MDL_SHARED)' failed in mysql_rm_table_no_locks Early report error in case of DROP SEQUENCE Do not use error variable for other purposes except error. --- mysql-test/suite/sql_sequence/create.result | 2 +- mysql-test/suite/sql_sequence/create.test | 2 +- mysql-test/suite/sql_sequence/other.result | 59 ++++++++++++++++++++++++++ mysql-test/suite/sql_sequence/other.test | 64 +++++++++++++++++++++++++++++ 4 files changed, 125 insertions(+), 2 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/sql_sequence/create.result b/mysql-test/suite/sql_sequence/create.result index 14464c60e99..5a53a66c9a8 100644 --- a/mysql-test/suite/sql_sequence/create.result +++ b/mysql-test/suite/sql_sequence/create.result @@ -666,7 +666,7 @@ create temporary sequence s; drop temporary table s; create temporary table s (i int); drop temporary sequence s; -ERROR 42S02: Unknown SEQUENCE: 'test.s' +ERROR 42S02: 'test.s' is not a SEQUENCE drop table s; # # MDEV-15115 Assertion failure in CREATE SEQUENCE...ROW_FORMAT=REDUNDANT diff --git a/mysql-test/suite/sql_sequence/create.test b/mysql-test/suite/sql_sequence/create.test index 2c41fb3658b..ac3aae845cd 100644 --- a/mysql-test/suite/sql_sequence/create.test +++ b/mysql-test/suite/sql_sequence/create.test @@ -489,7 +489,7 @@ drop table s; create temporary sequence s; drop temporary table s; create temporary table s (i int); ---error ER_UNKNOWN_SEQUENCES +--error ER_NOT_SEQUENCE2 drop temporary sequence s; drop table s; diff --git a/mysql-test/suite/sql_sequence/other.result b/mysql-test/suite/sql_sequence/other.result index abc101b3c00..643233149d2 100644 --- a/mysql-test/suite/sql_sequence/other.result +++ b/mysql-test/suite/sql_sequence/other.result @@ -300,4 +300,63 @@ update t1 set p_first_name='Yunxi' where p_id=1; drop view v2; drop table t1,t2; drop sequence s1; +# +# MDEV-19273:Server crash in MDL_ticket::has_stronger_or_equal_type or +# Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE, +# table->db.str, table->table_name.str, MDL_SHARED)' failed +# in mysql_rm_table_no_locks +# +CREATE TABLE t1 (a INT); +CREATE TEMPORARY TABLE tmp (b INT); +LOCK TABLE t1 READ; +DROP SEQUENCE tmp; +ERROR 42S02: 'test.tmp' is not a SEQUENCE +DROP TEMPORARY SEQUENCE tmp; +ERROR 42S02: 'test.tmp' is not a SEQUENCE +DROP SEQUENCE t1; +ERROR HY000: Table 't1' was locked with a READ lock and can't be updated +DROP TEMPORARY SEQUENCE t1; +ERROR 42S02: Unknown SEQUENCE: 'test.t1' +UNLOCK TABLES; +DROP SEQUENCE t1; +ERROR 42S02: 'test.t1' is not a SEQUENCE +DROP TEMPORARY SEQUENCE t1; +ERROR 42S02: Unknown SEQUENCE: 'test.t1' +DROP TABLE t1; +CREATE TABLE t (a INT); +CREATE TEMPORARY TABLE s (f INT); +CREATE SEQUENCE s; +LOCK TABLE t WRITE; +DROP SEQUENCE s; +ERROR 42S02: 'test.s' is not a SEQUENCE +DROP TEMPORARY SEQUENCE s; +ERROR 42S02: 'test.s' is not a SEQUENCE +UNLOCK TABLES; +CREATE TEMPORARY SEQUENCE s; +LOCK TABLE t WRITE; +DROP TEMPORARY SEQUENCE s; +UNLOCK TABLES; +DROP TEMPORARY TABLE s; +DROP SEQUENCE s; +create table s(a INT); +CREATE TEMPORARY TABLE s (f INT); +LOCK TABLE t WRITE; +DROP TEMPORARY TABLE s; +CREATE TEMPORARY TABLE s (f INT); +DROP TABLE s; +DROP TABLE s; +ERROR HY000: Table 's' was not locked with LOCK TABLES +UNLOCK TABLES; +DROP TABLE s; +CREATE VIEW v1 as SELECT * FROM t; +CREATE SEQUENCE s; +DROP SEQUENCE IF EXISTS v1; +Warnings: +Note 4091 Unknown SEQUENCE: 'test.v1' +DROP VIEW IF EXISTS s; +Warnings: +Note 4092 Unknown VIEW: 'test.s' +DROP VIEW v1; +DROP SEQUENCE s; +DROP TABLE t; # End of 10.3 tests diff --git a/mysql-test/suite/sql_sequence/other.test b/mysql-test/suite/sql_sequence/other.test index 70c4efa40e5..0fbb2d0e2f9 100644 --- a/mysql-test/suite/sql_sequence/other.test +++ b/mysql-test/suite/sql_sequence/other.test @@ -315,4 +315,68 @@ drop view v2; drop table t1,t2; drop sequence s1; +--echo # +--echo # MDEV-19273:Server crash in MDL_ticket::has_stronger_or_equal_type or +--echo # Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE, +--echo # table->db.str, table->table_name.str, MDL_SHARED)' failed +--echo # in mysql_rm_table_no_locks +--echo # + +CREATE TABLE t1 (a INT); +CREATE TEMPORARY TABLE tmp (b INT); +LOCK TABLE t1 READ; +--error ER_NOT_SEQUENCE2 +DROP SEQUENCE tmp; +--error ER_NOT_SEQUENCE2 +DROP TEMPORARY SEQUENCE tmp; +--error ER_TABLE_NOT_LOCKED_FOR_WRITE +DROP SEQUENCE t1; +--error ER_UNKNOWN_SEQUENCES +DROP TEMPORARY SEQUENCE t1; +UNLOCK TABLES; +--error ER_NOT_SEQUENCE2 +DROP SEQUENCE t1; +--error ER_UNKNOWN_SEQUENCES +DROP TEMPORARY SEQUENCE t1; + +# Cleanup +DROP TABLE t1; + + +CREATE TABLE t (a INT); +CREATE TEMPORARY TABLE s (f INT); +CREATE SEQUENCE s; +LOCK TABLE t WRITE; +--error ER_NOT_SEQUENCE2 +DROP SEQUENCE s; +--error ER_NOT_SEQUENCE2 +DROP TEMPORARY SEQUENCE s; +UNLOCK TABLES; +CREATE TEMPORARY SEQUENCE s; +LOCK TABLE t WRITE; +DROP TEMPORARY SEQUENCE s; +UNLOCK TABLES; +DROP TEMPORARY TABLE s; +DROP SEQUENCE s; + +create table s(a INT); +CREATE TEMPORARY TABLE s (f INT); +LOCK TABLE t WRITE; +DROP TEMPORARY TABLE s; +CREATE TEMPORARY TABLE s (f INT); +DROP TABLE s; +--error ER_TABLE_NOT_LOCKED +DROP TABLE s; +UNLOCK TABLES; +DROP TABLE s; + +CREATE VIEW v1 as SELECT * FROM t; +CREATE SEQUENCE s; + +DROP SEQUENCE IF EXISTS v1; +DROP VIEW IF EXISTS s; + +DROP VIEW v1; +DROP SEQUENCE s; +DROP TABLE t; --echo # End of 10.3 tests -- cgit v1.2.1 From 18256bce23a5e219a8f4424b56a4380cf8be330a Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 12 Dec 2020 12:10:37 +0100 Subject: remove the test for MDEV-22485 that doesn't test MDEV-22485 This reverts commit bc2dc83cb56851144a8c15e73a83c7817dc705a2. --- mysql-test/main/mysqlslap.opt | 1 - mysql-test/main/mysqlslap.result | 100 --------------------------------------- mysql-test/main/mysqlslap.test | 51 -------------------- 3 files changed, 152 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/main/mysqlslap.opt b/mysql-test/main/mysqlslap.opt index da7672849bb..632f5b4c069 100644 --- a/mysql-test/main/mysqlslap.opt +++ b/mysql-test/main/mysqlslap.opt @@ -1,2 +1 @@ --sql_mode='NO_ENGINE_SUBSTITUTION' ---log-output=TABLE,FILE --general-log=0 --slow-query-log=0 diff --git a/mysql-test/main/mysqlslap.result b/mysql-test/main/mysqlslap.result index a83d4d38a16..791cb5ac6b3 100644 --- a/mysql-test/main/mysqlslap.result +++ b/mysql-test/main/mysqlslap.result @@ -258,103 +258,3 @@ DROP TABLE t1; # # Bug MDEV-15789 (Upstream: #80329): MYSQLSLAP OPTIONS --AUTO-GENERATE-SQL-GUID-PRIMARY and --AUTO-GENERATE-SQL-SECONDARY-INDEXES DONT WORK # -# -# MDEV-22485: mysqlslap does not use current user as default for connecting to server -# -set @old_general_log=@@global.general_log; -set @old_general_log_file=@@global.general_log_file; -select @old_general_log; -@old_general_log -0 -show global variables -where Variable_name = 'general_log' or Variable_name = 'slow_query_log'; -Variable_name Value -general_log OFF -slow_query_log OFF -truncate table mysql.general_log; -select * from mysql.general_log; -event_time user_host thread_id server_id command_type argument -set global general_log=ON; -current_user.log; -@@current_user.log -current_user.log -SET GLOBAL general_log_file=general_log.log; -show global variables -where Variable_name = 'general_log' or Variable_name = 'slow_query_log'; -Variable_name Value -general_log ON -slow_query_log OFF -flush logs; -create user anel@localhost; -grant all on *.* to anel@localhost; -connect con1,localhost,anel,,; -connection con1; -create table t(t int); -# Run mysqlslap user anel -Benchmark - Average number of seconds to run all queries: X seconds - Minimum number of seconds to run all queries: X seconds - Maximum number of seconds to run all queries: X seconds - Number of clients running queries: 1 - Average number of queries per client: 1 - -flush tables; -select user_host, command_type, argument from mysql.general_log; -user_host command_type argument -root[root] @ localhost [] Query select @@general_log_file -root[root] @ localhost [] Query SET GLOBAL general_log_file=current_user.log -root[root] @ localhost [] Query show global variables -where Variable_name = 'general_log' or Variable_name = 'slow_query_log' -root[root] @ localhost [] Query flush logs -root[root] @ localhost [] Query create user anel@localhost -root[root] @ localhost [] Query grant all on *.* to anel@localhost -[anel] @ localhost [] Connect anel@localhost as anonymous on test -anel[anel] @ localhost [] Query create table t(t int) -[root] @ localhost [] Connect root@localhost as anonymous on -[root] @ localhost [] Connect root@localhost as anonymous on test -root[root] @ localhost [] Query SELECT current_user() -root[root] @ localhost [] Quit -root[root] @ localhost [] Quit -anel[anel] @ localhost [] Query flush tables -anel[anel] @ localhost [] Query select user_host, command_type, argument from mysql.general_log -disconnect con1; -connection default; -# Run mysqlslap user root -Benchmark - Average number of seconds to run all queries: X seconds - Minimum number of seconds to run all queries: X seconds - Maximum number of seconds to run all queries: X seconds - Number of clients running queries: 1 - Average number of queries per client: 1 - -flush tables; -select user_host, command_type, argument from mysql.general_log; -user_host command_type argument -root[root] @ localhost [] Query select @@general_log_file -root[root] @ localhost [] Query SET GLOBAL general_log_file=current_user.log -root[root] @ localhost [] Query show global variables -where Variable_name = 'general_log' or Variable_name = 'slow_query_log' -root[root] @ localhost [] Query flush logs -root[root] @ localhost [] Query create user anel@localhost -root[root] @ localhost [] Query grant all on *.* to anel@localhost -[anel] @ localhost [] Connect anel@localhost as anonymous on test -anel[anel] @ localhost [] Query create table t(t int) -[root] @ localhost [] Connect root@localhost as anonymous on -[root] @ localhost [] Connect root@localhost as anonymous on test -root[root] @ localhost [] Query SELECT current_user() -root[root] @ localhost [] Quit -root[root] @ localhost [] Quit -anel[anel] @ localhost [] Query flush tables -anel[anel] @ localhost [] Query select user_host, command_type, argument from mysql.general_log -anel[anel] @ localhost [] Quit -[root] @ localhost [] Connect root@localhost as anonymous on -[root] @ localhost [] Connect root@localhost as anonymous on test -root[root] @ localhost [] Query SELECT current_user() -root[root] @ localhost [] Quit -root[root] @ localhost [] Quit -root[root] @ localhost [] Query flush tables -root[root] @ localhost [] Query select user_host, command_type, argument from mysql.general_log -drop user anel@localhost; -drop table t; -set global general_log= @old_general_log; -set global general_log_file= @old_general_log_file; diff --git a/mysql-test/main/mysqlslap.test b/mysql-test/main/mysqlslap.test index 4e99b8f2cd2..81115d59d09 100644 --- a/mysql-test/main/mysqlslap.test +++ b/mysql-test/main/mysqlslap.test @@ -88,54 +88,3 @@ DROP TABLE t1; --exec $MYSQL_SLAP --concurrency=1 --silent --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-guid-primary --create-schema=slap --exec $MYSQL_SLAP --concurrency=1 --silent --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-secondary-indexes=1 --create-schema=slap - ---echo # ---echo # MDEV-22485: mysqlslap does not use current user as default for connecting to server ---echo # ---disable_ps_protocol -set @old_general_log=@@global.general_log; -set @old_general_log_file=@@global.general_log_file; -select @old_general_log; - -show global variables -where Variable_name = 'general_log' or Variable_name = 'slow_query_log'; -truncate table mysql.general_log; -# empty log at the beginning -select * from mysql.general_log; - -set global general_log=ON; ---replace_regex /[\/\w:](?!.log).*/current_user.log/ -select @@general_log_file; ---replace_regex /=.+"/=general_log.log/ ---let $gen_log_file=$MYSQLTEST_VARDIR/tmp/general_log.log ---replace_regex /".+"/general_log.log/ ---eval SET GLOBAL general_log_file="$gen_log_file" -show global variables -where Variable_name = 'general_log' or Variable_name = 'slow_query_log'; -flush logs; -create user anel@localhost; -grant all on *.* to anel@localhost; -connect con1,localhost,anel,,; -connection con1; -create table t(t int); ---echo # Run mysqlslap user anel ---replace_regex /\d[.]\d+/X/ ---exec $MYSQL_SLAP --create-schema=test --query="SELECT current_user()" --concurrency=1 --iterations=1 -flush tables; ---replace_regex /".+/current_user.log/ /[::1]// -select user_host, command_type, argument from mysql.general_log; -disconnect con1; - -connection default; ---echo # Run mysqlslap user root ---replace_regex /\d[.]\d+/X/ ---exec $MYSQL_SLAP --create-schema=test --query="SELECT current_user()" --concurrency=1 --iterations=1 -flush tables; -#--exec $MYSQL_SLAP --concurrency=1 --silent --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-guid-primary --create-schema=slap ---replace_regex /".+/current_user.log/ /[::1]// -select user_host, command_type, argument from mysql.general_log; -drop user anel@localhost; -drop table t; -set global general_log= @old_general_log; -set global general_log_file= @old_general_log_file; ---enable_ps_protocol -- cgit v1.2.1 From 71806bf37c45d5490d8382cba6a5cca6879fa0db Mon Sep 17 00:00:00 2001 From: Stepan Patryshev Date: Tue, 15 Dec 2020 18:05:56 +0200 Subject: MDEV-24414 Update and enable galera.galera_defaults --- mysql-test/suite/galera/disabled.def | 1 - mysql-test/suite/galera/t/galera_defaults.test | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index dd1721839e0..0692a02c7b0 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -14,7 +14,6 @@ MW-286 : MDEV-18464 Killing thread can cause mutex deadlock if done concurrently MW-328A : MDEV-22666 galera.MW-328A MTR failed: "Semaphore wait has lasted > 600 seconds" and do not release port 16002 MW-328B : MDEV-22666 galera.MW-328A MTR failed: "Semaphore wait has lasted > 600 seconds" and do not release port 16002 MW-329 : MDEV-19962 Galera test failure on MW-329 -galera.galera_defaults : MDEV-21494 Galera test sporadic failure on galera.galera_defaults galera_as_slave_replication_bundle : MDEV-15785 OPTION_GTID_BEGIN is set in Gtid_log_event::do_apply_event() galera_binlog_stmt_autoinc : MDEV-19959 Galera test failure on galera_binlog_stmt_autoinc galera_gcache_recover_manytrx : MDEV-18834 Galera test failure diff --git a/mysql-test/suite/galera/t/galera_defaults.test b/mysql-test/suite/galera/t/galera_defaults.test index 3d4a7da7b54..a9e10de0176 100644 --- a/mysql-test/suite/galera/t/galera_defaults.test +++ b/mysql-test/suite/galera/t/galera_defaults.test @@ -13,7 +13,7 @@ # Make sure that the test is operating on the right version of galera library. --disable_query_log ---let $galera_version=25.3.20 +--let $galera_version=25.3.31 source ../wsrep/include/check_galera_version.inc; --enable_query_log -- cgit v1.2.1 From c742346e5041d85caaf30d2d6c10369603ad09ad Mon Sep 17 00:00:00 2001 From: Stepan Patryshev Date: Wed, 16 Dec 2020 18:29:06 +0200 Subject: TODO-2697 Enable galera.lp1376747-4 on 10.3 CS --- mysql-test/suite/galera/disabled.def | 1 - 1 file changed, 1 deletion(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 0692a02c7b0..87dbb7a6487 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -23,7 +23,6 @@ galera_ssl_upgrade : MDEV-19950 Galera test failure on galera_ssl_upgrade galera_sst_mariabackup_encrypt_with_key : MDEV-21484 galera_sst_mariabackup_encrypt_with_key galera_var_node_address : MDEV-20485 Galera test failure galera_wan : MDEV-17259 Test failure on galera.galera_wan -lp1376747-4 : MDEV-21911 Galera test failure on lp1376747-4 partition : MDEV-19958 Galera test failure on galera.partition query_cache: MDEV-15805 Test failure on galera.query_cache sql_log_bin : MDEV-21491 galera.sql_log_bin -- cgit v1.2.1 From d4258f3a8fba0f8972714325c0dc0ca925879b86 Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Tue, 22 Dec 2020 03:33:53 +0300 Subject: MDEV-22178 Assertion `info->alias.str' failed in partition_info::check_partition_info instead of ER_VERS_WRONG_PARTS Assign create_info->alias for ALTER TABLE since it is NULL and later accessed for printing error message. --- mysql-test/suite/versioning/r/partition.result | 7 +++++++ mysql-test/suite/versioning/t/partition.test | 9 +++++++++ 2 files changed, 16 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result index a89053369a7..06aa0ded32d 100644 --- a/mysql-test/suite/versioning/r/partition.result +++ b/mysql-test/suite/versioning/r/partition.result @@ -683,4 +683,11 @@ create table t1 (a int) with system versioning partition by system_time alter table t1 add partition (partition p2); ERROR HY000: Wrong partitioning type, expected type: `SYSTEM_TIME` drop table t1; +# +# MDEV-22178 Assertion `info->alias.str' failed in partition_info::check_partition_info instead of ER_VERS_WRONG_PARTS +# +create or replace table t1 (a int) with system versioning; +alter table t1 partition by system_time (partition pn current); +ERROR HY000: Wrong partitions for `t1`: must have at least one HISTORY and exactly one last CURRENT +drop table t1; # End of 10.3 tests diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test index 957fddc730d..454e4068e15 100644 --- a/mysql-test/suite/versioning/t/partition.test +++ b/mysql-test/suite/versioning/t/partition.test @@ -652,6 +652,15 @@ alter table t1 add partition (partition p2); # Cleanup drop table t1; +--echo # +--echo # MDEV-22178 Assertion `info->alias.str' failed in partition_info::check_partition_info instead of ER_VERS_WRONG_PARTS +--echo # +create or replace table t1 (a int) with system versioning; +--error ER_VERS_WRONG_PARTS +alter table t1 partition by system_time (partition pn current); +# Cleanup +drop table t1; + --echo # End of 10.3 tests --source suite/versioning/common_finish.inc -- cgit v1.2.1 From 7410ff436e95de09c2f3f0028e7af8b3a043028b Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Tue, 22 Dec 2020 03:33:53 +0300 Subject: MDEV-21138 Assertion `col->ord_part' or `f.col->ord_part' failed in row_build_index_entry_low First part (row0mysql.cc) fixes ins_node_set_new_row() usage workflow as it is designed to operate on empty row (see row_get_prebuilt_insert_row() for example). Second part (row0ins.cc) fixes duplicate key error in FTS_DOC_ID_INDEX since history rows must not generate entries in that index. We detect FTS_DOC_ID_INDEX by a number of attributes and skip it if the row is historical. Misc fixes: row_build_index_entry_low() does not accept non-NULL tuple for FTS index (subject assertion fails), assertion (index->type != DICT_FTS) adds code understanding. Now as historical_row is copied in row_update_vers_insert() there is no need to copy the row twice: ROW_COPY_POINTERS is used to build historical_row initially. dbug_print_rec() debug functions. --- mysql-test/suite/versioning/r/delete.result | 19 +++++++++++++++++++ mysql-test/suite/versioning/r/update.result | 20 ++++++++++++++++++++ mysql-test/suite/versioning/t/delete.test | 15 +++++++++++++++ mysql-test/suite/versioning/t/update.test | 15 +++++++++++++++ 4 files changed, 69 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/suite/versioning/r/delete.result b/mysql-test/suite/versioning/r/delete.result index 5aa239b9cb8..4a0fec639b0 100644 --- a/mysql-test/suite/versioning/r/delete.result +++ b/mysql-test/suite/versioning/r/delete.result @@ -130,3 +130,22 @@ ERROR 42S02: Table 'test.xx' doesn't exist drop procedure pr; drop trigger tr; drop table t1; +# +# MDEV-21138 Assertion `col->ord_part' or `f.col->ord_part' failed in row_build_index_entry_low +# +create table t1 ( +f1 int, f2 text, f3 int, fulltext (f2), key(f1), key(f3), +foreign key r (f3) references t1 (f1) on delete set null) +with system versioning engine innodb; +insert into t1 values (1, repeat('a', 8193), 1), (1, repeat('b', 8193), 1); +select f1, f3, check_row(row_start, row_end) from t1; +f1 f3 check_row(row_start, row_end) +1 1 CURRENT ROW +1 1 CURRENT ROW +delete from t1; +select f1, f3, check_row(row_start, row_end) from t1 for system_time all; +f1 f3 check_row(row_start, row_end) +1 1 HISTORICAL ROW +1 NULL ERROR: row_end == row_start +1 1 HISTORICAL ROW +drop table t1; diff --git a/mysql-test/suite/versioning/r/update.result b/mysql-test/suite/versioning/r/update.result index cd26c341113..0b239423834 100644 --- a/mysql-test/suite/versioning/r/update.result +++ b/mysql-test/suite/versioning/r/update.result @@ -241,6 +241,26 @@ B2 salary 1 2500 drop table t1; drop table t2; +# Ensure FTS retains correct history +create table t1 ( +x int, y text, fulltext (y), +row_start SYS_DATATYPE as row start invisible, +row_end SYS_DATATYPE as row end invisible, +period for system_time (row_start, row_end)) +with system versioning engine innodb; +insert into t1 values (1, repeat('LONG', 2048)); +update t1 set x= x + 1; +select x, left(y, 4), length(y), check_row(row_start, row_end) from t1 for system_time all order by x, y; +x left(y, 4) length(y) check_row(row_start, row_end) +1 LONG 8192 HISTORICAL ROW +2 LONG 8192 CURRENT ROW +update t1 set y= 'SHORT'; +select x, left(y, 4), length(y), check_row(row_start, row_end) from t1 for system_time all order by x, y; +x left(y, 4) length(y) check_row(row_start, row_end) +1 LONG 8192 HISTORICAL ROW +2 LONG 8192 HISTORICAL ROW +2 SHOR 5 CURRENT ROW +drop tables t1; ### Issue tempesta-tech/mariadb#365, bug 7 (duplicate of historical row) create or replace table t1 (a int primary key, b int) with system versioning engine myisam; diff --git a/mysql-test/suite/versioning/t/delete.test b/mysql-test/suite/versioning/t/delete.test index 492463f9395..e2f7240303d 100644 --- a/mysql-test/suite/versioning/t/delete.test +++ b/mysql-test/suite/versioning/t/delete.test @@ -94,4 +94,19 @@ drop procedure pr; drop trigger tr; drop table t1; +--echo # +--echo # MDEV-21138 Assertion `col->ord_part' or `f.col->ord_part' failed in row_build_index_entry_low +--echo # +create table t1 ( + f1 int, f2 text, f3 int, fulltext (f2), key(f1), key(f3), + foreign key r (f3) references t1 (f1) on delete set null) +with system versioning engine innodb; +insert into t1 values (1, repeat('a', 8193), 1), (1, repeat('b', 8193), 1); +select f1, f3, check_row(row_start, row_end) from t1; +delete from t1; +select f1, f3, check_row(row_start, row_end) from t1 for system_time all; + +# cleanup +drop table t1; + --source suite/versioning/common_finish.inc diff --git a/mysql-test/suite/versioning/t/update.test b/mysql-test/suite/versioning/t/update.test index 06f81ea9064..f64dcfd0e5c 100644 --- a/mysql-test/suite/versioning/t/update.test +++ b/mysql-test/suite/versioning/t/update.test @@ -147,6 +147,21 @@ select @tmp2 = sys_trx_start as B2, salary from t2; drop table t1; drop table t2; +--echo # Ensure FTS retains correct history +replace_result $sys_datatype_expl SYS_DATATYPE; +eval create table t1 ( + x int, y text, fulltext (y), + row_start $sys_datatype_expl as row start invisible, + row_end $sys_datatype_expl as row end invisible, + period for system_time (row_start, row_end)) +with system versioning engine innodb; +insert into t1 values (1, repeat('LONG', 2048)); +update t1 set x= x + 1; +select x, left(y, 4), length(y), check_row(row_start, row_end) from t1 for system_time all order by x, y; +update t1 set y= 'SHORT'; +select x, left(y, 4), length(y), check_row(row_start, row_end) from t1 for system_time all order by x, y; +drop tables t1; + --echo ### Issue tempesta-tech/mariadb#365, bug 7 (duplicate of historical row) create or replace table t1 (a int primary key, b int) with system versioning engine myisam; -- cgit v1.2.1 From 932ec586aada4bd78f613ee10750effc7f442327 Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Tue, 22 Dec 2020 03:33:53 +0300 Subject: MDEV-23644 Assertion on evaluating foreign referential action for self-reference in system versioned table First part of the fix (row0mysql.cc) addresses external columns when adding history row on referential action. The full data must be retrieved before the row is inserted. Second part of the fix (the rest) avoids duplicate primary key error between the history row generated on referential action and the history row generated by SQL command. Both command and referential action can happen on same table since foreign key can be self-reference (parent and child tables are same). Moreover, the self-reference can refer multiple rows when the key is non-unique. In such case history is generated by referential action occured on first row but processed all rows by a matched key. The second round is when the next row is processed by a command but history already exists. In such case we check TRX_ID of existing history row and if it is the same we assume the above situation and skip adding one more history row or failing the command. --- mysql-test/suite/versioning/common.inc | 21 +++++++++++++++++++++ mysql-test/suite/versioning/common_finish.inc | 2 ++ mysql-test/suite/versioning/r/delete.result | 8 ++++---- mysql-test/suite/versioning/r/foreign.result | 16 ++++++++++++++++ mysql-test/suite/versioning/r/trx_id.result | 8 ++++++++ mysql-test/suite/versioning/t/delete.test | 4 ++-- mysql-test/suite/versioning/t/foreign.test | 18 ++++++++++++++++++ mysql-test/suite/versioning/t/trx_id.test | 6 ++++++ 8 files changed, 77 insertions(+), 6 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/versioning/common.inc b/mysql-test/suite/versioning/common.inc index efb081a02e4..25adf15dd50 100644 --- a/mysql-test/suite/versioning/common.inc +++ b/mysql-test/suite/versioning/common.inc @@ -70,6 +70,11 @@ returns int deterministic return sys_trx_end = $sys_datatype_max; +eval create or replace function current_row_ts(sys_trx_end timestamp(6)) +returns int +deterministic + return convert_tz(sys_trx_end, '+00:00', @@time_zone) = TIMESTAMP'2038-01-19 03:14:07.999999'; + delimiter ~~; eval create or replace function check_row(row_start $sys_datatype_expl, row_end $sys_datatype_expl) returns varchar(255) @@ -86,4 +91,20 @@ begin end~~ delimiter ;~~ +delimiter ~~; +eval create or replace function check_row_ts(row_start timestamp(6), row_end timestamp(6)) +returns varchar(255) +deterministic +begin + if row_end < row_start then + return "ERROR: row_end < row_start"; + elseif row_end = row_start then + return "ERROR: row_end == row_start"; + elseif current_row_ts(row_end) then + return "CURRENT ROW"; + end if; + return "HISTORICAL ROW"; +end~~ +delimiter ;~~ + --enable_query_log diff --git a/mysql-test/suite/versioning/common_finish.inc b/mysql-test/suite/versioning/common_finish.inc index 61641c6c5ce..3c4e7b66ff3 100644 --- a/mysql-test/suite/versioning/common_finish.inc +++ b/mysql-test/suite/versioning/common_finish.inc @@ -4,5 +4,7 @@ drop procedure if exists verify_trt; drop procedure if exists verify_trt_dummy; 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; --enable_warnings --enable_query_log diff --git a/mysql-test/suite/versioning/r/delete.result b/mysql-test/suite/versioning/r/delete.result index 4a0fec639b0..0f9e2c22130 100644 --- a/mysql-test/suite/versioning/r/delete.result +++ b/mysql-test/suite/versioning/r/delete.result @@ -138,13 +138,13 @@ f1 int, f2 text, f3 int, fulltext (f2), key(f1), key(f3), foreign key r (f3) references t1 (f1) on delete set null) with system versioning engine innodb; insert into t1 values (1, repeat('a', 8193), 1), (1, repeat('b', 8193), 1); -select f1, f3, check_row(row_start, row_end) from t1; -f1 f3 check_row(row_start, row_end) +select f1, f3, check_row_ts(row_start, row_end) from t1; +f1 f3 check_row_ts(row_start, row_end) 1 1 CURRENT ROW 1 1 CURRENT ROW delete from t1; -select f1, f3, check_row(row_start, row_end) from t1 for system_time all; -f1 f3 check_row(row_start, row_end) +select f1, f3, check_row_ts(row_start, row_end) from t1 for system_time all; +f1 f3 check_row_ts(row_start, row_end) 1 1 HISTORICAL ROW 1 NULL ERROR: row_end == row_start 1 1 HISTORICAL ROW diff --git a/mysql-test/suite/versioning/r/foreign.result b/mysql-test/suite/versioning/r/foreign.result index 32b5e5cf3d8..e54afdbc74e 100644 --- a/mysql-test/suite/versioning/r/foreign.result +++ b/mysql-test/suite/versioning/r/foreign.result @@ -398,6 +398,8 @@ Warning 1265 Data truncated for column 'f12' at row 7 SET timestamp = 9; REPLACE INTO t2 SELECT * FROM t2; DROP TABLE t1, t2; +set timestamp= default; +set time_zone='+00:00'; # # MDEV-16210 FK constraints on versioned tables use historical rows, which may cause constraint violation # @@ -427,3 +429,17 @@ insert into t2 values (1), (1); # DELETE from foreign table is allowed delete from t2; drop tables t2, t1; +# +# MDEV-23644 Assertion on evaluating foreign referential action for self-reference in system versioned table +# +create table t1 (pk int primary key, f1 int,f2 int, f3 text, +key(f1), fulltext(f3), key(f3(10)), +foreign key (f2) references t1 (f1) on delete set null +) engine=innodb with system versioning; +insert into t1 values (1, 8, 8, 'SHORT'), (2, 8, 8, repeat('LONG', 8071)); +delete from t1; +select pk, f1, f2, left(f3, 4), check_row_ts(row_start, row_end) from t1 for system_time all order by pk; +pk f1 f2 left(f3, 4) check_row_ts(row_start, row_end) +1 8 8 SHOR HISTORICAL ROW +2 8 8 LONG HISTORICAL ROW +drop table t1; diff --git a/mysql-test/suite/versioning/r/trx_id.result b/mysql-test/suite/versioning/r/trx_id.result index 5dd9e7aa188..58d02505fb6 100644 --- a/mysql-test/suite/versioning/r/trx_id.result +++ b/mysql-test/suite/versioning/r/trx_id.result @@ -5,7 +5,15 @@ sys_trx_start bigint(20) unsigned as row start invisible, sys_trx_end bigint(20) unsigned as row end invisible, period for system_time (sys_trx_start, sys_trx_end) ) with system versioning; +# No history inside the transaction +start transaction; insert into t1 (x) values (1); +update t1 set x= x + 1; +update t1 set x= x + 1; +commit; +select *, sys_trx_start > 1, sys_trx_end from t1 for system_time all; +x sys_trx_start > 1 sys_trx_end +3 1 18446744073709551615 # ALTER ADD SYSTEM VERSIONING should write to mysql.transaction_registry set @@system_versioning_alter_history=keep; create or replace table t1 (x int); diff --git a/mysql-test/suite/versioning/t/delete.test b/mysql-test/suite/versioning/t/delete.test index e2f7240303d..a5a0497fef2 100644 --- a/mysql-test/suite/versioning/t/delete.test +++ b/mysql-test/suite/versioning/t/delete.test @@ -102,9 +102,9 @@ create table t1 ( foreign key r (f3) references t1 (f1) on delete set null) with system versioning engine innodb; insert into t1 values (1, repeat('a', 8193), 1), (1, repeat('b', 8193), 1); -select f1, f3, check_row(row_start, row_end) from t1; +select f1, f3, check_row_ts(row_start, row_end) from t1; delete from t1; -select f1, f3, check_row(row_start, row_end) from t1 for system_time all; +select f1, f3, check_row_ts(row_start, row_end) from t1 for system_time all; # cleanup drop table t1; diff --git a/mysql-test/suite/versioning/t/foreign.test b/mysql-test/suite/versioning/t/foreign.test index 7493f99cba7..725f51f0660 100644 --- a/mysql-test/suite/versioning/t/foreign.test +++ b/mysql-test/suite/versioning/t/foreign.test @@ -421,6 +421,8 @@ REPLACE INTO t2 SELECT * FROM t2; # Cleanup DROP TABLE t1, t2; +set timestamp= default; +set time_zone='+00:00'; --let $datadir= `select @@datadir` --remove_file $datadir/test/t1.data --remove_file $datadir/test/t1.data.2 @@ -458,4 +460,20 @@ insert into t2 values (1), (1); delete from t2; drop tables t2, t1; +--echo # +--echo # MDEV-23644 Assertion on evaluating foreign referential action for self-reference in system versioned table +--echo # +create table t1 (pk int primary key, f1 int,f2 int, f3 text, + key(f1), fulltext(f3), key(f3(10)), + foreign key (f2) references t1 (f1) on delete set null +) engine=innodb with system versioning; + +insert into t1 values (1, 8, 8, 'SHORT'), (2, 8, 8, repeat('LONG', 8071)); + +delete from t1; +select pk, f1, f2, left(f3, 4), check_row_ts(row_start, row_end) from t1 for system_time all order by pk; + +# cleanup +drop table t1; + --source suite/versioning/common_finish.inc diff --git a/mysql-test/suite/versioning/t/trx_id.test b/mysql-test/suite/versioning/t/trx_id.test index 38724a47fd1..7dfc8acb080 100644 --- a/mysql-test/suite/versioning/t/trx_id.test +++ b/mysql-test/suite/versioning/t/trx_id.test @@ -14,7 +14,13 @@ create or replace table t1 ( period for system_time (sys_trx_start, sys_trx_end) ) with system versioning; +--echo # No history inside the transaction +start transaction; insert into t1 (x) values (1); +update t1 set x= x + 1; +update t1 set x= x + 1; +commit; +select *, sys_trx_start > 1, sys_trx_end from t1 for system_time all; --echo # ALTER ADD SYSTEM VERSIONING should write to mysql.transaction_registry set @@system_versioning_alter_history=keep; -- cgit v1.2.1 From 9b38ed4c85bda254f48c02890f134adf227700e3 Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Tue, 22 Dec 2020 08:34:18 +0300 Subject: MDEV-23446 UPDATE does not insert history row if the row is not changed Add history row outside of compare_record() check. For TRX_ID versioning we have to fail can_compare_record to force InnoDB update which adds history row; and there in ha_innobase::update_row() is additional "row changed" check where we force history row anyway. --- mysql-test/suite/versioning/r/update.result | 29 +++++++++++++++++++++++++++++ mysql-test/suite/versioning/t/update.test | 25 +++++++++++++++++++++++++ 2 files changed, 54 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/suite/versioning/r/update.result b/mysql-test/suite/versioning/r/update.result index 0b239423834..fbb9f541b06 100644 --- a/mysql-test/suite/versioning/r/update.result +++ b/mysql-test/suite/versioning/r/update.result @@ -370,3 +370,32 @@ insert into t1 (a) values (1), (2); update ignore t1 set a= 3; delete history from t1; drop table t1; +# +# MDEV-23446 UPDATE does not insert history row if the row is not changed +# +create table t1 ( +a int, +row_start SYS_DATATYPE as row start invisible, +row_end SYS_DATATYPE as row end invisible, +period for system_time (row_start, row_end)) with system versioning; +insert into t1 values (1); +update t1 set a= 1; +select *, check_row(row_start, row_end) from t1 for system_time all order by row_end; +a check_row(row_start, row_end) +1 HISTORICAL ROW +1 CURRENT ROW +# multi-update +create or replace table t2 like t1; +create or replace table t3 like t1; +insert into t2 values (1); +insert into t3 values (1); +update t2, t3 set t2.a= 1, t3.a= 1 where t2.a = t3.a; +select *, check_row(row_start, row_end) from t2 for system_time all order by row_end; +a check_row(row_start, row_end) +1 HISTORICAL ROW +1 CURRENT ROW +select *, check_row(row_start, row_end) from t2 for system_time all order by row_end; +a check_row(row_start, row_end) +1 HISTORICAL ROW +1 CURRENT ROW +drop tables t1, t2, t3; diff --git a/mysql-test/suite/versioning/t/update.test b/mysql-test/suite/versioning/t/update.test index f64dcfd0e5c..7f99e307942 100644 --- a/mysql-test/suite/versioning/t/update.test +++ b/mysql-test/suite/versioning/t/update.test @@ -301,4 +301,29 @@ delete history from t1; # cleanup drop table t1; +--echo # +--echo # MDEV-23446 UPDATE does not insert history row if the row is not changed +--echo # +replace_result $sys_datatype_expl SYS_DATATYPE; +eval create table t1 ( + a int, + row_start $sys_datatype_expl as row start invisible, + row_end $sys_datatype_expl as row end invisible, + period for system_time (row_start, row_end)) with system versioning; +insert into t1 values (1); +update t1 set a= 1; +select *, check_row(row_start, row_end) from t1 for system_time all order by row_end; + +--echo # multi-update +create or replace table t2 like t1; +create or replace table t3 like t1; +insert into t2 values (1); +insert into t3 values (1); +update t2, t3 set t2.a= 1, t3.a= 1 where t2.a = t3.a; +select *, check_row(row_start, row_end) from t2 for system_time all order by row_end; +select *, check_row(row_start, row_end) from t2 for system_time all order by row_end; + +# cleanup +drop tables t1, t2, t3; + source suite/versioning/common_finish.inc; -- cgit v1.2.1