From 76f1195f5b8e77f7fe81d2fb1a62ca56d701f710 Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Tue, 11 Jul 2017 12:55:03 +0200 Subject: MW-388 Fix conflict handling of SPs with DECLARE ... HANDLER It is possible for a stored procedure that has an error handler that catches SQLEXCEPTION to call thd->clear_error() on a thd that failed certification. And because the error is cleared, wsrep patch proceeds with the normal path and may try to commit statements that should actually abort. This patch catches the situation where wsrep_conflict_state is still set, but the thd's error has been cleared, and rolls back the statement in such cases. --- mysql-test/suite/galera/r/MW-388.result | 33 ++++++++++++++++++++ mysql-test/suite/galera/t/MW-388.test | 54 +++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 mysql-test/suite/galera/r/MW-388.result create mode 100644 mysql-test/suite/galera/t/MW-388.test (limited to 'mysql-test') diff --git a/mysql-test/suite/galera/r/MW-388.result b/mysql-test/suite/galera/r/MW-388.result new file mode 100644 index 00000000000..f81f1e1a9fb --- /dev/null +++ b/mysql-test/suite/galera/r/MW-388.result @@ -0,0 +1,33 @@ +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB; +CREATE PROCEDURE insert_proc () +BEGIN +DECLARE CONTINUE HANDLER FOR SQLEXCEPTION +BEGIN +GET DIAGNOSTICS CONDITION 1 @errno = MYSQL_ERRNO; +END; +INSERT INTO t1 VALUES (1, 'node 1'),(2, 'node 1'); +INSERT INTO t1 VALUES (3, 'node 1'); +END| +SET GLOBAL DEBUG = "d,sync.wsrep_apply_cb"; +INSERT INTO t1 VALUES (1, 'node 2');; +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; +SET SESSION wsrep_sync_wait = 0; +SET SESSION DEBUG_SYNC = 'wsrep_before_replication SIGNAL wsrep_before_replication_reached WAIT_FOR wsrep_before_replication_continue'; +CALL insert_proc ();; +SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_before_replication_reached"; +SET GLOBAL DEBUG = ""; +SET DEBUG_SYNC = "now SIGNAL wsrep_before_replication_continue"; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; +SELECT @errno; +@errno +1213 +SELECT * FROM t1; +f1 f2 +1 node 2 +3 node 1 +SELECT * FROM t1; +f1 f2 +1 node 2 +3 node 1 +DROP TABLE t1; +DROP PROCEDURE insert_proc; diff --git a/mysql-test/suite/galera/t/MW-388.test b/mysql-test/suite/galera/t/MW-388.test new file mode 100644 index 00000000000..59b28dba236 --- /dev/null +++ b/mysql-test/suite/galera/t/MW-388.test @@ -0,0 +1,54 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB; + +DELIMITER |; +CREATE PROCEDURE insert_proc () +BEGIN + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION + BEGIN + GET DIAGNOSTICS CONDITION 1 @errno = MYSQL_ERRNO; + END; + INSERT INTO t1 VALUES (1, 'node 1'),(2, 'node 1'); + INSERT INTO t1 VALUES (3, 'node 1'); +END| +DELIMITER ;| + +SET GLOBAL DEBUG = "d,sync.wsrep_apply_cb"; + +--connection node_2 +--send INSERT INTO t1 VALUES (1, 'node 2'); + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; + +--connection node_1 +SET SESSION wsrep_sync_wait = 0; +SET SESSION DEBUG_SYNC = 'wsrep_before_replication SIGNAL wsrep_before_replication_reached WAIT_FOR wsrep_before_replication_continue'; +--send CALL insert_proc (); + +--connection node_1a +SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_before_replication_reached"; + +--connection node_1a +SET GLOBAL DEBUG = ""; +SET DEBUG_SYNC = "now SIGNAL wsrep_before_replication_continue"; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; + +--connection node_2 +--reap + +--connection node_1 +# We expect no errors here, because the handler in insert_proc() caught the deadlock error +--reap +SELECT @errno; +SELECT * FROM t1; + +--connection node_2 +SELECT * FROM t1; + +DROP TABLE t1; +DROP PROCEDURE insert_proc; \ No newline at end of file -- cgit v1.2.1 From f4f2e8fa2a540a6e2edd75c9c6dd97ed4185163d Mon Sep 17 00:00:00 2001 From: sjaakola Date: Thu, 24 Aug 2017 10:34:21 +0300 Subject: MW-402 cascading FK issues * created tests focusing in multi-master conflicts during cascading foreign key processing * in row0upd.cc, calling wsrep_row_ups_check_foreign_constraints only when running in cluster * in row0ins.cc fixed regression from MW-369, which caused crash with MW-402.test --- mysql-test/suite/galera/r/MW-388.result | 14 +-- mysql-test/suite/galera/r/MW-402.result | 152 ++++++++++++++++++++++++++ mysql-test/suite/galera/t/MW-388.test | 24 ++++- mysql-test/suite/galera/t/MW-402.test | 184 ++++++++++++++++++++++++++++++++ 4 files changed, 363 insertions(+), 11 deletions(-) create mode 100644 mysql-test/suite/galera/r/MW-402.result create mode 100644 mysql-test/suite/galera/t/MW-402.test (limited to 'mysql-test') diff --git a/mysql-test/suite/galera/r/MW-388.result b/mysql-test/suite/galera/r/MW-388.result index f81f1e1a9fb..117b0fe88d0 100644 --- a/mysql-test/suite/galera/r/MW-388.result +++ b/mysql-test/suite/galera/r/MW-388.result @@ -8,19 +8,20 @@ END; INSERT INTO t1 VALUES (1, 'node 1'),(2, 'node 1'); INSERT INTO t1 VALUES (3, 'node 1'); END| +SET GLOBAL wsrep_slave_threads = 2; SET GLOBAL DEBUG = "d,sync.wsrep_apply_cb"; INSERT INTO t1 VALUES (1, 'node 2');; SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; SET SESSION wsrep_sync_wait = 0; -SET SESSION DEBUG_SYNC = 'wsrep_before_replication SIGNAL wsrep_before_replication_reached WAIT_FOR wsrep_before_replication_continue'; +SET SESSION DEBUG_SYNC = 'wsrep_after_replication SIGNAL wsrep_after_replication_reached WAIT_FOR wsrep_after_replication_continue'; CALL insert_proc ();; -SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_before_replication_reached"; +SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_after_replication_reached"; SET GLOBAL DEBUG = ""; -SET DEBUG_SYNC = "now SIGNAL wsrep_before_replication_continue"; +SET DEBUG_SYNC = "now SIGNAL wsrep_after_replication_continue"; SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; -SELECT @errno; -@errno -1213 +SELECT @errno = 1213; +@errno = 1213 +1 SELECT * FROM t1; f1 f2 1 node 2 @@ -29,5 +30,6 @@ SELECT * FROM t1; f1 f2 1 node 2 3 node 1 +SET GLOBAL wsrep_slave_threads = DEFAULT; DROP TABLE t1; DROP PROCEDURE insert_proc; diff --git a/mysql-test/suite/galera/r/MW-402.result b/mysql-test/suite/galera/r/MW-402.result new file mode 100644 index 00000000000..4261bc6bac3 --- /dev/null +++ b/mysql-test/suite/galera/r/MW-402.result @@ -0,0 +1,152 @@ +CREATE TABLE p (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; +CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id INTEGER, f2 INTEGER, +CONSTRAINT fk_1 FOREIGN KEY (p_id) REFERENCES p (f1) ON DELETE CASCADE); +INSERT INTO p VALUES (1, 0); +INSERT INTO p VALUES (2, 0); +INSERT INTO c VALUES (1, 1, 0); +SET AUTOCOMMIT=ON; +START TRANSACTION; +UPDATE c SET f2=1 where f1=1; +SET SESSION wsrep_sync_wait = 0; +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +DELETE FROM p WHERE f1 = 1; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_enter_sync'; +COMMIT; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; +SET GLOBAL wsrep_provider_options = 'signal=local_monitor_enter_sync'; +SET GLOBAL wsrep_provider_options = 'dbug='; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +SELECT * FROM p; +f1 f2 +2 0 +SELECT * FROM c; +f1 p_id f2 +DROP TABLE c; +DROP TABLE p; +CREATE TABLE p (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; +CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id INTEGER, f2 INTEGER, +CONSTRAINT fk_1 FOREIGN KEY (p_id) REFERENCES p (f1) ON UPDATE CASCADE); +INSERT INTO p VALUES (1, 0); +INSERT INTO p VALUES (2, 0); +INSERT INTO c VALUES (1, 1, 0); +SET AUTOCOMMIT=ON; +START TRANSACTION; +UPDATE c SET f2=2 where f1=1; +SET SESSION wsrep_sync_wait = 0; +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +UPDATE p set f1=11 WHERE f1 = 1; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_enter_sync'; +COMMIT; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; +SET GLOBAL wsrep_provider_options = 'signal=local_monitor_enter_sync'; +SET GLOBAL wsrep_provider_options = 'dbug='; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +SELECT * FROM p; +f1 f2 +2 0 +11 0 +SELECT * FROM c; +f1 p_id f2 +1 11 0 +DROP TABLE c; +DROP TABLE p; +CREATE TABLE p (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; +CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id INTEGER, f2 INTEGER, +CONSTRAINT fk_1 FOREIGN KEY (p_id) REFERENCES p (f1) ON UPDATE CASCADE); +INSERT INTO p VALUES (1, 0); +INSERT INTO p VALUES (2, 0); +INSERT INTO c VALUES (1, 1, 0); +SET AUTOCOMMIT=ON; +START TRANSACTION; +UPDATE c SET p_id=2 where f1=1; +SET SESSION wsrep_sync_wait = 0; +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +UPDATE p set f1=11 WHERE f1 = 1; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_enter_sync'; +COMMIT; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; +SET GLOBAL wsrep_provider_options = 'signal=local_monitor_enter_sync'; +SET GLOBAL wsrep_provider_options = 'dbug='; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +SELECT * FROM p; +f1 f2 +2 0 +11 0 +SELECT * FROM c; +f1 p_id f2 +1 11 0 +SET AUTOCOMMIT=ON; +START TRANSACTION; +UPDATE p set f1=21 WHERE f1 = 11; +SET SESSION wsrep_sync_wait = 0; +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +UPDATE c SET p_id=2 where f1=1; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_enter_sync'; +COMMIT; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; +SET GLOBAL wsrep_provider_options = 'signal=local_monitor_enter_sync'; +SET GLOBAL wsrep_provider_options = 'dbug='; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +SELECT * FROM p; +f1 f2 +2 0 +11 0 +SELECT * FROM c; +f1 p_id f2 +1 2 0 +DROP TABLE c; +DROP TABLE p; +CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; +CREATE TABLE p2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; +CREATE TABLE c (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER, f2 INTEGER, +CONSTRAINT fk_1 FOREIGN KEY (p1_id) REFERENCES p1 (f1) ON DELETE CASCADE, +CONSTRAINT fk_2 FOREIGN KEY (p2_id) REFERENCES p2 (f1)); +INSERT INTO p1 VALUES (1, 0); +INSERT INTO p2 VALUES (1, 0); +INSERT INTO c VALUES (1, 1, 1, 0); +SET AUTOCOMMIT=ON; +START TRANSACTION; +UPDATE p2 SET f2=2 where f1=1; +SET SESSION wsrep_sync_wait = 0; +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +DELETE FROM p1 WHERE f1 = 1; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_enter_sync'; +COMMIT; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; +SET GLOBAL wsrep_provider_options = 'signal=local_monitor_enter_sync'; +SET GLOBAL wsrep_provider_options = 'dbug='; +SELECT * FROM p1; +f1 f2 +SELECT * FROM p2; +f1 f2 +1 2 +SELECT * FROM c; +f1 p1_id p2_id f2 +DROP TABLE c; +DROP TABLE p1; +DROP TABLE p2; diff --git a/mysql-test/suite/galera/t/MW-388.test b/mysql-test/suite/galera/t/MW-388.test index 59b28dba236..5446731093b 100644 --- a/mysql-test/suite/galera/t/MW-388.test +++ b/mysql-test/suite/galera/t/MW-388.test @@ -16,6 +16,18 @@ BEGIN END| DELIMITER ;| +# We need two slave threads here to guarantee progress. +# If we use only one thread the following could happen +# in node_1: +# We block the only slave thread in wsrep_apply_cb and we +# issue an INSERT (by calling the stored procedure) that will +# try to acquire galera's local monitor in pre_commit(). +# This usually works fine, except for when a commit cut event +# sneaks in the slave queue and gets a local seqno smaller than +# that of the INSERT. Because there is only one slave thread, +# commit cut is not processed and therefore does not advance +# local monitor, and our INSERT remains stuck there. +SET GLOBAL wsrep_slave_threads = 2; SET GLOBAL DEBUG = "d,sync.wsrep_apply_cb"; --connection node_2 @@ -27,15 +39,15 @@ SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; --connection node_1 SET SESSION wsrep_sync_wait = 0; -SET SESSION DEBUG_SYNC = 'wsrep_before_replication SIGNAL wsrep_before_replication_reached WAIT_FOR wsrep_before_replication_continue'; +SET SESSION DEBUG_SYNC = 'wsrep_after_replication SIGNAL wsrep_after_replication_reached WAIT_FOR wsrep_after_replication_continue'; --send CALL insert_proc (); --connection node_1a -SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_before_replication_reached"; +SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_after_replication_reached"; + ---connection node_1a SET GLOBAL DEBUG = ""; -SET DEBUG_SYNC = "now SIGNAL wsrep_before_replication_continue"; +SET DEBUG_SYNC = "now SIGNAL wsrep_after_replication_continue"; SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; --connection node_2 @@ -44,11 +56,13 @@ SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; --connection node_1 # We expect no errors here, because the handler in insert_proc() caught the deadlock error --reap -SELECT @errno; +SELECT @errno = 1213; SELECT * FROM t1; --connection node_2 SELECT * FROM t1; +--connection node_1 +SET GLOBAL wsrep_slave_threads = DEFAULT; DROP TABLE t1; DROP PROCEDURE insert_proc; \ No newline at end of file diff --git a/mysql-test/suite/galera/t/MW-402.test b/mysql-test/suite/galera/t/MW-402.test new file mode 100644 index 00000000000..5713cda5282 --- /dev/null +++ b/mysql-test/suite/galera/t/MW-402.test @@ -0,0 +1,184 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source suite/galera/include/galera_have_debug_sync.inc + +# +# we must open connection node_1a here, MW-369.inc will use it later +# +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 + +# +# cascading delete operation is replicated from node2 +# and this conflicts with an update for child table in node1 +# +# As a result, the update should fail for certification error +# +--connection node_1 + +CREATE TABLE p (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; +CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id INTEGER, f2 INTEGER, + CONSTRAINT fk_1 FOREIGN KEY (p_id) REFERENCES p (f1) ON DELETE CASCADE); + + +INSERT INTO p VALUES (1, 0); +INSERT INTO p VALUES (2, 0); + +INSERT INTO c VALUES (1, 1, 0); + +--let $mw_369_parent_query = UPDATE c SET f2=1 where f1=1 +--let $mw_369_child_query = DELETE FROM p WHERE f1 = 1 + +--connection node_1a +--source MW-369.inc + +# Commit fails +--connection node_1 +--error ER_LOCK_DEADLOCK +--reap + +--connection node_2 +SELECT * FROM p; +SELECT * FROM c; + +DROP TABLE c; +DROP TABLE p; + +# +# cascading update operation is replicated from node2 +# and this conflicts with an update for child table in node1 +# +# As a result, the update should fail for certification error +# +--connection node_1 + +CREATE TABLE p (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; +CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id INTEGER, f2 INTEGER, + CONSTRAINT fk_1 FOREIGN KEY (p_id) REFERENCES p (f1) ON UPDATE CASCADE); + + +INSERT INTO p VALUES (1, 0); +INSERT INTO p VALUES (2, 0); + +INSERT INTO c VALUES (1, 1, 0); + +--let $mw_369_parent_query = UPDATE c SET f2=2 where f1=1 +--let $mw_369_child_query = UPDATE p set f1=11 WHERE f1 = 1 + +--connection node_1a +--source MW-369.inc + +# Commit fails +--connection node_1 +--error ER_LOCK_DEADLOCK +--reap + +--connection node_2 +SELECT * FROM p; +SELECT * FROM c; + +DROP TABLE c; +DROP TABLE p; + +# +# ON UPDATE CASCADE tests +# Here we update primary key of parent table to cause cascaded update +# on child table +# +# cascading update operation is replicated from node2 +# and this conflicts with an update for child table in node1 +# +# As a result, the update should fail for certification error +# +--connection node_1 + +CREATE TABLE p (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; +CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id INTEGER, f2 INTEGER, + CONSTRAINT fk_1 FOREIGN KEY (p_id) REFERENCES p (f1) ON UPDATE CASCADE); + + +INSERT INTO p VALUES (1, 0); +INSERT INTO p VALUES (2, 0); + +INSERT INTO c VALUES (1, 1, 0); + +--let $mw_369_parent_query = UPDATE c SET p_id=2 where f1=1 +--let $mw_369_child_query = UPDATE p set f1=11 WHERE f1 = 1 + +--connection node_1a +--source MW-369.inc + +# Commit fails +--connection node_1 +--error ER_LOCK_DEADLOCK +--reap + +# same as previous, but statements in different order +--connection node_2 +SELECT * FROM p; +SELECT * FROM c; + +--let $mw_369_parent_query = UPDATE p set f1=21 WHERE f1 = 11 +--let $mw_369_child_query = UPDATE c SET p_id=2 where f1=1 + +--connection node_1a +--source MW-369.inc + +# Commit fails +--connection node_1 +--error ER_LOCK_DEADLOCK +--reap + + +--connection node_2 +SELECT * FROM p; +SELECT * FROM c; + +DROP TABLE c; +DROP TABLE p; + + +# +# CASCADE DELETE tests with two parent tables +# Here we cause cascaded operation on child table through +# one parent table and have other operation on the other +# parent table +# +# cascading update operation is replicated from node2 +# but this does not conflict with an update for the other parent table in node1 +# +# As a result, the update on p2 should succeed +# +--connection node_1 + +CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; +CREATE TABLE p2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; +CREATE TABLE c (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER, f2 INTEGER, + CONSTRAINT fk_1 FOREIGN KEY (p1_id) REFERENCES p1 (f1) ON DELETE CASCADE, + CONSTRAINT fk_2 FOREIGN KEY (p2_id) REFERENCES p2 (f1)); + + +INSERT INTO p1 VALUES (1, 0); +INSERT INTO p2 VALUES (1, 0); + +INSERT INTO c VALUES (1, 1, 1, 0); + +--let $mw_369_parent_query = UPDATE p2 SET f2=2 where f1=1 +--let $mw_369_child_query = DELETE FROM p1 WHERE f1 = 1 + +--connection node_1a +--source MW-369.inc + +# Commit succeeds +--connection node_1 +--reap + +# same as previous, but statements in different order +--connection node_2 +SELECT * FROM p1; +SELECT * FROM p2; +SELECT * FROM c; + +DROP TABLE c; +DROP TABLE p1; +DROP TABLE p2; \ No newline at end of file -- cgit v1.2.1 From 6d783b6a7625cd7a5b5727634c490bbd15c5c791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Wed, 8 Nov 2017 14:15:54 +0200 Subject: MW-388 MariaDB adjustments. --- mysql-test/suite/galera/r/MW-388.result | 11 +++++++++++ mysql-test/suite/galera/t/MW-388.test | 8 +++++++- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/galera/r/MW-388.result b/mysql-test/suite/galera/r/MW-388.result index 117b0fe88d0..17d347a11fb 100644 --- a/mysql-test/suite/galera/r/MW-388.result +++ b/mysql-test/suite/galera/r/MW-388.result @@ -10,6 +10,8 @@ INSERT INTO t1 VALUES (3, 'node 1'); END| SET GLOBAL wsrep_slave_threads = 2; SET GLOBAL DEBUG = "d,sync.wsrep_apply_cb"; +Warnings: +Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead INSERT INTO t1 VALUES (1, 'node 2');; SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; SET SESSION wsrep_sync_wait = 0; @@ -17,6 +19,8 @@ SET SESSION DEBUG_SYNC = 'wsrep_after_replication SIGNAL wsrep_after_replication CALL insert_proc ();; SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_after_replication_reached"; SET GLOBAL DEBUG = ""; +Warnings: +Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead SET DEBUG_SYNC = "now SIGNAL wsrep_after_replication_continue"; SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; SELECT @errno = 1213; @@ -33,3 +37,10 @@ f1 f2 SET GLOBAL wsrep_slave_threads = DEFAULT; DROP TABLE t1; DROP PROCEDURE insert_proc; +SET GLOBAL debug = NULL; +Warnings: +Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +SET debug_sync='RESET'; +SELECT @@debug_sync; +@@debug_sync +ON - current signal: '' diff --git a/mysql-test/suite/galera/t/MW-388.test b/mysql-test/suite/galera/t/MW-388.test index 5446731093b..3ba611a912e 100644 --- a/mysql-test/suite/galera/t/MW-388.test +++ b/mysql-test/suite/galera/t/MW-388.test @@ -65,4 +65,10 @@ SELECT * FROM t1; --connection node_1 SET GLOBAL wsrep_slave_threads = DEFAULT; DROP TABLE t1; -DROP PROCEDURE insert_proc; \ No newline at end of file +DROP PROCEDURE insert_proc; + +SET GLOBAL debug = NULL; +SET debug_sync='RESET'; + +# Make sure no pending signals are leftover to surprise subsequent tests. +SELECT @@debug_sync; -- cgit v1.2.1 From b5802888e38db4fd5f7e76f01e049da69d7ad55e Mon Sep 17 00:00:00 2001 From: sjaakola Date: Thu, 7 Sep 2017 16:45:21 +0300 Subject: MW-402 cascading FK issues, 5.6 version Added one more test scenario for two cascading parent tables --- mysql-test/suite/galera/r/MW-402.result | 44 +++++++++++++++++++++++++-- mysql-test/suite/galera/t/MW-402.test | 54 ++++++++++++++++++++++++++++++--- 2 files changed, 91 insertions(+), 7 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/galera/r/MW-402.result b/mysql-test/suite/galera/r/MW-402.result index 4261bc6bac3..fdcf6e324b5 100644 --- a/mysql-test/suite/galera/r/MW-402.result +++ b/mysql-test/suite/galera/r/MW-402.result @@ -118,8 +118,10 @@ DROP TABLE c; DROP TABLE p; CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; CREATE TABLE p2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; -CREATE TABLE c (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER, f2 INTEGER, -CONSTRAINT fk_1 FOREIGN KEY (p1_id) REFERENCES p1 (f1) ON DELETE CASCADE, +CREATE TABLE c (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER, +f2 INTEGER, +CONSTRAINT fk_1 FOREIGN KEY (p1_id) REFERENCES p1 (f1) +ON DELETE CASCADE, CONSTRAINT fk_2 FOREIGN KEY (p2_id) REFERENCES p2 (f1)); INSERT INTO p1 VALUES (1, 0); INSERT INTO p2 VALUES (1, 0); @@ -150,3 +152,41 @@ f1 p1_id p2_id f2 DROP TABLE c; DROP TABLE p1; DROP TABLE p2; +CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; +CREATE TABLE p2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; +CREATE TABLE c (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER, +f2 INTEGER, +CONSTRAINT fk_1 FOREIGN KEY (p1_id) REFERENCES p1 (f1) +ON DELETE CASCADE, +CONSTRAINT fk_2 FOREIGN KEY (p2_id) REFERENCES p2 (f1) +ON DELETE CASCADE); +INSERT INTO p1 VALUES (1, 0); +INSERT INTO p2 VALUES (1, 0); +INSERT INTO c VALUES (1, 1, 1, 0); +SET AUTOCOMMIT=ON; +START TRANSACTION; +DELETE FROM p2 WHERE f1=1; +SET SESSION wsrep_sync_wait = 0; +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +DELETE FROM p1 WHERE f1=1; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_enter_sync'; +COMMIT; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; +SET GLOBAL wsrep_provider_options = 'signal=local_monitor_enter_sync'; +SET GLOBAL wsrep_provider_options = 'dbug='; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +SELECT * FROM p1; +f1 f2 +SELECT * FROM p2; +f1 f2 +1 0 +SELECT * FROM c; +f1 p1_id p2_id f2 +DROP TABLE c; +DROP TABLE p1; +DROP TABLE p2; diff --git a/mysql-test/suite/galera/t/MW-402.test b/mysql-test/suite/galera/t/MW-402.test index 5713cda5282..80f368b50c8 100644 --- a/mysql-test/suite/galera/t/MW-402.test +++ b/mysql-test/suite/galera/t/MW-402.test @@ -137,7 +137,6 @@ SELECT * FROM c; DROP TABLE c; DROP TABLE p; - # # CASCADE DELETE tests with two parent tables # Here we cause cascaded operation on child table through @@ -153,10 +152,11 @@ DROP TABLE p; CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; CREATE TABLE p2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; -CREATE TABLE c (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER, f2 INTEGER, - CONSTRAINT fk_1 FOREIGN KEY (p1_id) REFERENCES p1 (f1) ON DELETE CASCADE, +CREATE TABLE c (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER, + f2 INTEGER, + CONSTRAINT fk_1 FOREIGN KEY (p1_id) REFERENCES p1 (f1) + ON DELETE CASCADE, CONSTRAINT fk_2 FOREIGN KEY (p2_id) REFERENCES p2 (f1)); - INSERT INTO p1 VALUES (1, 0); INSERT INTO p2 VALUES (1, 0); @@ -173,7 +173,51 @@ INSERT INTO c VALUES (1, 1, 1, 0); --connection node_1 --reap -# same as previous, but statements in different order +--connection node_2 +SELECT * FROM p1; +SELECT * FROM p2; +SELECT * FROM c; + +DROP TABLE c; +DROP TABLE p1; +DROP TABLE p2; + +# +# CASCADE DELETE tests with two parent tables +# Here we cause cascaded operation on child table through +# one parent table and issue other delete operation through the +# other parent table. The cascade progresses to same child table row where +# we should see the conflict to happen +# +# As a result, the update on p2 should fail +# +--connection node_1 + +CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; +CREATE TABLE p2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; +CREATE TABLE c (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER, + f2 INTEGER, + CONSTRAINT fk_1 FOREIGN KEY (p1_id) REFERENCES p1 (f1) + ON DELETE CASCADE, + CONSTRAINT fk_2 FOREIGN KEY (p2_id) REFERENCES p2 (f1) + ON DELETE CASCADE); + +INSERT INTO p1 VALUES (1, 0); +INSERT INTO p2 VALUES (1, 0); + +INSERT INTO c VALUES (1, 1, 1, 0); + +--let $mw_369_parent_query = DELETE FROM p2 WHERE f1=1 +--let $mw_369_child_query = DELETE FROM p1 WHERE f1=1 + +--connection node_1a +--source MW-369.inc + +# Commit succeeds +--connection node_1 +--error ER_LOCK_DEADLOCK +--reap + --connection node_2 SELECT * FROM p1; SELECT * FROM p2; -- cgit v1.2.1 From 0eaf24e842b51081a4d32e04c08c2f2c4f433987 Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Fri, 22 Sep 2017 10:06:59 +0200 Subject: MW-410 Stability fix for test galera.galera_ftwrl --- mysql-test/suite/galera/t/galera_ftwrl.test | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/galera/t/galera_ftwrl.test b/mysql-test/suite/galera/t/galera_ftwrl.test index de8310e52d2..739255609ee 100644 --- a/mysql-test/suite/galera/t/galera_ftwrl.test +++ b/mysql-test/suite/galera/t/galera_ftwrl.test @@ -29,12 +29,11 @@ SELECT * FROM t1; UNLOCK TABLES; -SHOW TABLES; -SELECT COUNT(*) = 1 FROM t1; - --disable_query_log --eval SET GLOBAL wsrep_provider_options = "$wsrep_provider_options_orig"; --enable_query_log -DROP TABLE t1; +SHOW TABLES; +SELECT COUNT(*) = 1 FROM t1; +DROP TABLE t1; -- cgit v1.2.1 From ca42ee0ff39b658c760346108885ac57e6ddc38c Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Tue, 19 Sep 2017 16:23:29 +0300 Subject: Fix galera.galera_suspend_slave on FreeBSD Use symbolic signal names (e.g. SIGSTOP) instead of numeric ones (e.g. 19) because the latter are not portable. --- mysql-test/suite/galera/t/galera_suspend_slave.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/galera/t/galera_suspend_slave.test b/mysql-test/suite/galera/t/galera_suspend_slave.test index fd8bc362d02..d2a4ed16335 100644 --- a/mysql-test/suite/galera/t/galera_suspend_slave.test +++ b/mysql-test/suite/galera/t/galera_suspend_slave.test @@ -25,7 +25,7 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; my $pid_filename = $ENV{'NODE_2_PIDFILE'}; my $mysqld_pid = `cat $pid_filename`; chomp($mysqld_pid); - system("kill -19 $mysqld_pid"); + system("kill -SIGSTOP $mysqld_pid"); exit(0); EOF @@ -37,7 +37,7 @@ INSERT INTO t1 VALUES (1); my $pid_filename = $ENV{'NODE_2_PIDFILE'}; my $mysqld_pid = `cat $pid_filename`; chomp($mysqld_pid); - system("kill -18 $mysqld_pid"); + system("kill -SIGCONT $mysqld_pid"); exit(0); EOF -- cgit v1.2.1 From 9572bbdc3791178b82d4c71a8e3948a3a35123d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Wed, 8 Nov 2017 17:22:11 +0200 Subject: MW-388 Test uses now debug and debug_sync. --- mysql-test/suite/galera/t/MW-388.test | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/suite/galera/t/MW-388.test b/mysql-test/suite/galera/t/MW-388.test index 3ba611a912e..209695dca80 100644 --- a/mysql-test/suite/galera/t/MW-388.test +++ b/mysql-test/suite/galera/t/MW-388.test @@ -1,5 +1,7 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc --connection node_1 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB; -- cgit v1.2.1 From c97a7cdbd04e73fda85207b8ca8238ed1f7508c9 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 9 Nov 2017 20:51:11 +0100 Subject: remove redundant tests from mysql-test/include/*.inc files Some tests are skipped by checks in suite.pm. It is redundant to have an sql-level run-time check in the .inc file itself. In some cases it's not only redundant, but dangerous. After one bug in 10.2 innodb.create_isl_with_direct failed to start InnoDB, but the server started fine (just without InnoDB) and instead of failing, the test was skipped by run-time check in have_innodb.inc. # Conflicts: # mysql-test/include/not_embedded.inc # mysql-test/r/change_user_notembedded.result # mysql-test/suite.pm # mysql-test/t/change_user_notembedded.test --- mysql-test/include/have_debug.inc | 5 ----- mysql-test/include/have_example_plugin.inc | 14 ++------------ mysql-test/include/have_innodb.inc | 6 ------ mysql-test/include/have_xtradb.inc | 7 ------- mysql-test/include/not_embedded.inc | 6 ------ mysql-test/include/not_windows.inc | 8 ++++---- mysql-test/r/not_windows.require | 2 -- 7 files changed, 6 insertions(+), 42 deletions(-) delete mode 100644 mysql-test/r/not_windows.require (limited to 'mysql-test') diff --git a/mysql-test/include/have_debug.inc b/mysql-test/include/have_debug.inc index 5df3080a6ed..a035031e49a 100644 --- a/mysql-test/include/have_debug.inc +++ b/mysql-test/include/have_debug.inc @@ -2,8 +2,3 @@ # suite.pm will make sure that all tests including this file # will be skipped unless this is a debug build. # -# The test below is redundant - -if (`select version() not like '%debug%'`) { - --skip Needs a debug build -} diff --git a/mysql-test/include/have_example_plugin.inc b/mysql-test/include/have_example_plugin.inc index 5571c345850..c0da490dde0 100644 --- a/mysql-test/include/have_example_plugin.inc +++ b/mysql-test/include/have_example_plugin.inc @@ -1,14 +1,4 @@ # -# Check if server has support for loading plugins +# suite.pm will make sure that all tests including this file +# will be skipped unless dynamic ha_example plugin is available # -if (`SELECT @@have_dynamic_loading != 'YES'`) { - --skip Example plugin requires dynamic loading -} - -# -# Check if the variable EXAMPLE_PLUGIN is set -# -if (!$HA_EXAMPLE_SO) { - --skip Need example plugin -} - diff --git a/mysql-test/include/have_innodb.inc b/mysql-test/include/have_innodb.inc index 021970423cd..b89797d5828 100644 --- a/mysql-test/include/have_innodb.inc +++ b/mysql-test/include/have_innodb.inc @@ -2,9 +2,3 @@ # suite.pm will make sure that all tests including this file # will be skipped unless innodb or xtradb is enabled # -# The test below is redundant - -if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED')`) -{ - --skip Test requires InnoDB. -} diff --git a/mysql-test/include/have_xtradb.inc b/mysql-test/include/have_xtradb.inc index 478b9926e21..d12802e057d 100644 --- a/mysql-test/include/have_xtradb.inc +++ b/mysql-test/include/have_xtradb.inc @@ -2,10 +2,3 @@ # suite.pm will make sure that all tests including this file # will be skipped unless xtradb is enabled # -# The test below is redundant - -if (!`SELECT count(*) FROM information_schema.plugins WHERE - plugin_name = 'innodb' AND plugin_status = 'active' AND - plugin_description LIKE '%xtradb%'`){ - skip Needs XtraDB engine; -} diff --git a/mysql-test/include/not_embedded.inc b/mysql-test/include/not_embedded.inc index 88185af3b15..4c168f71979 100644 --- a/mysql-test/include/not_embedded.inc +++ b/mysql-test/include/not_embedded.inc @@ -2,9 +2,3 @@ # suite.pm will make sure that all tests including this file # will be skipped unless this is an embedded test run # -# The test below is redundant - -if (`select version() like '%embedded%'`) { - This should never happen; -} - diff --git a/mysql-test/include/not_windows.inc b/mysql-test/include/not_windows.inc index 9240271077a..08373095438 100644 --- a/mysql-test/include/not_windows.inc +++ b/mysql-test/include/not_windows.inc @@ -1,4 +1,4 @@ ---require r/not_windows.require -disable_query_log; -select convert(@@version_compile_os using latin1) NOT IN ("Win32","Win64","Windows") as "TRUE"; -enable_query_log; +# +# suite.pm will make sure that all tests including this file +# will be skipped unless this is on Windows +# diff --git a/mysql-test/r/not_windows.require b/mysql-test/r/not_windows.require deleted file mode 100644 index 09aae1ed1d0..00000000000 --- a/mysql-test/r/not_windows.require +++ /dev/null @@ -1,2 +0,0 @@ -TRUE -1 -- cgit v1.2.1 From 56394a78e361bf0205a506185ee95a0ab012b621 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 3 Nov 2017 12:33:01 +0100 Subject: MDEV-12372 mysqlbinlog --version output is the same on 10.x as on 5.5.x, and contains not only version don't print usage() for --version --- mysql-test/r/mysqlbinlog.result | 1 + mysql-test/t/mysqlbinlog.test | 6 ++++++ 2 files changed, 7 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index b29fe0b9ec7..fe1af53e837 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -1250,3 +1250,4 @@ DELIMITER ; ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; +mysqlbinlog Ver VER for OS at ARCH diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index b778a1deb9b..7e680702a7a 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -603,3 +603,9 @@ eval SET GLOBAL SERVER_ID = $old_server_id; --exec $MYSQL_BINLOG --hexdump std_data/mdev-4645-binlog_group_id.binlog --exec $MYSQL_BINLOG --hexdump std_data/mdev-4645-binlog_group_id_checksum.binlog --exec $MYSQL_BINLOG --hexdump std_data/mdev-4645-binlog_none.binlog + +# +# MDEV-12372 mysqlbinlog --version output is the same on 10.x as on 5.5.x, and contains not only version +# +replace_regex /.*mysqlbinlog(\.exe)? Ver .* for .* at [-_a-zA-Z0-9]+/mysqlbinlog Ver VER for OS at ARCH/; +exec $MYSQL_BINLOG --version; -- cgit v1.2.1 From 1fdf11669c1295bb49f50d1aaefec2d93bb24191 Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Fri, 10 Nov 2017 21:06:58 +0200 Subject: Updated list of unstable tests for 10.1.29 release --- mysql-test/unstable-tests | 243 ++++++++++++++++++++++------------------------ 1 file changed, 117 insertions(+), 126 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests index cf99f822dfc..b5f8f9fffb9 100644 --- a/mysql-test/unstable-tests +++ b/mysql-test/unstable-tests @@ -23,72 +23,83 @@ # ############################################################################## -main.alter_table : Modified in 10.1.27 +main.alter_table : Modified in 10.1.29 main.alter_table_trans : MDEV-12084 - timeout -main.analyze_format_json : MDEV-11866 - Wrong result -main.analyze_stmt_orderby : MDEV-11866 - Wrong result main.analyze_stmt_slow_query_log : MDEV-12237 - Wrong result -main.binary_to_hex : Added in 10.1.26 +main.bootstrap : Include files modified in 10.1.29 +main.case : Modified in 10.1.29 main.count_distinct : Modified in 10.1.27 main.create_delayed : MDEV-10605 - failed with timeout -main.create_drop_event : Modified in 10.1.26 +main.ctype_gbk : Modified in 10.1.29 +main.ctype_latin1 : Modified in 10.1.29 +main.ctype_ucs : Modified in 10.1.29 main.ctype_utf16le : MDEV-10675: timeout or extra warnings -main.ctype_utf8 : Modified in 10.1.27 -main.drop-no_root : MDEV-12633 - Valgrind warnings -main.errors : Modified in 10.1.26 +main.ctype_utf32 : Modified in 10.1.29 +main.ctype_utf8 : Modified in 10.1.29 +main.delete_returning : Modified in 10.1.29 +main.delimiter_command_case_sensitivity : Added in 10.1.29 +main.events_2 : MDEV-13277 - Server crash main.events_bugs : MDEV-12892 - Crash in fill_schema_processlist main.events_restart : MDEV-12236 - Server shutdown problem -main.func_misc : Modified in 10.1.27 -main.func_regexp_pcre : MDEV-13412 - Crash; modified in 10.1.26 -main.gis : Modified in 10.1.26 -main.gis-rt-precise : Modified in 10.1.26 -main.group_by : Modified in 10.1.26 +main.func_in : Modified in 10.1.29 +main.func_misc : Modified in 10.1.29 +main.func_regexp_pcre : Modified in 10.1.29 +main.func_time : Modified in 10.1.29 +main.gis-precise : Modified in 10.1.29 main.host_cache_size_functionality : MDEV-10606 - sporadic failure on shutdown main.index_intersect_innodb : MDEV-10643 - failed with timeout main.index_merge_innodb : MDEV-7142 - Wrong execution plan, timeout with valgrind +main.information_schema : Modified in 10.1.29 main.innodb_mysql_lock : MDEV-7861 - sporadic lock detection failure main.insert : Modified in 10.1.27 main.kill_processlist-6619 : MDEV-10793 - wrong result in processlist -main.loadxml : Data file modified in 10.1.26 main.log_tables-big : Modified in 10.1.27 main.mdev-504 : MDEV-10607 - sporadic "can't connect" +main.mdev13607 : Added in 10.1.29 main.mdev375 : MDEV-10607 - sporadic "can't connect" main.merge : MDEV-10607 - sporadic "can't connect" -main.mysqlcheck : MDEV-12633 - Valgrind warnings +main.myisam : Modified in 10.1.29 +main.mysql_upgrade_noengine : MDEV-14355 - Plugin is busy +main.mysqlbinlog : Modified in 10.1.29 main.mysqlslap : MDEV-11801 - timeout main.mysqltest : MDEV-9269 - fails on Alpha -main.mysql_client_test : MDEV-12633 - Valgrind warnings -main.mysql_client_test_comp : MDEV-12633 - Valgrind warnings -main.mysql_client_test_nonblock : MDEV-12633 - Valgrind warnings -main.mysql_upgrade : Modified in 10.1.26 main.old-mode : Modified in 10.1.27 -main.openssl_1 : Modified in 10.1.26 -main.openssl_6975 : Modified in 10.1.26 main.order_by_optimizer_innodb : MDEV-10683 - wrong execution plan +main.partition_datatype : Modified in 10.1.29 +main.partition_example : Include files modified in 10.1.29 main.partition_innodb_plugin : MDEV-12901 - Valgrind warnings main.partition_symlink : Modified in 10.1.27 -main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count +main.plugin : Include files modified in 10.1.29 +main.plugin_innodb : Include files modified in 10.1.29 +main.plugin_load : Include files modified in 10.1.29 +main.plugin_load_option : Include files modified in 10.1.29 +main.plugin_maturity : Include files modified in 10.1.29 +main.plugin_not_embedded : Include files modified in 10.1.29 +main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count; modified in 10.1.29 main.query_cache : MDEV-12895 - Wrong result +main.range_vs_index_merge : Modified in 10.1.29 main.range_vs_index_merge_innodb : MDEV-12637 - Timeout -main.read_only : Modified in 10.1.26 -main.repair_symlink-5543 : MDEV-12215 - Wrong error codes +main.read_only : Modified in 10.1.29 main.set_statement : MDEV-13183 - Wrong result -main.show_check : MDEV-12633 - Valgrind warnings main.show_explain : MDEV-10674 - sporadic failure +main.show_function_with_pad_char_to_full_length : Added in 10.1.29 main.sp : Modified in 10.1.27 main.sp-security : MDEV-10607 - sporadic "can't connect" -main.ssl : Modified in 10.1.26 main.status : MDEV-8510 - sporadic wrong result -main.subselect : Modified in 10.1.26 +main.subselect_exists2in : Modified in 10.1.29 main.subselect_innodb : MDEV-10614 - sporadic wrong results -main.subselect_nulls : Modified in 10.1.26 +main.subselect_mat_cost_bugs : Modified in 10.1.29 main.symlink : Modified in 10.1.27 -main.symlink-aria-11902 : MDEV-12215 - Unexpected errors -main.symlink-myisam-11902 : MDEV-12215 - Unexpected errors +main.table_options-5867 : Include files modified in 10.1.29 main.tc_heuristic_recover : Added in 10.1.27 +main.truncate_badse : Include files modified in 10.1.29 +main.type_bit : Modified in 10.1.29 +main.type_date : Modified in 10.1.29 main.type_datetime_hires : MDEV-10687 - timeout -main.union : Modified in 10.1.26 -main.view : Modified in 10.1.27 +main.type_varchar : Modified in 10.1.29 +main.user_var : Modified in 10.1.29 +main.view : Modified in 10.1.29 +main.xml : Modified in 10.1.29 #---------------------------------------------------------------- @@ -98,9 +109,7 @@ archive.discover : MDEV-10510 - table is marked as crashed binlog.binlog_commit_wait : MDEV-10150 - Error: too much time elapsed binlog.binlog_killed : MDEV-12925 - Wrong result -binlog.binlog_parallel_replication_marks_row : Added in 10.1.26 -binlog.binlog_parallel_replication_marks_stm_mix : Added in 10.1.26 -binlog.binlog_unsafe : Modified in 10.1.26 +binlog.binlog_spurious_ddl_errors : Include files modified in 10.1.29 binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint #---------------------------------------------------------------- @@ -109,6 +118,7 @@ binlog_encryption.binlog_xa_recover : MDEV-12908 - Extra checkpoint binlog_encryption.encrypted_master : MDEV-12906 - Failed to sync binlog_encryption.rpl_parallel : MDEV-10653 - Timeout binlog_encryption.rpl_semi_sync : MDEV-11220 - Wrong result, MDEV-11673 - Valgrind warning +binlog_encryption.rpl_typeconv : MDEV-14362 - Lost connection to MySQL server during query #---------------------------------------------------------------- @@ -118,19 +128,19 @@ connect.infoschema-9739 : Modified in 10.1.27 connect.infoschema2-9739 : Added in 10.1.27 connect.jdbc_new : Modified in 10.1.27 connect.json : Modified in 10.1.27 -connect.json_java_2 : Added in 10.1.27 -connect.json_java_3 : Added in 10.1.27 -connect.json_mongo_c : Added in 10.1.27 +connect.json_java_2 : Include file modified in 10.1.29 +connect.json_java_3 : Include file modified in 10.1.29 +connect.json_mongo_c : Include file modified in 10.1.29 connect.json_udf : Modified in 10.1.27 connect.json_udf_bin : Modified in 10.1.27 -connect.mongo_c : Added in 10.1.27 -connect.mongo_java_2 : Added in 10.1.27 -connect.mongo_java_3 : Added in 10.1.27 +connect.mongo_c : Include file modified in 10.1.29 +connect.mongo_java_2 : Include file modified in 10.1.29 +connect.mongo_java_3 : Include file modified in 10.1.29 connect.mul_new : Added in 10.1.27 connect.mysql_exec : Modified in 10.1.27 connect.mysql_new : Modified in 10.1.27 connect.tbl : MDEV-9844, MDEV-10179 - sporadic crashes, valgrind warnings, wrong results; modified in 10.1.27 -connect.tbl_thread : MDEV-9844, MDEV-10179 - sporadic crashes, valgrind warnings, wrong results; added in 10.1.27 +connect.tbl_thread : MDEV-9844, MDEV-10179, MDEV-14214 - sporadic crashes, valgrind warnings, wrong results; added in 10.1.27 connect.unsigned : Modified in 10.1.27 connect.upd : Modified in 10.1.27 connect.xml : Modified in 10.1.27 @@ -150,17 +160,21 @@ connect.zip : MDEV-13884 - Wrong result; modified in 10.1.27 #---------------------------------------------------------------- encryption.create_or_replace : MDEV-9359 - Assertion failure, MDEV-13516 - Assertion failure +encryption.debug_key_management : MDEV-13841 - Timeout on wait condition encryption.encrypt_and_grep : MDEV-13765 - Wrong result +encryption.encryption_force : Modified in 10.1.29 +encryption.filekeys_encfile : Include file modified in 10.1.29 +encryption.filekeys_encfile_file : Include file modified in 10.1.29 encryption.innodb-bad-key-change2 : MDEV-12632 - Valgrind warnings -encryption.innochecksum : Modified in 10.1.26 encryption.innodb-discard-import-change : MDEV-12632 - Valgrind warnings encryption.innodb_encryption : Modified in 10.1.27 +encryption.innodb-encryption-alter : Modified in 10.1.29 encryption.innodb_encryption_discard_import : MDEV-12903 - Wrong result encryption.innodb_encryption_filekeys : MDEV-9962 - timeouts encryption.innodb_encryption-page-compression : MDEV-12630 - crash or assertion failure encryption.innodb_encryption_tables : MDEV-9359 - Assertion failure encryption.innodb_first_page : MDEV-10689 - crashes -encryption.innodb-first-page-read : MDEV-13181 - Signal 8; modified in 10.1.27 +encryption.innodb-first-page-read : MDEV-14356 - Timeout on wait condition encryption.innodb_lotoftables : MDEV-11531 - InnoDB error; modified in 10.1.27 encryption.innodb-missing-key : MDEV-9359 - assertion failure encryption.innodb-page_encryption : MDEV-10641 - mutex problem @@ -168,7 +182,6 @@ encryption.innodb-redo-badkey : MDEV-12898 - Server hang on startu encryption.innodb_scrub : MDEV-8139 - scrubbing tests need fixing encryption.innodb_scrub_background : MDEV-8139 - scrubbing tests need fixing encryption.innodb_scrub_compressed : MDEV-8139 - scrubbing tests need fixing -encryption.second_plugin-12863 : Added in 10.1.26 #---------------------------------------------------------------- @@ -182,7 +195,6 @@ federated.federated_innodb : MDEV-10617, MDEV-10417 - Wrong checksum, time federated.federated_partition : MDEV-10417 - Fails on Mips federated.federated_transactions : MDEV-10617, MDEV-10417 - Wrong checksum, timeouts, fails on Mips federated.federatedx : MDEV-10617 - Wrong checksum, timeouts -federated.net_thd_crash-12725 : Added in 10.1.26 #---------------------------------------------------------------- @@ -211,55 +223,72 @@ galera.MW-328A : MDEV-13876 - Wrong result #---------------------------------------------------------------- -innodb.101_compatibility : Modified in 10.1.26 innodb.alter_rename_existing : Added in 10.1.27 innodb.binlog_consistent : MDEV-10618 - Server fails to start innodb.create-index-debug : Added in 10.1.27 -innodb.doublewrite : MDEV-12905 - Lost connection to MySQL server +innodb.doublewrite : MDEV-12905, MDEV-14205 - Lost connection to MySQL server innodb.index_tree_operation : Added in 10.1.27 -innodb.innodb-32k : Option file modified in 10.1.26 -innodb.innodb-32k-crash : Option file modified in 10.1.26 -innodb.innodb-64k : Modified in 10.1.26 +innodb.innodb-16k : Modified in 10.1.29 +innodb.innodb-32k : Modified in 10.1.29 +innodb.innodb-64k : Modified in 10.1.29 innodb.innodb-64k-crash : MDEV-13872 - Failure and crash on startup -innodb.innodb-alter : Added in 10.1.27 +innodb.innodb-alter : Modified in 10.1.29 innodb.innodb-alter-autoinc : Added in 10.1.27 innodb.innodb-alter-debug : MDEV-13182 - InnoDB: adjusting FSP_SPACE_FLAGS -innodb.innodb-alter-table : MDEV-10619 - Testcase timeout +innodb.innodb-alter-table : MDEV-10619 - Testcase timeout; modified in 10.1.29 innodb.innodb-blob : MDEV-12053 - Client crash innodb.innodb_bug14147491 : MDEV-11808 - wrong error codes innodb.innodb_bug30423 : MDEV-7311 - Wrong number of rows in the plan innodb.innodb-enlarge-blob : Modified in 10.1.27 innodb.innodb-fk : MDEV-13832 - Assertion failure on shutdown +innodb.innodb-get-fk : Modified in 10.1.29 innodb.innodb-index-debug : Added in 10.1.27 innodb.innodb-index-online : Added in 10.1.27 innodb.innodb-index-online-delete : Added in 10.1.27 innodb.innodb-index-online-fk : Added in 10.1.27 innodb.innodb-index-online-purge : Added in 10.1.27 -innodb.innodb_max_recordsize_32k : Added in 10.1.26 -innodb.innodb_max_recordsize_64k : Added in 10.1.26 +innodb.innodb-page_compression_lzma : MDEV-14353 - wrong result on Fedora 25 +innodb.innodb-page_compression_tables : Modified in 10.1.29 innodb.innodb-page_compression_zip : MDEV-10641 - mutex problem innodb.innodb_stats : MDEV-10682 - wrong result innodb.innodb_sys_semaphore_waits : MDEV-10331 - wrong result -innodb.innodb-table-online : Added in 10.1.27 -innodb.innodb-wl5980-alter : Added in 10.1.27 -innodb.innodb_zip_innochecksum : Added in 10.1.26 +innodb.innodb-table-online : Modified in 10.1.29 +innodb.innodb-wl5522-debug : Modified in 10.1.29 +innodb.innodb-wl5980-alter : Modified in 10.1.29 innodb.innodb_zip_innochecksum2 : MDEV-13882 - Warning: difficult to find free blocks -innodb.innodb_zip_innochecksum3 : Added in 10.1.26 innodb.log_data_file_size : Modified in 10.1.27 +innodb.table_definition_cache_debug : MDEV-14206 - Extra warning; modified in 10.1.29 +innodb.table_flags : MDEV-14363 - Operating system error number 2 +innodb.undo_log : Modified in 10.1.29 innodb.xa_recovery : Modified in 10.1.27 +innodb_fts.concurrent_insert : Added in 10.1.29 +innodb_fts.fulltext : Modified in 10.1.29 innodb_fts.fulltext_misc : MDEV-12636 - Valgrind warnings +innodb_zip.innodb_prefix_index_liftedlimit : Modified in 10.1.29 +innodb_zip.wl5522_debug_zip : Added in 10.1.29 + +#---------------------------------------------------------------- + +maria.maria : Modified in 10.1.29 #---------------------------------------------------------------- mariabackup.apply-log-only : Added in 10.1.27 mariabackup.apply-log-only-incr : Added in 10.1.27 mariabackup.auth_plugin_win : Added in 10.1.27 +mariabackup.compress_qpress : Added in 10.1.29 +mariabackup.data_directory : Added in 10.1.29 +mariabackup.incremental_backup : Modified in 10.1.29 +mariabackup.partition_datadir : Added in 10.1.29 mariabackup.xb_aws_key_management : Modified in 10.1.27 #---------------------------------------------------------------- +mroonga.* : Many tests and include files added and modified in 10.1.29 +mroonga/storage.* : Many tests and include files added and modified in 10.1.29 + mroonga/storage.column_datetime_32bit_2038 : Wrong result on Alpha mroonga/storage.column_datetime_32bit_before_unix_epoch : Wrong result on Alpha mroonga/storage.column_datetime_32bit_max : Wrong result on Alpha @@ -280,7 +309,8 @@ multi_source.status_vars : MDEV-4632 - failed while waiting for Slave_received_h #---------------------------------------------------------------- -parts.longname : Added in 10.1.26 +parts.partition_alter_maria : Added in 10.1.29 +parts.partition_alter2_2_maria : MDEV-14364 - Lost connection to MySQL server during query parts.partition_exch_myisam_innodb : Modified in 10.1.27 parts.partition_exch_qa_10 : Include files modified in 10.1.27 parts.partition_exch_qa_11 : Include files modified in 10.1.27 @@ -296,7 +326,7 @@ parts.partition_innodb_status_file : MDEV-12901 - Valgrind perfschema.func_file_io : MDEV-5708 - fails for s390x perfschema.func_mutex : MDEV-5708 - fails for s390x -perfschema.privilege_table_io : MDEV-13184 - Extra lines; modified in 10.1.26 +perfschema.privilege_table_io : MDEV-13184 - Extra lines perfschema.setup_actors : MDEV-10679 - rare crash perfschema.socket_summary_by_event_name_func : MDEV-10622 - Socket summary tables do not match perfschema.stage_mdl_global : MDEV-11803 - wrong result on slow builders @@ -306,12 +336,15 @@ perfschema.threads_mysql : MDEV-10677 - sporadic wrong resul #---------------------------------------------------------------- plugins.feedback_plugin_send : MDEV-7932 - ssl failed for url -plugins.server_audit : MDEV-9562 - crashes on sol10-sparc -plugins.thread_pool_server_audit : MDEV-9562 - crashes on sol10-sparc +plugins.server_audit : MDEV-9562 - crashes on sol10-sparc; modified in 10.1.29 +plugins.thread_pool_server_audit : MDEV-9562 - crashes on sol10-sparc; modified in 10.1.29 + +#---------------------------------------------------------------- + +roles.definer : Modified in 10.1.29 #---------------------------------------------------------------- -rpl.circular_serverid0 : Added in 10.1.26 rpl.last_insert_id : MDEV-10625 - warnings in error log rpl.rpl_auto_increment : MDEV-10417 - Fails on Mips rpl.rpl_auto_increment_bug45679 : MDEV-10417 - Fails on Mips @@ -319,13 +352,8 @@ rpl.rpl_auto_increment_update_failure : MDEV-10625 - warnings in error log rpl.rpl_binlog_index : MDEV-9501 - Warning: failed registering on master rpl.rpl_checksum_cache : MDEV-12173 - Unexpected error rpl.rpl_ddl : MDEV-10417 - Fails on Mips +rpl.rpl_domain_id_filter_io_crash : MDEV-14357 - Wrong result rpl.rpl_domain_id_filter_restart : MDEV-10684 - Wrong result -rpl.rpl_extra_col_master_innodb : Include file modified in 10.1.26 -rpl.rpl_extra_col_master_myisam : Include file modified in 10.1.26 -rpl.rpl_extra_col_slave_innodb : Include file modified in 10.1.26 -rpl.rpl_extra_col_slave_myisam : Include file modified in 10.1.26 -rpl.rpl_filter_tables_dynamic : Include file modified in 10.1.26 -rpl.rpl_filter_tables_not_exist : Include file modified in 10.1.26 rpl.rpl_gtid_basic : MDEV-10681 - server startup problem rpl.rpl_gtid_crash : MDEV-9501 - Warning: failed registering on master rpl.rpl_gtid_mdev9033 : MDEV-10680 - warnings @@ -334,42 +362,36 @@ rpl.rpl_gtid_until : MDEV-10625 - warnings in error log rpl.rpl_innodb_bug30888 : MDEV-10417 - Fails on Mips rpl.rpl_insert : MDEV-9329 - Fails on Ubuntu/s390x rpl.rpl_insert_delayed : MDEV-9329 - Fails on Ubuntu/s390x +rpl.rpl_insert_ignore : MDEV-14365 - Lost connection to MySQL server during query rpl.rpl_invoked_features : MDEV-10417 - Fails on Mips -rpl.rpl_loaddata : Include file modified in 10.1.26 -rpl.rpl_loaddata_fatal : Include file modified in 10.1.26 rpl.rpl_mariadb_slave_capability : MDEV-11018 - sporadic wrong events in binlog rpl.rpl_mdev6020 : MDEV-10630, MDEV-10417 - Timeouts, fails on Mips -rpl.rpl_mdev-11092 : Include file modified in 10.1.26 -rpl.rpl_mixed_binlog_max_cache_size : Include file modified in 10.1.26 -rpl.rpl_old_decimal : Include file modified in 10.1.26 rpl.rpl_parallel : MDEV-10653 - Timeouts rpl.rpl_parallel_mdev6589 : MDEV-12979 - Assertion failure -rpl.rpl_parallel_optimistic : MDEV-10511 - timeout; modified in 10.1.26 +rpl.rpl_parallel_optimistic : MDEV-10511 - timeout rpl.rpl_parallel_retry : MDEV-11119 - Server crash rpl.rpl_parallel_temptable : MDEV-10356 - Crash in close_thread_tables rpl.rpl_partition_innodb : MDEV-10417 - Fails on Mips rpl.rpl_password_boundaries : MDEV-11534 - Slave IO warnings -rpl.rpl_reset_slave_fail : Added in 10.1.26 -rpl.rpl_rotate_logs : Include file modified in 10.1.26 -rpl.rpl_row_binlog_max_cache_size : Include file modified in 10.1.26 +rpl.rpl_plugin_load : Include files modified in 10.1.29 +rpl.rpl_row_img_blobs : MDEV-13875 - command "diff_files" failed rpl.rpl_row_img_eng_min : MDEV-13875 - command "diff_files" failed -rpl.rpl_row_loaddata_concurrent : Include file modified in 10.1.26 +rpl.rpl_row_img_eng_noblob : MDEV-13875 - command "diff_files" failed rpl.rpl_row_log_innodb : MDEV-10688 - Wrong result rpl.rpl_row_sp001 : MDEV-9329 - Fails on Ubuntu/s390x -rpl.rpl_row_tabledefs_2myisam : Include file modified in 10.1.26 -rpl.rpl_row_tabledefs_3innodb : Include file modified in 10.1.26 rpl.rpl_semi_sync : MDEV-11220 - Wrong result +rpl.rpl_semi_sync_after_sync_row : MDEV-14366 - Wrong result rpl.rpl_semi_sync_event_after_sync : MDEV-11806 - warnings -rpl.rpl_semi_sync_uninstall_plugin : MDEV-7140 - Wrong plugin status, MDEV-10892 - Assertion failure +rpl.rpl_semi_sync_uninstall_plugin : MDEV-7140 - Wrong plugin status rpl.rpl_semi_sync_wait_point : MDEV-11807 - timeout in wait condition rpl.rpl_show_slave_hosts : MDEV-10681 - server startup problem rpl.rpl_skip_replication : MDEV-9268 - Fails with timeout in sync_slave_with_master on Alpha rpl.rpl_slave_grp_exec : MDEV-10514 - Unexpected deadlock rpl.rpl_sp_variables : Added in 10.1.27 -rpl.rpl_stm_000001 : Include file modified in 10.1.26 -rpl.rpl_stm_binlog_max_cache_size : Include file modified in 10.1.26 -rpl.rpl_stm_loaddata_concurrent : Include file modified in 10.1.26 +rpl.rpl_start_stop_slave : MDEV-13567 - Replication failure +rpl.rpl_stm_relay_ign_space : MDEV-14360 - Test assertion rpl.rpl_sync : MDEV-10633 - Database page corruption +rpl.rpl_table_options : Include files modified in 10.1.29 rpl.rpl_temporal_format_mariadb53_to_mysql56_dst : Added in 10.1.27 rpl.rpl_temporary_error2 : MDEV-10634 - Wrong number of retries rpl.sec_behind_master-5114 : MDEV-13878 - Wrong result @@ -408,8 +430,12 @@ stress.ddl_innodb : MDEV-10635 - Testcase timeout #---------------------------------------------------------------- sys_vars.autocommit_func2 : MDEV-9329 - Fails on Ubuntu/s390x +sys_vars.explicit_defaults_for_timestamp_off : Include file modified in 10.1.29 +sys_vars.explicit_defaults_for_timestamp_on : Include file modified in 10.1.29 sys_vars.keep_files_on_create_basic : MDEV-10676 - timeout -sys_vars.innodb_buffer_pool_dump_pct_basic : MDEV-10651 - sporadic failure on file_exists +sys_vars.innodb_buffer_pool_dump_now_basic : Modified in 10.1.29 +sys_vars.innodb_buffer_pool_dump_pct_basic : Modified in 10.1.29 +sys_vars.innodb_buffer_pool_load_now_basic : Modified in 10.1.29 sys_vars.innodb_fatal_semaphore_wait_threshold : MDEV-10513 - crashes sys_vars.log_slow_admin_statements_func : MDEV-12235 - Server crash sys_vars.rpl_init_slave_func : MDEV-10149 - wrong results @@ -428,54 +454,18 @@ tokudb.cluster_filter : MDEV-10678 - Wrong execution plan tokudb.cluster_filter_hidden : MDEV-10678 - Wrong execution plan tokudb.cluster_filter_unpack_varchar : MDEV-10636 - Wrong execution plan tokudb.dir_per_db : MDEV-11537 - Wrong result; modified in 10.1.27 +tokudb.dir_per_db_rename_to_nonexisting_schema : MDEV-14359 - Directory not empty tokudb.hotindex-insert-bigchar : MDEV-12640 - Crash +tokudb.hotindex-insert-1 : MDEV-13870 - Lost connection to MySQL server tokudb.hotindex-update-1 : MDEV-12640 - Crash -tokudb.kill_query_blocked_in_lt : Added in 10.1.26 -tokudb.locks-select-update-3 : Modified in 10.1.26 tokudb.rows-32m-rand-insert : MDEV-12640 - Crash tokudb.rows-32m-seq-insert : MDEV-12640 - Crash -tokudb_backup.rpl_safe_slave : Include file modified in 10.1.26 - tokudb_bugs.checkpoint_lock : MDEV-10637 - Wrong processlist output tokudb_bugs.checkpoint_lock_3 : MDEV-10637 - Wrong processlist output tokudb_bugs.xa : MDEV-11804 - Lock wait timeout tokudb_mariadb.mdev6657 : MDEV-12737 - Wrong plan, valgrind warnings -tokudb_mariadb.mdev12972 : Added in 10.1.26 - -rpl-tokudb.rpl_extra_col_master_tokudb : Include file modified in 10.1.26 -rpl-tokudb.rpl_extra_col_slave_tokudb : Include file modified in 10.1.26 -rpl-tokudb.rpl_not_null_tokudb : Modified in 10.1.26 -rpl-tokudb.rpl_parallel_tokudb_delete_pk : Option file modified in 10.1.26 -rpl-tokudb.rpl_parallel_tokudb_update_pk_uc0_lookup0 : Modified in 10.1.26 -rpl-tokudb.rpl_parallel_tokudb_write_pk : Modified in 10.1.26 -rpl-tokudb.rpl_rfr_disable_on_expl_pk_absence : Added in 10.1.26 -rpl-tokudb.rpl_row_basic_3tokudb : Modified in 10.1.26 -rpl-tokudb.rpl_row_tabledefs_3tokudb : Include file modified in 10.1.26 -rpl-tokudb.rpl_tokudb_commit_after_flush : Added in 10.1.26 -rpl-tokudb.rpl_tokudb_insert_id : Added in 10.1.26 -rpl-tokudb.rpl_tokudb_insert_id_pk : Added in 10.1.26 -rpl-tokudb.rpl_tokudb_multi_update : Added in 10.1.26 -rpl-tokudb.rpl_tokudb_multi_update2 : Added in 10.1.26 -rpl-tokudb.rpl_tokudb_multi_update3 : Added in 10.1.26 -rpl-tokudb.rpl_tokudb_rfr_partition_table : Added in 10.1.26 -rpl-tokudb.rpl_tokudb_row_crash_safe : Added in 10.1.26 -rpl-tokudb.rpl_tokudb_row_img_blobs : Added in 10.1.26 -rpl-tokudb.rpl_tokudb_row_img_eng_full : Added in 10.1.26 -rpl-tokudb.rpl_tokudb_row_img_eng_min : Added in 10.1.26 -rpl-tokudb.rpl_tokudb_row_img_eng_noblob : Added in 10.1.26 -rpl-tokudb.rpl_tokudb_row_img_idx_full : Added in 10.1.26 -rpl-tokudb.rpl_tokudb_row_img_idx_min : Added in 10.1.26 -rpl-tokudb.rpl_tokudb_row_img_idx_noblob : Added in 10.1.26 -rpl-tokudb.rpl_tokudb_row_log : Added in 10.1.26 -rpl-tokudb.rpl_tokudb_row_lower_case_table_names : Added in 10.1.26 -rpl-tokudb.rpl_tokudb_row_sp003 : Added in 10.1.26 -rpl-tokudb.rpl_tokudb_row_sp006 : Added in 10.1.26 -rpl-tokudb.rpl_tokudb_row_trig004 : Added in 10.1.26 -rpl-tokudb.rpl_tokudb_stm_log : Added in 10.1.26 -rpl-tokudb.rpl_tokudb_stm_mixed_crash_safe : Added in 10.1.26 -rpl-tokudb.rpl_tokudb_stm_mixed_lower_case_table_names : Added in 10.1.26 #---------------------------------------------------------------- @@ -486,11 +476,12 @@ unit.ma_test_loghandler : MDEV-10638 - record read not ok vcol.not_supported : MDEV-10639 - Testcase timeout vcol.vcol_keys_innodb : MDEV-10639 - Testcase timeout +vcol.vcol_misc : Modified in 10.1.29 #---------------------------------------------------------------- wsrep.binlog_format : MDEV-11532 - WSREP has not yet prepared node -wsrep.mdev_6832 : Option file changed in 10.1.27 +wsrep.mdev_6832 : MDEV-14195 - Failure upon check-testcase; option file changed in 10.1.27 wsrep.mdev_7798 : Option file changed in 10.1.27 wsrep.pool_of_threads : MDEV-12234 - Library problem on Power -- cgit v1.2.1 From dcbf2823c7d64380f06372d77d1522e97fb8f066 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Fri, 10 Nov 2017 13:58:00 -0800 Subject: Fixed MDEV-13994 Bad join results with orderby_uses_equalities=on. This patch effectively blocks the optimization that uses multiple equalities for ORDER BY to remove tmp table in the case when the first table happens to be the result of materialization of a semi-join nest. Currently there is no code at the execution level that would support the optimization in this case. --- mysql-test/r/order_by.result | 48 ++++++++++++++++++++++++ mysql-test/r/order_by_innodb.result | 73 +++++++++++++++++++++++++++++++++++++ mysql-test/t/order_by.test | 43 ++++++++++++++++++++++ mysql-test/t/order_by_innodb.test | 47 ++++++++++++++++++++++++ 4 files changed, 211 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index f43e6ce18af..5a9f2fae1e0 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -3159,3 +3159,51 @@ pk 2 3 DROP TABLE t1; +# +# MDEV-13994: Bad join results with orderby_uses_equalities=on +# +CREATE TABLE books ( +id int(16) NOT NULL AUTO_INCREMENT, +library_id int(16) NOT NULL DEFAULT 0, +wings_id int(12) NOT NULL DEFAULT 0, +scheduled_for_removal int(1) DEFAULT 0, +PRIMARY KEY (id), +KEY library_idx (library_id) +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; +INSERT INTO books VALUES (32625,8663,707,0),(32624,8663,505,1); +CREATE TABLE wings ( +id int(11) NOT NULL AUTO_INCREMENT, +department_id int(11) DEFAULT NULL, +PRIMARY KEY (id) +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; +INSERT INTO wings VALUES (505,11745),(707,11768); +SET @save_optimizer_switch=@@optimizer_switch; +SET optimizer_switch='orderby_uses_equalities=off'; +SELECT wings.id as wing_id, wings.department_id FROM wings +WHERE wings.id IN ( SELECT books.wings_id FROM books +WHERE books.library_id = 8663 AND +books.scheduled_for_removal=0 ) +ORDER BY wings.id; +wing_id department_id +707 11768 +SET optimizer_switch='orderby_uses_equalities=on'; +SELECT wings.id as wing_id, wings.department_id FROM wings +WHERE wings.id IN ( SELECT books.wings_id FROM books +WHERE books.library_id = 8663 AND +books.scheduled_for_removal=0 ) +ORDER BY wings.id; +wing_id department_id +707 11768 +explain extended SELECT wings.id as wing_id, wings.department_id FROM wings +WHERE wings.id IN ( SELECT books.wings_id FROM books +WHERE books.library_id = 8663 AND +books.scheduled_for_removal=0 ) +ORDER BY wings.id; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ALL distinct_key NULL NULL NULL 1 100.00 Using temporary; Using filesort +1 PRIMARY wings eq_ref PRIMARY PRIMARY 4 test.books.wings_id 1 100.00 +2 MATERIALIZED books ref library_idx library_idx 4 const 1 100.00 Using where +Warnings: +Note 1003 select `test`.`wings`.`id` AS `wing_id`,`test`.`wings`.`department_id` AS `department_id` from `test`.`wings` semi join (`test`.`books`) where `test`.`books`.`library_id` = 8663 and `test`.`books`.`scheduled_for_removal` = 0 and `test`.`wings`.`id` = `test`.`books`.`wings_id` order by `test`.`wings`.`id` +set optimizer_switch= @save_optimizer_switch; +DROP TABLE books, wings; diff --git a/mysql-test/r/order_by_innodb.result b/mysql-test/r/order_by_innodb.result index 4f59a2f8c20..3ff1f92e94a 100644 --- a/mysql-test/r/order_by_innodb.result +++ b/mysql-test/r/order_by_innodb.result @@ -48,3 +48,76 @@ where key1<3 or key2<3; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL # Using sort_union(key1,key2); Using where drop table t0, t1; +# +# MDEV-14071: wrong results with orderby_uses_equalities=on +# (duplicate of MDEV-13994) +# +CREATE TABLE t1 (i int, j int, z int,PRIMARY KEY (i,j), KEY (z)) ENGINE=InnoDB; +CREATE TABLE t2 (i int, j int, PRIMARY KEY (i,j)) ENGINE=InnoDB; +CREATE TABLE t3 (j int, n varchar(5), PRIMARY KEY (j)) ENGINE=InnoDB; +INSERT INTO t1 VALUES +(127,0,1),(188,0,1),(206,0,1),(218,0,1),(292,0,1),(338,0,1),(375,0,1), +(381,0,1),(409,0,1),(466,0,1),(469,0,1),(498,0,1),(656,0,1); +INSERT INTO t1 VALUES +(77,4,0),(86,7,0),(96,6,0),(96,7,0),(99,9,0),(99,10,0),(99,11,0),(104,4,0), +(106,5,0),(148,6,0),(177,6,0),(181,5,0),(188,8,0),(218,8,0),(253,7,0), +(268,4,0),(338,4,0),(409,7,0),(466,8,0),(469,8,0),(498,8,0),(656,8,0); +INSERT INTO t2 VALUES +(127,7),(188,8),(188,9),(206,6),(218,8),(218,9),(292,7),(338,4),(338,5), +(375,6),(381,5),(409,7),(409,8),(466,8),(466,9),(469,8),(469,9),(498,8), +(498,9),(656,8),(656,9); +INSERT INTO t3 VALUES +(4,'four'),(5,'five'),(6,'six'),(7,'seven'),(8,'eight'),(9,'nine'); +SET @save_optimizer_switch=@@optimizer_switch; +SET optimizer_switch='orderby_uses_equalities=off'; +SELECT i,n +FROM t1 INNER JOIN t2 USING (i,j) LEFT JOIN t3 USING (j) +WHERE i IN (SELECT i FROM t1 WHERE z=1) AND z=0 ORDER BY i; +i n +188 eight +218 eight +338 four +409 seven +466 eight +469 eight +498 eight +656 eight +SELECT i,n +FROM t1 x INNER JOIN t2 USING (i,j) LEFT JOIN t3 USING (j) +WHERE EXISTS (SELECT * FROM t1 WHERE i=x.i AND z=1) AND z=0 ORDER BY i; +i n +188 eight +218 eight +338 four +409 seven +466 eight +469 eight +498 eight +656 eight +SET optimizer_switch='orderby_uses_equalities=on'; +SELECT i,n +FROM t1 INNER JOIN t2 USING (i,j) LEFT JOIN t3 USING (j) +WHERE i IN (SELECT i FROM t1 WHERE z=1) AND z=0 ORDER BY i; +i n +188 eight +218 eight +338 four +409 seven +466 eight +469 eight +498 eight +656 eight +SELECT i,n +FROM t1 x INNER JOIN t2 USING (i,j) LEFT JOIN t3 USING (j) +WHERE EXISTS (SELECT * FROM t1 WHERE i=x.i AND z=1) AND z=0 ORDER BY i; +i n +188 eight +218 eight +338 four +409 seven +466 eight +469 eight +498 eight +656 eight +set optimizer_switch= @save_optimizer_switch; +DROP TABLE t1,t2,t3; diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index 8722401ccae..914911648b2 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -2106,3 +2106,46 @@ INSERT INTO t1 VALUES (1),(2),(3); SELECT DISTINCT pk FROM t1 GROUP BY 'foo'; SELECT DISTINCT pk FROM t1; DROP TABLE t1; + +--echo # +--echo # MDEV-13994: Bad join results with orderby_uses_equalities=on +--echo # + +CREATE TABLE books ( + id int(16) NOT NULL AUTO_INCREMENT, + library_id int(16) NOT NULL DEFAULT 0, + wings_id int(12) NOT NULL DEFAULT 0, + scheduled_for_removal int(1) DEFAULT 0, + PRIMARY KEY (id), + KEY library_idx (library_id) +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; + +INSERT INTO books VALUES (32625,8663,707,0),(32624,8663,505,1); + +CREATE TABLE wings ( + id int(11) NOT NULL AUTO_INCREMENT, + department_id int(11) DEFAULT NULL, + PRIMARY KEY (id) +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; + +INSERT INTO wings VALUES (505,11745),(707,11768); + +let $q= +SELECT wings.id as wing_id, wings.department_id FROM wings + WHERE wings.id IN ( SELECT books.wings_id FROM books + WHERE books.library_id = 8663 AND + books.scheduled_for_removal=0 ) +ORDER BY wings.id; + +SET @save_optimizer_switch=@@optimizer_switch; + +SET optimizer_switch='orderby_uses_equalities=off'; +eval $q; + +SET optimizer_switch='orderby_uses_equalities=on'; +eval $q; +eval explain extended $q; + +set optimizer_switch= @save_optimizer_switch; + +DROP TABLE books, wings; diff --git a/mysql-test/t/order_by_innodb.test b/mysql-test/t/order_by_innodb.test index 097eddd24f1..0debb777749 100644 --- a/mysql-test/t/order_by_innodb.test +++ b/mysql-test/t/order_by_innodb.test @@ -61,3 +61,50 @@ from t1 where key1<3 or key2<3; drop table t0, t1; + +--echo # +--echo # MDEV-14071: wrong results with orderby_uses_equalities=on +--echo # (duplicate of MDEV-13994) +--echo # + +CREATE TABLE t1 (i int, j int, z int,PRIMARY KEY (i,j), KEY (z)) ENGINE=InnoDB; +CREATE TABLE t2 (i int, j int, PRIMARY KEY (i,j)) ENGINE=InnoDB; +CREATE TABLE t3 (j int, n varchar(5), PRIMARY KEY (j)) ENGINE=InnoDB; + +INSERT INTO t1 VALUES + (127,0,1),(188,0,1),(206,0,1),(218,0,1),(292,0,1),(338,0,1),(375,0,1), + (381,0,1),(409,0,1),(466,0,1),(469,0,1),(498,0,1),(656,0,1); +INSERT INTO t1 VALUES + (77,4,0),(86,7,0),(96,6,0),(96,7,0),(99,9,0),(99,10,0),(99,11,0),(104,4,0), + (106,5,0),(148,6,0),(177,6,0),(181,5,0),(188,8,0),(218,8,0),(253,7,0), + (268,4,0),(338,4,0),(409,7,0),(466,8,0),(469,8,0),(498,8,0),(656,8,0); + +INSERT INTO t2 VALUES + (127,7),(188,8),(188,9),(206,6),(218,8),(218,9),(292,7),(338,4),(338,5), + (375,6),(381,5),(409,7),(409,8),(466,8),(466,9),(469,8),(469,9),(498,8), + (498,9),(656,8),(656,9); +INSERT INTO t3 VALUES + (4,'four'),(5,'five'),(6,'six'),(7,'seven'),(8,'eight'),(9,'nine'); + +let $q1= +SELECT i,n +FROM t1 INNER JOIN t2 USING (i,j) LEFT JOIN t3 USING (j) +WHERE i IN (SELECT i FROM t1 WHERE z=1) AND z=0 ORDER BY i; +let $q2= +SELECT i,n +FROM t1 x INNER JOIN t2 USING (i,j) LEFT JOIN t3 USING (j) +WHERE EXISTS (SELECT * FROM t1 WHERE i=x.i AND z=1) AND z=0 ORDER BY i; + +SET @save_optimizer_switch=@@optimizer_switch; + +SET optimizer_switch='orderby_uses_equalities=off'; +eval $q1; +eval $q2; + +SET optimizer_switch='orderby_uses_equalities=on'; +eval $q1; +eval $q2; + +set optimizer_switch= @save_optimizer_switch; + +DROP TABLE t1,t2,t3; -- cgit v1.2.1 From 1e2d4f677e08294691a7d218acb3b9f78727ae18 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Sat, 11 Nov 2017 13:54:56 +0400 Subject: MDEV-13971 crash in skip_num_constant. Character bigger than 0x60 wasn't handled properly inside a numeric constant. --- mysql-test/r/func_json.result | 3 +++ mysql-test/t/func_json.test | 4 ++++ 2 files changed, 7 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/func_json.result b/mysql-test/r/func_json.result index dc27062bc27..041030f4aab 100644 --- a/mysql-test/r/func_json.result +++ b/mysql-test/r/func_json.result @@ -725,3 +725,6 @@ json_contains_path('{"foo":"bar"}', 'one', '$[]') NULL Warnings: Warning 4042 Syntax error in JSON path in argument 3 to function 'json_contains_path' at position 3 +select JSON_VALID(0x36f0c8dccd83c5eac156da); +JSON_VALID(0x36f0c8dccd83c5eac156da) +0 diff --git a/mysql-test/t/func_json.test b/mysql-test/t/func_json.test index 2b865360b51..2052fad0c04 100644 --- a/mysql-test/t/func_json.test +++ b/mysql-test/t/func_json.test @@ -378,3 +378,7 @@ SELECT JSON_OBJECT("user","Jožko Mrkvičká") as json_data; select json_contains_path('{"foo":"bar"}', 'one', '$[]'); +# +# MDEV-13971 crash in skip_num_constant. +# +select JSON_VALID(0x36f0c8dccd83c5eac156da); -- cgit v1.2.1 From d2bf101cbfae40b8719edee9f2bc74a3f0a0ca07 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Mon, 13 Nov 2017 09:41:29 +0100 Subject: MDEV-13723: Server crashes in ha_heap::find_unique_row or Assertion `0' failed in st_select_lex_unit::optimize with INTERSECT With INTERSECT/EXCEPT fact that subquery item of IN/ALL/ANY was not assigned value does not mean that temporary table used for calculating unit is empty (records could be deleted). --- mysql-test/r/except.result | 10 ++++++++++ mysql-test/r/intersect.result | 1 + mysql-test/t/except.test | 14 ++++++++++++++ mysql-test/t/intersect.test | 1 + 4 files changed, 26 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/except.result b/mysql-test/r/except.result index fdaa625ea65..594bb7118eb 100644 --- a/mysql-test/r/except.result +++ b/mysql-test/r/except.result @@ -525,3 +525,13 @@ t3 CREATE TABLE `t3` ( `b1` blob DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop tables t1,t2,t3; +# +# MDEV-13723: Server crashes in ha_heap::find_unique_row or +# Assertion `0' failed in st_select_lex_unit::optimize with INTERSECT +# +CREATE TABLE t (i INT); +INSERT INTO t VALUES (1),(2); +SELECT * FROM t WHERE i != ANY ( SELECT 3 EXCEPT SELECT 3 ); +i +drop table t; +# End of 10.3 tests diff --git a/mysql-test/r/intersect.result b/mysql-test/r/intersect.result index 5dfb7fb6875..7a0301a23e6 100644 --- a/mysql-test/r/intersect.result +++ b/mysql-test/r/intersect.result @@ -689,3 +689,4 @@ View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union select `__3`.`c` AS `c`,`__3`.`d` AS `d` from ((select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect (select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `__3` union (select 4 AS `4`,4 AS `4`) latin1 latin1_swedish_ci drop view v1; drop tables t1,t2,t3; +# End of 10.3 tests diff --git a/mysql-test/t/except.test b/mysql-test/t/except.test index e13137701a9..f88d9b29e35 100644 --- a/mysql-test/t/except.test +++ b/mysql-test/t/except.test @@ -81,3 +81,17 @@ create table t3 (select a,b,b1 from t1) except (select c,d,d1 from t2); show create table t3; drop tables t1,t2,t3; + +--echo # +--echo # MDEV-13723: Server crashes in ha_heap::find_unique_row or +--echo # Assertion `0' failed in st_select_lex_unit::optimize with INTERSECT +--echo # +CREATE TABLE t (i INT); +INSERT INTO t VALUES (1),(2); + +SELECT * FROM t WHERE i != ANY ( SELECT 3 EXCEPT SELECT 3 ); + +drop table t; + + +--echo # End of 10.3 tests diff --git a/mysql-test/t/intersect.test b/mysql-test/t/intersect.test index 6028b2fa498..99a54606291 100644 --- a/mysql-test/t/intersect.test +++ b/mysql-test/t/intersect.test @@ -190,3 +190,4 @@ show create view v1; drop view v1; drop tables t1,t2,t3; +--echo # End of 10.3 tests -- cgit v1.2.1 From d1b666b5c63fba4bd4e80b69747ebd0c3c09fd3d Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Mon, 13 Nov 2017 10:02:59 +0100 Subject: MDEV-14346: incorrect result of intersect with ANY/ALL/IN subquery Reinit internal state of select_unit before using to correctly run it after first time. --- mysql-test/r/intersect.result | 13 +++++++++++++ mysql-test/t/intersect.test | 15 +++++++++++++++ 2 files changed, 28 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/intersect.result b/mysql-test/r/intersect.result index 7a0301a23e6..05adaf160ed 100644 --- a/mysql-test/r/intersect.result +++ b/mysql-test/r/intersect.result @@ -689,4 +689,17 @@ View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union select `__3`.`c` AS `c`,`__3`.`d` AS `d` from ((select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect (select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `__3` union (select 4 AS `4`,4 AS `4`) latin1 latin1_swedish_ci drop view v1; drop tables t1,t2,t3; +# +# MDEV-14346:incorrect result of intersect with ANY/ALL/IN subquery +# +CREATE TABLE t (i INT); +INSERT INTO t VALUES (1),(2); +SELECT * FROM t WHERE i != ANY ( SELECT 6 INTERSECT SELECT 3 ); +i +select i from t where +exists ((select 6 as r from dual having t.i <> 6) +intersect +(select 3 from dual having t.i <> 3)); +i +drop table t; # End of 10.3 tests diff --git a/mysql-test/t/intersect.test b/mysql-test/t/intersect.test index 99a54606291..98b6d1eb1c6 100644 --- a/mysql-test/t/intersect.test +++ b/mysql-test/t/intersect.test @@ -190,4 +190,19 @@ show create view v1; drop view v1; drop tables t1,t2,t3; +--echo # +--echo # MDEV-14346:incorrect result of intersect with ANY/ALL/IN subquery +--echo # +CREATE TABLE t (i INT); +INSERT INTO t VALUES (1),(2); +SELECT * FROM t WHERE i != ANY ( SELECT 6 INTERSECT SELECT 3 ); + +select i from t where + exists ((select 6 as r from dual having t.i <> 6) + intersect + (select 3 from dual having t.i <> 3)); + +drop table t; + + --echo # End of 10.3 tests -- cgit v1.2.1 From 071aece907e86ac28e3c4b7869ccebea6e974ed0 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 13 Nov 2017 21:58:00 +0400 Subject: MDEV-14376 Explicit CAST(CHAR(N)) erroneously escalates warnings to errors in STRICT_ALL_TABLES --- mysql-test/r/cast.result | 109 +++++++++++++++++++++++++++++++++++++ mysql-test/t/cast.test | 137 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 246 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result index 3c9cbb18bcb..ca314573581 100644 --- a/mysql-test/r/cast.result +++ b/mysql-test/r/cast.result @@ -1168,3 +1168,112 @@ CAST('-1' AS UNSIGNED) 18446744073709551615 DROP TABLE t1; SET sql_mode=DEFAULT; +# +# MDEV-14376 Explicit CAST(CHAR(N)) erroneously escalates warnings to errors in STRICT_ALL_TABLES +# +SET sql_mode=STRICT_ALL_TABLES; +SELECT CAST('xxx' AS CHAR(1)); +CAST('xxx' AS CHAR(1)) +x +Warnings: +Warning 1292 Truncated incorrect CHAR(1) value: 'xxx' +CREATE OR REPLACE TABLE t1 (a VARCHAR(1)); +INSERT INTO t1 VALUES (CAST('xxx' AS CHAR(1))); +Warnings: +Warning 1292 Truncated incorrect CHAR(1) value: 'xxx' +DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (a VARCHAR(3)); +INSERT INTO t1 VALUES ('xxx'); +UPDATE t1 SET a=CAST(a AS CHAR(1)); +Warnings: +Warning 1292 Truncated incorrect CHAR(1) value: 'xxx' +DROP TABLE t1; +BEGIN NOT ATOMIC +DECLARE a VARCHAR(30) CHARACTER SET latin1; +SET a=CAST('xxx' AS CHAR(1)); +END; +$$ +Warnings: +Warning 1292 Truncated incorrect CHAR(1) value: 'xxx' +BEGIN NOT ATOMIC +DECLARE a VARCHAR(30) CHARACTER SET latin1; +SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET latin1); +END; +$$ +Warnings: +Warning 1292 Truncated incorrect CHAR(1) value: 'xxx' +BEGIN NOT ATOMIC +DECLARE a VARCHAR(30) CHARACTER SET latin1; +SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET utf8); +END; +$$ +Warnings: +Warning 1292 Truncated incorrect CHAR(1) value: 'xxx' +BEGIN NOT ATOMIC +DECLARE a VARCHAR(30) CHARACTER SET utf8; +SET a=CAST('xxx' AS CHAR(1)); +END; +$$ +Warnings: +Warning 1292 Truncated incorrect CHAR(1) value: 'xxx' +BEGIN NOT ATOMIC +DECLARE a VARCHAR(30) CHARACTER SET utf8; +SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET latin1); +END; +$$ +Warnings: +Warning 1292 Truncated incorrect CHAR(1) value: 'xxx' +BEGIN NOT ATOMIC +DECLARE a VARCHAR(30) CHARACTER SET utf8; +SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET utf8); +END; +$$ +Warnings: +Warning 1292 Truncated incorrect CHAR(1) value: 'xxx' +# Conversion problems still escalate warnings to errors (without right truncation) +BEGIN NOT ATOMIC +DECLARE a VARCHAR(30) CHARACTER SET utf8; +SET a=CAST(_utf8 0xD18F AS CHAR(1) CHARACTER SET latin1); +END; +$$ +ERROR HY000: Cannot convert 'utf8' character 0xD18F to 'latin1' +# Conversion problems still escalate warnings to errors (with right truncation) +BEGIN NOT ATOMIC +DECLARE a VARCHAR(30) CHARACTER SET utf8; +SET a=CAST(_utf8 0xD18FD18F AS CHAR(1) CHARACTER SET latin1); +END; +$$ +ERROR HY000: Cannot convert 'utf8' character 0xD18F to 'latin1' +# CAST(number AS CHAR) escalates warnings to errors on truncation +CREATE OR REPLACE TABLE t1 (a VARCHAR(10)); +INSERT INTO t1 VALUES (CAST(123 AS CHAR(1))); +ERROR 22007: Truncated incorrect CHAR(1) value: '123' +DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (a VARCHAR(10)); +INSERT INTO t1 VALUES ('1'); +UPDATE t1 SET a=CAST(123 AS CHAR(1)); +ERROR 22007: Truncated incorrect CHAR(1) value: '123' +DROP TABLE t1; +BEGIN NOT ATOMIC +DECLARE a VARCHAR(10); +SET a=CAST(123 AS CHAR(1)); +END; +$$ +ERROR 22007: Truncated incorrect CHAR(1) value: '123' +# CAST(temporal AS CHAR) escalates warnings to errors on truncation +CREATE OR REPLACE TABLE t1 (a VARCHAR(10)); +INSERT INTO t1 VALUES (CAST(TIME'10:20:30' AS CHAR(1))); +ERROR 22007: Truncated incorrect CHAR(1) value: '10:20:30' +DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (a VARCHAR(10)); +INSERT INTO t1 VALUES ('1'); +UPDATE t1 SET a=CAST(TIME'10:20:30' AS CHAR(1)); +ERROR 22007: Truncated incorrect CHAR(1) value: '10:20:30' +DROP TABLE t1; +BEGIN NOT ATOMIC +DECLARE a VARCHAR(10); +SET a=CAST(TIME'10:20:30' AS CHAR(1)); +END; +$$ +ERROR 22007: Truncated incorrect CHAR(1) value: '10:20:30' +SET sql_mode=DEFAULT; diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test index 17e8be839a8..b514dbb5b2d 100644 --- a/mysql-test/t/cast.test +++ b/mysql-test/t/cast.test @@ -587,3 +587,140 @@ SHOW CREATE TABLE t1; SELECT * FROM t1; DROP TABLE t1; SET sql_mode=DEFAULT; + + +--echo # +--echo # MDEV-14376 Explicit CAST(CHAR(N)) erroneously escalates warnings to errors in STRICT_ALL_TABLES +--echo # + +SET sql_mode=STRICT_ALL_TABLES; +SELECT CAST('xxx' AS CHAR(1)); + +CREATE OR REPLACE TABLE t1 (a VARCHAR(1)); +INSERT INTO t1 VALUES (CAST('xxx' AS CHAR(1))); +DROP TABLE t1; + +CREATE OR REPLACE TABLE t1 (a VARCHAR(3)); +INSERT INTO t1 VALUES ('xxx'); +UPDATE t1 SET a=CAST(a AS CHAR(1)); +DROP TABLE t1; + +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE a VARCHAR(30) CHARACTER SET latin1; + SET a=CAST('xxx' AS CHAR(1)); +END; +$$ +DELIMITER ;$$ + +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE a VARCHAR(30) CHARACTER SET latin1; + SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET latin1); +END; +$$ +DELIMITER ;$$ + +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE a VARCHAR(30) CHARACTER SET latin1; + SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET utf8); +END; +$$ +DELIMITER ;$$ + +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE a VARCHAR(30) CHARACTER SET utf8; + SET a=CAST('xxx' AS CHAR(1)); +END; +$$ +DELIMITER ;$$ + +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE a VARCHAR(30) CHARACTER SET utf8; + SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET latin1); +END; +$$ +DELIMITER ;$$ + +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE a VARCHAR(30) CHARACTER SET utf8; + SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET utf8); +END; +$$ +DELIMITER ;$$ + + +--echo # Conversion problems still escalate warnings to errors (without right truncation) + +DELIMITER $$; +--error ER_CANNOT_CONVERT_CHARACTER +BEGIN NOT ATOMIC + DECLARE a VARCHAR(30) CHARACTER SET utf8; + SET a=CAST(_utf8 0xD18F AS CHAR(1) CHARACTER SET latin1); +END; +$$ +DELIMITER ;$$ + + +--echo # Conversion problems still escalate warnings to errors (with right truncation) + +DELIMITER $$; +--error ER_CANNOT_CONVERT_CHARACTER +BEGIN NOT ATOMIC + DECLARE a VARCHAR(30) CHARACTER SET utf8; + SET a=CAST(_utf8 0xD18FD18F AS CHAR(1) CHARACTER SET latin1); +END; +$$ +DELIMITER ;$$ + + +--echo # CAST(number AS CHAR) escalates warnings to errors on truncation + +CREATE OR REPLACE TABLE t1 (a VARCHAR(10)); +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO t1 VALUES (CAST(123 AS CHAR(1))); +DROP TABLE t1; + +CREATE OR REPLACE TABLE t1 (a VARCHAR(10)); +INSERT INTO t1 VALUES ('1'); +--error ER_TRUNCATED_WRONG_VALUE +UPDATE t1 SET a=CAST(123 AS CHAR(1)); +DROP TABLE t1; + +DELIMITER $$; +--error ER_TRUNCATED_WRONG_VALUE +BEGIN NOT ATOMIC + DECLARE a VARCHAR(10); + SET a=CAST(123 AS CHAR(1)); +END; +$$ +DELIMITER ;$$ + + +--echo # CAST(temporal AS CHAR) escalates warnings to errors on truncation + +CREATE OR REPLACE TABLE t1 (a VARCHAR(10)); +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO t1 VALUES (CAST(TIME'10:20:30' AS CHAR(1))); +DROP TABLE t1; + +CREATE OR REPLACE TABLE t1 (a VARCHAR(10)); +INSERT INTO t1 VALUES ('1'); +--error ER_TRUNCATED_WRONG_VALUE +UPDATE t1 SET a=CAST(TIME'10:20:30' AS CHAR(1)); +DROP TABLE t1; + +DELIMITER $$; +--error ER_TRUNCATED_WRONG_VALUE +BEGIN NOT ATOMIC + DECLARE a VARCHAR(10); + SET a=CAST(TIME'10:20:30' AS CHAR(1)); +END; +$$ +DELIMITER ;$$ + +SET sql_mode=DEFAULT; -- cgit v1.2.1 From 0f43279cc472d82859960f5057e0ec98428459ee Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Mon, 6 Nov 2017 14:35:58 +0100 Subject: MDEV-13936: Server crashes in Time_and_counter_tracker::incr_loops Repeat reworked solution of procedures for all posible Sp (functions & triggers). --- mysql-test/r/sp.result | 12 ++++++++++++ mysql-test/r/trigger.result | 17 +++++++++++++++++ mysql-test/t/sp.test | 17 +++++++++++++++++ mysql-test/t/trigger.test | 24 ++++++++++++++++++++++++ 4 files changed, 70 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index c6867d46489..9b0ace5c002 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -8107,4 +8107,16 @@ CALL p(); drop procedure p; drop view v; drop table t, tmp_t; +# +# MDEV-13936: Server crashes in Time_and_counter_tracker::incr_loops +# +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT * FROM t1 WHERE RAND() > 0.5; +CREATE FUNCTION f1() RETURNS INT RETURN ( SELECT MAX(i) FROM v1 ); +REPLACE INTO v1 VALUES (f1()); +ERROR HY000: The target table v1 of the INSERT is not insertable-into +SET @aux = f1(); +DROP FUNCTION f1; +DROP VIEW v1; +DROP TABLE t1; #End of 10.1 tests diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result index 86219875bed..8455450e294 100644 --- a/mysql-test/r/trigger.result +++ b/mysql-test/r/trigger.result @@ -2290,3 +2290,20 @@ INSERT INTO t1 VALUES ('a'); ERROR 22001: Data too long for column 'c' at row 1 DROP TRIGGER t1_bi; DROP TABLE t1; +# +# MDEV-13936: Server crashes in Time_and_counter_tracker::incr_loops +# +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT * FROM t1 WHERE RAND() > 0.5; +CREATE TABLE t2 (a int); +CREATE TABLE t3 (a int); +create trigger trg after insert on t2 for each row +INSERT INTO t3 SELECT MAX(i) FROM v1 UNION SELECT MAX(i) FROM v1; +drop table t1; +insert into t2 value (2); +ERROR 42S02: Table 'test.t1' doesn't exist +CREATE TABLE t1 (i INT); +insert into t2 value (2); +DROP VIEW v1; +DROP TABLE t1,t2,t3; +End of 10.1 tests. diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 99020eb951f..7453cec8f21 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -9588,4 +9588,21 @@ drop procedure p; drop view v; drop table t, tmp_t; + +--echo # +--echo # MDEV-13936: Server crashes in Time_and_counter_tracker::incr_loops +--echo # +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT * FROM t1 WHERE RAND() > 0.5; +CREATE FUNCTION f1() RETURNS INT RETURN ( SELECT MAX(i) FROM v1 ); + +--error ER_NON_INSERTABLE_TABLE +REPLACE INTO v1 VALUES (f1()); +SET @aux = f1(); + +# Cleanup +DROP FUNCTION f1; +DROP VIEW v1; +DROP TABLE t1; + --echo #End of 10.1 tests diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index a02dce34837..ff6f38b719d 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -2634,3 +2634,27 @@ INSERT INTO t1 VALUES ('a'); DROP TRIGGER t1_bi; DROP TABLE t1; +--echo # +--echo # MDEV-13936: Server crashes in Time_and_counter_tracker::incr_loops +--echo # + +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT * FROM t1 WHERE RAND() > 0.5; +CREATE TABLE t2 (a int); +CREATE TABLE t3 (a int); + +create trigger trg after insert on t2 for each row + INSERT INTO t3 SELECT MAX(i) FROM v1 UNION SELECT MAX(i) FROM v1; + +drop table t1; + +--error ER_NO_SUCH_TABLE +insert into t2 value (2); +CREATE TABLE t1 (i INT); +insert into t2 value (2); + +DROP VIEW v1; +DROP TABLE t1,t2,t3; + + +--echo End of 10.1 tests. -- cgit v1.2.1 From 24184938ad9954f25c082a1afd74a053a8ab6d8c Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Tue, 14 Nov 2017 13:36:50 +0400 Subject: MDEV-11881 Empty coordinates must be rejected in GeoJSON objects. Check for the empty 'coordinates' array. --- mysql-test/r/gis-json.result | 15 +++++++++++++++ mysql-test/t/gis-json.test | 4 ++++ 2 files changed, 19 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/gis-json.result b/mysql-test/r/gis-json.result index d888b08351d..1d6e2193fc9 100644 --- a/mysql-test/r/gis-json.result +++ b/mysql-test/r/gis-json.result @@ -89,6 +89,21 @@ ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 1) SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 5); ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 5) {"bbox": [10, 11, 10, 11], "type": "Point", "coordinates": [10, 11]} +SELECT st_astext(st_geomfromgeojson('{"type": "MultiLineString","coordinates": []}')) as a; +a +NULL +Warnings: +Warning 4076 Incorrect GeoJSON format - empty 'coordinates' array. +SELECT st_astext(st_geomfromgeojson('{"type": "Polygon","coordinates": []}')) as a; +a +NULL +Warnings: +Warning 4076 Incorrect GeoJSON format - empty 'coordinates' array. +SELECT st_astext(st_geomfromgeojson('{"type": "MultiPolygon","coordinates": []}')) as a; +a +NULL +Warnings: +Warning 4076 Incorrect GeoJSON format - empty 'coordinates' array. # # End of 10.2 tests # diff --git a/mysql-test/t/gis-json.test b/mysql-test/t/gis-json.test index 5e695fbca9c..b91ef235fd0 100644 --- a/mysql-test/t/gis-json.test +++ b/mysql-test/t/gis-json.test @@ -40,6 +40,10 @@ SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),10); SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 1); SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 5); +SELECT st_astext(st_geomfromgeojson('{"type": "MultiLineString","coordinates": []}')) as a; +SELECT st_astext(st_geomfromgeojson('{"type": "Polygon","coordinates": []}')) as a; +SELECT st_astext(st_geomfromgeojson('{"type": "MultiPolygon","coordinates": []}')) as a; + --echo # --echo # End of 10.2 tests --echo # -- cgit v1.2.1 From 765452dbef57b71962950a9001ce21b64e1aba94 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 14 Nov 2017 16:31:10 +0400 Subject: MDEV-14388 Server crashes in handle_select / val_uint in ORACLE mode --- .../suite/compat/oracle/r/sp-cursor-rowtype.result | 33 ++++++++++++++++++++ .../suite/compat/oracle/t/sp-cursor-rowtype.test | 36 ++++++++++++++++++++++ 2 files changed, 69 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result b/mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result index 3030a3dc658..a46daf30a8f 100644 --- a/mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result +++ b/mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result @@ -1359,3 +1359,36 @@ t2 CREATE TABLE "t2" ( "b" varchar(3) DEFAULT NULL, "c" time DEFAULT NULL ) +# +# MDEV-14388 Server crashes in handle_select / val_uint in ORACLE mode +# +CREATE TABLE t1 (id INT); +INSERT INTO t1 VALUES (0),(1),(2),(3); +CREATE FUNCTION f1() RETURN INT is +BEGIN +FOR v1 in (SELECT id FROM t1) +LOOP +NULL; +END LOOP; +RETURN 1; +END; +$$ +SELECT f1(); +f1() +1 +DROP FUNCTION f1; +DROP TABLE t1; +CREATE TABLE t1 (id INT); +INSERT INTO t1 VALUES (1),(2),(3),(4); +CREATE FUNCTION f1() RETURN INT IS +CURSOR cur IS SELECT id FROM t1; +rec cur%ROWTYPE; +BEGIN +RETURN 1; +END; +$$ +SELECT f1(); +f1() +1 +DROP FUNCTION f1; +DROP TABLE t1; diff --git a/mysql-test/suite/compat/oracle/t/sp-cursor-rowtype.test b/mysql-test/suite/compat/oracle/t/sp-cursor-rowtype.test index 19a50eacca1..fd148d1f261 100644 --- a/mysql-test/suite/compat/oracle/t/sp-cursor-rowtype.test +++ b/mysql-test/suite/compat/oracle/t/sp-cursor-rowtype.test @@ -1444,3 +1444,39 @@ BEGIN END; $$ DELIMITER ;$$ + +--echo # +--echo # MDEV-14388 Server crashes in handle_select / val_uint in ORACLE mode +--echo # + +CREATE TABLE t1 (id INT); +INSERT INTO t1 VALUES (0),(1),(2),(3); +DELIMITER $$; +CREATE FUNCTION f1() RETURN INT is +BEGIN + FOR v1 in (SELECT id FROM t1) + LOOP + NULL; + END LOOP; + RETURN 1; +END; +$$ +DELIMITER ;$$ +SELECT f1(); +DROP FUNCTION f1; +DROP TABLE t1; + +CREATE TABLE t1 (id INT); +INSERT INTO t1 VALUES (1),(2),(3),(4); +DELIMITER $$; +CREATE FUNCTION f1() RETURN INT IS + CURSOR cur IS SELECT id FROM t1; + rec cur%ROWTYPE; +BEGIN + RETURN 1; +END; +$$ +DELIMITER ;$$ +SELECT f1(); +DROP FUNCTION f1; +DROP TABLE t1; -- cgit v1.2.1 From 3afc9629fd84fbbc615f02aac0154e6b5ba92168 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Tue, 14 Nov 2017 12:22:30 -0800 Subject: Fixed bug mdev-13453 Executing a query via CTE requires more permissions than the query itself ACL checks were not properly supported for tables used in CTE specifications. This patch fixes the problem. --- mysql-test/r/cte_nonrecursive.result | 58 ++++++++++++++++++++++++++++++++++++ mysql-test/t/cte_nonrecursive.test | 51 +++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/cte_nonrecursive.result b/mysql-test/r/cte_nonrecursive.result index ebe1aae1e8f..21a1fa3164f 100644 --- a/mysql-test/r/cte_nonrecursive.result +++ b/mysql-test/r/cte_nonrecursive.result @@ -1147,3 +1147,61 @@ SELECT * FROM cte_test; a 1 DROP VIEW cte_test; +# +# MDEV-13453: privileges checking for CTE +# +create database db; +use db; +create table t1 (i int); +insert into t1 +values (3), (7), (1), (4), (2), (3), (1); +create table t2 (a int, b int); +insert into t2 +values (3,10), (7,11), (1,17), (4,15), (2,11), (3,10), (1,15); +create user foo@localhost; +grant SELECT on db.t1 to foo@localhost; +grant SELECT(a) on db.t2 to foo@localhost; +connect con1,localhost,foo,,; +use db; +with cte as (select * from t1 where i < 4) +select * from cte; +i +3 +1 +2 +3 +1 +with cte as (select * from t1 where i < 4 group by i) +select * from cte; +i +1 +2 +3 +with cte as (select * from t1 where i < 4) +select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2; +i +1 +3 +with cte as (select * from t1 where i < 4 group by i) +select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2; +i +1 +3 +with cte as (select b from t2 where a < 4) +select * from cte cte1 where b < 15 union select * from cte cte2 where b > 15; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'b' in table 't2' +with cte as (select a from t2 where a < 4) +select * from cte cte1 where a < 2 union select * from cte cte2 where a > 2; +a +1 +3 +connection default; +revoke SELECT on db.t1 from foo@localhost; +connection con1; +with cte as (select * from t1 where i < 4) +select * from cte; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1' +disconnect con1; +connection default; +drop database db; +drop user foo@localhost; diff --git a/mysql-test/t/cte_nonrecursive.test b/mysql-test/t/cte_nonrecursive.test index 742e8f6e4d7..03e6e298fa8 100644 --- a/mysql-test/t/cte_nonrecursive.test +++ b/mysql-test/t/cte_nonrecursive.test @@ -790,3 +790,54 @@ SHOW CREATE VIEW cte_test; SELECT * FROM cte_test; DROP VIEW cte_test; + +--echo # +--echo # MDEV-13453: privileges checking for CTE +--echo # + +create database db; +use db; +create table t1 (i int); +insert into t1 + values (3), (7), (1), (4), (2), (3), (1); + +create table t2 (a int, b int); +insert into t2 + values (3,10), (7,11), (1,17), (4,15), (2,11), (3,10), (1,15); + +create user foo@localhost; +grant SELECT on db.t1 to foo@localhost; +grant SELECT(a) on db.t2 to foo@localhost; + +--connect (con1,localhost,foo,,) +use db; +with cte as (select * from t1 where i < 4) + select * from cte; +with cte as (select * from t1 where i < 4 group by i) + select * from cte; +with cte as (select * from t1 where i < 4) + select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2; +with cte as (select * from t1 where i < 4 group by i) + select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2; + +--error ER_COLUMNACCESS_DENIED_ERROR +with cte as (select b from t2 where a < 4) + select * from cte cte1 where b < 15 union select * from cte cte2 where b > 15; +with cte as (select a from t2 where a < 4) + select * from cte cte1 where a < 2 union select * from cte cte2 where a > 2; + +--connection default +revoke SELECT on db.t1 from foo@localhost; + +--connection con1 + +--error ER_TABLEACCESS_DENIED_ERROR +with cte as (select * from t1 where i < 4) + select * from cte; + +# Cleanup +--disconnect con1 + +--connection default +drop database db; +drop user foo@localhost; -- cgit v1.2.1 From b8f906dd4b2094deb30812c5d0b6c71151be1d6b Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 15 Nov 2017 14:18:46 +0400 Subject: MDEV-12846 sql_mode=ORACLE: using Oracle-style placeholders in direct query execution makes the server crash --- mysql-test/suite/compat/oracle/r/ps.result | 15 +++++++++++++++ mysql-test/suite/compat/oracle/t/ps.test | 19 +++++++++++++++++++ 2 files changed, 34 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/suite/compat/oracle/r/ps.result b/mysql-test/suite/compat/oracle/r/ps.result index ed7cb4c51d5..158d15e9f90 100644 --- a/mysql-test/suite/compat/oracle/r/ps.result +++ b/mysql-test/suite/compat/oracle/r/ps.result @@ -247,3 +247,18 @@ DROP PROCEDURE p1; # # End of MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions # +# +# MDEV-12846 sql_mode=ORACLE: using Oracle-style placeholders in direct query execution makes the server crash +# +SELECT ? FROM DUAL; +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 '? FROM DUAL' at line 1 +SELECT :a FROM DUAL; +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 ':a FROM DUAL' at line 1 +SELECT :1 FROM DUAL; +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 ':1 FROM DUAL' at line 1 +SELECT 1+? FROM DUAL; +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 '? FROM DUAL' at line 1 +SELECT 1+:a FROM DUAL; +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 ':a FROM DUAL' at line 1 +SELECT 1+:1 FROM DUAL; +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 ':1 FROM DUAL' at line 1 diff --git a/mysql-test/suite/compat/oracle/t/ps.test b/mysql-test/suite/compat/oracle/t/ps.test index 08bb957c33f..d5a325d526f 100644 --- a/mysql-test/suite/compat/oracle/t/ps.test +++ b/mysql-test/suite/compat/oracle/t/ps.test @@ -264,3 +264,22 @@ DROP PROCEDURE p1; --echo # --echo # End of MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions --echo # + + +--echo # +--echo # MDEV-12846 sql_mode=ORACLE: using Oracle-style placeholders in direct query execution makes the server crash +--echo # + +--error ER_PARSE_ERROR +SELECT ? FROM DUAL; +--error ER_PARSE_ERROR +SELECT :a FROM DUAL; +--error ER_PARSE_ERROR +SELECT :1 FROM DUAL; + +--error ER_PARSE_ERROR +SELECT 1+? FROM DUAL; +--error ER_PARSE_ERROR +SELECT 1+:a FROM DUAL; +--error ER_PARSE_ERROR +SELECT 1+:1 FROM DUAL; -- cgit v1.2.1 From ac8e0507fe0983ed16472f98dd9f5e138aa8be6f Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 15 Nov 2017 14:34:04 +0400 Subject: MDEV-11155 Bad error message when creating a SET column with comma and non-ASCII characters The patch for MDEV-11146 fixed this problem earlier. Only adding tests from the report. --- mysql-test/r/type_set.result | 6 ++++++ mysql-test/t/type_set.test | 8 ++++++++ 2 files changed, 14 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/type_set.result b/mysql-test/r/type_set.result index 1258de317ec..ae72619b5ae 100644 --- a/mysql-test/r/type_set.result +++ b/mysql-test/r/type_set.result @@ -352,3 +352,9 @@ EXPLAIN SELECT * FROM t1 WHERE a='1.1'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables DROP TABLE t1; +# +# MDEV-11155 Bad error message when creating a SET column with comma and non-ASCII characters +# +SET NAMES utf8; +CREATE TABLE t1 (a SET('a,bü')); +ERROR 22007: Illegal set 'a,bü' value found during parsing diff --git a/mysql-test/t/type_set.test b/mysql-test/t/type_set.test index 8c26d5a4366..637ad40c316 100644 --- a/mysql-test/t/type_set.test +++ b/mysql-test/t/type_set.test @@ -240,3 +240,11 @@ EXPLAIN SELECT * FROM t1 WHERE a='1x'; EXPLAIN SELECT * FROM t1 WHERE a='1.0'; EXPLAIN SELECT * FROM t1 WHERE a='1.1'; DROP TABLE t1; + +--echo # +--echo # MDEV-11155 Bad error message when creating a SET column with comma and non-ASCII characters +--echo # + +SET NAMES utf8; +--error ER_ILLEGAL_VALUE_FOR_TYPE +CREATE TABLE t1 (a SET('a,bü')); -- cgit v1.2.1 From 7663773e56e64098b1126651a6ff3cbc41192329 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 15 Nov 2017 14:42:04 +0400 Subject: MDEV-11160 "Incorrect column name" when "CREATE TABLE t1 AS SELECT spvar" This problem was earlier fixed in bb-10.2-ext. Adding tests only. --- mysql-test/suite/compat/oracle/r/sp.result | 28 ++++++++++++++++++++++++++++ mysql-test/suite/compat/oracle/t/sp.test | 27 +++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/suite/compat/oracle/r/sp.result b/mysql-test/suite/compat/oracle/r/sp.result index 53411e80251..2bf4f50e6d5 100644 --- a/mysql-test/suite/compat/oracle/r/sp.result +++ b/mysql-test/suite/compat/oracle/r/sp.result @@ -2404,3 +2404,31 @@ t1 CREATE TABLE "t1" ( "aa_timestamp5" timestamp(5) NULL DEFAULT NULL, "aa_date0" datetime DEFAULT NULL ) +# +# MDEV-11160 "Incorrect column name" when "CREATE TABLE t1 AS SELECT spvar" +# +CREATE TABLE t1 (x INT); +INSERT INTO t1 VALUES (10); +CREATE VIEW v1 AS SELECT x+1 AS a,x+1 AS b FROM t1; +CREATE PROCEDURE p1 +AS +a INT := 1; +b INT := 2; +BEGIN +CREATE TABLE t2 AS SELECT a,b FROM v1; +SHOW CREATE TABLE t2; +SELECT * FROM t2; +DROP TABLE t2; +END; +$$ +CALL p1(); +Table Create Table +t2 CREATE TABLE "t2" ( + "a" int(11) DEFAULT NULL, + "b" int(11) DEFAULT NULL +) +a b +1 2 +DROP PROCEDURE p1; +DROP VIEW v1; +DROP TABLE t1; diff --git a/mysql-test/suite/compat/oracle/t/sp.test b/mysql-test/suite/compat/oracle/t/sp.test index 61a37459483..e7adbb5403a 100644 --- a/mysql-test/suite/compat/oracle/t/sp.test +++ b/mysql-test/suite/compat/oracle/t/sp.test @@ -2233,3 +2233,30 @@ BEGIN END; $$ DELIMITER ;$$ + + +--echo # +--echo # MDEV-11160 "Incorrect column name" when "CREATE TABLE t1 AS SELECT spvar" +--echo # + + +CREATE TABLE t1 (x INT); +INSERT INTO t1 VALUES (10); +CREATE VIEW v1 AS SELECT x+1 AS a,x+1 AS b FROM t1; +DELIMITER $$; +CREATE PROCEDURE p1 +AS + a INT := 1; + b INT := 2; +BEGIN + CREATE TABLE t2 AS SELECT a,b FROM v1; + SHOW CREATE TABLE t2; + SELECT * FROM t2; + DROP TABLE t2; +END; +$$ +DELIMITER ;$$ +CALL p1(); +DROP PROCEDURE p1; +DROP VIEW v1; +DROP TABLE t1; -- cgit v1.2.1 From aae4932775d5780fe575087b40779700eaa4fcbf Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Fri, 29 Sep 2017 21:56:59 +0300 Subject: MDEV-12012/MDEV-11969 Can't remove GTIDs for a stale GTID Domain ID As reported in MDEV-11969 "there's no way to ditch knowledge" about some domain that is no longer updated on a server. Besides being of annoyance to clutter output in DBA console stale domains can prevent the slave to connect the master as MDEV-12012 witnesses. What domain is obsolete must be evaluated by the user (DBA) according to whether the domain info is still relevant and will the domain ever receive any update. This patch introduces a method to discard obsolete gtid domains from the server binlog state. The removal requires no event group from such domain present in existing binlog files though. If there are any the containing logs must be first PURGEd in order for FLUSH BINARY LOGS DELETE_DOMAIN_ID=(list-of-domains) succeed. Otherwise the command returns an error. The list of obsolete domains can be computed through intersecting two sets - the earliest (first) binlog's Gtid_list and the current value of @@global.gtid_binlog_state - and extracting the domain id components from the intersection list items. The new DELETE_DOMAIN_ID featured FLUSH continues to rotate binlog omitting the deleted domains from the active binlog file's Gtid_list. Notice though when the command is ineffective - that none of requested to delete domain exists in the binlog state - rotation does not occur. Obsolete domain deletion is not harmful for connected slaves as long as master side binlog files *purge* is synchronized with FLUSH-DELETE_DOMAIN_ID. The slaves must have the last event from purged files processed as usual, in order not to bump later into requesting a gtid from a file which was already gone. While the command is not replicated (as ordinary FLUSH BINLOG LOGS is) slaves, even though having extra domains, won't suffer from reconnection errors thanks to master-slave gtid connection protocol allowing the master to be ignorant about a gtid domain. Should at failover such slave to be promoted into master role it may run the ex-master's FLUSH BINARY LOGS DELETE_DOMAIN_ID=(list-of-domains) to clean its own binlog state. NOTES. suite/perfschema/r/start_server_low_digest.result is re-recorded as consequence of internal parser codes changes. --- mysql-test/include/show_gtid_list.inc | 15 +++ .../r/binlog_flush_binlogs_delete_domain.result | 78 ++++++++++++ .../r/binlog_gtid_delete_domain_debug.result | 6 + .../t/binlog_flush_binlogs_delete_domain.test | 137 +++++++++++++++++++++ .../binlog/t/binlog_gtid_delete_domain_debug.test | 11 ++ .../perfschema/r/start_server_low_digest.result | 4 +- .../suite/rpl/r/rpl_gtid_delete_domain.result | 30 +++++ mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test | 95 ++++++++++++++ 8 files changed, 374 insertions(+), 2 deletions(-) create mode 100644 mysql-test/include/show_gtid_list.inc create mode 100644 mysql-test/suite/binlog/r/binlog_flush_binlogs_delete_domain.result create mode 100644 mysql-test/suite/binlog/r/binlog_gtid_delete_domain_debug.result create mode 100644 mysql-test/suite/binlog/t/binlog_flush_binlogs_delete_domain.test create mode 100644 mysql-test/suite/binlog/t/binlog_gtid_delete_domain_debug.test create mode 100644 mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result create mode 100644 mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test (limited to 'mysql-test') diff --git a/mysql-test/include/show_gtid_list.inc b/mysql-test/include/show_gtid_list.inc new file mode 100644 index 00000000000..96f813f180c --- /dev/null +++ b/mysql-test/include/show_gtid_list.inc @@ -0,0 +1,15 @@ +# ==== Purpose ==== +# +# Extract Gtid_list info from SHOW BINLOG EVENTS output masking +# non-deterministic fields. +# +# ==== Usage ==== +# +# [--let $binlog_file=filename +# +if ($binlog_file) +{ + --let $_in_binlog_file=in '$binlog_file' +} +--replace_column 2 # 5 # +--eval show binlog events $_in_binlog_file limit 1,1 diff --git a/mysql-test/suite/binlog/r/binlog_flush_binlogs_delete_domain.result b/mysql-test/suite/binlog/r/binlog_flush_binlogs_delete_domain.result new file mode 100644 index 00000000000..daf2f4d6490 --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_flush_binlogs_delete_domain.result @@ -0,0 +1,78 @@ +RESET MASTER; +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (); +and the command execution is effective thence rotates binlog as usual +show binary logs; +Log_name File_size +master-bin.000001 # +master-bin.000002 # +Non-existed domain is warned, the command completes without rotation +but with a warning +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (99); +Warnings: +Warning 1982 The gtid domain being deleted ('99') is not in the current binlog state +show binary logs; +Log_name File_size +master-bin.000001 # +master-bin.000002 # +SET @@SESSION.gtid_domain_id=1; +SET @@SESSION.server_id=1; +CREATE TABLE t (a int); +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1); +ERROR HY000: Could not delete gtid domain. Reason: binlog files may contain gtids from the domain ('1') being deleted. Make sure to first purge those files. +FLUSH BINARY LOGS; +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1); +ERROR HY000: Could not delete gtid domain. Reason: binlog files may contain gtids from the domain ('1') being deleted. Make sure to first purge those files. +PURGE BINARY LOGS TO 'master-bin.000003';; +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1); +Gtid_list of the current binlog does not contain '1': +show binlog events in 'master-bin.000004' limit 1,1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000004 # Gtid_list 1 # [] +But the previous log's Gtid_list may have it which explains a warning from the following command +show binlog events in 'master-bin.000003' limit 1,1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000003 # Gtid_list 1 # [1-1-1] +Already deleted domain in Gtid_list of the earliest log is benign +but may cause a warning +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1); +Warnings: +Warning 1982 The current gtid binlog state is incompatible with a former one missing gtids from the '1-1' domain-server pair which is referred to in the gtid list describing an earlier state. Ignore if the domain ('1') was already explicitly deleted. +Warning 1982 The gtid domain being deleted ('1') is not in the current binlog state +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0); +ERROR HY000: Could not delete gtid domain. Reason: binlog files may contain gtids from the domain ('1') being deleted. Make sure to first purge those files. +FLUSH BINARY LOGS; +PURGE BINARY LOGS TO 'master-bin.000005'; +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0); +Warnings: +Warning 1982 The gtid domain being deleted ('0') is not in the current binlog state +Gtid_list of the current binlog does not contain 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0: +show binlog events in 'master-bin.000006' limit 1,1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000006 # Gtid_list 1 # [] +SET @@SESSION.gtid_domain_id=1;; +SET @@SESSION.server_id=1; +SET @@SESSION.gtid_seq_no=1; +INSERT INTO t SET a=1; +SET @@SESSION.server_id=2; +SET @@SESSION.gtid_seq_no=2; +INSERT INTO t SET a=2; +SET @@SESSION.gtid_domain_id=11; +SET @@SESSION.server_id=11; +SET @@SESSION.gtid_seq_no=11; +INSERT INTO t SET a=11; +SET @gtid_binlog_state_saved=@@GLOBAL.gtid_binlog_state; +FLUSH BINARY LOGS; +SET @@SESSION.gtid_domain_id=11; +SET @@SESSION.server_id=11; +SET @@SESSION.gtid_seq_no=1; +INSERT INTO t SET a=1; +SELECT @gtid_binlog_state_saved "as original state", @@GLOBAL.gtid_binlog_state as "out of order for 11 domain state"; +as original state out of order for 11 domain state +1-1-1,1-2-2,11-11-11 1-1-1,1-2-2,11-11-1 +PURGE BINARY LOGS TO 'master-bin.000007'; +the following command succeeds with warnings +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1); +Warnings: +Warning 1982 The current gtid binlog state is incompatible with a former one having a gtid '11-11-1' which is less than the '11-11-11' of the gtid list describing an earlier state. The state may have been affected by manually injecting a lower sequence number gtid or via replication. +DROP TABLE t; +RESET MASTER; diff --git a/mysql-test/suite/binlog/r/binlog_gtid_delete_domain_debug.result b/mysql-test/suite/binlog/r/binlog_gtid_delete_domain_debug.result new file mode 100644 index 00000000000..5193267e2f2 --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_gtid_delete_domain_debug.result @@ -0,0 +1,6 @@ +SET @@SESSION.debug_dbug='+d,inject_binlog_delete_domain_init_error'; +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (99); +ERROR HY000: Could not delete gtid domain. Reason: injected error. +SHOW WARNINGS; +Level Code Message +Error 1982 Could not delete gtid domain. Reason: injected error. diff --git a/mysql-test/suite/binlog/t/binlog_flush_binlogs_delete_domain.test b/mysql-test/suite/binlog/t/binlog_flush_binlogs_delete_domain.test new file mode 100644 index 00000000000..0faafa35a1b --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_flush_binlogs_delete_domain.test @@ -0,0 +1,137 @@ +# Prove basic properties of +# +# FLUSH BINARY LOGS DELETE_DOMAIN_ID = (...) +# +# The command removes the supplied list of domains from the current +# @@global.gtid_binlog_state provided the binlog files do not contain +# events from such domains. + +# The test is not format specific. One format is chosen to run it. +--source include/have_binlog_format_mixed.inc + +# Reset binlog state +RESET MASTER; + +# Empty list is accepted +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (); +--echo and the command execution is effective thence rotates binlog as usual +--source include/show_binary_logs.inc + +--echo Non-existed domain is warned, the command completes without rotation +--echo but with a warning +--let $binlog_pre_flush=query_get_value(SHOW MASTER STATUS, Position, 1) +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (99); +--let $binlog_start=$binlog_pre_flush +--source include/show_binary_logs.inc + +# Log one event in a specified domain and try to delete the domain +SET @@SESSION.gtid_domain_id=1; +SET @@SESSION.server_id=1; +CREATE TABLE t (a int); + +--error ER_BINLOG_CANT_DELETE_GTID_DOMAIN +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1); + +# the same error after log rotation +FLUSH BINARY LOGS; +--error ER_BINLOG_CANT_DELETE_GTID_DOMAIN +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1); + +# the latest binlog does not really contain any events incl ones from 1-domain +--let $purge_to_binlog= query_get_value(SHOW MASTER STATUS, File, 1) +--eval PURGE BINARY LOGS TO '$purge_to_binlog'; +# So now it's safe to delete +--error 0 +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1); +--echo Gtid_list of the current binlog does not contain '1': +--let $binlog_file=query_get_value(SHOW MASTER STATUS, File, 1) +--source include/show_gtid_list.inc +--echo But the previous log's Gtid_list may have it which explains a warning from the following command +--let $binlog_file=$purge_to_binlog +--source include/show_gtid_list.inc + +--echo Already deleted domain in Gtid_list of the earliest log is benign +--echo but may cause a warning +--error 0 +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1); + +# Few domains delete. The chosen number verifies among others how +# expected overrun of the static buffers of underlying dynamic arrays is doing. +--let $domain_cnt=17 +--let $server_in_domain_cnt=3 +--let $domain_list= +--disable_query_log +while ($domain_cnt) +{ + --let servers=$server_in_domain_cnt + --eval SET @@SESSION.gtid_domain_id=$domain_cnt + while ($servers) + { + --eval SET @@SESSION.server_id=10*$domain_cnt + $servers + --eval INSERT INTO t SET a=@@SESSION.server_id + + --dec $servers + } + --let $domain_list= $domain_cnt, $domain_list + + --dec $domain_cnt +} +--enable_query_log +--let $zero=0 +--let $domain_list= $domain_list$zero + +--error ER_BINLOG_CANT_DELETE_GTID_DOMAIN +--eval FLUSH BINARY LOGS DELETE_DOMAIN_ID = ($domain_list) + +# Now satisfy the safety condtion to purge log files containing $domain list +FLUSH BINARY LOGS; +--let $purge_to_binlog= query_get_value(SHOW MASTER STATUS, File, 1) +--eval PURGE BINARY LOGS TO '$purge_to_binlog' +--error 0 +--eval FLUSH BINARY LOGS DELETE_DOMAIN_ID = ($domain_list) +--echo Gtid_list of the current binlog does not contain $domain_list: +--let $binlog_file=query_get_value(SHOW MASTER STATUS, File, 1) +--source include/show_gtid_list.inc + +# Show reaction on @@global.gtid_binlog_state not succeeding +# earlier state as described by the 1st binlog' Gtid_list. +# Now let it be out-order gtid logged to a domain unrelated to deletion. + +--let $del_d_id=1 +--eval SET @@SESSION.gtid_domain_id=$del_d_id; +SET @@SESSION.server_id=1; +SET @@SESSION.gtid_seq_no=1; +INSERT INTO t SET a=1; +SET @@SESSION.server_id=2; +SET @@SESSION.gtid_seq_no=2; +INSERT INTO t SET a=2; + +SET @@SESSION.gtid_domain_id=11; +SET @@SESSION.server_id=11; +SET @@SESSION.gtid_seq_no=11; +INSERT INTO t SET a=11; + +SET @gtid_binlog_state_saved=@@GLOBAL.gtid_binlog_state; +FLUSH BINARY LOGS; + +# Inject out of order for domain '11' before +SET @@SESSION.gtid_domain_id=11; +SET @@SESSION.server_id=11; +SET @@SESSION.gtid_seq_no=1; +INSERT INTO t SET a=1; + +SELECT @gtid_binlog_state_saved "as original state", @@GLOBAL.gtid_binlog_state as "out of order for 11 domain state"; + +# to delete '1', first to purge logs containing its events +--let $purge_to_binlog= query_get_value(SHOW MASTER STATUS, File, 1) +--eval PURGE BINARY LOGS TO '$purge_to_binlog' + +--echo the following command succeeds with warnings +--eval FLUSH BINARY LOGS DELETE_DOMAIN_ID = ($del_d_id) + +# +# Cleanup +# + +DROP TABLE t; +RESET MASTER; diff --git a/mysql-test/suite/binlog/t/binlog_gtid_delete_domain_debug.test b/mysql-test/suite/binlog/t/binlog_gtid_delete_domain_debug.test new file mode 100644 index 00000000000..5de549c45bb --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_gtid_delete_domain_debug.test @@ -0,0 +1,11 @@ +# Check "internal" error branches of +# FLUSH BINARY LOGS DELETE_DOMAIN_ID = (...) +# handler. +--source include/have_debug.inc +--source include/have_binlog_format_mixed.inc + +SET @@SESSION.debug_dbug='+d,inject_binlog_delete_domain_init_error'; +--error ER_BINLOG_CANT_DELETE_GTID_DOMAIN +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (99); + +SHOW WARNINGS; diff --git a/mysql-test/suite/perfschema/r/start_server_low_digest.result b/mysql-test/suite/perfschema/r/start_server_low_digest.result index 8cc92f21964..6fc41fbb715 100644 --- a/mysql-test/suite/perfschema/r/start_server_low_digest.result +++ b/mysql-test/suite/perfschema/r/start_server_low_digest.result @@ -8,5 +8,5 @@ SELECT 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1 #################################### SELECT event_name, digest, digest_text, sql_text FROM events_statements_history_long; event_name digest digest_text sql_text -statement/sql/truncate e1c917a43f978456fab15240f89372ca TRUNCATE TABLE truncate table events_statements_history_long -statement/sql/select 3f7ca34376814d0e985337bd588b5ffd SELECT ? + ? + SELECT 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1 +statement/sql/truncate 6206ac02a54d832f55015e480e6f2213 TRUNCATE TABLE truncate table events_statements_history_long +statement/sql/select 4cc1c447d79877c4e8df0423fd0cde9a SELECT ? + ? + SELECT 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1 diff --git a/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result b/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result new file mode 100644 index 00000000000..3558a6764d1 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result @@ -0,0 +1,30 @@ +include/master-slave.inc +[connection master] +SET @@SESSION.gtid_domain_id=0; +CREATE TABLE t (a INT); +call mtr.add_suppression("connecting slave requested to start from.*which is not in the master's binlog"); +include/stop_slave.inc +CHANGE MASTER TO master_use_gtid=slave_pos; +SET @@SESSION.gtid_domain_id=11; +SET @@SESSION.server_id=111; +SET @@SESSION.gtid_seq_no=1; +INSERT INTO t SET a=1; +SET @save.gtid_slave_pos=@@global.gtid_slave_pos; +SET @@global.gtid_slave_pos=concat(@@global.gtid_slave_pos, ",", 11, "-", 111, "-", 1 + 1); +Warnings: +Warning 1947 Specified GTID 0-1-1 conflicts with the binary log which contains a more recent GTID 0-2-2. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos. +START SLAVE IO_THREAD; +include/wait_for_slave_io_error.inc [errno=1236] +FLUSH BINARY LOGS; +PURGE BINARY LOGS TO 'master-bin.000002';; +FLUSH BINARY LOGS DELETE_DOMAIN_ID=(11); +include/start_slave.inc +INSERT INTO t SET a=1; +include/wait_for_slave_io_error.inc [errno=1236] +FLUSH BINARY LOGS; +PURGE BINARY LOGS TO 'master-bin.000004';; +FLUSH BINARY LOGS DELETE_DOMAIN_ID=(11); +include/start_slave.inc +SET @@SESSION.gtid_domain_id=0; +DROP TABLE t; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test b/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test new file mode 100644 index 00000000000..5abedd7eb37 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test @@ -0,0 +1,95 @@ +# In case master's gtid binlog state is divergent from the slave's gtid_slave_pos +# slave may not be able to connect. +# For instance when slave is more updated in some of domains, see +# MDEV-12012 as example, the master's state may require adjustment. +# In a specific case of an "old" divergent domain, that is there +# won't be no more event groups from it generated, the states can be +# made compatible with wiping the problematic domain away. After that slave +# becomes connectable. +# +# Notice that the slave applied gtid state is not really required to +# be similarly cleaned in order for replication to flow. +# However this could lead to an expected error when the master +# resumes binlogging of such domain which the test demonstrate. + +--source include/master-slave.inc + +--connection master +# enforce the default domain_id binlogging explicitly +SET @@SESSION.gtid_domain_id=0; +CREATE TABLE t (a INT); +--sync_slave_with_master + +--connection slave +call mtr.add_suppression("connecting slave requested to start from.*which is not in the master's binlog"); + +--source include/stop_slave.inc +CHANGE MASTER TO master_use_gtid=slave_pos; + +--connection master +# create extra gtid domains for binlog state +--let $extra_domain_id=11 +--let $extra_domain_server_id=111 +--let $extra_gtid_seq_no=1 +--eval SET @@SESSION.gtid_domain_id=$extra_domain_id +--eval SET @@SESSION.server_id=$extra_domain_server_id +--eval SET @@SESSION.gtid_seq_no=$extra_gtid_seq_no +INSERT INTO t SET a=1; + +# +# Set up the slave replication state as if slave knows more events from the extra +# domain. +# +--connection slave +SET @save.gtid_slave_pos=@@global.gtid_slave_pos; +--eval SET @@global.gtid_slave_pos=concat(@@global.gtid_slave_pos, ",", $extra_domain_id, "-", $extra_domain_server_id, "-", $extra_gtid_seq_no + 1) + +# unsuccessful attempt to start slave +START SLAVE IO_THREAD; +--let $slave_io_errno=1236 +--source include/wait_for_slave_io_error.inc + +--connection master +# adjust the master binlog state +FLUSH BINARY LOGS; +--let $purge_to_binlog= query_get_value(SHOW MASTER STATUS, File, 1) +--eval PURGE BINARY LOGS TO '$purge_to_binlog'; +# with final removal of the extra domain +--eval FLUSH BINARY LOGS DELETE_DOMAIN_ID=($extra_domain_id) + +--connection slave +# start the slave sucessfully +--source include/start_slave.inc + +--connection master +# but the following gtid from the *extra* domain will break replication +INSERT INTO t SET a=1; + +# take note of the slave io thread error due to being dismissed +# extra domain at connection to master which tried becoming active; +# slave is to stop. +--connection slave +--let $errno=1236 +--source include/wait_for_slave_io_error.inc + +# let's apply the very same medicine +--connection master +FLUSH BINARY LOGS; +--let $purge_to_binlog= query_get_value(SHOW MASTER STATUS, File, 1) +--eval PURGE BINARY LOGS TO '$purge_to_binlog'; +# with final removal of the extra domain +--eval FLUSH BINARY LOGS DELETE_DOMAIN_ID=($extra_domain_id) + +--connection slave +--source include/start_slave.inc + +# +# cleanup +# +--connection master +SET @@SESSION.gtid_domain_id=0; +DROP TABLE t; + +sync_slave_with_master; + +--source include/rpl_end.inc -- cgit v1.2.1 From c7e38076f33fd050160a8ce8d9b4cc7197ed0d23 Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Mon, 16 Oct 2017 19:32:02 +0300 Subject: MDEV-9510 Segmentation fault in binlog thread causes crash With combination of --log-bin and Galera the server may crash reporting two characteristic stacks: /usr/sbin/mysqld(_ZN13MYSQL_BIN_LOG13mark_xid_doneEmb+0xc7)[0x7f182a8e2cb7] /usr/sbin/mysqld(binlog_background_thread+0x2b5)[0x7f182a8e3275] or /usr/sbin/mysqld(_ZN13MYSQL_BIN_LOG21do_checkpoint_requestEm+0x9d)[0x7ff395b2dafd] /usr/sbin/mysqld(_ZN13MYSQL_BIN_LOG20checkpoint_and_purgeEm+0x11)[0x7ff395b2db91] /usr/sbin/mysqld(_ZN13MYSQL_BIN_LOG16rotate_and_purgeEb+0xc2)[0x7ff395b300b2] The reason of the failure appears to be non-matching decrements for `xid_count_per_binlog::xid_count` which can occur when a transaction is executed having its connection issued `SET @@sql_log_bin=0`. In such case the xid count is not incremented but its decrements still runs to turn `binlog_xid_count_list` into improper state which the following FLUSH BINARY LOGS exposes through the crash. *Note_1*: the regression test reuses an existing galera.sql_log_bin which does not run stably (even in its base form) by mtr with --log-bin. *Note_2*: 10.0-galera branch is free of this issue having missed MDEV-7205 fixes. --- mysql-test/suite/galera/r/sql_log_bin.result | 1 + mysql-test/suite/galera/t/sql_log_bin.test | 12 ++++++++++++ 2 files changed, 13 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/suite/galera/r/sql_log_bin.result b/mysql-test/suite/galera/r/sql_log_bin.result index 237725ec9a7..a2ebafe5231 100644 --- a/mysql-test/suite/galera/r/sql_log_bin.result +++ b/mysql-test/suite/galera/r/sql_log_bin.result @@ -6,6 +6,7 @@ INSERT INTO t1 VALUES (1); # Disable binary logging for current session SET SQL_LOG_BIN=OFF; INSERT INTO t1 VALUES (2); +FLUSH BINARY LOGS; CREATE TABLE t2(c1 INT PRIMARY KEY) ENGINE=INNODB; INSERT INTO t2 VALUES (1); CREATE TABLE test.t3 AS SELECT * from t1; diff --git a/mysql-test/suite/galera/t/sql_log_bin.test b/mysql-test/suite/galera/t/sql_log_bin.test index 615bc4c30af..9f8f7c84486 100644 --- a/mysql-test/suite/galera/t/sql_log_bin.test +++ b/mysql-test/suite/galera/t/sql_log_bin.test @@ -1,5 +1,13 @@ # Test to check the behavior of galera cluster with sql_log_bin=ON|OFF & binary # logging is disabled. sql_bin_log should not affect galera replication. +# +# The following bugfixes are tested: +# +# MDEV-9510: Segmentation fault in binlog thread. +# A scenario otherwise causing a similar segfault is replayed. +# The test must pass having no crashes. +# The sequence of sql statements is provided by original +# sql_log_bin.test augmented with a FLUSH BINLOG LOGS, below. --source include/galera_cluster.inc --source include/have_innodb.inc @@ -15,6 +23,10 @@ INSERT INTO t1 VALUES (1); --echo # Disable binary logging for current session SET SQL_LOG_BIN=OFF; INSERT INTO t1 VALUES (2); + +# MDEV-9510: the following binlog rotation due to FLUSH segfaults wo/ the fixes +FLUSH BINARY LOGS; + CREATE TABLE t2(c1 INT PRIMARY KEY) ENGINE=INNODB; INSERT INTO t2 VALUES (1); CREATE TABLE test.t3 AS SELECT * from t1; -- cgit v1.2.1 From 0c4d11e8199f4c7a9e41fc3f86819219c21ddc4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 16 Nov 2017 11:05:24 +0200 Subject: MDEV-13206: INSERT ON DUPLICATE KEY UPDATE foreign key fail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is caused by following change: commit 95d29c99f01882ffcc2259f62b3163f9b0e80c75 Author: Marko Mäkelä Date: Tue Nov 27 11:12:13 2012 +0200 Bug#15920445 INNODB REPORTS ER_DUP_KEY BEFORE CREATE UNIQUE INDEX COMPLETED There is a phase during online secondary index creation where the index has been internally completed inside InnoDB, but does not 'officially' exist yet. We used to report ER_DUP_KEY in these situations, like this: ERROR 23000: Can't write; duplicate key in table 't1' What we should do is to let the 'offending' operation complete, but report an error to the ALTER TABLE t1 ADD UNIQUE KEY (c2): ERROR HY000: Index c2 is corrupted (This misleading error message should be fixed separately: Bug#15920713 CREATE UNIQUE INDEX REPORTS ER_INDEX_CORRUPT INSTEAD OF DUPLICATE) row_ins_sec_index_entry_low(): flag the index corrupted instead of reporting a duplicate, in case the index has not been published yet. rb:1614 approved by Jimmy Yang Problem is that after we have found duplicate key on primary key we continue to get necessary gap locks in secondary indexes to block concurrent transactions from inserting the searched records. However, search from unique index used in foreign key constraint could return DB_NO_REFERENCED_ROW if INSERT .. ON DUPLICATE KEY UPDATE does not contain value for foreign key column. In this case we should return the original DB_DUPLICATE_KEY error instead of DB_NO_REFERENCED_ROW. Consider as a example following: create table child(a int not null primary key, b int not null, c int, unique key (b), foreign key (b) references parent (id)) engine=innodb; insert into child values (1,1,2); insert into child(a) values (1) on duplicate key update c = 3; Now primary key value 1 naturally causes duplicate key error that will be stored on node->duplicate. If there was no duplicate key error, we should return the actual no referenced row error. As value for column b used in both unique key and foreign key is not provided, server uses 0 as a search value. This is naturally, not found leading to DB_NO_REFERENCED_ROW. But, we should update the row with primay key value 1 anyway as requested by on duplicate key update clause. --- .../innodb/r/innodb-on-duplicate-update.result | 60 +++++++++++++++++++++ .../suite/innodb/t/innodb-on-duplicate-update.test | 63 ++++++++++++++++++++++ 2 files changed, 123 insertions(+) create mode 100644 mysql-test/suite/innodb/r/innodb-on-duplicate-update.result create mode 100644 mysql-test/suite/innodb/t/innodb-on-duplicate-update.test (limited to 'mysql-test') diff --git a/mysql-test/suite/innodb/r/innodb-on-duplicate-update.result b/mysql-test/suite/innodb/r/innodb-on-duplicate-update.result new file mode 100644 index 00000000000..474ebf33bbd --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-on-duplicate-update.result @@ -0,0 +1,60 @@ +set sql_mode=''; +set innodb_strict_mode=0; +CREATE TABLE `v` ( +`id` int(11) unsigned NOT NULL AUTO_INCREMENT, +PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; +INSERT v values (1); +CREATE TABLE `vp` ( +`id` int(11) unsigned NOT NULL AUTO_INCREMENT, +`v_id` int(10) unsigned NOT NULL, +`p_id` int(10) unsigned NOT NULL, +`ppp` varchar(255) NOT NULL, +PRIMARY KEY (`id`), +UNIQUE KEY `IDX_vp_uniq` (`v_id`,`p_id`), +KEY `FK_vp_v` (`v_id`), +CONSTRAINT `FK_vp_v` FOREIGN KEY (`v_id`) REFERENCES `v` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; +INSERT vp VALUES (12, 1, 100, 'text12'); +INSERT INTO `vp` (`id`,`ppp`) VALUES (12, 'test12-2') ON DUPLICATE KEY UPDATE `ppp` = VALUES(`ppp`); +Warnings: +Warning 1364 Field 'v_id' doesn't have a default value +Warning 1364 Field 'p_id' doesn't have a default value +SELECT * FROM vp; +id v_id p_id ppp +12 1 100 test12-2 +DROP TABLE vp, v; +CREATE TABLE t1 (i int PRIMARY KEY) ENGINE=InnoDB; +INSERT into t1 values (1); +CREATE TABLE t2 ( +i int not null primary key, +vi int not null, +m int, +UNIQUE KEY (vi), +CONSTRAINT `cc` FOREIGN KEY (vi) REFERENCES t1 (i) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; +INSERT into t2 VALUES (1, 1, 100); +INSERT INTO t2 (i,m) VALUES (1, 2) ON DUPLICATE KEY UPDATE m=3; +Warnings: +Warning 1364 Field 'vi' doesn't have a default value +SELECT * FROM t2; +i vi m +1 1 3 +DROP TABLE t2,t1; +CREATE TABLE t1 (i int PRIMARY KEY) ENGINE=InnoDB; +INSERT into t1 values (1); +CREATE TABLE t2 ( +i int not null primary key, +vi int not null, +m int, +KEY (vi), +CONSTRAINT `cc` FOREIGN KEY (vi) REFERENCES t1 (i) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; +INSERT into t2 VALUES (1, 1, 100); +INSERT INTO t2 (i,m) VALUES (1, 2) ON DUPLICATE KEY UPDATE m=3; +Warnings: +Warning 1364 Field 'vi' doesn't have a default value +SELECT * FROM t2; +i vi m +1 1 3 +DROP TABLE t2, t1; diff --git a/mysql-test/suite/innodb/t/innodb-on-duplicate-update.test b/mysql-test/suite/innodb/t/innodb-on-duplicate-update.test new file mode 100644 index 00000000000..cc80198d24a --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb-on-duplicate-update.test @@ -0,0 +1,63 @@ +--source include/have_innodb.inc + +# +# MDEV-13206: INSERT ON DUPLICATE KEY UPDATE foreign key fail +# +set sql_mode=''; +set innodb_strict_mode=0; + +CREATE TABLE `v` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; + +INSERT v values (1); + +CREATE TABLE `vp` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `v_id` int(10) unsigned NOT NULL, + `p_id` int(10) unsigned NOT NULL, + `ppp` varchar(255) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `IDX_vp_uniq` (`v_id`,`p_id`), + KEY `FK_vp_v` (`v_id`), + CONSTRAINT `FK_vp_v` FOREIGN KEY (`v_id`) REFERENCES `v` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; + +INSERT vp VALUES (12, 1, 100, 'text12'); +INSERT INTO `vp` (`id`,`ppp`) VALUES (12, 'test12-2') ON DUPLICATE KEY UPDATE `ppp` = VALUES(`ppp`); +SELECT * FROM vp; +DROP TABLE vp, v; + +CREATE TABLE t1 (i int PRIMARY KEY) ENGINE=InnoDB; +INSERT into t1 values (1); + +CREATE TABLE t2 ( + i int not null primary key, + vi int not null, + m int, + UNIQUE KEY (vi), + CONSTRAINT `cc` FOREIGN KEY (vi) REFERENCES t1 (i) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +INSERT into t2 VALUES (1, 1, 100); +INSERT INTO t2 (i,m) VALUES (1, 2) ON DUPLICATE KEY UPDATE m=3; +SELECT * FROM t2; + +DROP TABLE t2,t1; + +CREATE TABLE t1 (i int PRIMARY KEY) ENGINE=InnoDB; +INSERT into t1 values (1); + +CREATE TABLE t2 ( + i int not null primary key, + vi int not null, + m int, + KEY (vi), + CONSTRAINT `cc` FOREIGN KEY (vi) REFERENCES t1 (i) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +INSERT into t2 VALUES (1, 1, 100); +INSERT INTO t2 (i,m) VALUES (1, 2) ON DUPLICATE KEY UPDATE m=3; +SELECT * FROM t2; +DROP TABLE t2, t1; -- cgit v1.2.1 From a0c7d3ff940600aa2d7cff067396ef6985f0bdc4 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Thu, 16 Nov 2017 14:33:28 +0400 Subject: MDEV-14415 Add Oracle-style FOR loop to sql_mode=DEFAULT --- mysql-test/r/sp-code.result | 303 ++++++++++++++++++++++++++++++++++++++++ mysql-test/r/sp-cursor.result | 131 +++++++++++++++++ mysql-test/r/sp-for-loop.result | 208 +++++++++++++++++++++++++++ mysql-test/t/sp-code.test | 169 ++++++++++++++++++++++ mysql-test/t/sp-cursor.test | 133 ++++++++++++++++++ mysql-test/t/sp-for-loop.test | 212 ++++++++++++++++++++++++++++ 6 files changed, 1156 insertions(+) create mode 100644 mysql-test/r/sp-for-loop.result create mode 100644 mysql-test/t/sp-for-loop.test (limited to 'mysql-test') diff --git a/mysql-test/r/sp-code.result b/mysql-test/r/sp-code.result index ddb2901b8a4..3a4dc9db6f8 100644 --- a/mysql-test/r/sp-code.result +++ b/mysql-test/r/sp-code.result @@ -998,3 +998,306 @@ Pos Instruction 7 set b.a@1["a"] a.a@0["a"] DROP PROCEDURE p1; DROP TABLE t1; +# +# MDEV-14415 Add Oracle-style FOR loop to sql_mode=DEFAULT +# +# Integer range FOR loop +CREATE PROCEDURE p1() +BEGIN +FOR i IN 1..3 +DO +SELECT i; +END FOR; +END; +$$ +CALL p1; +i +1 +i +2 +i +3 +SHOW PROCEDURE CODE p1; +Pos Instruction +0 set i@0 1 +1 set [upper_bound]@1 3 +2 jump_if_not 6(6) i@0 <= [upper_bound]@1 +3 stmt 0 "SELECT i" +4 set i@0 i@0 + 1 +5 jump 2 +DROP PROCEDURE p1; +# Nested integer range FOR loops +CREATE PROCEDURE p1() +BEGIN +fori: +FOR i IN 1..3 +DO +forj: +FOR j IN 1..3 +DO +IF i = 3 THEN +LEAVE fori; +END IF; +IF j = 3 THEN +LEAVE forj; +END IF; +SELECT i,j; +END FOR; +END FOR; +END; +$$ +CALL p1; +i j +1 1 +i j +1 2 +i j +2 1 +i j +2 2 +SHOW PROCEDURE CODE p1; +Pos Instruction +0 set i@0 1 +1 set [upper_bound]@1 3 +2 jump_if_not 17(17) i@0 <= [upper_bound]@1 +3 set j@2 1 +4 set [upper_bound]@3 3 +5 jump_if_not 13(13) j@2 <= [upper_bound]@3 +6 jump_if_not 8(8) i@0 = 3 +7 jump 17 +8 jump_if_not 10(10) j@2 = 3 +9 jump 13 +10 stmt 0 "SELECT i,j" +11 set j@2 j@2 + 1 +12 jump 5 +13 set i@0 i@0 + 1 +14 jump 2 +DROP PROCEDURE p1; +# Explicit cursor FOR loops +CREATE PROCEDURE p1() +BEGIN +DECLARE cur0 CURSOR FOR SELECT 10 AS a, 'b0' AS b; +DECLARE cur1 CURSOR FOR SELECT 10 AS a, 'b0' AS b; +DECLARE cur2 CURSOR FOR SELECT 10 AS a, 'b0' AS b; +FOR rec1 IN cur1 +DO +SELECT rec1.a, rec1.b; +SET rec1.a= 11; +SET rec1.b= 'b1'; +SELECT rec1.a, rec1.b; +END FOR; +FOR rec0 IN cur0 +DO +SET rec0.a= 10; +SET rec0.b='b0'; +END FOR; +FOR rec2 IN cur2 +DO +SET rec2.a= 10; +SET rec2.b='b0'; +END FOR; +END; +$$ +SHOW PROCEDURE CODE p1; +Pos Instruction +0 cpush cur0@0 +1 cpush cur1@1 +2 cpush cur2@2 +3 cursor_copy_struct cur1 rec1@0 +4 copen cur1@1 +5 cfetch cur1@1 rec1@0 +6 jump_if_not 13(13) `cur1`%FOUND +7 stmt 0 "SELECT rec1.a, rec1.b" +8 set rec1.a@0["a"] 11 +9 set rec1.b@0["b"] 'b1' +10 stmt 0 "SELECT rec1.a, rec1.b" +11 cfetch cur1@1 rec1@0 +12 jump 6 +13 cursor_copy_struct cur0 rec0@1 +14 copen cur0@0 +15 cfetch cur0@0 rec0@1 +16 jump_if_not 21(21) `cur0`%FOUND +17 set rec0.a@1["a"] 10 +18 set rec0.b@1["b"] 'b0' +19 cfetch cur0@0 rec0@1 +20 jump 16 +21 cursor_copy_struct cur2 rec2@2 +22 copen cur2@2 +23 cfetch cur2@2 rec2@2 +24 jump_if_not 29(29) `cur2`%FOUND +25 set rec2.a@2["a"] 10 +26 set rec2.b@2["b"] 'b0' +27 cfetch cur2@2 rec2@2 +28 jump 24 +29 cpop 3 +DROP PROCEDURE p1; +# Nested explicit cursor FOR loops +CREATE PROCEDURE p1() +BEGIN +DECLARE cur0 CURSOR FOR SELECT 10 AS a, 'b0' AS b; +FOR rec0 IN cur0 +DO +BEGIN +DECLARE cur1 CURSOR FOR SELECT 11 AS a, 'b1' AS b; +SET rec0.a= 11; +SET rec0.b= 'b0'; +FOR rec1 IN cur1 +DO +SET rec1.a= 11; +SET rec1.b= 'b1'; +BEGIN +DECLARE cur2 CURSOR FOR SELECT 12 AS a, 'b2' AS b; +FOR rec2 IN cur2 +DO +SET rec2.a=12; +SET rec2.b='b2'; +END FOR; +END; +END FOR; +END; +END FOR; +END; +$$ +SHOW PROCEDURE CODE p1; +Pos Instruction +0 cpush cur0@0 +1 cursor_copy_struct cur0 rec0@0 +2 copen cur0@0 +3 cfetch cur0@0 rec0@0 +4 jump_if_not 29(29) `cur0`%FOUND +5 cpush cur1@1 +6 set rec0.a@0["a"] 11 +7 set rec0.b@0["b"] 'b0' +8 cursor_copy_struct cur1 rec1@1 +9 copen cur1@1 +10 cfetch cur1@1 rec1@1 +11 jump_if_not 26(26) `cur1`%FOUND +12 set rec1.a@1["a"] 11 +13 set rec1.b@1["b"] 'b1' +14 cpush cur2@2 +15 cursor_copy_struct cur2 rec2@2 +16 copen cur2@2 +17 cfetch cur2@2 rec2@2 +18 jump_if_not 23(23) `cur2`%FOUND +19 set rec2.a@2["a"] 12 +20 set rec2.b@2["b"] 'b2' +21 cfetch cur2@2 rec2@2 +22 jump 18 +23 cpop 1 +24 cfetch cur1@1 rec1@1 +25 jump 11 +26 cpop 1 +27 cfetch cur0@0 rec0@0 +28 jump 4 +29 cpop 1 +DROP PROCEDURE p1; +# Implicit cursor FOR loops +CREATE PROCEDURE p1() +BEGIN +FOR rec1 IN (SELECT 11 AS a, 'b1' AS b) +DO +SELECT rec1.a, rec1.b; +SET rec1.a= 11; +SET rec1.b= 'b1'; +SELECT rec1.a, rec1.b; +END FOR; +FOR rec0 IN (SELECT 10 AS a, 'b0' AS b) +DO +SET rec0.a= 10; +SET rec0.b='b0'; +END FOR; +FOR rec2 IN (SELECT 12 AS a, 'b2' AS b) +DO +SET rec2.a= 10; +SET rec2.b='b0'; +END FOR; +END; +$$ +SHOW PROCEDURE CODE p1; +Pos Instruction +0 cpush [implicit_cursor]@0 +1 cursor_copy_struct [implicit_cursor] rec1@0 +2 copen [implicit_cursor]@0 +3 cfetch [implicit_cursor]@0 rec1@0 +4 jump_if_not 11(11) `[implicit_cursor]`%FOUND +5 stmt 0 "SELECT rec1.a, rec1.b" +6 set rec1.a@0["a"] 11 +7 set rec1.b@0["b"] 'b1' +8 stmt 0 "SELECT rec1.a, rec1.b" +9 cfetch [implicit_cursor]@0 rec1@0 +10 jump 4 +11 cpop 1 +12 cpush [implicit_cursor]@0 +13 cursor_copy_struct [implicit_cursor] rec0@1 +14 copen [implicit_cursor]@0 +15 cfetch [implicit_cursor]@0 rec0@1 +16 jump_if_not 21(21) `[implicit_cursor]`%FOUND +17 set rec0.a@1["a"] 10 +18 set rec0.b@1["b"] 'b0' +19 cfetch [implicit_cursor]@0 rec0@1 +20 jump 16 +21 cpop 1 +22 cpush [implicit_cursor]@0 +23 cursor_copy_struct [implicit_cursor] rec2@2 +24 copen [implicit_cursor]@0 +25 cfetch [implicit_cursor]@0 rec2@2 +26 jump_if_not 31(31) `[implicit_cursor]`%FOUND +27 set rec2.a@2["a"] 10 +28 set rec2.b@2["b"] 'b0' +29 cfetch [implicit_cursor]@0 rec2@2 +30 jump 26 +31 cpop 1 +DROP PROCEDURE p1; +# Nested implicit cursor FOR loops +CREATE PROCEDURE p1() +BEGIN +FOR rec0 IN (SELECT 10 AS a, 'b0' AS b) +DO +SET rec0.a= 11; +SET rec0.b= 'b0'; +FOR rec1 IN (SELECT 11 AS a, 'b1' AS b) +DO +SET rec1.a= 11; +SET rec1.b= 'b1'; +FOR rec2 IN (SELECT 12 AS a, 'b2' AS b) +DO +SET rec2.a=12; +SET rec2.b='b2'; +END FOR; +END FOR; +END FOR; +END; +$$ +SHOW PROCEDURE CODE p1; +Pos Instruction +0 cpush [implicit_cursor]@0 +1 cursor_copy_struct [implicit_cursor] rec0@0 +2 copen [implicit_cursor]@0 +3 cfetch [implicit_cursor]@0 rec0@0 +4 jump_if_not 29(29) `[implicit_cursor]`%FOUND +5 set rec0.a@0["a"] 11 +6 set rec0.b@0["b"] 'b0' +7 cpush [implicit_cursor]@1 +8 cursor_copy_struct [implicit_cursor] rec1@1 +9 copen [implicit_cursor]@1 +10 cfetch [implicit_cursor]@1 rec1@1 +11 jump_if_not 26(26) `[implicit_cursor]`%FOUND +12 set rec1.a@1["a"] 11 +13 set rec1.b@1["b"] 'b1' +14 cpush [implicit_cursor]@2 +15 cursor_copy_struct [implicit_cursor] rec2@2 +16 copen [implicit_cursor]@2 +17 cfetch [implicit_cursor]@2 rec2@2 +18 jump_if_not 23(23) `[implicit_cursor]`%FOUND +19 set rec2.a@2["a"] 12 +20 set rec2.b@2["b"] 'b2' +21 cfetch [implicit_cursor]@2 rec2@2 +22 jump 18 +23 cpop 1 +24 cfetch [implicit_cursor]@1 rec1@1 +25 jump 11 +26 cpop 1 +27 cfetch [implicit_cursor]@0 rec0@0 +28 jump 4 +29 cpop 1 +DROP PROCEDURE p1; diff --git a/mysql-test/r/sp-cursor.result b/mysql-test/r/sp-cursor.result index d068c19b22b..1f8cb7f0635 100644 --- a/mysql-test/r/sp-cursor.result +++ b/mysql-test/r/sp-cursor.result @@ -480,3 +480,134 @@ DROP PROCEDURE p1; # # End of MDEV-12457 Cursors with parameters # +# +# MDEV-14415 Add Oracle-style FOR loop to sql_mode=DEFAULT +# +# Explicit cursor +CREATE TABLE t1 (a INT, b VARCHAR(10)); +INSERT INTO t1 VALUES (1,'b1'), (2,'b2'), (3,'b3'); +BEGIN NOT ATOMIC +DECLARE cur CURSOR FOR SELECT * FROM t1; +FOR rec IN cur +DO +SELECT rec.a AS a, rec.b AS b; +END FOR; +END; +$$ +a b +1 b1 +a b +2 b2 +a b +3 b3 +DROP TABLE t1; +# Explicit cursor with parameters +CREATE TABLE t1 (a INT, b VARCHAR(10)); +INSERT INTO t1 VALUES (1,'b1'), (2,'b2'), (3,'b3'); +BEGIN NOT ATOMIC +DECLARE cur CURSOR(pa INT) FOR SELECT * FROM t1 WHERE a>=pa; +FOR rec IN cur(2) +DO +SELECT rec.a AS a, rec.b AS b; +END FOR; +END; +$$ +a b +2 b2 +a b +3 b3 +DROP TABLE t1; +# Explicit cursor + label +CREATE TABLE t1 (a INT, b VARCHAR(10)); +INSERT INTO t1 VALUES ('1','b1'), ('2','b2'); +BEGIN NOT ATOMIC +DECLARE cur CURSOR FOR SELECT * FROM t1; +forrec: +FOR rec IN cur +DO +SELECT rec.a AS a, rec.b AS b; +IF rec.a = 2 THEN +LEAVE forrec; +END IF; +END FOR forrec; +END; +$$ +a b +1 b1 +a b +2 b2 +DROP TABLE t1; +# Explicit cursor + FETCH inside the loop body produce an error on "NOT FOUND" +BEGIN NOT ATOMIC +DECLARE x INT; +DECLARE cur CURSOR FOR SELECT 1 AS x; +FOR rec IN cur +DO +FETCH cur INTO x; +END FOR; +END; +$$ +ERROR 02000: No data - zero rows fetched, selected, or processed +# Explicit cursor + FETCH inside the loop body are normally handled by "HANDLER FOR NOT FOUND" +BEGIN NOT ATOMIC +DECLARE done INT DEFAULT 0; +DECLARE cur CURSOR FOR SELECT 1 AS x, 'y1' AS y UNION +SELECT 2,'y2' UNION +SELECT 3,'y3'; +DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; +forrec: +FOR rec IN cur +DO +SELECT CONCAT(rec.x, ' ', rec.y) AS 'Implicit FETCH'; +FETCH cur INTO rec; +IF done THEN +SELECT 'NO DATA' AS `Explicit FETCH`; +LEAVE forrec; +ELSE +SELECT CONCAT(rec.x, ' ', rec.y) AS 'Explicit FETCH'; +END IF; +END FOR; +END; +$$ +Implicit FETCH +1 y1 +Explicit FETCH +2 y2 +Implicit FETCH +3 y3 +Explicit FETCH +NO DATA +# Implicit cursor +CREATE TABLE t1 (a INT, b VARCHAR(10)); +INSERT INTO t1 VALUES ('1','b1'), ('2','b2'); +BEGIN NOT ATOMIC +FOR rec IN (SELECT * FROM t1) +DO +SELECT rec.a AS a, rec.b AS b; +END FOR; +END; +$$ +a b +1 b1 +a b +2 b2 +DROP TABLE t1; +# Implicit cursor + label +CREATE TABLE t1 (a INT, b VARCHAR(10)); +INSERT INTO t1 VALUES ('1','b1'), ('2','b2'); +BEGIN NOT ATOMIC +forrec: +FOR rec IN (SELECT * FROM t1) +DO +SELECT rec.a AS a, rec.b AS b; +IF rec.a = 2 THEN +LEAVE forrec; +END IF; +END FOR; +END; +$$ +a b +1 b1 +a b +2 b2 +DROP TABLE t1; diff --git a/mysql-test/r/sp-for-loop.result b/mysql-test/r/sp-for-loop.result new file mode 100644 index 00000000000..0da09586df5 --- /dev/null +++ b/mysql-test/r/sp-for-loop.result @@ -0,0 +1,208 @@ +# +# MDEV-14415 Add Oracle-style FOR loop to sql_mode=DEFAULT +# +CREATE TABLE t1 (a INT); +FOR i IN 1..3 +DO +INSERT INTO t1 VALUES (i); +END FOR; +/ +SELECT * FROM t1; +a +1 +2 +3 +DROP TABLE t1; +CREATE FUNCTION f1 (lower_bound INT, upper_bound INT, lim INT) RETURNS INT +BEGIN +DECLARE total INT DEFAULT 0; +FOR i IN lower_bound . . upper_bound +DO +NULL +END FOR; +RETURN total; +END; +/ +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 '. upper_bound +DO +NULL +END FOR; +RETURN total; +END' at line 4 +CREATE FUNCTION f1 (lower_bound INT, upper_bound INT, lim INT) RETURNS INT +BEGIN +DECLARE total INT DEFAULT 0; +lab: +FOR i IN lower_bound .. upper_bound +DO +SET total= total + i; +IF i = lim THEN +LEAVE lab; +END IF; +-- Bounds are calculated only once. +-- The below assignments have no effect on the loop condition +SET lower_bound= 900; +SET upper_bound= 1000; +END FOR; +RETURN total; +END; +/ +SELECT f1(1, 3, 100) FROM DUAL; +f1(1, 3, 100) +6 +SELECT f1(1, 3, 2) FROM DUAL; +f1(1, 3, 2) +3 +DROP FUNCTION f1; +CREATE FUNCTION f1() RETURNS INT +BEGIN +DECLARE total INT DEFAULT 0; +FOR i IN 1 .. 5 +DO +SET total= total + 1000; +forj: +FOR j IN 1 .. 5 +DO +SET total= total + 1; +IF j = 3 THEN +LEAVE forj; -- End the internal loop +END IF; +END FOR; +END FOR; +RETURN total; +END; +/ +SELECT f1() FROM DUAL; +f1() +5015 +DROP FUNCTION f1; +CREATE FUNCTION f1 (a INT, b INT) RETURNS INT +BEGIN +DECLARE total INT DEFAULT 0; +fori: +FOR i IN REVERSE a..1 +DO +SET total= total + i; +IF i = b THEN +LEAVE fori; +END IF; +END FOR; +RETURN total; +END +/ +SELECT f1(3, 100) FROM DUAL; +f1(3, 100) +6 +SELECT f1(3, 2) FROM DUAL; +f1(3, 2) +5 +DROP FUNCTION f1; +# Testing labeled FOR LOOP statement +CREATE FUNCTION f1 (a INT, limita INT, b INT, limitb INT) RETURNS INT +BEGIN +DECLARE total INT DEFAULT 0; +la: +FOR ia IN 1 .. a +DO +SET total= total + 1000; +lb: +FOR ib IN 1 .. b +DO +SET total= total + 1; +IF ib = limitb THEN +LEAVE lb; +END IF; +IF ia = limita THEN +LEAVE la; +END IF; +END FOR lb; +END FOR la; +RETURN total; +END; +/ +SELECT f1(1, 1, 1, 1) FROM DUAL; +f1(1, 1, 1, 1) +1001 +SELECT f1(1, 2, 1, 2) FROM DUAL; +f1(1, 2, 1, 2) +1001 +SELECT f1(2, 1, 2, 1) FROM DUAL; +f1(2, 1, 2, 1) +2002 +SELECT f1(2, 1, 2, 2) FROM DUAL; +f1(2, 1, 2, 2) +1001 +SELECT f1(2, 2, 2, 2) FROM DUAL; +f1(2, 2, 2, 2) +2003 +SELECT f1(2, 3, 2, 3) FROM DUAL; +f1(2, 3, 2, 3) +2004 +DROP FUNCTION f1; +# Testing labeled ITERATE in a labeled FOR LOOP statement +CREATE FUNCTION f1 (a INT, b INT, blim INT) RETURNS INT +BEGIN +DECLARE total INT DEFAULT 0; +la: +FOR ia IN 1 .. a +DO +SET total= total + 1000; +BEGIN +DECLARE ib INT DEFAULT 1; +WHILE ib <= b +DO +IF ib > blim THEN +ITERATE la; +END IF; +SET ib= ib + 1; +SET total= total + 1; +END WHILE; +END; +END FOR la; +RETURN total; +END; +/ +SELECT f1(3,3,0), f1(3,3,1), f1(3,3,2), f1(3,3,3), f1(3,3,4) FROM DUAL; +f1(3,3,0) f1(3,3,1) f1(3,3,2) f1(3,3,3) f1(3,3,4) +3000 3003 3006 3009 3009 +DROP FUNCTION f1; +# Testing INTERATE statement +CREATE FUNCTION f1(a INT) RETURNS INT +BEGIN +DECLARE total INT DEFAULT 0; +fori: +FOR i IN 1 .. a +DO +IF i=5 THEN +ITERATE fori; +END IF; +SET total= total + 1; +END FOR; +RETURN total; +END; +/ +SELECT f1(3), f1(4), f1(5), f1(6) FROM DUAL; +f1(3) f1(4) f1(5) f1(6) +3 4 4 5 +DROP FUNCTION f1; +CREATE FUNCTION f1(a INT) RETURNS INT +BEGIN +DECLARE total INT DEFAULT 0; +lj: +FOR j IN 1 .. 2 +DO +FOR i IN 1 .. a +DO +IF i=5 THEN +ITERATE lj; +END IF; +SET total= total + 1; +END FOR; +END FOR; +RETURN total; +END; +/ +SELECT f1(3), f1(4), f1(5) FROM DUAL; +f1(3) f1(4) f1(5) +6 8 8 +DROP FUNCTION f1; diff --git a/mysql-test/t/sp-code.test b/mysql-test/t/sp-code.test index 29b6764ebc6..1f2f5191f0a 100644 --- a/mysql-test/t/sp-code.test +++ b/mysql-test/t/sp-code.test @@ -758,3 +758,172 @@ DELIMITER ;$$ SHOW PROCEDURE CODE p1; DROP PROCEDURE p1; DROP TABLE t1; + +--echo # +--echo # MDEV-14415 Add Oracle-style FOR loop to sql_mode=DEFAULT +--echo # + +--echo # Integer range FOR loop + +DELIMITER $$; +CREATE PROCEDURE p1() +BEGIN + FOR i IN 1..3 + DO + SELECT i; + END FOR; +END; +$$ +DELIMITER ;$$ +CALL p1; +SHOW PROCEDURE CODE p1; +DROP PROCEDURE p1; + + +--echo # Nested integer range FOR loops + +DELIMITER $$; +CREATE PROCEDURE p1() +BEGIN + fori: + FOR i IN 1..3 + DO + forj: + FOR j IN 1..3 + DO + IF i = 3 THEN + LEAVE fori; + END IF; + IF j = 3 THEN + LEAVE forj; + END IF; + SELECT i,j; + END FOR; + END FOR; +END; +$$ +DELIMITER ;$$ +CALL p1; +SHOW PROCEDURE CODE p1; +DROP PROCEDURE p1; + + +--echo # Explicit cursor FOR loops + +DELIMITER $$; +CREATE PROCEDURE p1() +BEGIN + DECLARE cur0 CURSOR FOR SELECT 10 AS a, 'b0' AS b; + DECLARE cur1 CURSOR FOR SELECT 10 AS a, 'b0' AS b; + DECLARE cur2 CURSOR FOR SELECT 10 AS a, 'b0' AS b; + FOR rec1 IN cur1 + DO + SELECT rec1.a, rec1.b; + SET rec1.a= 11; + SET rec1.b= 'b1'; + SELECT rec1.a, rec1.b; + END FOR; + FOR rec0 IN cur0 + DO + SET rec0.a= 10; + SET rec0.b='b0'; + END FOR; + FOR rec2 IN cur2 + DO + SET rec2.a= 10; + SET rec2.b='b0'; + END FOR; +END; +$$ +DELIMITER ;$$ +SHOW PROCEDURE CODE p1; +DROP PROCEDURE p1; + + +--echo # Nested explicit cursor FOR loops + +DELIMITER $$; +CREATE PROCEDURE p1() +BEGIN + DECLARE cur0 CURSOR FOR SELECT 10 AS a, 'b0' AS b; + FOR rec0 IN cur0 + DO + BEGIN + DECLARE cur1 CURSOR FOR SELECT 11 AS a, 'b1' AS b; + SET rec0.a= 11; + SET rec0.b= 'b0'; + FOR rec1 IN cur1 + DO + SET rec1.a= 11; + SET rec1.b= 'b1'; + BEGIN + DECLARE cur2 CURSOR FOR SELECT 12 AS a, 'b2' AS b; + FOR rec2 IN cur2 + DO + SET rec2.a=12; + SET rec2.b='b2'; + END FOR; + END; + END FOR; + END; + END FOR; +END; +$$ +DELIMITER ;$$ +SHOW PROCEDURE CODE p1; +DROP PROCEDURE p1; + + +--echo # Implicit cursor FOR loops + +DELIMITER $$; +CREATE PROCEDURE p1() +BEGIN + FOR rec1 IN (SELECT 11 AS a, 'b1' AS b) + DO + SELECT rec1.a, rec1.b; + SET rec1.a= 11; + SET rec1.b= 'b1'; + SELECT rec1.a, rec1.b; + END FOR; + FOR rec0 IN (SELECT 10 AS a, 'b0' AS b) + DO + SET rec0.a= 10; + SET rec0.b='b0'; + END FOR; + FOR rec2 IN (SELECT 12 AS a, 'b2' AS b) + DO + SET rec2.a= 10; + SET rec2.b='b0'; + END FOR; +END; +$$ +DELIMITER ;$$ +SHOW PROCEDURE CODE p1; +DROP PROCEDURE p1; + +--echo # Nested implicit cursor FOR loops + +DELIMITER $$; +CREATE PROCEDURE p1() +BEGIN + FOR rec0 IN (SELECT 10 AS a, 'b0' AS b) + DO + SET rec0.a= 11; + SET rec0.b= 'b0'; + FOR rec1 IN (SELECT 11 AS a, 'b1' AS b) + DO + SET rec1.a= 11; + SET rec1.b= 'b1'; + FOR rec2 IN (SELECT 12 AS a, 'b2' AS b) + DO + SET rec2.a=12; + SET rec2.b='b2'; + END FOR; + END FOR; + END FOR; +END; +$$ +DELIMITER ;$$ +SHOW PROCEDURE CODE p1; +DROP PROCEDURE p1; diff --git a/mysql-test/t/sp-cursor.test b/mysql-test/t/sp-cursor.test index 394dc56556a..2e7a72cf8d0 100644 --- a/mysql-test/t/sp-cursor.test +++ b/mysql-test/t/sp-cursor.test @@ -474,3 +474,136 @@ DROP PROCEDURE p1; --echo # --echo # End of MDEV-12457 Cursors with parameters --echo # + + +--echo # +--echo # MDEV-14415 Add Oracle-style FOR loop to sql_mode=DEFAULT +--echo # + +--echo # Explicit cursor + +CREATE TABLE t1 (a INT, b VARCHAR(10)); +INSERT INTO t1 VALUES (1,'b1'), (2,'b2'), (3,'b3'); +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE cur CURSOR FOR SELECT * FROM t1; + FOR rec IN cur + DO + SELECT rec.a AS a, rec.b AS b; + END FOR; +END; +$$ +DELIMITER ;$$ +DROP TABLE t1; + +--echo # Explicit cursor with parameters + +CREATE TABLE t1 (a INT, b VARCHAR(10)); +INSERT INTO t1 VALUES (1,'b1'), (2,'b2'), (3,'b3'); +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE cur CURSOR(pa INT) FOR SELECT * FROM t1 WHERE a>=pa; + FOR rec IN cur(2) + DO + SELECT rec.a AS a, rec.b AS b; + END FOR; +END; +$$ +DELIMITER ;$$ +DROP TABLE t1; + +--echo # Explicit cursor + label + +CREATE TABLE t1 (a INT, b VARCHAR(10)); +INSERT INTO t1 VALUES ('1','b1'), ('2','b2'); +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE cur CURSOR FOR SELECT * FROM t1; + forrec: + FOR rec IN cur + DO + SELECT rec.a AS a, rec.b AS b; + IF rec.a = 2 THEN + LEAVE forrec; + END IF; + END FOR forrec; +END; +$$ +DELIMITER ;$$ +DROP TABLE t1; + +--echo # Explicit cursor + FETCH inside the loop body produce an error on "NOT FOUND" + +DELIMITER $$; +--error ER_SP_FETCH_NO_DATA +BEGIN NOT ATOMIC + DECLARE x INT; + DECLARE cur CURSOR FOR SELECT 1 AS x; + FOR rec IN cur + DO + FETCH cur INTO x; + END FOR; +END; +$$ +DELIMITER ;$$ + + +--echo # Explicit cursor + FETCH inside the loop body are normally handled by "HANDLER FOR NOT FOUND" + +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE done INT DEFAULT 0; + DECLARE cur CURSOR FOR SELECT 1 AS x, 'y1' AS y UNION + SELECT 2,'y2' UNION + SELECT 3,'y3'; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + forrec: + FOR rec IN cur + DO + SELECT CONCAT(rec.x, ' ', rec.y) AS 'Implicit FETCH'; + FETCH cur INTO rec; + IF done THEN + SELECT 'NO DATA' AS `Explicit FETCH`; + LEAVE forrec; + ELSE + SELECT CONCAT(rec.x, ' ', rec.y) AS 'Explicit FETCH'; + END IF; + END FOR; +END; +$$ +DELIMITER ;$$ + + +--echo # Implicit cursor + +CREATE TABLE t1 (a INT, b VARCHAR(10)); +INSERT INTO t1 VALUES ('1','b1'), ('2','b2'); +DELIMITER $$; +BEGIN NOT ATOMIC + FOR rec IN (SELECT * FROM t1) + DO + SELECT rec.a AS a, rec.b AS b; + END FOR; +END; +$$ +DELIMITER ;$$ +DROP TABLE t1; + +--echo # Implicit cursor + label + +CREATE TABLE t1 (a INT, b VARCHAR(10)); +INSERT INTO t1 VALUES ('1','b1'), ('2','b2'); +DELIMITER $$; +BEGIN NOT ATOMIC + forrec: + FOR rec IN (SELECT * FROM t1) + DO + SELECT rec.a AS a, rec.b AS b; + IF rec.a = 2 THEN + LEAVE forrec; + END IF; + END FOR; +END; +$$ +DELIMITER ;$$ +DROP TABLE t1; diff --git a/mysql-test/t/sp-for-loop.test b/mysql-test/t/sp-for-loop.test new file mode 100644 index 00000000000..6350e9fb9d3 --- /dev/null +++ b/mysql-test/t/sp-for-loop.test @@ -0,0 +1,212 @@ +--echo # +--echo # MDEV-14415 Add Oracle-style FOR loop to sql_mode=DEFAULT +--echo # + + +CREATE TABLE t1 (a INT); +DELIMITER /; +FOR i IN 1..3 +DO + INSERT INTO t1 VALUES (i); +END FOR; +/ +DELIMITER ;/ +SELECT * FROM t1; +DROP TABLE t1; + + +# Dots must have no delimiters in between + +DELIMITER /; +--error ER_PARSE_ERROR +CREATE FUNCTION f1 (lower_bound INT, upper_bound INT, lim INT) RETURNS INT +BEGIN + DECLARE total INT DEFAULT 0; + FOR i IN lower_bound . . upper_bound + DO + NULL + END FOR; + RETURN total; +END; +/ +DELIMITER ;/ + + +DELIMITER /; +CREATE FUNCTION f1 (lower_bound INT, upper_bound INT, lim INT) RETURNS INT +BEGIN + DECLARE total INT DEFAULT 0; + lab: + FOR i IN lower_bound .. upper_bound + DO + SET total= total + i; + IF i = lim THEN + LEAVE lab; + END IF; + -- Bounds are calculated only once. + -- The below assignments have no effect on the loop condition + SET lower_bound= 900; + SET upper_bound= 1000; + END FOR; + RETURN total; +END; +/ +DELIMITER ;/ +SELECT f1(1, 3, 100) FROM DUAL; +SELECT f1(1, 3, 2) FROM DUAL; +DROP FUNCTION f1; + + +DELIMITER /; +CREATE FUNCTION f1() RETURNS INT +BEGIN + DECLARE total INT DEFAULT 0; + FOR i IN 1 .. 5 + DO + SET total= total + 1000; + forj: + FOR j IN 1 .. 5 + DO + SET total= total + 1; + IF j = 3 THEN + LEAVE forj; -- End the internal loop + END IF; + END FOR; + END FOR; + RETURN total; +END; +/ +DELIMITER ;/ +SELECT f1() FROM DUAL; +DROP FUNCTION f1; + + +DELIMITER /; +CREATE FUNCTION f1 (a INT, b INT) RETURNS INT +BEGIN + DECLARE total INT DEFAULT 0; + fori: + FOR i IN REVERSE a..1 + DO + SET total= total + i; + IF i = b THEN + LEAVE fori; + END IF; + END FOR; + RETURN total; +END +/ +DELIMITER ;/ +SELECT f1(3, 100) FROM DUAL; +SELECT f1(3, 2) FROM DUAL; +DROP FUNCTION f1; + + +--echo # Testing labeled FOR LOOP statement + +DELIMITER /; +CREATE FUNCTION f1 (a INT, limita INT, b INT, limitb INT) RETURNS INT +BEGIN + DECLARE total INT DEFAULT 0; + la: + FOR ia IN 1 .. a + DO + SET total= total + 1000; + lb: + FOR ib IN 1 .. b + DO + SET total= total + 1; + IF ib = limitb THEN + LEAVE lb; + END IF; + IF ia = limita THEN + LEAVE la; + END IF; + END FOR lb; + END FOR la; + RETURN total; +END; +/ +DELIMITER ;/ +SELECT f1(1, 1, 1, 1) FROM DUAL; +SELECT f1(1, 2, 1, 2) FROM DUAL; +SELECT f1(2, 1, 2, 1) FROM DUAL; +SELECT f1(2, 1, 2, 2) FROM DUAL; +SELECT f1(2, 2, 2, 2) FROM DUAL; +SELECT f1(2, 3, 2, 3) FROM DUAL; +DROP FUNCTION f1; + + +--echo # Testing labeled ITERATE in a labeled FOR LOOP statement + +DELIMITER /; +CREATE FUNCTION f1 (a INT, b INT, blim INT) RETURNS INT +BEGIN + DECLARE total INT DEFAULT 0; + la: + FOR ia IN 1 .. a + DO + SET total= total + 1000; + BEGIN + DECLARE ib INT DEFAULT 1; + WHILE ib <= b + DO + IF ib > blim THEN + ITERATE la; + END IF; + SET ib= ib + 1; + SET total= total + 1; + END WHILE; + END; + END FOR la; + RETURN total; +END; +/ +DELIMITER ;/ +SELECT f1(3,3,0), f1(3,3,1), f1(3,3,2), f1(3,3,3), f1(3,3,4) FROM DUAL; +DROP FUNCTION f1; + + +--echo # Testing INTERATE statement + +DELIMITER /; +CREATE FUNCTION f1(a INT) RETURNS INT +BEGIN + DECLARE total INT DEFAULT 0; + fori: + FOR i IN 1 .. a + DO + IF i=5 THEN + ITERATE fori; + END IF; + SET total= total + 1; + END FOR; + RETURN total; +END; +/ +DELIMITER ;/ +SELECT f1(3), f1(4), f1(5), f1(6) FROM DUAL; +DROP FUNCTION f1; + + +DELIMITER /; +CREATE FUNCTION f1(a INT) RETURNS INT +BEGIN + DECLARE total INT DEFAULT 0; + lj: + FOR j IN 1 .. 2 + DO + FOR i IN 1 .. a + DO + IF i=5 THEN + ITERATE lj; + END IF; + SET total= total + 1; + END FOR; + END FOR; + RETURN total; +END; +/ +DELIMITER ;/ +SELECT f1(3), f1(4), f1(5) FROM DUAL; +DROP FUNCTION f1; -- cgit v1.2.1 From eeec64d75eb39155e0080f464c9f2103897dd809 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 16 Nov 2017 13:18:22 +0200 Subject: MDEV-9663: InnoDB assertion failure: *cursor->index->name == TEMP_INDEX_PREFIX Imported missing test case from MySQL 5.7 for commit 25781c154396dbbc21023786aa3be070057d6999 Author: Annamalai Gurusami Date: Mon Feb 24 14:00:03 2014 +0530 Bug #17604730 ASSERTION: *CURSOR->INDEX->NAME == TEMP_INDEX_PREFIX --- mysql-test/suite/innodb/r/innodb-replace-debug.result | 9 +++++++++ mysql-test/suite/innodb/t/innodb-replace-debug.test | 13 +++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 mysql-test/suite/innodb/r/innodb-replace-debug.result create mode 100644 mysql-test/suite/innodb/t/innodb-replace-debug.test (limited to 'mysql-test') diff --git a/mysql-test/suite/innodb/r/innodb-replace-debug.result b/mysql-test/suite/innodb/r/innodb-replace-debug.result new file mode 100644 index 00000000000..0de351efded --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-replace-debug.result @@ -0,0 +1,9 @@ +# +# Bug#17604730 ASSERTION: *CURSOR->INDEX->NAME == TEMP_INDEX_PREFIX +# +create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2), +key k2(f3)) engine=innodb; +insert into t1 values (14, 24, 34); +set debug = '+d,row_ins_sec_index_entry_timeout'; +replace into t1 values (14, 25, 34); +drop table t1; diff --git a/mysql-test/suite/innodb/t/innodb-replace-debug.test b/mysql-test/suite/innodb/t/innodb-replace-debug.test new file mode 100644 index 00000000000..250c90ba5b1 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb-replace-debug.test @@ -0,0 +1,13 @@ +--source include/have_innodb.inc +--source include/have_debug.inc + +--echo # +--echo # Bug#17604730 ASSERTION: *CURSOR->INDEX->NAME == TEMP_INDEX_PREFIX +--echo # + +create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2), + key k2(f3)) engine=innodb; +insert into t1 values (14, 24, 34); +set debug = '+d,row_ins_sec_index_entry_timeout'; +replace into t1 values (14, 25, 34); +drop table t1; -- cgit v1.2.1 From d7349e204b873cd882666c2598b1ec1bf1490563 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 16 Nov 2017 13:21:07 +0200 Subject: MDEV-9663: InnoDB assertion failure: *cursor->index->name == TEMP_INDEX_PREFIX MariaDB adjustments to test case innodb-replace-debug and add missing instrumentation to row0ins.cc. MariaDB 10.1 does not seem to be affected. --- mysql-test/suite/innodb/r/innodb-replace-debug.result | 6 +++++- mysql-test/suite/innodb/t/innodb-replace-debug.test | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/innodb/r/innodb-replace-debug.result b/mysql-test/suite/innodb/r/innodb-replace-debug.result index 0de351efded..84bc9dc9769 100644 --- a/mysql-test/suite/innodb/r/innodb-replace-debug.result +++ b/mysql-test/suite/innodb/r/innodb-replace-debug.result @@ -4,6 +4,10 @@ create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2), key k2(f3)) engine=innodb; insert into t1 values (14, 24, 34); -set debug = '+d,row_ins_sec_index_entry_timeout'; +set @@debug_dbug = '+d,row_ins_sec_index_entry_timeout'; replace into t1 values (14, 25, 34); +select * from t1; +f1 f2 f3 +14 25 34 drop table t1; +set @@debug_dbug = '-d,row_ins_sec_index_entry_timeout'; diff --git a/mysql-test/suite/innodb/t/innodb-replace-debug.test b/mysql-test/suite/innodb/t/innodb-replace-debug.test index 250c90ba5b1..5cec9e1febf 100644 --- a/mysql-test/suite/innodb/t/innodb-replace-debug.test +++ b/mysql-test/suite/innodb/t/innodb-replace-debug.test @@ -8,6 +8,8 @@ create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2), key k2(f3)) engine=innodb; insert into t1 values (14, 24, 34); -set debug = '+d,row_ins_sec_index_entry_timeout'; +set @@debug_dbug = '+d,row_ins_sec_index_entry_timeout'; replace into t1 values (14, 25, 34); +select * from t1; drop table t1; +set @@debug_dbug = '-d,row_ins_sec_index_entry_timeout'; -- cgit v1.2.1 From 842dce378aae168a339fc8d789e3e395903aeb26 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Thu, 16 Nov 2017 19:59:27 +0400 Subject: MDEV-14402 JSON_VALUE doesn't escape quote. Result unescaping added. --- mysql-test/r/func_json.result | 3 +++ mysql-test/t/func_json.test | 1 + 2 files changed, 4 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/func_json.result b/mysql-test/r/func_json.result index 041030f4aab..55e64ea38e3 100644 --- a/mysql-test/r/func_json.result +++ b/mysql-test/r/func_json.result @@ -28,6 +28,9 @@ NULL select json_value('{"key1": [1,2,3], "key1":123}', '$.key1'); json_value('{"key1": [1,2,3], "key1":123}', '$.key1') 123 +select JSON_VALUE('{ "x": [0,1], "y": "[0,1]", "z": "Mon\\\"t\\\"y" }','$.z'); +JSON_VALUE('{ "x": [0,1], "y": "[0,1]", "z": "Mon\\\"t\\\"y" }','$.z') +Mon"t"y select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2'); json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2') NULL diff --git a/mysql-test/t/func_json.test b/mysql-test/t/func_json.test index 2052fad0c04..c6c7c8d3976 100644 --- a/mysql-test/t/func_json.test +++ b/mysql-test/t/func_json.test @@ -9,6 +9,7 @@ select json_value('{"key1":123}', '$.key2'); select json_value('{"key1":123}', '$.key1'); select json_value('{"key1":[1,2,3]}', '$.key1'); select json_value('{"key1": [1,2,3], "key1":123}', '$.key1'); +select JSON_VALUE('{ "x": [0,1], "y": "[0,1]", "z": "Mon\\\"t\\\"y" }','$.z'); select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2'); select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key1'); -- cgit v1.2.1 From 4c2c5ec94e9b06a240629c43a9686b873bd7d3b3 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Sat, 18 Nov 2017 00:19:46 +0400 Subject: MDEV-14434 Wrong result for CHARSET(CONCAT(?,const)) --- mysql-test/r/ps.result | 37 +++++++++++++++++++++++++++++++++++++ mysql-test/t/ps.test | 19 +++++++++++++++++++ 2 files changed, 56 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index fcd5a8aa7ee..6dfc7e80ba0 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -4992,3 +4992,40 @@ ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NE EXECUTE IMMEDIATE 'CALL p1(?)' USING IGNORE; ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NEW pseudo-variable in BEFORE trigger DROP PROCEDURE p1; +# +# MDEV-14434 Wrong result for CHARSET(CONCAT(?,const)) +# +SET NAMES utf8; +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(5,_latin1'a'))"; +CHARSET(CONCAT(5,_latin1'a')) +latin1 +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5; +CHARSET(CONCAT(?,_latin1'a')) +latin1 +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5.5; +CHARSET(CONCAT(?,_latin1'a')) +latin1 +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5.5e0; +CHARSET(CONCAT(?,_latin1'a')) +latin1 +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING TIME'10:20:30'; +CHARSET(CONCAT(?,_latin1'a')) +latin1 +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING TIMESTAMP'2001-01-01 10:20:30'; +CHARSET(CONCAT(?,_latin1'a')) +latin1 +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5; +COERCIBILITY(?) +5 +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5; +COERCIBILITY(?) +5 +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5e0; +COERCIBILITY(?) +5 +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIME'10:20:30'; +COERCIBILITY(?) +5 +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIMESTAMP'2001-01-01 10:20:30'; +COERCIBILITY(?) +5 diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index b61c4cf2568..90f2b7179f9 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -4476,3 +4476,22 @@ EXECUTE IMMEDIATE 'CALL p1(?)' USING DEFAULT; --error ER_SP_NOT_VAR_ARG EXECUTE IMMEDIATE 'CALL p1(?)' USING IGNORE; DROP PROCEDURE p1; + + +--echo # +--echo # MDEV-14434 Wrong result for CHARSET(CONCAT(?,const)) +--echo # + +SET NAMES utf8; +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(5,_latin1'a'))"; +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5; +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5.5; +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5.5e0; +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING TIME'10:20:30'; +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING TIMESTAMP'2001-01-01 10:20:30'; + +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5; +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5; +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5e0; +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIME'10:20:30'; +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIMESTAMP'2001-01-01 10:20:30'; -- cgit v1.2.1 From a20c1217a5ce4235f72c59935a03b56fead2f6c4 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Sat, 18 Nov 2017 18:29:50 +0400 Subject: MDEV-14435 Different UNSIGNED flag of out user variable for YEAR parameter for direct vs prepared CALL --- mysql-test/r/ps.result | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- mysql-test/t/ps.test | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 2 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 6dfc7e80ba0..6857ebc68af 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -3388,7 +3388,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( - `c1` bigint(20) DEFAULT NULL + `c1` bigint(20) unsigned DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT @a, @a = b'10100100101'; @a @a = b'10100100101' @@ -3478,7 +3478,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( - `c1` bigint(20) DEFAULT NULL + `c1` bigint(20) unsigned DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT @a, @a = 2010; @a @a = 2010 @@ -5029,3 +5029,48 @@ COERCIBILITY(?) EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIMESTAMP'2001-01-01 10:20:30'; COERCIBILITY(?) 5 +# +# MDEV-14435 Different UNSIGNED flag of out user variable for YEAR parameter for direct vs prepared CALL +# +CREATE PROCEDURE p1(OUT v INT UNSIGNED) SET v = 2010; +CALL p1(@a); +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING @b; +DEALLOCATE PREPARE stmt; +CREATE TABLE t1 AS SELECT @a AS a, @b AS b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) unsigned DEFAULT NULL, + `b` bigint(20) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT v YEAR) SET v = 2010; +CALL p1(@a); +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING @b; +DEALLOCATE PREPARE stmt; +CREATE TABLE t1 AS SELECT @a AS a, @b AS b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) unsigned DEFAULT NULL, + `b` bigint(20) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT v BIT(16)) SET v = 2010; +CALL p1(@a); +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING @b; +DEALLOCATE PREPARE stmt; +CREATE TABLE t1 AS SELECT @a AS a, @b AS b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) unsigned DEFAULT NULL, + `b` bigint(20) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +DROP PROCEDURE p1; diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index 90f2b7179f9..a7683b5aae6 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -4495,3 +4495,37 @@ EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5; EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5e0; EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIME'10:20:30'; EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIMESTAMP'2001-01-01 10:20:30'; + +--echo # +--echo # MDEV-14435 Different UNSIGNED flag of out user variable for YEAR parameter for direct vs prepared CALL +--echo # + +CREATE PROCEDURE p1(OUT v INT UNSIGNED) SET v = 2010; +CALL p1(@a); +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING @b; +DEALLOCATE PREPARE stmt; +CREATE TABLE t1 AS SELECT @a AS a, @b AS b; +SHOW CREATE TABLE t1; +DROP TABLE t1; +DROP PROCEDURE p1; + +CREATE PROCEDURE p1(OUT v YEAR) SET v = 2010; +CALL p1(@a); +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING @b; +DEALLOCATE PREPARE stmt; +CREATE TABLE t1 AS SELECT @a AS a, @b AS b; +SHOW CREATE TABLE t1; +DROP TABLE t1; +DROP PROCEDURE p1; + +CREATE PROCEDURE p1(OUT v BIT(16)) SET v = 2010; +CALL p1(@a); +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING @b; +DEALLOCATE PREPARE stmt; +CREATE TABLE t1 AS SELECT @a AS a, @b AS b; +SHOW CREATE TABLE t1; +DROP TABLE t1; +DROP PROCEDURE p1; -- cgit v1.2.1 From b54aeeb080aba2385204cdd09cba3eedbbf1b891 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 19 Nov 2017 14:05:07 +0100 Subject: never add new error messages to old GA releases! this fixes aae4932775d --- .../suite/binlog/r/binlog_flush_binlogs_delete_domain.result | 10 +++++----- .../suite/binlog/r/binlog_gtid_delete_domain_debug.result | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/binlog/r/binlog_flush_binlogs_delete_domain.result b/mysql-test/suite/binlog/r/binlog_flush_binlogs_delete_domain.result index daf2f4d6490..99f2a57835f 100644 --- a/mysql-test/suite/binlog/r/binlog_flush_binlogs_delete_domain.result +++ b/mysql-test/suite/binlog/r/binlog_flush_binlogs_delete_domain.result @@ -9,7 +9,7 @@ Non-existed domain is warned, the command completes without rotation but with a warning FLUSH BINARY LOGS DELETE_DOMAIN_ID = (99); Warnings: -Warning 1982 The gtid domain being deleted ('99') is not in the current binlog state +Warning 1076 The gtid domain being deleted ('99') is not in the current binlog state show binary logs; Log_name File_size master-bin.000001 # @@ -36,15 +36,15 @@ Already deleted domain in Gtid_list of the earliest log is benign but may cause a warning FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1); Warnings: -Warning 1982 The current gtid binlog state is incompatible with a former one missing gtids from the '1-1' domain-server pair which is referred to in the gtid list describing an earlier state. Ignore if the domain ('1') was already explicitly deleted. -Warning 1982 The gtid domain being deleted ('1') is not in the current binlog state +Warning 1076 The current gtid binlog state is incompatible with a former one missing gtids from the '1-1' domain-server pair which is referred to in the gtid list describing an earlier state. Ignore if the domain ('1') was already explicitly deleted. +Warning 1076 The gtid domain being deleted ('1') is not in the current binlog state FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0); ERROR HY000: Could not delete gtid domain. Reason: binlog files may contain gtids from the domain ('1') being deleted. Make sure to first purge those files. FLUSH BINARY LOGS; PURGE BINARY LOGS TO 'master-bin.000005'; FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0); Warnings: -Warning 1982 The gtid domain being deleted ('0') is not in the current binlog state +Warning 1076 The gtid domain being deleted ('0') is not in the current binlog state Gtid_list of the current binlog does not contain 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0: show binlog events in 'master-bin.000006' limit 1,1; Log_name Pos Event_type Server_id End_log_pos Info @@ -73,6 +73,6 @@ PURGE BINARY LOGS TO 'master-bin.000007'; the following command succeeds with warnings FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1); Warnings: -Warning 1982 The current gtid binlog state is incompatible with a former one having a gtid '11-11-1' which is less than the '11-11-11' of the gtid list describing an earlier state. The state may have been affected by manually injecting a lower sequence number gtid or via replication. +Warning 1076 The current gtid binlog state is incompatible with a former one having a gtid '11-11-1' which is less than the '11-11-11' of the gtid list describing an earlier state. The state may have been affected by manually injecting a lower sequence number gtid or via replication. DROP TABLE t; RESET MASTER; diff --git a/mysql-test/suite/binlog/r/binlog_gtid_delete_domain_debug.result b/mysql-test/suite/binlog/r/binlog_gtid_delete_domain_debug.result index 5193267e2f2..b4627caceb2 100644 --- a/mysql-test/suite/binlog/r/binlog_gtid_delete_domain_debug.result +++ b/mysql-test/suite/binlog/r/binlog_gtid_delete_domain_debug.result @@ -3,4 +3,4 @@ FLUSH BINARY LOGS DELETE_DOMAIN_ID = (99); ERROR HY000: Could not delete gtid domain. Reason: injected error. SHOW WARNINGS; Level Code Message -Error 1982 Could not delete gtid domain. Reason: injected error. +Error 1076 Could not delete gtid domain. Reason: injected error. -- cgit v1.2.1 From 55a94ef1cf8f77c7fb190303b648b639a026515b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 20 Nov 2017 12:22:28 +0200 Subject: Import WL#7277 bulk insert creation tests from MySQL 5.7 --- .../innodb/include/innodb_bulk_create_index.inc | 185 ++++ .../include/innodb_bulk_create_index_debug.inc | 221 ++++ .../suite/innodb/r/innodb_bulk_create_index.result | 1061 ++++++++++++++++++++ .../innodb/r/innodb_bulk_create_index_debug.result | 501 +++++++++ .../innodb/r/innodb_bulk_create_index_flush.result | 53 + .../r/innodb_bulk_create_index_replication.result | 226 +++++ .../innodb/r/innodb_bulk_create_index_small.result | 147 +++ .../suite/innodb/t/innodb_bulk_create_index.test | 47 + .../innodb/t/innodb_bulk_create_index_debug.test | 23 + .../innodb/t/innodb_bulk_create_index_flush.test | 74 ++ .../t/innodb_bulk_create_index_replication.test | 181 ++++ .../innodb/t/innodb_bulk_create_index_small.test | 149 +++ 12 files changed, 2868 insertions(+) create mode 100644 mysql-test/suite/innodb/include/innodb_bulk_create_index.inc create mode 100644 mysql-test/suite/innodb/include/innodb_bulk_create_index_debug.inc create mode 100644 mysql-test/suite/innodb/r/innodb_bulk_create_index.result create mode 100644 mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result create mode 100644 mysql-test/suite/innodb/r/innodb_bulk_create_index_flush.result create mode 100644 mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result create mode 100644 mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result create mode 100644 mysql-test/suite/innodb/t/innodb_bulk_create_index.test create mode 100644 mysql-test/suite/innodb/t/innodb_bulk_create_index_debug.test create mode 100644 mysql-test/suite/innodb/t/innodb_bulk_create_index_flush.test create mode 100644 mysql-test/suite/innodb/t/innodb_bulk_create_index_replication.test create mode 100644 mysql-test/suite/innodb/t/innodb_bulk_create_index_small.test (limited to 'mysql-test') diff --git a/mysql-test/suite/innodb/include/innodb_bulk_create_index.inc b/mysql-test/suite/innodb/include/innodb_bulk_create_index.inc new file mode 100644 index 00000000000..3c10517933f --- /dev/null +++ b/mysql-test/suite/innodb/include/innodb_bulk_create_index.inc @@ -0,0 +1,185 @@ +# +# wl#7277: InnoDB: Bulk Load for Create Index +# + +# Create Insert Procedure +DELIMITER |; +CREATE PROCEDURE populate_t1(load_even INT) +BEGIN + DECLARE i int DEFAULT 1; + + START TRANSACTION; + WHILE (i <= 10000) DO + IF i%2 = 0 AND load_even = 1 THEN + INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); + END IF; + IF i%2 != 0 AND load_even != 1 THEN + INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); + END IF; + SET i = i + 1; + END WHILE; + COMMIT; +END| +DELIMITER ;| + +SELECT @@innodb_fill_factor; + +if ($row_format != 'COMPRESSED') +{ + eval CREATE TABLE t1( + class INT, + id INT, + title VARCHAR(100) + ) ENGINE=InnoDB ROW_FORMAT=$row_format; +} + +if ($row_format == 'COMPRESSED') +{ + SET GLOBAL innodb_file_per_table=1; + + eval CREATE TABLE t1( + class INT, + id INT, + title VARCHAR(100) + ) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4; +} + +-- disable_query_log +# Load half records +CALL populate_t1(1); +-- enable_query_log + +SELECT COUNT(*) FROM t1; + +/* Create index. */ +CREATE INDEX idx_id ON t1(id); + +CREATE INDEX idx_title ON t1(title); + +/* Check table. */ +CHECK TABLE t1; + +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE id = 10; +SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE id = 5000; +SELECT * FROM t1 WHERE title = 'a5000'; + +SELECT * FROM t1 WHERE id = 10000; +SELECT * FROM t1 WHERE title = 'a10000'; + +SELECT * FROM t1 WHERE id = 10010; +SELECT * FROM t1 WHERE title = 'a10010'; + +/*Insert/Update/Delete. */ +DELETE FROM t1 WHERE id < 4010 AND id > 3990; +INSERT INTO t1 VALUES(4000, 4000, 'b4000'); +UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990; + +SELECT * FROM t1 WHERE id = 3000; +SELECT * FROM t1 WHERE title = 'a3000'; +SELECT * FROM t1 WHERE title = 'b3000'; + +SELECT * FROM t1 WHERE id = 4000; +SELECT * FROM t1 WHERE title = 'a4000'; +SELECT * FROM t1 WHERE title = 'b4000'; + +SELECT * FROM t1 WHERE id = 4001; +SELECT * FROM t1 WHERE title = 'a4001'; + +-- disable_query_log +# Load half records (follow up load) +CALL populate_t1(0); +-- enable_query_log +SELECT COUNT(*) FROM t1; + + +/* Add column. */ +ALTER TABLE t1 ADD COLUMN content TEXT; + +CHECK TABLE t1; + +SELECT * FROM t1 WHERE id = 10; +SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE id = 5000; +SELECT * FROM t1 WHERE title = 'a5000'; + +SELECT * FROM t1 WHERE id = 10000; +SELECT * FROM t1 WHERE title = 'a10000'; + +SELECT * FROM t1 WHERE id = 10010; +SELECT * FROM t1 WHERE title = 'a10010'; + +/* Drop column. */ +ALTER TABLE t1 DROP COLUMN content; + +CHECK TABLE t1; + +SELECT * FROM t1 WHERE id = 10; +SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE id = 5000; +SELECT * FROM t1 WHERE title = 'a5000'; + +SELECT * FROM t1 WHERE id = 10000; +SELECT * FROM t1 WHERE title = 'a10000'; + +SELECT * FROM t1 WHERE id = 10010; +SELECT * FROM t1 WHERE title = 'a10010'; + +DROP TABLE t1; + +# Test Blob +if ($row_format != 'COMPRESSED') { + eval CREATE TABLE t1( + a INT PRIMARY KEY, + b TEXT, + c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format; +} + +if ($row_format == 'COMPRESSED') { + eval CREATE TABLE t1( + a INT PRIMARY KEY, + b BLOB, + c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4; +} + +let $cnt= 5000; +-- disable_query_log +WHILE ($cnt>=4950) +{ +EVAL INSERT INTO t1 VALUES + ($cnt, REPEAT(CONCAT('a', $cnt),2000), CONCAT('a', $cnt)); +dec $cnt; +} +-- enable_query_log +ALTER TABLE t1 ADD INDEX `idx` (a,b(5)); + +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%'; +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +DELETE FROM t1 WHERE a=4975 AND b like 'b4975%'; +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; + +ALTER TABLE t1 DROP COLUMN c; + +CHECK TABLE t1; + +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; + +DROP TABLE t1; + +# Restore global variables +if ($row_format == 'COMPRESSED') +{ + SET GLOBAL innodb_file_per_table=default; +} + +DROP PROCEDURE populate_t1; diff --git a/mysql-test/suite/innodb/include/innodb_bulk_create_index_debug.inc b/mysql-test/suite/innodb/include/innodb_bulk_create_index_debug.inc new file mode 100644 index 00000000000..9cfb6182423 --- /dev/null +++ b/mysql-test/suite/innodb/include/innodb_bulk_create_index_debug.inc @@ -0,0 +1,221 @@ +# +# wl#7277: InnoDB: Bulk Load for Create Index +# + +# Not supported in embedded +-- source include/not_embedded.inc + +# This test case needs to crash the server. Needs a debug server. +-- source include/have_debug.inc + +# Don't test this under valgrind, memory leaks will occur. +-- source include/not_valgrind.inc + +# Avoid CrashReporter popup on Mac +-- source include/not_crashrep.inc + +-- source include/have_innodb.inc + +# Create Insert Procedure +DELIMITER |; +CREATE PROCEDURE populate_t1() +BEGIN + DECLARE i int DEFAULT 1; + + START TRANSACTION; + WHILE (i <= 10000) DO + INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); + SET i = i + 1; + END WHILE; + COMMIT; +END| +DELIMITER ;| + +# Test scenarios: +# 1. Test restart; +# 2. Test crash recovery. + +# Test Restart +if ($row_format != 'COMPRESSED') +{ + eval CREATE TABLE t1( + class INT, + id INT, + title VARCHAR(100) + ) ENGINE=InnoDB ROW_FORMAT=$row_format; +} + +if ($row_format == 'COMPRESSED') +{ + SET GLOBAL innodb_file_per_table=1; + + eval CREATE TABLE t1( + class INT, + id INT, + title VARCHAR(100) + ) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4; +} + +-- disable_query_log +CALL populate_t1(); +-- enable_query_log + +SELECT COUNT(*) FROM t1; + +CREATE INDEX idx_title ON t1(title); + +--source include/restart_mysqld.inc + +CHECK TABLE t1; + +SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE title = 'a5000'; + +SELECT * FROM t1 WHERE title = 'a10000'; + +SELECT * FROM t1 WHERE title = 'a10010'; + +DROP TABLE t1; + +-- echo # Test Blob + +if ($row_format != 'COMPRESSED') { + eval CREATE TABLE t1( + a INT PRIMARY KEY, + b TEXT, + c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format; +} + +if ($row_format == 'COMPRESSED') { + SET GLOBAL innodb_file_per_table=1; + + eval CREATE TABLE t1( + a INT PRIMARY KEY, + b TEXT, + c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4; +} + +INSERT INTO t1 VALUES + (1, REPEAT('a',10000), 'a'), + (2, REPEAT('b',20000), 'b'), + (3, REPEAT('c',40000), 'c'), + (4, REPEAT('d',60000), 'd'); + +SELECT CHAR_LENGTH(b) FROM t1; + +ALTER TABLE t1 DROP COLUMN c; + +--source include/restart_mysqld.inc + +CHECK TABLE t1; + +SELECT CHAR_LENGTH(b) FROM t1; + +DROP TABLE t1; + +# Test Crash Recovery + +if ($row_format != 'COMPRESSED') +{ + eval CREATE TABLE t1( + class INT, + id INT, + title VARCHAR(100) + ) ENGINE=InnoDB ROW_FORMAT=$row_format; +} + +if ($row_format == 'COMPRESSED') +{ + SET GLOBAL innodb_file_per_table=1; + + eval CREATE TABLE t1( + class INT, + id INT, + title VARCHAR(100) + ) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4; +} + +-- disable_query_log +CALL populate_t1(); +-- enable_query_log + +SET SESSION debug="+d,crash_commit_before"; + +# Write file to make mysql-test-run.pl start up the server again +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect + +--error 2013 +CREATE INDEX idx_title ON t1(title); + +--enable_reconnect +--source include/wait_until_connected_again.inc +--disable_reconnect + +SELECT COUNT(*) FROM t1; + +CHECK TABLE t1; + +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE title = 'a5000'; + +SELECT * FROM t1 WHERE title = 'a10000'; + +SELECT * FROM t1 WHERE title = 'a10010'; + +DROP TABLE t1; + +-- echo # Test Blob + +if ($row_format != 'COMPRESSED') { + eval CREATE TABLE t1( + a INT PRIMARY KEY, + b TEXT, + c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format; +} + +if ($row_format == 'COMPRESSED') { + SET GLOBAL innodb_file_per_table=1; + + eval CREATE TABLE t1( + a INT PRIMARY KEY, + b TEXT, + c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4; +} + +INSERT INTO t1 VALUES + (1, REPEAT('a',10000), 'a'), + (2, REPEAT('b',20000), 'b'), + (3, REPEAT('c',40000), 'c'), + (4, REPEAT('d',60000), 'd'); + +SELECT CHAR_LENGTH(b) FROM t1; + +SET SESSION debug="+d,crash_commit_before"; + +# Write file to make mysql-test-run.pl start up the server again +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect + +--error 2013 +ALTER TABLE t1 DROP COLUMN c; + +--enable_reconnect +--source include/wait_until_connected_again.inc +--disable_reconnect + +CHECK TABLE t1; + +SELECT CHAR_LENGTH(b) FROM t1; + +DROP TABLE t1; + +# Restore global variables +if ($row_format == 'COMPRESSED') +{ + SET GLOBAL innodb_file_per_table=default; +} + +DROP PROCEDURE populate_t1; diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index.result new file mode 100644 index 00000000000..78f0c256d85 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index.result @@ -0,0 +1,1061 @@ +CREATE PROCEDURE populate_t1(load_even INT) +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +IF i%2 = 0 AND load_even = 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +IF i%2 != 0 AND load_even != 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +SET i = i + 1; +END WHILE; +COMMIT; +END| +SELECT @@innodb_fill_factor; +@@innodb_fill_factor +100 +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +SELECT COUNT(*) FROM t1; +COUNT(*) +5000 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Check table. */ +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_id idx_id 5 const 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`id` = 10) +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +/*Insert/Update/Delete. */ +DELETE FROM t1 WHERE id < 4010 AND id > 3990; +INSERT INTO t1 VALUES(4000, 4000, 'b4000'); +UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990; +SELECT * FROM t1 WHERE id = 3000; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE title = 'a3000'; +class id title +SELECT * FROM t1 WHERE title = 'b3000'; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE id = 4000; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE title = 'a4000'; +class id title +SELECT * FROM t1 WHERE title = 'b4000'; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE id = 4001; +class id title +SELECT * FROM t1 WHERE title = 'a4001'; +class id title +SELECT COUNT(*) FROM t1; +COUNT(*) +9992 +/* Add column. */ +ALTER TABLE t1 ADD COLUMN content TEXT; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE title = 'a10'; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE id = 5000; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE title = 'a5000'; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE id = 10000; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE title = 'a10000'; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE id = 10010; +class id title content +SELECT * FROM t1 WHERE title = 'a10010'; +class id title content +/* Drop column. */ +ALTER TABLE t1 DROP COLUMN content; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +ALTER TABLE t1 ADD INDEX `idx` (a,b(5)); +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +10000 +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +1 +UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%'; +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +1 +DELETE FROM t1 WHERE a=4975 AND b like 'b4975%'; +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +DROP TABLE t1; +DROP PROCEDURE populate_t1; +CREATE PROCEDURE populate_t1(load_even INT) +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +IF i%2 = 0 AND load_even = 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +IF i%2 != 0 AND load_even != 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +SET i = i + 1; +END WHILE; +COMMIT; +END| +SELECT @@innodb_fill_factor; +@@innodb_fill_factor +100 +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPACT; +SELECT COUNT(*) FROM t1; +COUNT(*) +5000 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Check table. */ +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_id idx_id 5 const 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`id` = 10) +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +/*Insert/Update/Delete. */ +DELETE FROM t1 WHERE id < 4010 AND id > 3990; +INSERT INTO t1 VALUES(4000, 4000, 'b4000'); +UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990; +SELECT * FROM t1 WHERE id = 3000; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE title = 'a3000'; +class id title +SELECT * FROM t1 WHERE title = 'b3000'; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE id = 4000; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE title = 'a4000'; +class id title +SELECT * FROM t1 WHERE title = 'b4000'; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE id = 4001; +class id title +SELECT * FROM t1 WHERE title = 'a4001'; +class id title +SELECT COUNT(*) FROM t1; +COUNT(*) +9992 +/* Add column. */ +ALTER TABLE t1 ADD COLUMN content TEXT; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE title = 'a10'; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE id = 5000; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE title = 'a5000'; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE id = 10000; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE title = 'a10000'; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE id = 10010; +class id title content +SELECT * FROM t1 WHERE title = 'a10010'; +class id title content +/* Drop column. */ +ALTER TABLE t1 DROP COLUMN content; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 ADD INDEX `idx` (a,b(5)); +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +10000 +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +1 +UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%'; +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +1 +DELETE FROM t1 WHERE a=4975 AND b like 'b4975%'; +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +DROP TABLE t1; +DROP PROCEDURE populate_t1; +CREATE PROCEDURE populate_t1(load_even INT) +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +IF i%2 = 0 AND load_even = 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +IF i%2 != 0 AND load_even != 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +SET i = i + 1; +END WHILE; +COMMIT; +END| +SELECT @@innodb_fill_factor; +@@innodb_fill_factor +100 +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +SELECT COUNT(*) FROM t1; +COUNT(*) +5000 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Check table. */ +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_id idx_id 5 const 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`id` = 10) +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +/*Insert/Update/Delete. */ +DELETE FROM t1 WHERE id < 4010 AND id > 3990; +INSERT INTO t1 VALUES(4000, 4000, 'b4000'); +UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990; +SELECT * FROM t1 WHERE id = 3000; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE title = 'a3000'; +class id title +SELECT * FROM t1 WHERE title = 'b3000'; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE id = 4000; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE title = 'a4000'; +class id title +SELECT * FROM t1 WHERE title = 'b4000'; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE id = 4001; +class id title +SELECT * FROM t1 WHERE title = 'a4001'; +class id title +SELECT COUNT(*) FROM t1; +COUNT(*) +9992 +/* Add column. */ +ALTER TABLE t1 ADD COLUMN content TEXT; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE title = 'a10'; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE id = 5000; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE title = 'a5000'; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE id = 10000; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE title = 'a10000'; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE id = 10010; +class id title content +SELECT * FROM t1 WHERE title = 'a10010'; +class id title content +/* Drop column. */ +ALTER TABLE t1 DROP COLUMN content; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +ALTER TABLE t1 ADD INDEX `idx` (a,b(5)); +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +10000 +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +1 +UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%'; +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +1 +DELETE FROM t1 WHERE a=4975 AND b like 'b4975%'; +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +DROP TABLE t1; +DROP PROCEDURE populate_t1; +CREATE PROCEDURE populate_t1(load_even INT) +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +IF i%2 = 0 AND load_even = 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +IF i%2 != 0 AND load_even != 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +SET i = i + 1; +END WHILE; +COMMIT; +END| +SELECT @@innodb_fill_factor; +@@innodb_fill_factor +100 +SET GLOBAL innodb_file_per_table=1; +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +SELECT COUNT(*) FROM t1; +COUNT(*) +5000 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Check table. */ +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_id idx_id 5 const 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`id` = 10) +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +/*Insert/Update/Delete. */ +DELETE FROM t1 WHERE id < 4010 AND id > 3990; +INSERT INTO t1 VALUES(4000, 4000, 'b4000'); +UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990; +SELECT * FROM t1 WHERE id = 3000; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE title = 'a3000'; +class id title +SELECT * FROM t1 WHERE title = 'b3000'; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE id = 4000; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE title = 'a4000'; +class id title +SELECT * FROM t1 WHERE title = 'b4000'; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE id = 4001; +class id title +SELECT * FROM t1 WHERE title = 'a4001'; +class id title +SELECT COUNT(*) FROM t1; +COUNT(*) +9992 +/* Add column. */ +ALTER TABLE t1 ADD COLUMN content TEXT; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE title = 'a10'; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE id = 5000; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE title = 'a5000'; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE id = 10000; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE title = 'a10000'; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE id = 10010; +class id title content +SELECT * FROM t1 WHERE title = 'a10010'; +class id title content +/* Drop column. */ +ALTER TABLE t1 DROP COLUMN content; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b BLOB, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +ALTER TABLE t1 ADD INDEX `idx` (a,b(5)); +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +10000 +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +1 +UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%'; +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +1 +DELETE FROM t1 WHERE a=4975 AND b like 'b4975%'; +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +DROP TABLE t1; +SET GLOBAL innodb_file_per_table=default; +DROP PROCEDURE populate_t1; +SET GLOBAL innodb_fill_factor=10; +CREATE PROCEDURE populate_t1(load_even INT) +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +IF i%2 = 0 AND load_even = 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +IF i%2 != 0 AND load_even != 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +SET i = i + 1; +END WHILE; +COMMIT; +END| +SELECT @@innodb_fill_factor; +@@innodb_fill_factor +10 +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPACT; +SELECT COUNT(*) FROM t1; +COUNT(*) +5000 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Check table. */ +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_id idx_id 5 const 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`id` = 10) +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +/*Insert/Update/Delete. */ +DELETE FROM t1 WHERE id < 4010 AND id > 3990; +INSERT INTO t1 VALUES(4000, 4000, 'b4000'); +UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990; +SELECT * FROM t1 WHERE id = 3000; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE title = 'a3000'; +class id title +SELECT * FROM t1 WHERE title = 'b3000'; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE id = 4000; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE title = 'a4000'; +class id title +SELECT * FROM t1 WHERE title = 'b4000'; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE id = 4001; +class id title +SELECT * FROM t1 WHERE title = 'a4001'; +class id title +SELECT COUNT(*) FROM t1; +COUNT(*) +9992 +/* Add column. */ +ALTER TABLE t1 ADD COLUMN content TEXT; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE title = 'a10'; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE id = 5000; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE title = 'a5000'; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE id = 10000; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE title = 'a10000'; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE id = 10010; +class id title content +SELECT * FROM t1 WHERE title = 'a10010'; +class id title content +/* Drop column. */ +ALTER TABLE t1 DROP COLUMN content; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 ADD INDEX `idx` (a,b(5)); +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +10000 +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +1 +UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%'; +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +1 +DELETE FROM t1 WHERE a=4975 AND b like 'b4975%'; +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +DROP TABLE t1; +DROP PROCEDURE populate_t1; +SET GLOBAL innodb_fill_factor=50; +CREATE PROCEDURE populate_t1(load_even INT) +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +IF i%2 = 0 AND load_even = 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +IF i%2 != 0 AND load_even != 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +SET i = i + 1; +END WHILE; +COMMIT; +END| +SELECT @@innodb_fill_factor; +@@innodb_fill_factor +50 +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPACT; +SELECT COUNT(*) FROM t1; +COUNT(*) +5000 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Check table. */ +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_id idx_id 5 const 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`id` = 10) +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +/*Insert/Update/Delete. */ +DELETE FROM t1 WHERE id < 4010 AND id > 3990; +INSERT INTO t1 VALUES(4000, 4000, 'b4000'); +UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990; +SELECT * FROM t1 WHERE id = 3000; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE title = 'a3000'; +class id title +SELECT * FROM t1 WHERE title = 'b3000'; +class id title +3000 3000 b3000 +SELECT * FROM t1 WHERE id = 4000; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE title = 'a4000'; +class id title +SELECT * FROM t1 WHERE title = 'b4000'; +class id title +4000 4000 b4000 +SELECT * FROM t1 WHERE id = 4001; +class id title +SELECT * FROM t1 WHERE title = 'a4001'; +class id title +SELECT COUNT(*) FROM t1; +COUNT(*) +9992 +/* Add column. */ +ALTER TABLE t1 ADD COLUMN content TEXT; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE title = 'a10'; +class id title content +10 10 a10 NULL +SELECT * FROM t1 WHERE id = 5000; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE title = 'a5000'; +class id title content +5000 5000 a5000 NULL +SELECT * FROM t1 WHERE id = 10000; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE title = 'a10000'; +class id title content +10000 10000 a10000 NULL +SELECT * FROM t1 WHERE id = 10010; +class id title content +SELECT * FROM t1 WHERE title = 'a10010'; +class id title content +/* Drop column. */ +ALTER TABLE t1 DROP COLUMN content; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 5000; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE id = 10000; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE id = 10010; +class id title +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 ADD INDEX `idx` (a,b(5)); +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +10000 +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +1 +UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%'; +SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%'; +b=REPEAT(CONCAT('a',4975),2000) +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +1 +DELETE FROM t1 WHERE a=4975 AND b like 'b4975%'; +SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%'; +b=REPEAT(CONCAT('b',4975),2000) +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +DROP TABLE t1; +DROP PROCEDURE populate_t1; +SET GLOBAL innodb_fill_factor=default; diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result new file mode 100644 index 00000000000..631b189f107 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result @@ -0,0 +1,501 @@ +CREATE PROCEDURE populate_t1() +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +SET i = i + 1; +END WHILE; +COMMIT; +END| +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +SELECT COUNT(*) FROM t1; +COUNT(*) +10000 +CREATE INDEX idx_title ON t1(title); +# restart +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +# Test Blob +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +ALTER TABLE t1 DROP COLUMN c; +# restart +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +DROP TABLE t1; +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +SET SESSION debug="+d,crash_commit_before"; +CREATE INDEX idx_title ON t1(title); +ERROR HY000: Lost connection to MySQL server during query +SELECT COUNT(*) FROM t1; +COUNT(*) +10000 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +# Test Blob +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +SET SESSION debug="+d,crash_commit_before"; +ALTER TABLE t1 DROP COLUMN c; +ERROR HY000: Lost connection to MySQL server during query +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +DROP TABLE t1; +DROP PROCEDURE populate_t1; +CREATE PROCEDURE populate_t1() +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +SET i = i + 1; +END WHILE; +COMMIT; +END| +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPACT; +SELECT COUNT(*) FROM t1; +COUNT(*) +10000 +CREATE INDEX idx_title ON t1(title); +# restart +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +# Test Blob +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +ALTER TABLE t1 DROP COLUMN c; +# restart +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +DROP TABLE t1; +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPACT; +SET SESSION debug="+d,crash_commit_before"; +CREATE INDEX idx_title ON t1(title); +ERROR HY000: Lost connection to MySQL server during query +SELECT COUNT(*) FROM t1; +COUNT(*) +10000 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +# Test Blob +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +SET SESSION debug="+d,crash_commit_before"; +ALTER TABLE t1 DROP COLUMN c; +ERROR HY000: Lost connection to MySQL server during query +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +DROP TABLE t1; +DROP PROCEDURE populate_t1; +CREATE PROCEDURE populate_t1() +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +SET i = i + 1; +END WHILE; +COMMIT; +END| +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +SELECT COUNT(*) FROM t1; +COUNT(*) +10000 +CREATE INDEX idx_title ON t1(title); +# restart +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +# Test Blob +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +ALTER TABLE t1 DROP COLUMN c; +# restart +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +DROP TABLE t1; +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +SET SESSION debug="+d,crash_commit_before"; +CREATE INDEX idx_title ON t1(title); +ERROR HY000: Lost connection to MySQL server during query +SELECT COUNT(*) FROM t1; +COUNT(*) +10000 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +# Test Blob +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +SET SESSION debug="+d,crash_commit_before"; +ALTER TABLE t1 DROP COLUMN c; +ERROR HY000: Lost connection to MySQL server during query +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +DROP TABLE t1; +DROP PROCEDURE populate_t1; +CREATE PROCEDURE populate_t1() +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +SET i = i + 1; +END WHILE; +COMMIT; +END| +SET GLOBAL innodb_file_per_table=1; +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +SELECT COUNT(*) FROM t1; +COUNT(*) +10000 +CREATE INDEX idx_title ON t1(title); +# restart +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +# Test Blob +SET GLOBAL innodb_file_per_table=1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +ALTER TABLE t1 DROP COLUMN c; +# restart +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +DROP TABLE t1; +SET GLOBAL innodb_file_per_table=1; +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +SET SESSION debug="+d,crash_commit_before"; +CREATE INDEX idx_title ON t1(title); +ERROR HY000: Lost connection to MySQL server during query +SELECT COUNT(*) FROM t1; +COUNT(*) +10000 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a5000'; +class id title +5000 5000 a5000 +SELECT * FROM t1 WHERE title = 'a10000'; +class id title +10000 10000 a10000 +SELECT * FROM t1 WHERE title = 'a10010'; +class id title +DROP TABLE t1; +# Test Blob +SET GLOBAL innodb_file_per_table=1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +SET SESSION debug="+d,crash_commit_before"; +ALTER TABLE t1 DROP COLUMN c; +ERROR HY000: Lost connection to MySQL server during query +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1; +CHAR_LENGTH(b) +10000 +20000 +40000 +60000 +DROP TABLE t1; +SET GLOBAL innodb_file_per_table=default; +DROP PROCEDURE populate_t1; diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_flush.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_flush.result new file mode 100644 index 00000000000..c0120ade42a --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_flush.result @@ -0,0 +1,53 @@ +CREATE PROCEDURE populate_t1() +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 10000) DO +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +SET i = i + 1; +END WHILE; +COMMIT; +END| +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB; +SELECT COUNT(*) FROM t1; +COUNT(*) +10000 +SET SESSION debug="+d,ib_index_build_fail_before_flush"; +CREATE INDEX idx_id ON t1(id); +ERROR HY000: Got error 1000 from storage engine +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +CREATE INDEX idx_title ON t1(title); +ERROR HY000: Got error 1000 from storage engine +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +CREATE FULLTEXT INDEX fidx_title ON t1(title); +ERROR HY000: Got error 1000 from storage engine +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +ALTER TABLE t1 ADD COLUMN content TEXT; +ERROR HY000: Got error 1000 from storage engine +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SET SESSION debug="-d,ib_index_build_fail_before_flush"; +INSERT INTO t1 VALUES(10001, 10001, 'a10000'); +ALTER TABLE t1 ADD UNIQUE INDEX idx_title(title); +ERROR 23000: Duplicate entry 'a10000' for key 'idx_title' +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +ALTER TABLE t1 ADD UNIQUE INDEX idx_id(id), ADD UNIQUE INDEX idx_title(title); +ERROR 23000: Duplicate entry 'a10000' for key 'idx_title' +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +DROP PROCEDURE populate_t1; diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result new file mode 100644 index 00000000000..4adafa179b4 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result @@ -0,0 +1,226 @@ +include/master-slave.inc +Warnings: +Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. +Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. +[connection master] +CREATE PROCEDURE populate_t1(load_even INT) +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 100) DO +IF i%2 = 0 AND load_even = 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +IF i%2 != 0 AND load_even != 1 THEN +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +END IF; +SET i = i + 1; +END WHILE; +COMMIT; +END| +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ; +SELECT COUNT(*) FROM t1; +COUNT(*) +50 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_id idx_id 5 const 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`id` = 10) +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 20; +class id title +20 20 a20 +SELECT * FROM t1 WHERE title = 'a20'; +class id title +20 20 a20 +SELECT * FROM t1 WHERE id = 30; +class id title +30 30 a30 +SELECT * FROM t1 WHERE title = 'a30'; +class id title +30 30 a30 +SELECT * FROM t1 WHERE id = 101; +class id title +SELECT * FROM t1 WHERE title = 'a101'; +class id title +/*Insert/Update/Delete. */ +DELETE FROM t1 WHERE id < 40 AND id > 30; +INSERT INTO t1 VALUES(38, 38, 'b38'); +UPDATE t1 SET title = CONCAT('b', id) WHERE id < 30 AND id > 20; +SELECT * FROM t1 WHERE id = 28; +class id title +28 28 b28 +SELECT * FROM t1 WHERE title = 'a28'; +class id title +SELECT * FROM t1 WHERE title = 'b28'; +class id title +28 28 b28 +SELECT * FROM t1 WHERE id = 38; +class id title +38 38 b38 +SELECT * FROM t1 WHERE title = 'a38'; +class id title +SELECT * FROM t1 WHERE title = 'b38'; +class id title +38 38 b38 +SELECT * FROM t1 WHERE id = 101; +class id title +SELECT * FROM t1 WHERE title = 'a101'; +class id title +SELECT COUNT(*) FROM t1; +COUNT(*) +97 +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 20; +class id title +20 20 a20 +SELECT * FROM t1 WHERE title = 'a20'; +class id title +20 20 a20 +SELECT * FROM t1 WHERE id = 30; +class id title +30 30 a30 +SELECT * FROM t1 WHERE title = 'a30'; +class id title +30 30 a30 +SELECT * FROM t1 WHERE id = 101; +class id title +SELECT * FROM t1 WHERE title = 'a101'; +class id title +CREATE TABLE t_part ( +class INT , +id INT , +title VARCHAR(30) +) ENGINE=InnoDB +PARTITION BY RANGE(id) +SUBPARTITION BY KEY(id) +SUBPARTITIONS 4 +( +PARTITION p0 VALUES LESS THAN (5000), +PARTITION p1 VALUES LESS THAN (MAXVALUE) +); +INSERT INTO t_part SELECT * FROM t1; +ALTER TABLE t_part ADD INDEX `idx` (class,id,title(10)); +SELECT * FROM t_part WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t_part WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t_part WHERE id = 20; +class id title +20 20 a20 +SELECT * FROM t_part WHERE title = 'a20'; +class id title +20 20 a20 +SELECT * FROM t_part WHERE id = 30; +class id title +30 30 a30 +SELECT * FROM t_part WHERE title = 'a30'; +class id title +30 30 a30 +SELECT * FROM t_part WHERE id = 101; +class id title +SELECT * FROM t_part WHERE title = 'a101'; +class id title +include/sync_slave_sql_with_master.inc +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `class` int(11) DEFAULT NULL, + `id` int(11) DEFAULT NULL, + `title` varchar(100) DEFAULT NULL, + KEY `idx_id` (`id`), + KEY `idx_title` (`title`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW CREATE TABLE t_part; +Table Create Table +t_part CREATE TABLE `t_part` ( + `class` int(11) DEFAULT NULL, + `id` int(11) DEFAULT NULL, + `title` varchar(30) DEFAULT NULL, + KEY `idx` (`class`,`id`,`title`(10)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY RANGE (id) +SUBPARTITION BY KEY (id) +SUBPARTITIONS 4 +(PARTITION p0 VALUES LESS THAN (5000) ENGINE = InnoDB, + PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ +SELECT COUNT(*) FROM t1; +COUNT(*) +97 +SELECT COUNT(*) FROM t_part; +COUNT(*) +97 +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 20; +class id title +20 20 a20 +SELECT * FROM t1 WHERE title = 'a20'; +class id title +20 20 a20 +SELECT * FROM t1 WHERE id = 30; +class id title +30 30 a30 +SELECT * FROM t1 WHERE title = 'a30'; +class id title +30 30 a30 +SELECT * FROM t1 WHERE id = 101; +class id title +SELECT * FROM t1 WHERE title = 'a101'; +class id title +SELECT * FROM t_part WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t_part WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t_part WHERE id = 20; +class id title +20 20 a20 +SELECT * FROM t_part WHERE title = 'a20'; +class id title +20 20 a20 +SELECT * FROM t_part WHERE id = 30; +class id title +30 30 a30 +SELECT * FROM t_part WHERE title = 'a30'; +class id title +30 30 a30 +SELECT * FROM t_part WHERE id = 101; +class id title +SELECT * FROM t_part WHERE title = 'a101'; +class id title +DROP PROCEDURE populate_t1; +DROP TABLE t1; +DROP TABLE t_part; +include/rpl_end.inc diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result new file mode 100644 index 00000000000..db3eacaadc3 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result @@ -0,0 +1,147 @@ +CREATE PROCEDURE populate_t1() +BEGIN +DECLARE i int DEFAULT 1; +START TRANSACTION; +WHILE (i <= 1000) DO +INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); +SET i = i + 1; +END WHILE; +COMMIT; +END| +SELECT @@innodb_fill_factor; +@@innodb_fill_factor +100 +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPACT; +SELECT COUNT(*) FROM t1; +COUNT(*) +1000 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Check table. */ +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_id idx_id 5 const 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`id` = 10) +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 500; +class id title +500 500 a500 +SELECT * FROM t1 WHERE title = 'a500'; +class id title +500 500 a500 +SELECT * FROM t1 WHERE id = 1000; +class id title +1000 1000 a1000 +SELECT * FROM t1 WHERE title = 'a1000'; +class id title +1000 1000 a1000 +SELECT * FROM t1 WHERE id = 1010; +class id title +SELECT * FROM t1 WHERE title = 'a1010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +DROP TABLE t1; +SET GLOBAL innodb_file_per_table=default; +SET GLOBAL innodb_file_per_table=1; +CREATE TABLE t1( +class INT, +id INT, +title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +SELECT COUNT(*) FROM t1; +COUNT(*) +1000 +/* Create index. */ +CREATE INDEX idx_id ON t1(id); +CREATE INDEX idx_title ON t1(title); +/* Check table. */ +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_id idx_id 5 const 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`id` = 10) +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') +SELECT * FROM t1 WHERE id = 10; +class id title +10 10 a10 +SELECT * FROM t1 WHERE title = 'a10'; +class id title +10 10 a10 +SELECT * FROM t1 WHERE id = 500; +class id title +500 500 a500 +SELECT * FROM t1 WHERE title = 'a500'; +class id title +500 500 a500 +SELECT * FROM t1 WHERE id = 1000; +class id title +1000 1000 a1000 +SELECT * FROM t1 WHERE title = 'a1000'; +class id title +1000 1000 a1000 +SELECT * FROM t1 WHERE id = 1010; +class id title +SELECT * FROM t1 WHERE title = 'a1010'; +class id title +DROP TABLE t1; +CREATE TABLE t1( +a INT PRIMARY KEY, +b TEXT, +c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +INSERT INTO t1 VALUES +(1, REPEAT('a',10000), 'a'), +(2, REPEAT('b',20000), 'b'), +(3, REPEAT('c',40000), 'c'), +(4, REPEAT('d',60000), 'd'); +ALTER TABLE t1 DROP COLUMN c; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; +CHAR_LENGTH(b) +DROP TABLE t1; +SET GLOBAL innodb_file_per_table=default; +DROP PROCEDURE populate_t1; diff --git a/mysql-test/suite/innodb/t/innodb_bulk_create_index.test b/mysql-test/suite/innodb/t/innodb_bulk_create_index.test new file mode 100644 index 00000000000..317f737f7c2 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bulk_create_index.test @@ -0,0 +1,47 @@ +######## suite/innodb/t/innodb_bulk_create_index.test ##### +# # +# Testcase for worklog WL#7277: InnoDB: Bulk Load for Create Index # +# The basic idea of bulk load is to build an index from bottom up # +# (also known as sorted index build). # +# Earlier index was create by repeatedly inserting records # +# Test scenario : # +# - Run bulk create index on 10K rows # +# - Run bulk create index on table with various row types # +# - Run DML and SELECT after bulk index creation # +# Creation: # +# 2014-06-19 Implemented this test as part of WL#7277 # +# # +###################################################################### + +-- source include/not_embedded.inc +-- source include/have_innodb.inc +-- source include/have_innodb_zip.inc +-- source include/big_test.inc + +# Test Row Format: REDUNDANT. +let $row_format = REDUNDANT; +-- source suite/innodb/include/innodb_bulk_create_index.inc + +# Test Row Format: COMPACT. +let $row_format = COMPACT; +-- source suite/innodb/include/innodb_bulk_create_index.inc + +# Test Row Format: DYNAMIC. +let $row_format = DYNAMIC; +-- source suite/innodb/include/innodb_bulk_create_index.inc + +# Test Row Format: COMPRESSED. +let $row_format = COMPRESSED; +-- source suite/innodb/include/innodb_bulk_create_index.inc + +# Test Fill Factor: 10 +let $row_format = COMPACT; +SET GLOBAL innodb_fill_factor=10; +-- source suite/innodb/include/innodb_bulk_create_index.inc + +# Test Fill Factor: 50 +let $row_format = COMPACT; +SET GLOBAL innodb_fill_factor=50; +-- source suite/innodb/include/innodb_bulk_create_index.inc + +SET GLOBAL innodb_fill_factor=default; diff --git a/mysql-test/suite/innodb/t/innodb_bulk_create_index_debug.test b/mysql-test/suite/innodb/t/innodb_bulk_create_index_debug.test new file mode 100644 index 00000000000..ed6dbf238ea --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bulk_create_index_debug.test @@ -0,0 +1,23 @@ +# +# wl#7277: InnoDB: Bulk Load for Create Index +# + +# Test Restart & Crash Recovery. +-- source include/big_test.inc +-- source include/have_innodb_zip.inc + +# Test Row Format: REDUNDANT. +let $row_format = REDUNDANT; +-- source suite/innodb/include/innodb_bulk_create_index_debug.inc + +# Test Row Format: COMPACT. +let $row_format = COMPACT; +-- source suite/innodb/include/innodb_bulk_create_index_debug.inc + +# Test Row Format: DYNAMIC. +let $row_format = DYNAMIC; +-- source suite/innodb/include/innodb_bulk_create_index_debug.inc + +# Test Row Format: COMPRESSED. +let $row_format = COMPRESSED; +-- source suite/innodb/include/innodb_bulk_create_index_debug.inc diff --git a/mysql-test/suite/innodb/t/innodb_bulk_create_index_flush.test b/mysql-test/suite/innodb/t/innodb_bulk_create_index_flush.test new file mode 100644 index 00000000000..8ae4c5703d5 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bulk_create_index_flush.test @@ -0,0 +1,74 @@ +# +# Test flush on error in bulk load to make sure we do a proper cleanup. +# Note: We flush all dirty pages before applying any online log in bulk load. +# + +-- source include/have_innodb.inc +-- source include/have_debug.inc + +# Create Insert Procedure +DELIMITER |; +CREATE PROCEDURE populate_t1() +BEGIN + DECLARE i int DEFAULT 1; + + START TRANSACTION; + WHILE (i <= 10000) DO + INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); + SET i = i + 1; + END WHILE; + COMMIT; +END| +DELIMITER ;| + +CREATE TABLE t1( + class INT, + id INT, + title VARCHAR(100) +) ENGINE=InnoDB; + +-- disable_query_log +CALL populate_t1(); +-- enable_query_log + +SELECT COUNT(*) FROM t1; + +SET SESSION debug="+d,ib_index_build_fail_before_flush"; + +-- error ER_GET_ERRNO +CREATE INDEX idx_id ON t1(id); + +CHECK TABLE t1; + +-- error ER_GET_ERRNO +CREATE INDEX idx_title ON t1(title); + +CHECK TABLE t1; + +-- error ER_GET_ERRNO +CREATE FULLTEXT INDEX fidx_title ON t1(title); + +CHECK TABLE t1; + +-- error ER_GET_ERRNO +ALTER TABLE t1 ADD COLUMN content TEXT; + +CHECK TABLE t1; + +SET SESSION debug="-d,ib_index_build_fail_before_flush"; + +INSERT INTO t1 VALUES(10001, 10001, 'a10000'); + +-- error ER_DUP_ENTRY +ALTER TABLE t1 ADD UNIQUE INDEX idx_title(title); + +CHECK TABLE t1; + +-- error ER_DUP_ENTRY +ALTER TABLE t1 ADD UNIQUE INDEX idx_id(id), ADD UNIQUE INDEX idx_title(title); + +CHECK TABLE t1; + +DROP TABLE t1; + +DROP PROCEDURE populate_t1; diff --git a/mysql-test/suite/innodb/t/innodb_bulk_create_index_replication.test b/mysql-test/suite/innodb/t/innodb_bulk_create_index_replication.test new file mode 100644 index 00000000000..714aabe3b9c --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bulk_create_index_replication.test @@ -0,0 +1,181 @@ +######## suite/innodb/t/innodb_wl7277_1.test ##### +# # +# Testcase for worklog WL#7277: InnoDB: Bulk Load for Create Index # +# The basic idea of bulk load is to build an index from bottom up # +# (also known as sorted index build). # +# Earlier index was create by repeatedly inserting records # +# Test scenario : # +# - Run bulk create index on replication setup # +# - Run bulk create on partitioned table and see its replictaed # +# to slave # +# Creation: # +# 2014-06-19 Implemented this test as part of WL#7277 # +# # +###################################################################### + +--source include/not_embedded.inc +-- source include/have_innodb.inc +-- source include/master-slave.inc + +-- connection master +# Create Insert Procedure +DELIMITER |; +CREATE PROCEDURE populate_t1(load_even INT) +BEGIN + DECLARE i int DEFAULT 1; + + START TRANSACTION; + WHILE (i <= 100) DO + IF i%2 = 0 AND load_even = 1 THEN + INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); + END IF; + IF i%2 != 0 AND load_even != 1 THEN + INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); + END IF; + SET i = i + 1; + END WHILE; + COMMIT; +END| +DELIMITER ;| + +CREATE TABLE t1( + class INT, + id INT, + title VARCHAR(100) +) ENGINE=InnoDB ; + + + + +-- disable_query_log +# Load half records +CALL populate_t1(1); +-- enable_query_log + +SELECT COUNT(*) FROM t1; + +/* Create index. */ +CREATE INDEX idx_id ON t1(id); + +CREATE INDEX idx_title ON t1(title); + + +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE id = 10; +SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE id = 20; +SELECT * FROM t1 WHERE title = 'a20'; + +SELECT * FROM t1 WHERE id = 30; +SELECT * FROM t1 WHERE title = 'a30'; + +SELECT * FROM t1 WHERE id = 101; +SELECT * FROM t1 WHERE title = 'a101'; + +/*Insert/Update/Delete. */ +DELETE FROM t1 WHERE id < 40 AND id > 30; +INSERT INTO t1 VALUES(38, 38, 'b38'); +UPDATE t1 SET title = CONCAT('b', id) WHERE id < 30 AND id > 20; + +SELECT * FROM t1 WHERE id = 28; +SELECT * FROM t1 WHERE title = 'a28'; +SELECT * FROM t1 WHERE title = 'b28'; + +SELECT * FROM t1 WHERE id = 38; +SELECT * FROM t1 WHERE title = 'a38'; +SELECT * FROM t1 WHERE title = 'b38'; + +SELECT * FROM t1 WHERE id = 101; +SELECT * FROM t1 WHERE title = 'a101'; + +-- disable_query_log +# Load half records (follow up load) +CALL populate_t1(0); +-- enable_query_log +SELECT COUNT(*) FROM t1; + + +SELECT * FROM t1 WHERE id = 10; +SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE id = 20; +SELECT * FROM t1 WHERE title = 'a20'; + +SELECT * FROM t1 WHERE id = 30; +SELECT * FROM t1 WHERE title = 'a30'; + +SELECT * FROM t1 WHERE id = 101; +SELECT * FROM t1 WHERE title = 'a101'; + +# Create partition table +CREATE TABLE t_part ( + class INT , + id INT , + title VARCHAR(30) + ) ENGINE=InnoDB + PARTITION BY RANGE(id) + SUBPARTITION BY KEY(id) + SUBPARTITIONS 4 + ( + PARTITION p0 VALUES LESS THAN (5000), + PARTITION p1 VALUES LESS THAN (MAXVALUE) + ); +INSERT INTO t_part SELECT * FROM t1; +ALTER TABLE t_part ADD INDEX `idx` (class,id,title(10)); + +SELECT * FROM t_part WHERE id = 10; +SELECT * FROM t_part WHERE title = 'a10'; + +SELECT * FROM t_part WHERE id = 20; +SELECT * FROM t_part WHERE title = 'a20'; + +SELECT * FROM t_part WHERE id = 30; +SELECT * FROM t_part WHERE title = 'a30'; + +SELECT * FROM t_part WHERE id = 101; +SELECT * FROM t_part WHERE title = 'a101'; + + +--source include/sync_slave_sql_with_master.inc +-- connection slave +SHOW CREATE TABLE t1; +SHOW CREATE TABLE t_part; +SELECT COUNT(*) FROM t1; +SELECT COUNT(*) FROM t_part; + +SELECT * FROM t1 WHERE id = 10; +SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE id = 20; +SELECT * FROM t1 WHERE title = 'a20'; + +SELECT * FROM t1 WHERE id = 30; +SELECT * FROM t1 WHERE title = 'a30'; + +SELECT * FROM t1 WHERE id = 101; +SELECT * FROM t1 WHERE title = 'a101'; + + + +SELECT * FROM t_part WHERE id = 10; +SELECT * FROM t_part WHERE title = 'a10'; + +SELECT * FROM t_part WHERE id = 20; +SELECT * FROM t_part WHERE title = 'a20'; + +SELECT * FROM t_part WHERE id = 30; +SELECT * FROM t_part WHERE title = 'a30'; + +SELECT * FROM t_part WHERE id = 101; +SELECT * FROM t_part WHERE title = 'a101'; + + +-- connection master +DROP PROCEDURE populate_t1; +DROP TABLE t1; +DROP TABLE t_part; +--source include/rpl_end.inc diff --git a/mysql-test/suite/innodb/t/innodb_bulk_create_index_small.test b/mysql-test/suite/innodb/t/innodb_bulk_create_index_small.test new file mode 100644 index 00000000000..76c80f4958d --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bulk_create_index_small.test @@ -0,0 +1,149 @@ +# +# wl#7277: InnoDB: Bulk Load for Create Index +# + +-- source include/have_innodb.inc +-- source include/have_innodb_zip.inc + +# Create Insert Procedure +DELIMITER |; +CREATE PROCEDURE populate_t1() +BEGIN + DECLARE i int DEFAULT 1; + + START TRANSACTION; + WHILE (i <= 1000) DO + INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); + SET i = i + 1; + END WHILE; + COMMIT; +END| +DELIMITER ;| + +SELECT @@innodb_fill_factor; + +# Test Compact Table +CREATE TABLE t1( + class INT, + id INT, + title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPACT; + +-- disable_query_log +CALL populate_t1(); +-- enable_query_log + +SELECT COUNT(*) FROM t1; + +/* Create index. */ +CREATE INDEX idx_id ON t1(id); + +CREATE INDEX idx_title ON t1(title); + +/* Check table. */ +CHECK TABLE t1; + +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE id = 10; +SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE id = 500; +SELECT * FROM t1 WHERE title = 'a500'; + +SELECT * FROM t1 WHERE id = 1000; +SELECT * FROM t1 WHERE title = 'a1000'; + +SELECT * FROM t1 WHERE id = 1010; +SELECT * FROM t1 WHERE title = 'a1010'; + +DROP TABLE t1; + +# Test Blob +CREATE TABLE t1( + a INT PRIMARY KEY, + b TEXT, + c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT; + +INSERT INTO t1 VALUES + (1, REPEAT('a',10000), 'a'), + (2, REPEAT('b',20000), 'b'), + (3, REPEAT('c',40000), 'c'), + (4, REPEAT('d',60000), 'd'); + +ALTER TABLE t1 DROP COLUMN c; + +CHECK TABLE t1; + +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; + +DROP TABLE t1; + +SET GLOBAL innodb_file_per_table=default; + +# Test Compressed Table +SET GLOBAL innodb_file_per_table=1; + +CREATE TABLE t1( + class INT, + id INT, + title VARCHAR(100) +) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; + +-- disable_query_log +CALL populate_t1(); +-- enable_query_log + +SELECT COUNT(*) FROM t1; + +/* Create index. */ +CREATE INDEX idx_id ON t1(id); + +CREATE INDEX idx_title ON t1(title); + +/* Check table. */ +CHECK TABLE t1; + +/* Select by index. */ +EXPLAIN SELECT * FROM t1 WHERE id = 10; +EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE id = 10; +SELECT * FROM t1 WHERE title = 'a10'; + +SELECT * FROM t1 WHERE id = 500; +SELECT * FROM t1 WHERE title = 'a500'; + +SELECT * FROM t1 WHERE id = 1000; +SELECT * FROM t1 WHERE title = 'a1000'; + +SELECT * FROM t1 WHERE id = 1010; +SELECT * FROM t1 WHERE title = 'a1010'; + +DROP TABLE t1; + +# Test Compression & Blob +CREATE TABLE t1( + a INT PRIMARY KEY, + b TEXT, + c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; + +INSERT INTO t1 VALUES + (1, REPEAT('a',10000), 'a'), + (2, REPEAT('b',20000), 'b'), + (3, REPEAT('c',40000), 'c'), + (4, REPEAT('d',60000), 'd'); + +ALTER TABLE t1 DROP COLUMN c; + +CHECK TABLE t1; + +SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; + +DROP TABLE t1; + +SET GLOBAL innodb_file_per_table=default; + +DROP PROCEDURE populate_t1; -- cgit v1.2.1 From f233c9778e91e4087e294fbe62ee32d51add9eba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 20 Nov 2017 13:24:43 +0200 Subject: Adjust the MySQL 5.7 tests for MariaDB 10.2 --- .../suite/innodb/r/innodb_bulk_create_index.result | 72 ++++++++-------------- .../innodb/r/innodb_bulk_create_index_flush.result | 13 ++-- .../r/innodb_bulk_create_index_replication.result | 26 ++++---- .../innodb/r/innodb_bulk_create_index_small.result | 24 +++----- .../suite/innodb/t/innodb_bulk_create_index.test | 3 +- .../innodb/t/innodb_bulk_create_index_debug.test | 2 +- .../innodb/t/innodb_bulk_create_index_flush.test | 13 ++-- .../t/innodb_bulk_create_index_replication.test | 1 + .../innodb/t/innodb_bulk_create_index_small.test | 3 +- 9 files changed, 61 insertions(+), 96 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index.result index 78f0c256d85..ec7ce044cb7 100644 --- a/mysql-test/suite/innodb/r/innodb_bulk_create_index.result +++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index.result @@ -33,15 +33,11 @@ Table Op Msg_type Msg_text test.t1 check status OK /* Select by index. */ EXPLAIN SELECT * FROM t1 WHERE id = 10; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 NULL ref idx_id idx_id 5 const 1 100.00 NULL -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`id` = 10) +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition SELECT * FROM t1 WHERE id = 10; class id title 10 10 a10 @@ -209,15 +205,11 @@ Table Op Msg_type Msg_text test.t1 check status OK /* Select by index. */ EXPLAIN SELECT * FROM t1 WHERE id = 10; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 NULL ref idx_id idx_id 5 const 1 100.00 NULL -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`id` = 10) +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition SELECT * FROM t1 WHERE id = 10; class id title 10 10 a10 @@ -385,15 +377,11 @@ Table Op Msg_type Msg_text test.t1 check status OK /* Select by index. */ EXPLAIN SELECT * FROM t1 WHERE id = 10; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 NULL ref idx_id idx_id 5 const 1 100.00 NULL -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`id` = 10) +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition SELECT * FROM t1 WHERE id = 10; class id title 10 10 a10 @@ -562,15 +550,11 @@ Table Op Msg_type Msg_text test.t1 check status OK /* Select by index. */ EXPLAIN SELECT * FROM t1 WHERE id = 10; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 NULL ref idx_id idx_id 5 const 1 100.00 NULL -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`id` = 10) +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition SELECT * FROM t1 WHERE id = 10; class id title 10 10 a10 @@ -740,15 +724,11 @@ Table Op Msg_type Msg_text test.t1 check status OK /* Select by index. */ EXPLAIN SELECT * FROM t1 WHERE id = 10; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 NULL ref idx_id idx_id 5 const 1 100.00 NULL -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`id` = 10) +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition SELECT * FROM t1 WHERE id = 10; class id title 10 10 a10 @@ -917,15 +897,11 @@ Table Op Msg_type Msg_text test.t1 check status OK /* Select by index. */ EXPLAIN SELECT * FROM t1 WHERE id = 10; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 NULL ref idx_id idx_id 5 const 1 100.00 NULL -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`id` = 10) +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition SELECT * FROM t1 WHERE id = 10; class id title 10 10 a10 diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_flush.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_flush.result index c0120ade42a..c795ee044e6 100644 --- a/mysql-test/suite/innodb/r/innodb_bulk_create_index_flush.result +++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_flush.result @@ -16,28 +16,29 @@ title VARCHAR(100) SELECT COUNT(*) FROM t1; COUNT(*) 10000 -SET SESSION debug="+d,ib_index_build_fail_before_flush"; +SET @saved_dbug= @@SESSION.debug_dbug; +SET debug_dbug='+d,ib_index_build_fail_before_flush'; CREATE INDEX idx_id ON t1(id); -ERROR HY000: Got error 1000 from storage engine +ERROR 70100: Query execution was interrupted CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK CREATE INDEX idx_title ON t1(title); -ERROR HY000: Got error 1000 from storage engine +ERROR 70100: Query execution was interrupted CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK CREATE FULLTEXT INDEX fidx_title ON t1(title); -ERROR HY000: Got error 1000 from storage engine +ERROR 70100: Query execution was interrupted CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK ALTER TABLE t1 ADD COLUMN content TEXT; -ERROR HY000: Got error 1000 from storage engine +ERROR 70100: Query execution was interrupted CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK -SET SESSION debug="-d,ib_index_build_fail_before_flush"; +SET debug_dbug= @saved_dbug; INSERT INTO t1 VALUES(10001, 10001, 'a10000'); ALTER TABLE t1 ADD UNIQUE INDEX idx_title(title); ERROR 23000: Duplicate entry 'a10000' for key 'idx_title' diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result index 4adafa179b4..ae050170b4f 100644 --- a/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result +++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result @@ -1,8 +1,6 @@ include/master-slave.inc -Warnings: -Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. -Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. [connection master] +connection master; CREATE PROCEDURE populate_t1(load_even INT) BEGIN DECLARE i int DEFAULT 1; @@ -31,15 +29,11 @@ CREATE INDEX idx_id ON t1(id); CREATE INDEX idx_title ON t1(title); /* Select by index. */ EXPLAIN SELECT * FROM t1 WHERE id = 10; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 NULL ref idx_id idx_id 5 const 1 100.00 NULL -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`id` = 10) +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition SELECT * FROM t1 WHERE id = 10; class id title 10 10 a10 @@ -148,6 +142,7 @@ class id title SELECT * FROM t_part WHERE title = 'a101'; class id title include/sync_slave_sql_with_master.inc +connection slave; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -165,11 +160,11 @@ t_part CREATE TABLE `t_part` ( `title` varchar(30) DEFAULT NULL, KEY `idx` (`class`,`id`,`title`(10)) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY RANGE (id) -SUBPARTITION BY KEY (id) + PARTITION BY RANGE (`id`) +SUBPARTITION BY KEY (`id`) SUBPARTITIONS 4 -(PARTITION p0 VALUES LESS THAN (5000) ENGINE = InnoDB, - PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ +(PARTITION `p0` VALUES LESS THAN (5000) ENGINE = InnoDB, + PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) SELECT COUNT(*) FROM t1; COUNT(*) 97 @@ -220,6 +215,7 @@ SELECT * FROM t_part WHERE id = 101; class id title SELECT * FROM t_part WHERE title = 'a101'; class id title +connection master; DROP PROCEDURE populate_t1; DROP TABLE t1; DROP TABLE t_part; diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result index db3eacaadc3..b48207d4497 100644 --- a/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result +++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result @@ -28,15 +28,11 @@ Table Op Msg_type Msg_text test.t1 check status OK /* Select by index. */ EXPLAIN SELECT * FROM t1 WHERE id = 10; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 NULL ref idx_id idx_id 5 const 1 100.00 NULL -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`id` = 10) +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition SELECT * FROM t1 WHERE id = 10; class id title 10 10 a10 @@ -95,15 +91,11 @@ Table Op Msg_type Msg_text test.t1 check status OK /* Select by index. */ EXPLAIN SELECT * FROM t1 WHERE id = 10; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 NULL ref idx_id idx_id 5 const 1 100.00 NULL -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`id` = 10) +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_id idx_id 5 const 1 EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition SELECT * FROM t1 WHERE id = 10; class id title 10 10 a10 diff --git a/mysql-test/suite/innodb/t/innodb_bulk_create_index.test b/mysql-test/suite/innodb/t/innodb_bulk_create_index.test index 317f737f7c2..534b4de87f7 100644 --- a/mysql-test/suite/innodb/t/innodb_bulk_create_index.test +++ b/mysql-test/suite/innodb/t/innodb_bulk_create_index.test @@ -14,8 +14,7 @@ ###################################################################### -- source include/not_embedded.inc --- source include/have_innodb.inc --- source include/have_innodb_zip.inc +-- source include/innodb_page_size_small.inc -- source include/big_test.inc # Test Row Format: REDUNDANT. diff --git a/mysql-test/suite/innodb/t/innodb_bulk_create_index_debug.test b/mysql-test/suite/innodb/t/innodb_bulk_create_index_debug.test index ed6dbf238ea..83a12431802 100644 --- a/mysql-test/suite/innodb/t/innodb_bulk_create_index_debug.test +++ b/mysql-test/suite/innodb/t/innodb_bulk_create_index_debug.test @@ -4,7 +4,7 @@ # Test Restart & Crash Recovery. -- source include/big_test.inc --- source include/have_innodb_zip.inc +-- source include/innodb_page_size_small.inc # Test Row Format: REDUNDANT. let $row_format = REDUNDANT; diff --git a/mysql-test/suite/innodb/t/innodb_bulk_create_index_flush.test b/mysql-test/suite/innodb/t/innodb_bulk_create_index_flush.test index 8ae4c5703d5..0cc52b46c20 100644 --- a/mysql-test/suite/innodb/t/innodb_bulk_create_index_flush.test +++ b/mysql-test/suite/innodb/t/innodb_bulk_create_index_flush.test @@ -33,29 +33,30 @@ CALL populate_t1(); SELECT COUNT(*) FROM t1; -SET SESSION debug="+d,ib_index_build_fail_before_flush"; +SET @saved_dbug= @@SESSION.debug_dbug; +SET debug_dbug='+d,ib_index_build_fail_before_flush'; --- error ER_GET_ERRNO +-- error ER_QUERY_INTERRUPTED CREATE INDEX idx_id ON t1(id); CHECK TABLE t1; --- error ER_GET_ERRNO +-- error ER_QUERY_INTERRUPTED CREATE INDEX idx_title ON t1(title); CHECK TABLE t1; --- error ER_GET_ERRNO +-- error ER_QUERY_INTERRUPTED CREATE FULLTEXT INDEX fidx_title ON t1(title); CHECK TABLE t1; --- error ER_GET_ERRNO +-- error ER_QUERY_INTERRUPTED ALTER TABLE t1 ADD COLUMN content TEXT; CHECK TABLE t1; -SET SESSION debug="-d,ib_index_build_fail_before_flush"; +SET debug_dbug= @saved_dbug; INSERT INTO t1 VALUES(10001, 10001, 'a10000'); diff --git a/mysql-test/suite/innodb/t/innodb_bulk_create_index_replication.test b/mysql-test/suite/innodb/t/innodb_bulk_create_index_replication.test index 714aabe3b9c..5b4eaae7557 100644 --- a/mysql-test/suite/innodb/t/innodb_bulk_create_index_replication.test +++ b/mysql-test/suite/innodb/t/innodb_bulk_create_index_replication.test @@ -15,6 +15,7 @@ --source include/not_embedded.inc -- source include/have_innodb.inc +-- source include/have_partition.inc -- source include/master-slave.inc -- connection master diff --git a/mysql-test/suite/innodb/t/innodb_bulk_create_index_small.test b/mysql-test/suite/innodb/t/innodb_bulk_create_index_small.test index 76c80f4958d..d04dd59f7e7 100644 --- a/mysql-test/suite/innodb/t/innodb_bulk_create_index_small.test +++ b/mysql-test/suite/innodb/t/innodb_bulk_create_index_small.test @@ -2,8 +2,7 @@ # wl#7277: InnoDB: Bulk Load for Create Index # --- source include/have_innodb.inc --- source include/have_innodb_zip.inc +-- source include/innodb_page_size_small.inc # Create Insert Procedure DELIMITER |; -- cgit v1.2.1 From 563f1d894bc8c2852f53be8503bce469ede4cbc0 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 21 Nov 2017 16:02:26 +0400 Subject: MDEV-14454 Binary protocol returns wrong collation ID for SP OUT parameters Item_param::set_value() did not set Item::collation and Item_param::str_value_ptr.str_charset properly. So both metadata and data for OUT parameters were sent in a wrong way to the client. This patch removes the old implementation of Item_param::set_value() and rewrites it using Type_handler::Item_param_set_from_value(), so now setting IN and OUT parameters share the a lot of code. 1. Item_param::set_str() now: - accepts two additional parameters fromcs, tocs - sets str_value_ptr, to make sure it's always in sync with str_value, even without Item_param::convert_str_value() - does collation.set(tocs, DERIVATION_COERCIBLE), to make sure that DTCollation is valid even without Item_param::convert_str_value() 2. Item_param::set_value(), which is used to set OUT parameters, now reuses Type_handler::Item_param_set_from_value(). 3. Cleanup: moving Item_param::str_value_ptr to private, as it's not needed outside. 4. Cleanup: adding a new virtual method Settable_routine_parameter::get_item_param() and using it a few new DBUG_ASSERTs, where Item_param cannot appear. After this change: 1. Assigning of IN parameters works as before: a. Item_param::set_str() is called and sets the value as a binary string b. The original value is sent to the query used for binary/general logging c. Item_param::convert_str_value() converts the value from the client character set to the connection character set 2. Assigning of OUT parameters works in the new way: a. Item_param::set_str() and sets the value using the source Item's collation, so both Item::collation and Item_param::str_value_ptr.str_charset are properly set. b. Protocol_binary::send_out_parameters() sends the value to the client correctly: - Protocol::send_result_set_metadata() uses Item::collation.collation (which is now properly set), to detect if conversion is needed, and sends a correct collation ID. - Protocol::send_result_set_row() calls Type_handler::Item_send_str(), which uses Item_param::str_value_ptr.str_charset (which is now properly set) to actually perform the conversion. --- mysql-test/r/ps.result | 30 ++++++++++++++++++++++-------- mysql-test/t/ps.test | 12 ++++++++++++ 2 files changed, 34 insertions(+), 8 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index f1a62d88111..2174293b45b 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -3550,7 +3550,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( - `c1` longblob DEFAULT NULL + `c1` longtext DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT @a, @a = REPEAT('a', 16); @a @a = REPEAT('a', 16) @@ -3568,7 +3568,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( - `c1` longblob DEFAULT NULL + `c1` longtext DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT @a, @a = REPEAT('b', 16); @a @a = REPEAT('b', 16) @@ -3586,7 +3586,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( - `c1` longblob DEFAULT NULL + `c1` longtext DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT @a, @a = REPEAT('c', 16); @a @a = REPEAT('c', 16) @@ -3604,7 +3604,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( - `c1` longblob DEFAULT NULL + `c1` longtext DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT @a, @a = REPEAT('d', 16); @a @a = REPEAT('d', 16) @@ -3622,7 +3622,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( - `c1` longblob DEFAULT NULL + `c1` longtext DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT @a, @a = REPEAT('e', 16); @a @a = REPEAT('e', 16) @@ -3640,7 +3640,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( - `c1` longblob DEFAULT NULL + `c1` longtext DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT @a, @a = REPEAT('f', 16); @a @a = REPEAT('f', 16) @@ -3766,7 +3766,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( - `c1` longblob DEFAULT NULL + `c1` longtext DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT @a, @a = 'aaa'; @a @a = 'aaa' @@ -3784,7 +3784,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; SHOW CREATE TABLE tmp1; Table Create Table tmp1 CREATE TEMPORARY TABLE `tmp1` ( - `c1` longblob DEFAULT NULL + `c1` longtext DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT @a, @a = 'aaa'; @a @a = 'aaa' @@ -5074,3 +5074,17 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; DROP PROCEDURE p1; +# +# MDEV-14454 Binary protocol returns wrong collation ID for SP OUT parameters +# +CREATE PROCEDURE p1(OUT v CHAR(32) CHARACTER SET utf8) SET v='aaa'; +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TABLE t1 AS SELECT @a AS c1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` longtext CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +DROP PROCEDURE p1; diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index a7683b5aae6..139ed1b5e51 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -4529,3 +4529,15 @@ CREATE TABLE t1 AS SELECT @a AS a, @b AS b; SHOW CREATE TABLE t1; DROP TABLE t1; DROP PROCEDURE p1; + +--echo # +--echo # MDEV-14454 Binary protocol returns wrong collation ID for SP OUT parameters +--echo # + +CREATE PROCEDURE p1(OUT v CHAR(32) CHARACTER SET utf8) SET v='aaa'; +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TABLE t1 AS SELECT @a AS c1; +SHOW CREATE TABLE t1; +DROP TABLE t1; +DROP PROCEDURE p1; -- cgit v1.2.1 From 9405fdeb9ee63ad5bb48a16c7ddf2ad66b84087d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 21 Nov 2017 17:52:17 +0200 Subject: MDEV-13201 Assertion `srv_undo_sources || ...` failed on shutdown during DDL operation dict_stats_exec_sql(): Refuse the operation if shutdown has been initiated. The real fix would be to update the persistent statistics as part of the data dictionary transactions. To do this, we should move the storage of InnoDB persistent statistics to the InnoDB data files, and maybe also remove the InnoDB data dictionary. --- mysql-test/suite/innodb/r/truncate_restart.result | 13 +++++++++++++ mysql-test/suite/innodb/t/truncate_restart.test | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 mysql-test/suite/innodb/r/truncate_restart.result create mode 100644 mysql-test/suite/innodb/t/truncate_restart.test (limited to 'mysql-test') diff --git a/mysql-test/suite/innodb/r/truncate_restart.result b/mysql-test/suite/innodb/r/truncate_restart.result new file mode 100644 index 00000000000..169a56a004e --- /dev/null +++ b/mysql-test/suite/innodb/r/truncate_restart.result @@ -0,0 +1,13 @@ +call mtr.add_suppression("InnoDB: Cannot save table statistics for table `test`\\.`t1`: Persistent statistics do not exist"); +SET GLOBAL innodb_stats_persistent= ON; +CREATE TABLE t1 (t TEXT) ENGINE=InnoDB; +connect con1,localhost,root,,test; +SET DEBUG_SYNC='ib_trunc_table_trunc_completing SIGNAL committed WAIT_FOR ever'; +TRUNCATE TABLE t1; +connection default; +SET DEBUG_SYNC='now WAIT_FOR committed'; +disconnect con1; +SELECT COUNT(*) FROM t1; +COUNT(*) +0 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/truncate_restart.test b/mysql-test/suite/innodb/t/truncate_restart.test new file mode 100644 index 00000000000..92f09ac89b1 --- /dev/null +++ b/mysql-test/suite/innodb/t/truncate_restart.test @@ -0,0 +1,18 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +call mtr.add_suppression("InnoDB: Cannot save table statistics for table `test`\\.`t1`: Persistent statistics do not exist"); + +SET GLOBAL innodb_stats_persistent= ON; +CREATE TABLE t1 (t TEXT) ENGINE=InnoDB; +--connect (con1,localhost,root,,test) +SET DEBUG_SYNC='ib_trunc_table_trunc_completing SIGNAL committed WAIT_FOR ever'; +--send +TRUNCATE TABLE t1; +--connection default +SET DEBUG_SYNC='now WAIT_FOR committed'; +--source include/restart_mysqld.inc +--disconnect con1 +SELECT COUNT(*) FROM t1; +DROP TABLE t1; -- cgit v1.2.1 From 375caf99c494a4add7d48d5db3a3ec4b409a256e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 21 Nov 2017 18:53:00 +0200 Subject: Adjust an imported test --- .../include/innodb_bulk_create_index_debug.inc | 4 +- .../innodb/r/innodb_bulk_create_index_debug.result | 48 ++++++++-------------- 2 files changed, 18 insertions(+), 34 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/innodb/include/innodb_bulk_create_index_debug.inc b/mysql-test/suite/innodb/include/innodb_bulk_create_index_debug.inc index 9cfb6182423..48de3a1962d 100644 --- a/mysql-test/suite/innodb/include/innodb_bulk_create_index_debug.inc +++ b/mysql-test/suite/innodb/include/innodb_bulk_create_index_debug.inc @@ -140,7 +140,7 @@ if ($row_format == 'COMPRESSED') CALL populate_t1(); -- enable_query_log -SET SESSION debug="+d,crash_commit_before"; +SET debug_dbug='+d,crash_commit_before'; # Write file to make mysql-test-run.pl start up the server again --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect @@ -194,7 +194,7 @@ INSERT INTO t1 VALUES SELECT CHAR_LENGTH(b) FROM t1; -SET SESSION debug="+d,crash_commit_before"; +SET debug_dbug='+d,crash_commit_before'; # Write file to make mysql-test-run.pl start up the server again --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result index 631b189f107..cd5a3c340da 100644 --- a/mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result +++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result @@ -17,7 +17,6 @@ SELECT COUNT(*) FROM t1; COUNT(*) 10000 CREATE INDEX idx_title ON t1(title); -# restart CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -50,7 +49,6 @@ CHAR_LENGTH(b) 40000 60000 ALTER TABLE t1 DROP COLUMN c; -# restart CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -66,7 +64,7 @@ class INT, id INT, title VARCHAR(100) ) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; -SET SESSION debug="+d,crash_commit_before"; +SET debug_dbug='+d,crash_commit_before'; CREATE INDEX idx_title ON t1(title); ERROR HY000: Lost connection to MySQL server during query SELECT COUNT(*) FROM t1; @@ -76,10 +74,8 @@ CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition SELECT * FROM t1 WHERE title = 'a10'; class id title 10 10 a10 @@ -108,7 +104,7 @@ CHAR_LENGTH(b) 20000 40000 60000 -SET SESSION debug="+d,crash_commit_before"; +SET debug_dbug='+d,crash_commit_before'; ALTER TABLE t1 DROP COLUMN c; ERROR HY000: Lost connection to MySQL server during query CHECK TABLE t1; @@ -141,7 +137,6 @@ SELECT COUNT(*) FROM t1; COUNT(*) 10000 CREATE INDEX idx_title ON t1(title); -# restart CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -174,7 +169,6 @@ CHAR_LENGTH(b) 40000 60000 ALTER TABLE t1 DROP COLUMN c; -# restart CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -190,7 +184,7 @@ class INT, id INT, title VARCHAR(100) ) ENGINE=InnoDB ROW_FORMAT=COMPACT; -SET SESSION debug="+d,crash_commit_before"; +SET debug_dbug='+d,crash_commit_before'; CREATE INDEX idx_title ON t1(title); ERROR HY000: Lost connection to MySQL server during query SELECT COUNT(*) FROM t1; @@ -200,10 +194,8 @@ CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition SELECT * FROM t1 WHERE title = 'a10'; class id title 10 10 a10 @@ -232,7 +224,7 @@ CHAR_LENGTH(b) 20000 40000 60000 -SET SESSION debug="+d,crash_commit_before"; +SET debug_dbug='+d,crash_commit_before'; ALTER TABLE t1 DROP COLUMN c; ERROR HY000: Lost connection to MySQL server during query CHECK TABLE t1; @@ -265,7 +257,6 @@ SELECT COUNT(*) FROM t1; COUNT(*) 10000 CREATE INDEX idx_title ON t1(title); -# restart CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -298,7 +289,6 @@ CHAR_LENGTH(b) 40000 60000 ALTER TABLE t1 DROP COLUMN c; -# restart CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -314,7 +304,7 @@ class INT, id INT, title VARCHAR(100) ) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; -SET SESSION debug="+d,crash_commit_before"; +SET debug_dbug='+d,crash_commit_before'; CREATE INDEX idx_title ON t1(title); ERROR HY000: Lost connection to MySQL server during query SELECT COUNT(*) FROM t1; @@ -324,10 +314,8 @@ CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition SELECT * FROM t1 WHERE title = 'a10'; class id title 10 10 a10 @@ -356,7 +344,7 @@ CHAR_LENGTH(b) 20000 40000 60000 -SET SESSION debug="+d,crash_commit_before"; +SET debug_dbug='+d,crash_commit_before'; ALTER TABLE t1 DROP COLUMN c; ERROR HY000: Lost connection to MySQL server during query CHECK TABLE t1; @@ -390,7 +378,6 @@ SELECT COUNT(*) FROM t1; COUNT(*) 10000 CREATE INDEX idx_title ON t1(title); -# restart CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -424,7 +411,6 @@ CHAR_LENGTH(b) 40000 60000 ALTER TABLE t1 DROP COLUMN c; -# restart CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -441,7 +427,7 @@ class INT, id INT, title VARCHAR(100) ) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; -SET SESSION debug="+d,crash_commit_before"; +SET debug_dbug='+d,crash_commit_before'; CREATE INDEX idx_title ON t1(title); ERROR HY000: Lost connection to MySQL server during query SELECT COUNT(*) FROM t1; @@ -451,10 +437,8 @@ CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition SELECT * FROM t1 WHERE title = 'a10'; class id title 10 10 a10 @@ -484,7 +468,7 @@ CHAR_LENGTH(b) 20000 40000 60000 -SET SESSION debug="+d,crash_commit_before"; +SET debug_dbug='+d,crash_commit_before'; ALTER TABLE t1 DROP COLUMN c; ERROR HY000: Lost connection to MySQL server during query CHECK TABLE t1; -- cgit v1.2.1 From 5dd505b70995baf2db9baaa6bf971eb3495a04ad Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 20 Nov 2017 15:03:44 +0100 Subject: MDEV-14428 main.cte_nonrecursive failed in --embedded move the privilege related test to main.cte_grant --- mysql-test/r/cte_grant.result | 58 ++++++++++++++++++++++++++++++++++++ mysql-test/r/cte_nonrecursive.result | 58 ------------------------------------ mysql-test/t/cte_grant.test | 53 +++++++++++++++++++++++++++++++- mysql-test/t/cte_nonrecursive.test | 51 ------------------------------- 4 files changed, 110 insertions(+), 110 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/cte_grant.result b/mysql-test/r/cte_grant.result index 1282a98fdef..2ee31be3435 100644 --- a/mysql-test/r/cte_grant.result +++ b/mysql-test/r/cte_grant.result @@ -63,3 +63,61 @@ connection root; revoke all privileges on mysqltest.v1 from mysqltest_1@localhost; drop user mysqltest_1@localhost; drop database mysqltest; +# +# MDEV-13453: privileges checking for CTE +# +create database db; +use db; +create table t1 (i int); +insert into t1 +values (3), (7), (1), (4), (2), (3), (1); +create table t2 (a int, b int); +insert into t2 +values (3,10), (7,11), (1,17), (4,15), (2,11), (3,10), (1,15); +create user foo@localhost; +grant SELECT on db.t1 to foo@localhost; +grant SELECT(a) on db.t2 to foo@localhost; +connect con1,localhost,foo,,; +use db; +with cte as (select * from t1 where i < 4) +select * from cte; +i +3 +1 +2 +3 +1 +with cte as (select * from t1 where i < 4 group by i) +select * from cte; +i +1 +2 +3 +with cte as (select * from t1 where i < 4) +select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2; +i +1 +3 +with cte as (select * from t1 where i < 4 group by i) +select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2; +i +1 +3 +with cte as (select b from t2 where a < 4) +select * from cte cte1 where b < 15 union select * from cte cte2 where b > 15; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'b' in table 't2' +with cte as (select a from t2 where a < 4) +select * from cte cte1 where a < 2 union select * from cte cte2 where a > 2; +a +1 +3 +connection default; +revoke SELECT on db.t1 from foo@localhost; +connection con1; +with cte as (select * from t1 where i < 4) +select * from cte; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1' +disconnect con1; +connection default; +drop database db; +drop user foo@localhost; diff --git a/mysql-test/r/cte_nonrecursive.result b/mysql-test/r/cte_nonrecursive.result index 21a1fa3164f..ebe1aae1e8f 100644 --- a/mysql-test/r/cte_nonrecursive.result +++ b/mysql-test/r/cte_nonrecursive.result @@ -1147,61 +1147,3 @@ SELECT * FROM cte_test; a 1 DROP VIEW cte_test; -# -# MDEV-13453: privileges checking for CTE -# -create database db; -use db; -create table t1 (i int); -insert into t1 -values (3), (7), (1), (4), (2), (3), (1); -create table t2 (a int, b int); -insert into t2 -values (3,10), (7,11), (1,17), (4,15), (2,11), (3,10), (1,15); -create user foo@localhost; -grant SELECT on db.t1 to foo@localhost; -grant SELECT(a) on db.t2 to foo@localhost; -connect con1,localhost,foo,,; -use db; -with cte as (select * from t1 where i < 4) -select * from cte; -i -3 -1 -2 -3 -1 -with cte as (select * from t1 where i < 4 group by i) -select * from cte; -i -1 -2 -3 -with cte as (select * from t1 where i < 4) -select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2; -i -1 -3 -with cte as (select * from t1 where i < 4 group by i) -select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2; -i -1 -3 -with cte as (select b from t2 where a < 4) -select * from cte cte1 where b < 15 union select * from cte cte2 where b > 15; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'b' in table 't2' -with cte as (select a from t2 where a < 4) -select * from cte cte1 where a < 2 union select * from cte cte2 where a > 2; -a -1 -3 -connection default; -revoke SELECT on db.t1 from foo@localhost; -connection con1; -with cte as (select * from t1 where i < 4) -select * from cte; -ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1' -disconnect con1; -connection default; -drop database db; -drop user foo@localhost; diff --git a/mysql-test/t/cte_grant.test b/mysql-test/t/cte_grant.test index 44fd4a0bc6e..c6627c05829 100644 --- a/mysql-test/t/cte_grant.test +++ b/mysql-test/t/cte_grant.test @@ -76,4 +76,55 @@ select * from mysqltest.v3; connection root; revoke all privileges on mysqltest.v1 from mysqltest_1@localhost; drop user mysqltest_1@localhost; -drop database mysqltest; \ No newline at end of file +drop database mysqltest; + +--echo # +--echo # MDEV-13453: privileges checking for CTE +--echo # + +create database db; +use db; +create table t1 (i int); +insert into t1 + values (3), (7), (1), (4), (2), (3), (1); + +create table t2 (a int, b int); +insert into t2 + values (3,10), (7,11), (1,17), (4,15), (2,11), (3,10), (1,15); + +create user foo@localhost; +grant SELECT on db.t1 to foo@localhost; +grant SELECT(a) on db.t2 to foo@localhost; + +--connect (con1,localhost,foo,,) +use db; +with cte as (select * from t1 where i < 4) + select * from cte; +with cte as (select * from t1 where i < 4 group by i) + select * from cte; +with cte as (select * from t1 where i < 4) + select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2; +with cte as (select * from t1 where i < 4 group by i) + select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2; + +--error ER_COLUMNACCESS_DENIED_ERROR +with cte as (select b from t2 where a < 4) + select * from cte cte1 where b < 15 union select * from cte cte2 where b > 15; +with cte as (select a from t2 where a < 4) + select * from cte cte1 where a < 2 union select * from cte cte2 where a > 2; + +--connection default +revoke SELECT on db.t1 from foo@localhost; + +--connection con1 + +--error ER_TABLEACCESS_DENIED_ERROR +with cte as (select * from t1 where i < 4) + select * from cte; + +# Cleanup +--disconnect con1 + +--connection default +drop database db; +drop user foo@localhost; diff --git a/mysql-test/t/cte_nonrecursive.test b/mysql-test/t/cte_nonrecursive.test index 03e6e298fa8..742e8f6e4d7 100644 --- a/mysql-test/t/cte_nonrecursive.test +++ b/mysql-test/t/cte_nonrecursive.test @@ -790,54 +790,3 @@ SHOW CREATE VIEW cte_test; SELECT * FROM cte_test; DROP VIEW cte_test; - ---echo # ---echo # MDEV-13453: privileges checking for CTE ---echo # - -create database db; -use db; -create table t1 (i int); -insert into t1 - values (3), (7), (1), (4), (2), (3), (1); - -create table t2 (a int, b int); -insert into t2 - values (3,10), (7,11), (1,17), (4,15), (2,11), (3,10), (1,15); - -create user foo@localhost; -grant SELECT on db.t1 to foo@localhost; -grant SELECT(a) on db.t2 to foo@localhost; - ---connect (con1,localhost,foo,,) -use db; -with cte as (select * from t1 where i < 4) - select * from cte; -with cte as (select * from t1 where i < 4 group by i) - select * from cte; -with cte as (select * from t1 where i < 4) - select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2; -with cte as (select * from t1 where i < 4 group by i) - select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2; - ---error ER_COLUMNACCESS_DENIED_ERROR -with cte as (select b from t2 where a < 4) - select * from cte cte1 where b < 15 union select * from cte cte2 where b > 15; -with cte as (select a from t2 where a < 4) - select * from cte cte1 where a < 2 union select * from cte cte2 where a > 2; - ---connection default -revoke SELECT on db.t1 from foo@localhost; - ---connection con1 - ---error ER_TABLEACCESS_DENIED_ERROR -with cte as (select * from t1 where i < 4) - select * from cte; - -# Cleanup ---disconnect con1 - ---connection default -drop database db; -drop user foo@localhost; -- cgit v1.2.1 From a18f6009e3227d6c781fafd93a002767ae5b2425 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 22 Nov 2017 11:38:29 +0400 Subject: A cleanup for MDEV-12846 sql_mode=ORACLE: using Oracle-style placeholders in direct query execution makes the server crash Fixing a test failure in "mtr --ps compat/oracle.ps" caused by "SELECT ?" returning different errors: - CR_PARAMS_NOT_BOUND in prepared execution - ER_PARSE_ERROR in direct execution Disabling PS protocol for this test chunk. --- mysql-test/suite/compat/oracle/t/ps.test | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/suite/compat/oracle/t/ps.test b/mysql-test/suite/compat/oracle/t/ps.test index d5a325d526f..357b50e0eab 100644 --- a/mysql-test/suite/compat/oracle/t/ps.test +++ b/mysql-test/suite/compat/oracle/t/ps.test @@ -270,6 +270,10 @@ DROP PROCEDURE p1; --echo # MDEV-12846 sql_mode=ORACLE: using Oracle-style placeholders in direct query execution makes the server crash --echo # +# When running with --ps, the below queries return +# CR_PARAMS_NOT_BOUND instead of ER_PARSE_ERROR + +--disable_ps_protocol --error ER_PARSE_ERROR SELECT ? FROM DUAL; --error ER_PARSE_ERROR @@ -283,3 +287,4 @@ SELECT 1+? FROM DUAL; SELECT 1+:a FROM DUAL; --error ER_PARSE_ERROR SELECT 1+:1 FROM DUAL; +--enable_ps_protocol -- cgit v1.2.1 From f8bc799a89b97e278c08822e71b74043c0c578d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 23 Nov 2017 07:47:19 +0200 Subject: Import WL#6658 update_time tests from MySQL 5.7 --- mysql-test/suite/innodb/r/update_time.result | 53 ++++ .../suite/innodb/r/update_time_wl6658.result | 301 +++++++++++++++++++ mysql-test/suite/innodb/t/update_time-master.opt | 1 + mysql-test/suite/innodb/t/update_time.test | 79 +++++ mysql-test/suite/innodb/t/update_time_wl6658.test | 330 +++++++++++++++++++++ 5 files changed, 764 insertions(+) create mode 100644 mysql-test/suite/innodb/r/update_time.result create mode 100644 mysql-test/suite/innodb/r/update_time_wl6658.result create mode 100644 mysql-test/suite/innodb/t/update_time-master.opt create mode 100644 mysql-test/suite/innodb/t/update_time.test create mode 100644 mysql-test/suite/innodb/t/update_time_wl6658.test (limited to 'mysql-test') diff --git a/mysql-test/suite/innodb/r/update_time.result b/mysql-test/suite/innodb/r/update_time.result new file mode 100644 index 00000000000..0c6fc672dae --- /dev/null +++ b/mysql-test/suite/innodb/r/update_time.result @@ -0,0 +1,53 @@ +# +# Test that INFORMATION_SCHEMA.TABLES.UPDATE_TIME is filled +# correctly for InnoDB tables. +# +CREATE TABLE t (a INT) ENGINE=INNODB; +SELECT update_time FROM information_schema.tables WHERE table_name = 't'; +update_time +NULL +INSERT INTO t VALUES (1); +SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' +AND update_time IS NOT NULL; +COUNT(*) +1 +# We cant deterministically check that the saved value is correct, but +# at least we check that it is a timestamp not older than 2 minutes. +# Usually update_time and NOW() are equal below, but on heavily loaded +# machines NOW() could be younger. +SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' +AND TIMESTAMPDIFF(SECOND, update_time, NOW()) < 120; +COUNT(*) +1 +CREATE TABLE big (a TEXT) ENGINE=INNODB; +SELECT COUNT(*) FROM information_schema.innodb_buffer_page +WHERE table_name = '`test`.`t`'; +COUNT(*) +1 +# INSERT lots of data in table 'big': begin +# INSERT lots of data in table 'big': end +SELECT COUNT(*) FROM information_schema.innodb_buffer_page +WHERE table_name = '`test`.`t`'; +COUNT(*) +0 +SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' +AND update_time IS NOT NULL; +COUNT(*) +1 +DROP TABLE big; +# Test the behavior after restart with a prepared XA transaction +XA START 'xatrx'; +INSERT INTO t VALUES (5); +XA END 'xatrx'; +XA PREPARE 'xatrx'; +call mtr.add_suppression("Found 1 prepared XA transactions"); +# Kill and restart +SELECT update_time FROM information_schema.tables WHERE table_name = 't'; +update_time +NULL +XA COMMIT 'xatrx'; +SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' +AND update_time IS NOT NULL; +COUNT(*) +1 +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/update_time_wl6658.result b/mysql-test/suite/innodb/r/update_time_wl6658.result new file mode 100644 index 00000000000..ae02e7b487c --- /dev/null +++ b/mysql-test/suite/innodb/r/update_time_wl6658.result @@ -0,0 +1,301 @@ +#create base table +CREATE TABLE tab1(c1 int,c2 varchar(30), c3 BLOB) ENGINE=InnoDB; +CREATE TABLE tab3(c1 int,c2 varchar(30)) ENGINE=InnoDB; +CREATE TABLE tab4(c1 int,c2 varchar(30)) ENGINE=InnoDB; +CREATE TABLE tab5(c1 int,c2 varchar(30)) ENGINE=InnoDB; +#insert some base records +INSERT INTO tab4 VALUES(1,'Test for Update'); +INSERT INTO tab5 VALUES(1,'Test for Delete'); +#create a trigger +CREATE TRIGGER test_trig BEFORE INSERT ON tab1 +FOR EACH ROW BEGIN +INSERT INTO tab3 VALUES(1,'Inserted From Trigger'); +UPDATE tab4 SET c2='Updated from Trigger' WHERE c1=1; +DELETE FROM tab5; +END | +#restart the server +# restart +check the update_time Before DML, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables +WHERE table_name IN ('tab1','tab3','tab4','tab5'); +table_name update_time +tab1 NULL +tab3 NULL +tab4 NULL +tab5 NULL +SET AUTOCOMMIT=OFF; +#case1: +BEGIN WORK; +INSERT INTO tab1 +VALUES(1,'Testing the wl6658', 'Testing the wl6658'); +check the update_time Before commit, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab1'; +table_name update_time +tab1 NULL +COMMIT; +#check the record is inserted +SELECT * FROM tab1; +c1 c2 c3 +1 Testing the wl6658 Testing the wl6658 +#check the record is inserted +SELECT * FROM tab3; +c1 c2 +1 Inserted From Trigger +#check the record is updated +SELECT * FROM tab4; +c1 c2 +1 Updated from Trigger +#check no record exists +SELECT * FROM tab5; +c1 c2 +check the update_time After Commit, whether it is not NULL +SELECT table_name,COUNT(update_time) +FROM information_schema.tables +WHERE table_name IN ('tab1','tab3','tab4','tab5') +GROUP BY table_name; +table_name COUNT(update_time) +tab1 1 +tab3 1 +tab4 1 +tab5 1 +#restart the server +# restart +Testcase with UPDATE stmt and transaction +#check the record is existing +SELECT * FROM tab1; +c1 c2 c3 +1 Testing the wl6658 Testing the wl6658 +check the update_time Before DML, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab1'; +table_name update_time +tab1 NULL +SET AUTOCOMMIT=OFF; +#case2: +START TRANSACTION; +UPDATE tab1 SET c2='Updated',c3='Updated' WHERE c1=1; +check the update_time Before commit, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab1'; +table_name update_time +tab1 NULL +COMMIT; +#check the record is updated +SELECT * FROM tab1; +c1 c2 c3 +1 Updated Updated +check the update_time After Commit, whether it is not NULL +SELECT table_name,COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab1'; +table_name COUNT(update_time) +tab1 1 +#restart the server +# restart +#check the record is existing +SELECT * FROM tab1; +c1 c2 c3 +1 Updated Updated +check the update_time Before DML, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab1'; +table_name update_time +tab1 NULL +SET AUTOCOMMIT=OFF; +#case3: +START TRANSACTION; +DELETE FROM tab1; +check the update_time Before commit, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab1'; +table_name update_time +tab1 NULL +COMMIT; +#check the record is deleted +SELECT * FROM tab1; +c1 c2 c3 +check the update_time After Commit, whether it is not NULL +SELECT table_name,COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab1'; +table_name COUNT(update_time) +tab1 1 +#restart the server +# restart +#check no records are existing +SELECT * FROM tab1; +c1 c2 c3 +check the update_time Before DML, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab1'; +table_name update_time +tab1 NULL +SET AUTOCOMMIT=OFF; +#case4: +START TRANSACTION; +INSERT INTO tab1 +VALUES(1,'Testing the wl6658', 'Testing the wl6658'); +check the update_time Before Rollback, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab1'; +table_name update_time +tab1 NULL +ROLLBACK; +#check no record is inserted. +SELECT * FROM tab1; +c1 c2 c3 +check the update_time After Rollback, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab1'; +table_name update_time +tab1 NULL +CREATE TABLE tab2( +id INT NOT NULL, +store_name VARCHAR(30), +parts VARCHAR(30), +store_id INT +) ENGINE=InnoDB +PARTITION BY LIST(store_id) ( +PARTITION pNorth VALUES IN (10,20,30), +PARTITION pEast VALUES IN (40,50,60), +PARTITION pWest VALUES IN (70,80,100) +); +check the update_time Before DML, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab2'; +table_name update_time +tab2 NULL +#case5: +#create proc with DML +CREATE PROCEDURE proc_wl6658() +BEGIN +INSERT INTO tab2 VALUES(1,'ORACLE','NUTT',10); +INSERT INTO tab2 VALUES(2,'HUAWEI','BOLT',40); +COMMIT; +END | +CALL proc_wl6658; +#check the records are inserted +SELECT * FROM tab2 ORDER BY id,store_id; +id store_name parts store_id +1 ORACLE NUTT 10 +2 HUAWEI BOLT 40 +check the update_time After Commit, whether it is not NULL +SELECT table_name,COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab2'; +table_name COUNT(update_time) +tab2 1 +#delete all records +TRUNCATE TABLE tab2; +#restart the server +# restart +#case6: +SET AUTOCOMMIT=off; +BEGIN WORK; +INSERT INTO tab2 VALUES(1,'Oracle','NUTT',10); +SAVEPOINT A; +INSERT INTO tab2 VALUES(2,'HUAWEI','BOLT',40); +SAVEPOINT B; +INSERT INTO tab2 VALUES(3,'IBM','NAIL',70); +SAVEPOINT C; +ROLLBACK to A; +#check 1 record is inserted +SELECT * FROM tab2; +id store_name parts store_id +1 Oracle NUTT 10 +check the update_time Before DML, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab2'; +table_name update_time +tab2 NULL +#execute DDL instead of commit +create table tab6(c1 int); +check the update_time After Commit, whether it is not NULL +SELECT table_name,COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab2'; +table_name COUNT(update_time) +tab2 1 +#case7: +#create some base tables +set the flag to default +SET AUTOCOMMIT=Default; +CREATE TABLE tab7(c1 INT NOT NULL, PRIMARY KEY (c1)) ENGINE=INNODB; +CREATE TABLE tab8(c1 INT PRIMARY KEY,c2 INT, +FOREIGN KEY (c2) REFERENCES tab7(c1) ON DELETE CASCADE ) +ENGINE=INNODB; +check the update_time Before DML, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab7'; +table_name update_time +tab7 NULL +check the update_time Before DML, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab8'; +table_name update_time +tab8 NULL +INSERT INTO tab7 VALUES(1); +INSERT INTO tab8 VALUES(1,1); +#check the record is inserted +SELECT * FROM tab7; +c1 +1 +#check the record is inserted +SELECT * FROM tab8; +c1 c2 +1 1 +check the update_time After Autocommit, whether it is not NULL +SELECT table_name,COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab7'; +table_name COUNT(update_time) +tab7 1 +check the update_time After Autocommit, whether it is not NULL +SELECT table_name,COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab8'; +table_name COUNT(update_time) +tab8 1 +#restart the server +# restart +SET AUTOCOMMIT=off; +START TRANSACTION; +DELETE FROM tab7; +ROLLBACK; +#check record exist +SELECT * FROM tab7; +c1 +1 +#check record exist +SELECT * FROM tab8; +c1 c2 +1 1 +check the update_time After Rollback, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab7'; +table_name update_time +tab7 NULL +check the update_time After Rollback, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab8'; +table_name update_time +tab8 NULL +START TRANSACTION; +DELETE FROM tab7; +COMMIT; +#check no record exist +SELECT * FROM tab7; +c1 +#check no record exist +SELECT * FROM tab8; +c1 c2 +check the update_time After Commit, whether it is not NULL +SELECT table_name,COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab7'; +table_name COUNT(update_time) +tab7 1 +check the update_time After Commit, whether it is not NULL +SELECT table_name,COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab8'; +table_name COUNT(update_time) +tab8 1 +#cleanup +DROP TRIGGER test_trig; +DROP TABLE tab1,tab2,tab3,tab4,tab5,tab6,tab8,tab7; +DROP PROCEDURE proc_wl6658; diff --git a/mysql-test/suite/innodb/t/update_time-master.opt b/mysql-test/suite/innodb/t/update_time-master.opt new file mode 100644 index 00000000000..9f283a9503f --- /dev/null +++ b/mysql-test/suite/innodb/t/update_time-master.opt @@ -0,0 +1 @@ +--innodb-buffer-pool-size=10M diff --git a/mysql-test/suite/innodb/t/update_time.test b/mysql-test/suite/innodb/t/update_time.test new file mode 100644 index 00000000000..922fd40325f --- /dev/null +++ b/mysql-test/suite/innodb/t/update_time.test @@ -0,0 +1,79 @@ +################################################################### +-- echo # +-- echo # Test that INFORMATION_SCHEMA.TABLES.UPDATE_TIME is filled +-- echo # correctly for InnoDB tables. +-- echo # + +-- source include/have_innodb.inc +-- source include/have_innodb_max_16k.inc +# restart does not work with embedded +-- source include/not_embedded.inc + +CREATE TABLE t (a INT) ENGINE=INNODB; + +SELECT update_time FROM information_schema.tables WHERE table_name = 't'; + +INSERT INTO t VALUES (1); + +SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' +AND update_time IS NOT NULL; + +-- echo # We cant deterministically check that the saved value is correct, but +-- echo # at least we check that it is a timestamp not older than 2 minutes. +-- echo # Usually update_time and NOW() are equal below, but on heavily loaded +-- echo # machines NOW() could be younger. +SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' +AND TIMESTAMPDIFF(SECOND, update_time, NOW()) < 120; + +CREATE TABLE big (a TEXT) ENGINE=INNODB; + +SELECT COUNT(*) FROM information_schema.innodb_buffer_page +WHERE table_name = '`test`.`t`'; + +# evict table 't' by inserting as much data as the BP size itself +-- echo # INSERT lots of data in table 'big': begin +-- disable_query_log +BEGIN; +-- let $i = 10240 +while ($i) +{ + INSERT INTO big VALUES (REPEAT('a', 1024)); + dec $i; +} +COMMIT; +-- enable_query_log +-- echo # INSERT lots of data in table 'big': end + +# confirm that table 't' has been evicted +SELECT COUNT(*) FROM information_schema.innodb_buffer_page +WHERE table_name = '`test`.`t`'; + +# The result from this query will change once update_time becomes persistent +# (WL#6917). +SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' +AND update_time IS NOT NULL; + +DROP TABLE big; + +-- echo # Test the behavior after restart with a prepared XA transaction + +XA START 'xatrx'; +INSERT INTO t VALUES (5); +XA END 'xatrx'; +XA PREPARE 'xatrx'; + +CONNECT (con1,localhost,root,,); +CONNECTION con1; + +call mtr.add_suppression("Found 1 prepared XA transactions"); + +--source include/kill_and_restart_mysqld.inc + +SELECT update_time FROM information_schema.tables WHERE table_name = 't'; + +XA COMMIT 'xatrx'; + +SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' +AND update_time IS NOT NULL; + +DROP TABLE t; diff --git a/mysql-test/suite/innodb/t/update_time_wl6658.test b/mysql-test/suite/innodb/t/update_time_wl6658.test new file mode 100644 index 00000000000..e796b6aabe5 --- /dev/null +++ b/mysql-test/suite/innodb/t/update_time_wl6658.test @@ -0,0 +1,330 @@ +################################################################### +#Testing functionality of the WL6658 +#case1: when autocommit off begin work with INSERT with Triggers +#case2: when autocommit off begin transaction with UPDATE +#case3: when autocommit off begin transaction with DELETE +#case4: when autocommit off Rollback & INSERT +#case5: when autocommit off with partition table and procedures +#case6: when autocommit off with SAVEPOINTs & DDL +#case7: when autocommit off pk-fk with ON DELETE CASCADE +################################################################### +--source include/no_valgrind_without_big.inc +--source include/have_innodb.inc +--source include/not_embedded.inc + +--echo #create base table +CREATE TABLE tab1(c1 int,c2 varchar(30), c3 BLOB) ENGINE=InnoDB; +CREATE TABLE tab3(c1 int,c2 varchar(30)) ENGINE=InnoDB; +CREATE TABLE tab4(c1 int,c2 varchar(30)) ENGINE=InnoDB; +CREATE TABLE tab5(c1 int,c2 varchar(30)) ENGINE=InnoDB; + +--echo #insert some base records +INSERT INTO tab4 VALUES(1,'Test for Update'); +INSERT INTO tab5 VALUES(1,'Test for Delete'); + +delimiter |; + +--echo #create a trigger +CREATE TRIGGER test_trig BEFORE INSERT ON tab1 +FOR EACH ROW BEGIN + INSERT INTO tab3 VALUES(1,'Inserted From Trigger'); + UPDATE tab4 SET c2='Updated from Trigger' WHERE c1=1; + DELETE FROM tab5; +END | + +delimiter ;| + +--echo #restart the server +--source include/restart_mysqld.inc + +--echo check the update_time Before DML, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables +WHERE table_name IN ('tab1','tab3','tab4','tab5'); + +SET AUTOCOMMIT=OFF; + +--echo #case1: + +BEGIN WORK; + +INSERT INTO tab1 +VALUES(1,'Testing the wl6658', 'Testing the wl6658'); + +--echo check the update_time Before commit, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab1'; + +COMMIT; + +--echo #check the record is inserted +SELECT * FROM tab1; + +--echo #check the record is inserted +SELECT * FROM tab3; + +--echo #check the record is updated +SELECT * FROM tab4; + +--echo #check no record exists +SELECT * FROM tab5; + +--echo check the update_time After Commit, whether it is not NULL +--sorted_result +SELECT table_name,COUNT(update_time) +FROM information_schema.tables +WHERE table_name IN ('tab1','tab3','tab4','tab5') +GROUP BY table_name; + +--echo #restart the server +--source include/restart_mysqld.inc + +--echo Testcase with UPDATE stmt and transaction + +--echo #check the record is existing +SELECT * FROM tab1; + +--echo check the update_time Before DML, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab1'; + +SET AUTOCOMMIT=OFF; + +--echo #case2: +START TRANSACTION; + +UPDATE tab1 SET c2='Updated',c3='Updated' WHERE c1=1; + +--echo check the update_time Before commit, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab1'; + +COMMIT; + +--echo #check the record is updated +SELECT * FROM tab1; + +--echo check the update_time After Commit, whether it is not NULL +SELECT table_name,COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab1'; + +--echo #restart the server +--source include/restart_mysqld.inc + +--echo #check the record is existing +SELECT * FROM tab1; + +--echo check the update_time Before DML, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab1'; + +SET AUTOCOMMIT=OFF; + +--echo #case3: +START TRANSACTION; + +DELETE FROM tab1; + +--echo check the update_time Before commit, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab1'; + +COMMIT; + +--echo #check the record is deleted +SELECT * FROM tab1; + +--echo check the update_time After Commit, whether it is not NULL +SELECT table_name,COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab1'; + +--echo #restart the server +--source include/restart_mysqld.inc + +--echo #check no records are existing +SELECT * FROM tab1; + +--echo check the update_time Before DML, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab1'; + +SET AUTOCOMMIT=OFF; + +--echo #case4: +START TRANSACTION; + +INSERT INTO tab1 +VALUES(1,'Testing the wl6658', 'Testing the wl6658'); + +--echo check the update_time Before Rollback, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab1'; + +ROLLBACK; + +--echo #check no record is inserted. +SELECT * FROM tab1; + +--echo check the update_time After Rollback, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab1'; + +CREATE TABLE tab2( + id INT NOT NULL, + store_name VARCHAR(30), + parts VARCHAR(30), + store_id INT +) ENGINE=InnoDB +PARTITION BY LIST(store_id) ( + PARTITION pNorth VALUES IN (10,20,30), + PARTITION pEast VALUES IN (40,50,60), + PARTITION pWest VALUES IN (70,80,100) +); + +--echo check the update_time Before DML, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab2'; + +--echo #case5: + +delimiter |; + +--echo #create proc with DML +CREATE PROCEDURE proc_wl6658() +BEGIN +INSERT INTO tab2 VALUES(1,'ORACLE','NUTT',10); +INSERT INTO tab2 VALUES(2,'HUAWEI','BOLT',40); +COMMIT; +END | + +delimiter ;| + +CALL proc_wl6658; + +--echo #check the records are inserted +SELECT * FROM tab2 ORDER BY id,store_id; + +--echo check the update_time After Commit, whether it is not NULL +SELECT table_name,COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab2'; + +--echo #delete all records +TRUNCATE TABLE tab2; + +--echo #restart the server +--source include/restart_mysqld.inc + +--echo #case6: + +SET AUTOCOMMIT=off; + +BEGIN WORK; +INSERT INTO tab2 VALUES(1,'Oracle','NUTT',10); +SAVEPOINT A; +INSERT INTO tab2 VALUES(2,'HUAWEI','BOLT',40); +SAVEPOINT B; +INSERT INTO tab2 VALUES(3,'IBM','NAIL',70); +SAVEPOINT C; +ROLLBACK to A; + +--echo #check 1 record is inserted +SELECT * FROM tab2; + +--echo check the update_time Before DML, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab2'; + +--echo #execute DDL instead of commit +create table tab6(c1 int); + +--echo check the update_time After Commit, whether it is not NULL +SELECT table_name,COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab2'; + +--echo #case7: +--echo #create some base tables + +--echo set the flag to default +SET AUTOCOMMIT=Default; + +CREATE TABLE tab7(c1 INT NOT NULL, PRIMARY KEY (c1)) ENGINE=INNODB; + +CREATE TABLE tab8(c1 INT PRIMARY KEY,c2 INT, +FOREIGN KEY (c2) REFERENCES tab7(c1) ON DELETE CASCADE ) +ENGINE=INNODB; + +--echo check the update_time Before DML, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab7'; + +--echo check the update_time Before DML, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab8'; + +INSERT INTO tab7 VALUES(1); + +INSERT INTO tab8 VALUES(1,1); + +--echo #check the record is inserted +SELECT * FROM tab7; + +--echo #check the record is inserted +SELECT * FROM tab8; + +--echo check the update_time After Autocommit, whether it is not NULL +SELECT table_name,COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab7'; + +--echo check the update_time After Autocommit, whether it is not NULL +SELECT table_name,COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab8'; + +--echo #restart the server +--source include/restart_mysqld.inc + +SET AUTOCOMMIT=off; + +START TRANSACTION; + +DELETE FROM tab7; + +ROLLBACK; + +--echo #check record exist +SELECT * FROM tab7; + +--echo #check record exist +SELECT * FROM tab8; + +--echo check the update_time After Rollback, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab7'; + +--echo check the update_time After Rollback, whether it is NULL +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name='tab8'; + +START TRANSACTION; + +DELETE FROM tab7; + +COMMIT; + +--echo #check no record exist +SELECT * FROM tab7; + +--echo #check no record exist +SELECT * FROM tab8; + +--echo check the update_time After Commit, whether it is not NULL +SELECT table_name,COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab7'; + +--echo check the update_time After Commit, whether it is not NULL +SELECT table_name,COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab8'; + +--echo #cleanup +DROP TRIGGER test_trig; +DROP TABLE tab1,tab2,tab3,tab4,tab5,tab6,tab8,tab7; +DROP PROCEDURE proc_wl6658; -- cgit v1.2.1 From 187a5bbf28a599c95ad69ceec2a992cd08c7800c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 23 Nov 2017 08:54:33 +0200 Subject: Adjust the tests for MariaDB, and optimize them --- mysql-test/suite/innodb/r/update_time.result | 11 +- .../suite/innodb/r/update_time_wl6658.result | 317 ++++++++------------- mysql-test/suite/innodb/t/update_time.test | 11 +- mysql-test/suite/innodb/t/update_time_wl6658.test | 313 +++++++------------- 4 files changed, 240 insertions(+), 412 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/innodb/r/update_time.result b/mysql-test/suite/innodb/r/update_time.result index 0c6fc672dae..ab3eeb08dc7 100644 --- a/mysql-test/suite/innodb/r/update_time.result +++ b/mysql-test/suite/innodb/r/update_time.result @@ -19,7 +19,7 @@ SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' AND TIMESTAMPDIFF(SECOND, update_time, NOW()) < 120; COUNT(*) 1 -CREATE TABLE big (a TEXT) ENGINE=INNODB; +CREATE TEMPORARY TABLE big (a TEXT) ENGINE=INNODB; SELECT COUNT(*) FROM information_schema.innodb_buffer_page WHERE table_name = '`test`.`t`'; COUNT(*) @@ -34,20 +34,21 @@ SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' AND update_time IS NOT NULL; COUNT(*) 1 -DROP TABLE big; +DROP TEMPORARY TABLE big; # Test the behavior after restart with a prepared XA transaction XA START 'xatrx'; INSERT INTO t VALUES (5); XA END 'xatrx'; XA PREPARE 'xatrx'; +CONNECT con1,localhost,root,,; call mtr.add_suppression("Found 1 prepared XA transactions"); +FLUSH TABLES; # Kill and restart SELECT update_time FROM information_schema.tables WHERE table_name = 't'; update_time NULL XA COMMIT 'xatrx'; -SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' -AND update_time IS NOT NULL; -COUNT(*) +SELECT COUNT(update_time) FROM information_schema.tables WHERE table_name='t'; +COUNT(update_time) 1 DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/update_time_wl6658.result b/mysql-test/suite/innodb/r/update_time_wl6658.result index ae02e7b487c..9c069478ace 100644 --- a/mysql-test/suite/innodb/r/update_time_wl6658.result +++ b/mysql-test/suite/innodb/r/update_time_wl6658.result @@ -1,195 +1,180 @@ -#create base table CREATE TABLE tab1(c1 int,c2 varchar(30), c3 BLOB) ENGINE=InnoDB; +CREATE TABLE tab1u LIKE tab1; +CREATE TABLE tab1d LIKE tab1; +CREATE TABLE tab1i LIKE tab1; CREATE TABLE tab3(c1 int,c2 varchar(30)) ENGINE=InnoDB; CREATE TABLE tab4(c1 int,c2 varchar(30)) ENGINE=InnoDB; CREATE TABLE tab5(c1 int,c2 varchar(30)) ENGINE=InnoDB; -#insert some base records +INSERT INTO tab1u VALUES(1,'Testing the wl6658','Testing the wl6658'); +INSERT INTO tab1d VALUES(1,'Updated','Updated'); INSERT INTO tab4 VALUES(1,'Test for Update'); INSERT INTO tab5 VALUES(1,'Test for Delete'); -#create a trigger CREATE TRIGGER test_trig BEFORE INSERT ON tab1 FOR EACH ROW BEGIN INSERT INTO tab3 VALUES(1,'Inserted From Trigger'); UPDATE tab4 SET c2='Updated from Trigger' WHERE c1=1; DELETE FROM tab5; END | +CREATE TABLE tab2( +id INT NOT NULL, +store_name VARCHAR(30), +parts VARCHAR(30), +store_id INT +) ENGINE=InnoDB +PARTITION BY LIST(store_id) ( +PARTITION pNorth VALUES IN (10,20,30), +PARTITION pEast VALUES IN (40,50,60), +PARTITION pWest VALUES IN (70,80,100) +); +SELECT update_time +FROM information_schema.tables WHERE table_name='tab2'; +update_time +NULL +CREATE PROCEDURE proc_wl6658() +BEGIN +INSERT INTO tab2 VALUES(1,'ORACLE','NUTT',10); +INSERT INTO tab2 VALUES(2,'HUAWEI','BOLT',40); +COMMIT; +END | +CALL proc_wl6658; +SELECT * FROM tab2 ORDER BY id,store_id; +id store_name parts store_id +1 ORACLE NUTT 10 +2 HUAWEI BOLT 40 +SELECT COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab2'; +COUNT(update_time) +1 +TRUNCATE TABLE tab2; +SELECT COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab2'; +COUNT(update_time) +1 +CREATE TABLE tab7(c1 INT NOT NULL, PRIMARY KEY (c1)) ENGINE=INNODB; +CREATE TABLE tab8(c1 INT PRIMARY KEY,c2 INT, +FOREIGN KEY (c2) REFERENCES tab7(c1) ON DELETE CASCADE ) +ENGINE=INNODB; +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name IN ('tab7','tab8') +GROUP BY table_name ORDER BY table_name; +table_name update_time +tab7 NULL +tab8 NULL +INSERT INTO tab7 VALUES(1); +INSERT INTO tab8 VALUES(1,1); +SELECT table_name,COUNT(update_time) +FROM information_schema.tables WHERE table_name IN ('tab7','tab8') +GROUP BY table_name ORDER BY table_name; +table_name COUNT(update_time) +tab7 1 +tab8 1 #restart the server -# restart -check the update_time Before DML, whether it is NULL SELECT table_name,update_time FROM information_schema.tables -WHERE table_name IN ('tab1','tab3','tab4','tab5'); +WHERE table_name IN ('tab1','tab2','tab3','tab4','tab5','tab7','tab8') +ORDER BY table_name; table_name update_time tab1 NULL +tab2 NULL tab3 NULL tab4 NULL tab5 NULL -SET AUTOCOMMIT=OFF; +tab7 NULL +tab8 NULL #case1: BEGIN WORK; INSERT INTO tab1 VALUES(1,'Testing the wl6658', 'Testing the wl6658'); -check the update_time Before commit, whether it is NULL -SELECT table_name,update_time +SELECT update_time FROM information_schema.tables WHERE table_name='tab1'; -table_name update_time -tab1 NULL +update_time +NULL COMMIT; -#check the record is inserted SELECT * FROM tab1; c1 c2 c3 1 Testing the wl6658 Testing the wl6658 -#check the record is inserted SELECT * FROM tab3; c1 c2 1 Inserted From Trigger -#check the record is updated SELECT * FROM tab4; c1 c2 1 Updated from Trigger -#check no record exists SELECT * FROM tab5; c1 c2 -check the update_time After Commit, whether it is not NULL SELECT table_name,COUNT(update_time) FROM information_schema.tables WHERE table_name IN ('tab1','tab3','tab4','tab5') -GROUP BY table_name; +GROUP BY table_name ORDER BY table_name; table_name COUNT(update_time) tab1 1 tab3 1 tab4 1 tab5 1 -#restart the server -# restart Testcase with UPDATE stmt and transaction -#check the record is existing -SELECT * FROM tab1; +SELECT * FROM tab1u; c1 c2 c3 1 Testing the wl6658 Testing the wl6658 -check the update_time Before DML, whether it is NULL -SELECT table_name,update_time -FROM information_schema.tables WHERE table_name='tab1'; -table_name update_time -tab1 NULL -SET AUTOCOMMIT=OFF; +SELECT update_time +FROM information_schema.tables WHERE table_name='tab1u'; +update_time +NULL #case2: START TRANSACTION; -UPDATE tab1 SET c2='Updated',c3='Updated' WHERE c1=1; -check the update_time Before commit, whether it is NULL -SELECT table_name,update_time -FROM information_schema.tables WHERE table_name='tab1'; -table_name update_time -tab1 NULL +UPDATE tab1u SET c2='Updated',c3='Updated' WHERE c1=1; +SELECT update_time +FROM information_schema.tables WHERE table_name='tab1u'; +update_time +NULL COMMIT; -#check the record is updated -SELECT * FROM tab1; +SELECT * FROM tab1u; c1 c2 c3 1 Updated Updated -check the update_time After Commit, whether it is not NULL -SELECT table_name,COUNT(update_time) -FROM information_schema.tables WHERE table_name='tab1'; -table_name COUNT(update_time) -tab1 1 -#restart the server -# restart -#check the record is existing -SELECT * FROM tab1; +SELECT COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab1u'; +COUNT(update_time) +1 +SELECT * FROM tab1d; c1 c2 c3 1 Updated Updated -check the update_time Before DML, whether it is NULL -SELECT table_name,update_time -FROM information_schema.tables WHERE table_name='tab1'; -table_name update_time -tab1 NULL -SET AUTOCOMMIT=OFF; +SELECT update_time +FROM information_schema.tables WHERE table_name='tab1d'; +update_time +NULL #case3: START TRANSACTION; -DELETE FROM tab1; -check the update_time Before commit, whether it is NULL -SELECT table_name,update_time -FROM information_schema.tables WHERE table_name='tab1'; -table_name update_time -tab1 NULL +DELETE FROM tab1d; +SELECT update_time +FROM information_schema.tables WHERE table_name='tab1d'; +update_time +NULL COMMIT; -#check the record is deleted -SELECT * FROM tab1; +SELECT * FROM tab1d; c1 c2 c3 -check the update_time After Commit, whether it is not NULL -SELECT table_name,COUNT(update_time) -FROM information_schema.tables WHERE table_name='tab1'; -table_name COUNT(update_time) -tab1 1 -#restart the server -# restart -#check no records are existing -SELECT * FROM tab1; +SELECT COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab1d'; +COUNT(update_time) +1 +SELECT * FROM tab1i; c1 c2 c3 -check the update_time Before DML, whether it is NULL -SELECT table_name,update_time -FROM information_schema.tables WHERE table_name='tab1'; -table_name update_time -tab1 NULL -SET AUTOCOMMIT=OFF; +SELECT update_time +FROM information_schema.tables WHERE table_name='tab1i'; +update_time +NULL #case4: START TRANSACTION; -INSERT INTO tab1 +INSERT INTO tab1i VALUES(1,'Testing the wl6658', 'Testing the wl6658'); -check the update_time Before Rollback, whether it is NULL -SELECT table_name,update_time -FROM information_schema.tables WHERE table_name='tab1'; -table_name update_time -tab1 NULL +SELECT update_time +FROM information_schema.tables WHERE table_name='tab1i'; +update_time +NULL ROLLBACK; -#check no record is inserted. -SELECT * FROM tab1; +SELECT * FROM tab1i; c1 c2 c3 -check the update_time After Rollback, whether it is NULL -SELECT table_name,update_time -FROM information_schema.tables WHERE table_name='tab1'; -table_name update_time -tab1 NULL -CREATE TABLE tab2( -id INT NOT NULL, -store_name VARCHAR(30), -parts VARCHAR(30), -store_id INT -) ENGINE=InnoDB -PARTITION BY LIST(store_id) ( -PARTITION pNorth VALUES IN (10,20,30), -PARTITION pEast VALUES IN (40,50,60), -PARTITION pWest VALUES IN (70,80,100) -); -check the update_time Before DML, whether it is NULL -SELECT table_name,update_time -FROM information_schema.tables WHERE table_name='tab2'; -table_name update_time -tab2 NULL -#case5: -#create proc with DML -CREATE PROCEDURE proc_wl6658() -BEGIN -INSERT INTO tab2 VALUES(1,'ORACLE','NUTT',10); -INSERT INTO tab2 VALUES(2,'HUAWEI','BOLT',40); -COMMIT; -END | -CALL proc_wl6658; -#check the records are inserted -SELECT * FROM tab2 ORDER BY id,store_id; -id store_name parts store_id -1 ORACLE NUTT 10 -2 HUAWEI BOLT 40 -check the update_time After Commit, whether it is not NULL -SELECT table_name,COUNT(update_time) -FROM information_schema.tables WHERE table_name='tab2'; -table_name COUNT(update_time) -tab2 1 -#delete all records -TRUNCATE TABLE tab2; -#restart the server -# restart -#case6: -SET AUTOCOMMIT=off; +SELECT update_time +FROM information_schema.tables WHERE table_name='tab1i'; +update_time +NULL BEGIN WORK; INSERT INTO tab2 VALUES(1,'Oracle','NUTT',10); SAVEPOINT A; @@ -198,104 +183,46 @@ SAVEPOINT B; INSERT INTO tab2 VALUES(3,'IBM','NAIL',70); SAVEPOINT C; ROLLBACK to A; -#check 1 record is inserted SELECT * FROM tab2; id store_name parts store_id 1 Oracle NUTT 10 -check the update_time Before DML, whether it is NULL -SELECT table_name,update_time +SELECT update_time FROM information_schema.tables WHERE table_name='tab2'; -table_name update_time -tab2 NULL +update_time +NULL #execute DDL instead of commit create table tab6(c1 int); -check the update_time After Commit, whether it is not NULL -SELECT table_name,COUNT(update_time) +SELECT COUNT(update_time) FROM information_schema.tables WHERE table_name='tab2'; -table_name COUNT(update_time) -tab2 1 -#case7: -#create some base tables -set the flag to default -SET AUTOCOMMIT=Default; -CREATE TABLE tab7(c1 INT NOT NULL, PRIMARY KEY (c1)) ENGINE=INNODB; -CREATE TABLE tab8(c1 INT PRIMARY KEY,c2 INT, -FOREIGN KEY (c2) REFERENCES tab7(c1) ON DELETE CASCADE ) -ENGINE=INNODB; -check the update_time Before DML, whether it is NULL -SELECT table_name,update_time -FROM information_schema.tables WHERE table_name='tab7'; -table_name update_time -tab7 NULL -check the update_time Before DML, whether it is NULL -SELECT table_name,update_time -FROM information_schema.tables WHERE table_name='tab8'; -table_name update_time -tab8 NULL -INSERT INTO tab7 VALUES(1); -INSERT INTO tab8 VALUES(1,1); -#check the record is inserted -SELECT * FROM tab7; -c1 +COUNT(update_time) 1 -#check the record is inserted -SELECT * FROM tab8; -c1 c2 -1 1 -check the update_time After Autocommit, whether it is not NULL -SELECT table_name,COUNT(update_time) -FROM information_schema.tables WHERE table_name='tab7'; -table_name COUNT(update_time) -tab7 1 -check the update_time After Autocommit, whether it is not NULL -SELECT table_name,COUNT(update_time) -FROM information_schema.tables WHERE table_name='tab8'; -table_name COUNT(update_time) -tab8 1 -#restart the server -# restart -SET AUTOCOMMIT=off; START TRANSACTION; DELETE FROM tab7; ROLLBACK; -#check record exist SELECT * FROM tab7; c1 1 -#check record exist SELECT * FROM tab8; c1 c2 1 1 -check the update_time After Rollback, whether it is NULL SELECT table_name,update_time -FROM information_schema.tables WHERE table_name='tab7'; +FROM information_schema.tables WHERE table_name IN ('tab7','tab8') +GROUP BY table_name ORDER BY table_name; table_name update_time tab7 NULL -check the update_time After Rollback, whether it is NULL -SELECT table_name,update_time -FROM information_schema.tables WHERE table_name='tab8'; -table_name update_time tab8 NULL -START TRANSACTION; DELETE FROM tab7; -COMMIT; -#check no record exist SELECT * FROM tab7; c1 -#check no record exist SELECT * FROM tab8; c1 c2 -check the update_time After Commit, whether it is not NULL SELECT table_name,COUNT(update_time) -FROM information_schema.tables WHERE table_name='tab7'; +FROM information_schema.tables WHERE table_name IN ('tab7','tab8') +GROUP BY table_name ORDER BY table_name; table_name COUNT(update_time) tab7 1 -check the update_time After Commit, whether it is not NULL -SELECT table_name,COUNT(update_time) -FROM information_schema.tables WHERE table_name='tab8'; -table_name COUNT(update_time) tab8 1 #cleanup DROP TRIGGER test_trig; -DROP TABLE tab1,tab2,tab3,tab4,tab5,tab6,tab8,tab7; +DROP TABLE tab1,tab1u,tab1d,tab1i,tab2,tab3,tab4,tab5,tab6,tab8,tab7; DROP PROCEDURE proc_wl6658; diff --git a/mysql-test/suite/innodb/t/update_time.test b/mysql-test/suite/innodb/t/update_time.test index 922fd40325f..e2213c5d9b7 100644 --- a/mysql-test/suite/innodb/t/update_time.test +++ b/mysql-test/suite/innodb/t/update_time.test @@ -25,7 +25,7 @@ AND update_time IS NOT NULL; SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' AND TIMESTAMPDIFF(SECOND, update_time, NOW()) < 120; -CREATE TABLE big (a TEXT) ENGINE=INNODB; +CREATE TEMPORARY TABLE big (a TEXT) ENGINE=INNODB; SELECT COUNT(*) FROM information_schema.innodb_buffer_page WHERE table_name = '`test`.`t`'; @@ -44,7 +44,7 @@ COMMIT; -- enable_query_log -- echo # INSERT lots of data in table 'big': end -# confirm that table 't' has been evicted +# confirm that all pages for table 't' have been evicted SELECT COUNT(*) FROM information_schema.innodb_buffer_page WHERE table_name = '`test`.`t`'; @@ -53,7 +53,7 @@ WHERE table_name = '`test`.`t`'; SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' AND update_time IS NOT NULL; -DROP TABLE big; +DROP TEMPORARY TABLE big; -- echo # Test the behavior after restart with a prepared XA transaction @@ -63,9 +63,9 @@ XA END 'xatrx'; XA PREPARE 'xatrx'; CONNECT (con1,localhost,root,,); -CONNECTION con1; call mtr.add_suppression("Found 1 prepared XA transactions"); +FLUSH TABLES; --source include/kill_and_restart_mysqld.inc @@ -73,7 +73,6 @@ SELECT update_time FROM information_schema.tables WHERE table_name = 't'; XA COMMIT 'xatrx'; -SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' -AND update_time IS NOT NULL; +SELECT COUNT(update_time) FROM information_schema.tables WHERE table_name='t'; DROP TABLE t; diff --git a/mysql-test/suite/innodb/t/update_time_wl6658.test b/mysql-test/suite/innodb/t/update_time_wl6658.test index e796b6aabe5..0b2b94ae2a9 100644 --- a/mysql-test/suite/innodb/t/update_time_wl6658.test +++ b/mysql-test/suite/innodb/t/update_time_wl6658.test @@ -1,30 +1,33 @@ ################################################################### #Testing functionality of the WL6658 -#case1: when autocommit off begin work with INSERT with Triggers -#case2: when autocommit off begin transaction with UPDATE -#case3: when autocommit off begin transaction with DELETE -#case4: when autocommit off Rollback & INSERT -#case5: when autocommit off with partition table and procedures -#case6: when autocommit off with SAVEPOINTs & DDL -#case7: when autocommit off pk-fk with ON DELETE CASCADE +#case1: begin work with INSERT with Triggers +#case2: (tab1u) begin transaction with UPDATE +#case3: (tab1d) begin transaction with DELETE +#case4: (tab1i) Rollback & INSERT +#case5: (tab2) partitioned table and procedures +#case6: (tab2) SAVEPOINT +#case7: (tab7,tab8) pk-fk with ON DELETE CASCADE ################################################################### --source include/no_valgrind_without_big.inc --source include/have_innodb.inc +--source include/have_partition.inc --source include/not_embedded.inc ---echo #create base table CREATE TABLE tab1(c1 int,c2 varchar(30), c3 BLOB) ENGINE=InnoDB; +CREATE TABLE tab1u LIKE tab1; +CREATE TABLE tab1d LIKE tab1; +CREATE TABLE tab1i LIKE tab1; CREATE TABLE tab3(c1 int,c2 varchar(30)) ENGINE=InnoDB; CREATE TABLE tab4(c1 int,c2 varchar(30)) ENGINE=InnoDB; CREATE TABLE tab5(c1 int,c2 varchar(30)) ENGINE=InnoDB; ---echo #insert some base records +INSERT INTO tab1u VALUES(1,'Testing the wl6658','Testing the wl6658'); +INSERT INTO tab1d VALUES(1,'Updated','Updated'); INSERT INTO tab4 VALUES(1,'Test for Update'); INSERT INTO tab5 VALUES(1,'Test for Delete'); delimiter |; ---echo #create a trigger CREATE TRIGGER test_trig BEFORE INSERT ON tab1 FOR EACH ROW BEGIN INSERT INTO tab3 VALUES(1,'Inserted From Trigger'); @@ -34,15 +37,69 @@ END | delimiter ;| +CREATE TABLE tab2( + id INT NOT NULL, + store_name VARCHAR(30), + parts VARCHAR(30), + store_id INT +) ENGINE=InnoDB +PARTITION BY LIST(store_id) ( + PARTITION pNorth VALUES IN (10,20,30), + PARTITION pEast VALUES IN (40,50,60), + PARTITION pWest VALUES IN (70,80,100) +); + +SELECT update_time +FROM information_schema.tables WHERE table_name='tab2'; + +delimiter |; + +CREATE PROCEDURE proc_wl6658() +BEGIN +INSERT INTO tab2 VALUES(1,'ORACLE','NUTT',10); +INSERT INTO tab2 VALUES(2,'HUAWEI','BOLT',40); +COMMIT; +END | + +delimiter ;| + +CALL proc_wl6658; + +SELECT * FROM tab2 ORDER BY id,store_id; + +SELECT COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab2'; + +TRUNCATE TABLE tab2; + +SELECT COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab2'; + +CREATE TABLE tab7(c1 INT NOT NULL, PRIMARY KEY (c1)) ENGINE=INNODB; + +CREATE TABLE tab8(c1 INT PRIMARY KEY,c2 INT, +FOREIGN KEY (c2) REFERENCES tab7(c1) ON DELETE CASCADE ) +ENGINE=INNODB; + +SELECT table_name,update_time +FROM information_schema.tables WHERE table_name IN ('tab7','tab8') +GROUP BY table_name ORDER BY table_name; + +INSERT INTO tab7 VALUES(1); + +INSERT INTO tab8 VALUES(1,1); + +SELECT table_name,COUNT(update_time) +FROM information_schema.tables WHERE table_name IN ('tab7','tab8') +GROUP BY table_name ORDER BY table_name; + --echo #restart the server --source include/restart_mysqld.inc ---echo check the update_time Before DML, whether it is NULL SELECT table_name,update_time FROM information_schema.tables -WHERE table_name IN ('tab1','tab3','tab4','tab5'); - -SET AUTOCOMMIT=OFF; +WHERE table_name IN ('tab1','tab2','tab3','tab4','tab5','tab7','tab8') +ORDER BY table_name; --echo #case1: @@ -51,172 +108,83 @@ BEGIN WORK; INSERT INTO tab1 VALUES(1,'Testing the wl6658', 'Testing the wl6658'); ---echo check the update_time Before commit, whether it is NULL -SELECT table_name,update_time +SELECT update_time FROM information_schema.tables WHERE table_name='tab1'; COMMIT; ---echo #check the record is inserted SELECT * FROM tab1; - ---echo #check the record is inserted SELECT * FROM tab3; - ---echo #check the record is updated SELECT * FROM tab4; - ---echo #check no record exists SELECT * FROM tab5; ---echo check the update_time After Commit, whether it is not NULL ---sorted_result SELECT table_name,COUNT(update_time) FROM information_schema.tables WHERE table_name IN ('tab1','tab3','tab4','tab5') -GROUP BY table_name; - ---echo #restart the server ---source include/restart_mysqld.inc +GROUP BY table_name ORDER BY table_name; --echo Testcase with UPDATE stmt and transaction ---echo #check the record is existing -SELECT * FROM tab1; - ---echo check the update_time Before DML, whether it is NULL -SELECT table_name,update_time -FROM information_schema.tables WHERE table_name='tab1'; +SELECT * FROM tab1u; -SET AUTOCOMMIT=OFF; +SELECT update_time +FROM information_schema.tables WHERE table_name='tab1u'; --echo #case2: START TRANSACTION; -UPDATE tab1 SET c2='Updated',c3='Updated' WHERE c1=1; +UPDATE tab1u SET c2='Updated',c3='Updated' WHERE c1=1; ---echo check the update_time Before commit, whether it is NULL -SELECT table_name,update_time -FROM information_schema.tables WHERE table_name='tab1'; +SELECT update_time +FROM information_schema.tables WHERE table_name='tab1u'; COMMIT; ---echo #check the record is updated -SELECT * FROM tab1; - ---echo check the update_time After Commit, whether it is not NULL -SELECT table_name,COUNT(update_time) -FROM information_schema.tables WHERE table_name='tab1'; - ---echo #restart the server ---source include/restart_mysqld.inc +SELECT * FROM tab1u; ---echo #check the record is existing -SELECT * FROM tab1; +SELECT COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab1u'; ---echo check the update_time Before DML, whether it is NULL -SELECT table_name,update_time -FROM information_schema.tables WHERE table_name='tab1'; +SELECT * FROM tab1d; -SET AUTOCOMMIT=OFF; +SELECT update_time +FROM information_schema.tables WHERE table_name='tab1d'; --echo #case3: START TRANSACTION; -DELETE FROM tab1; +DELETE FROM tab1d; ---echo check the update_time Before commit, whether it is NULL -SELECT table_name,update_time -FROM information_schema.tables WHERE table_name='tab1'; +SELECT update_time +FROM information_schema.tables WHERE table_name='tab1d'; COMMIT; ---echo #check the record is deleted -SELECT * FROM tab1; - ---echo check the update_time After Commit, whether it is not NULL -SELECT table_name,COUNT(update_time) -FROM information_schema.tables WHERE table_name='tab1'; +SELECT * FROM tab1d; ---echo #restart the server ---source include/restart_mysqld.inc +SELECT COUNT(update_time) +FROM information_schema.tables WHERE table_name='tab1d'; ---echo #check no records are existing -SELECT * FROM tab1; +SELECT * FROM tab1i; ---echo check the update_time Before DML, whether it is NULL -SELECT table_name,update_time -FROM information_schema.tables WHERE table_name='tab1'; - -SET AUTOCOMMIT=OFF; +SELECT update_time +FROM information_schema.tables WHERE table_name='tab1i'; --echo #case4: START TRANSACTION; -INSERT INTO tab1 +INSERT INTO tab1i VALUES(1,'Testing the wl6658', 'Testing the wl6658'); ---echo check the update_time Before Rollback, whether it is NULL -SELECT table_name,update_time -FROM information_schema.tables WHERE table_name='tab1'; +SELECT update_time +FROM information_schema.tables WHERE table_name='tab1i'; ROLLBACK; ---echo #check no record is inserted. -SELECT * FROM tab1; - ---echo check the update_time After Rollback, whether it is NULL -SELECT table_name,update_time -FROM information_schema.tables WHERE table_name='tab1'; - -CREATE TABLE tab2( - id INT NOT NULL, - store_name VARCHAR(30), - parts VARCHAR(30), - store_id INT -) ENGINE=InnoDB -PARTITION BY LIST(store_id) ( - PARTITION pNorth VALUES IN (10,20,30), - PARTITION pEast VALUES IN (40,50,60), - PARTITION pWest VALUES IN (70,80,100) -); - ---echo check the update_time Before DML, whether it is NULL -SELECT table_name,update_time -FROM information_schema.tables WHERE table_name='tab2'; - ---echo #case5: - -delimiter |; - ---echo #create proc with DML -CREATE PROCEDURE proc_wl6658() -BEGIN -INSERT INTO tab2 VALUES(1,'ORACLE','NUTT',10); -INSERT INTO tab2 VALUES(2,'HUAWEI','BOLT',40); -COMMIT; -END | - -delimiter ;| - -CALL proc_wl6658; - ---echo #check the records are inserted -SELECT * FROM tab2 ORDER BY id,store_id; - ---echo check the update_time After Commit, whether it is not NULL -SELECT table_name,COUNT(update_time) -FROM information_schema.tables WHERE table_name='tab2'; - ---echo #delete all records -TRUNCATE TABLE tab2; - ---echo #restart the server ---source include/restart_mysqld.inc - ---echo #case6: +SELECT * FROM tab1i; -SET AUTOCOMMIT=off; +SELECT update_time +FROM information_schema.tables WHERE table_name='tab1i'; BEGIN WORK; INSERT INTO tab2 VALUES(1,'Oracle','NUTT',10); @@ -227,104 +195,37 @@ INSERT INTO tab2 VALUES(3,'IBM','NAIL',70); SAVEPOINT C; ROLLBACK to A; ---echo #check 1 record is inserted SELECT * FROM tab2; ---echo check the update_time Before DML, whether it is NULL -SELECT table_name,update_time +SELECT update_time FROM information_schema.tables WHERE table_name='tab2'; --echo #execute DDL instead of commit create table tab6(c1 int); ---echo check the update_time After Commit, whether it is not NULL -SELECT table_name,COUNT(update_time) +SELECT COUNT(update_time) FROM information_schema.tables WHERE table_name='tab2'; ---echo #case7: ---echo #create some base tables - ---echo set the flag to default -SET AUTOCOMMIT=Default; - -CREATE TABLE tab7(c1 INT NOT NULL, PRIMARY KEY (c1)) ENGINE=INNODB; - -CREATE TABLE tab8(c1 INT PRIMARY KEY,c2 INT, -FOREIGN KEY (c2) REFERENCES tab7(c1) ON DELETE CASCADE ) -ENGINE=INNODB; - ---echo check the update_time Before DML, whether it is NULL -SELECT table_name,update_time -FROM information_schema.tables WHERE table_name='tab7'; - ---echo check the update_time Before DML, whether it is NULL -SELECT table_name,update_time -FROM information_schema.tables WHERE table_name='tab8'; - -INSERT INTO tab7 VALUES(1); - -INSERT INTO tab8 VALUES(1,1); - ---echo #check the record is inserted -SELECT * FROM tab7; - ---echo #check the record is inserted -SELECT * FROM tab8; - ---echo check the update_time After Autocommit, whether it is not NULL -SELECT table_name,COUNT(update_time) -FROM information_schema.tables WHERE table_name='tab7'; - ---echo check the update_time After Autocommit, whether it is not NULL -SELECT table_name,COUNT(update_time) -FROM information_schema.tables WHERE table_name='tab8'; - ---echo #restart the server ---source include/restart_mysqld.inc - -SET AUTOCOMMIT=off; - START TRANSACTION; - DELETE FROM tab7; - ROLLBACK; ---echo #check record exist SELECT * FROM tab7; - ---echo #check record exist SELECT * FROM tab8; ---echo check the update_time After Rollback, whether it is NULL SELECT table_name,update_time -FROM information_schema.tables WHERE table_name='tab7'; - ---echo check the update_time After Rollback, whether it is NULL -SELECT table_name,update_time -FROM information_schema.tables WHERE table_name='tab8'; - -START TRANSACTION; +FROM information_schema.tables WHERE table_name IN ('tab7','tab8') +GROUP BY table_name ORDER BY table_name; DELETE FROM tab7; - -COMMIT; - ---echo #check no record exist SELECT * FROM tab7; - ---echo #check no record exist SELECT * FROM tab8; ---echo check the update_time After Commit, whether it is not NULL -SELECT table_name,COUNT(update_time) -FROM information_schema.tables WHERE table_name='tab7'; - ---echo check the update_time After Commit, whether it is not NULL SELECT table_name,COUNT(update_time) -FROM information_schema.tables WHERE table_name='tab8'; +FROM information_schema.tables WHERE table_name IN ('tab7','tab8') +GROUP BY table_name ORDER BY table_name; --echo #cleanup DROP TRIGGER test_trig; -DROP TABLE tab1,tab2,tab3,tab4,tab5,tab6,tab8,tab7; +DROP TABLE tab1,tab1u,tab1d,tab1i,tab2,tab3,tab4,tab5,tab6,tab8,tab7; DROP PROCEDURE proc_wl6658; -- cgit v1.2.1 From c666ca7b1b61fd924bf10efec4e60c8a06e4fc46 Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Thu, 23 Nov 2017 22:10:31 +0200 Subject: MDEV-12012. Post-push attempt to catch failure in rpl_gtid_delete_domain failing on P8. The test is made more verbose. --- .../suite/rpl/r/rpl_gtid_delete_domain.result | 39 ++++++++++++++++++++++ mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test | 5 ++- 2 files changed, 43 insertions(+), 1 deletion(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result b/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result index 52e7cb93bec..75a22b78a32 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result @@ -24,8 +24,47 @@ connection master; FLUSH BINARY LOGS; PURGE BINARY LOGS TO 'master-bin.000002';; FLUSH BINARY LOGS DELETE_DOMAIN_ID=(11); +SELECT @@global.gtid_binlog_pos, @@global.gtid_binlog_state; +@@global.gtid_binlog_pos @@global.gtid_binlog_state +0-1-1 0-1-1 connection slave; +SELECT @@global.gtid_slave_pos; +@@global.gtid_slave_pos +0-1-1,11-111-2 include/start_slave.inc +==== BEGIN include/start_slave.inc ==== + con='slave' warn='1' qlog='1' rlog='1' aborterr='1' +START SLAVE; +.==== BEGIN include/wait_for_slave_to_start.inc ==== +. con='slave' warn='1' qlog='1' rlog='1' aborterr='1' +..==== BEGIN include/wait_for_slave_io_to_start.inc ==== +.. con='slave' warn='1' qlog='1' rlog='1' aborterr='1' +...==== BEGIN include/wait_for_slave_param.inc [Slave_IO_Running] ==== +... con='slave' warn='1' qlog='1' rlog='1' aborterr='1' +Waiting until 'Slave_IO_Running' = 'Yes' [timeout='300', $slave_error_param='Last_IO_Errno'] +[connection slave] +...==== END include/wait_for_slave_param.inc [Slave_IO_Running] ==== +... con='slave' warn='1' qlog='1' rlog='1' aborterr='1' +[connection slave] +..==== END include/wait_for_slave_io_to_start.inc ==== +.. con='slave' warn='1' qlog='1' rlog='1' aborterr='1' +..==== BEGIN include/wait_for_slave_sql_to_start.inc ==== +.. con='slave' warn='1' qlog='1' rlog='1' aborterr='1' +...==== BEGIN include/wait_for_slave_param.inc [Slave_SQL_Running] ==== +... con='slave' warn='1' qlog='1' rlog='1' aborterr='1' +Waiting until 'Slave_SQL_Running' = 'Yes' [timeout='300', $slave_error_param='1'] +[connection slave] +...==== END include/wait_for_slave_param.inc [Slave_SQL_Running] ==== +... con='slave' warn='1' qlog='1' rlog='1' aborterr='1' +[connection slave] +..==== END include/wait_for_slave_sql_to_start.inc ==== +.. con='slave' warn='1' qlog='1' rlog='1' aborterr='1' +[connection slave] +.==== END include/wait_for_slave_to_start.inc ==== +. con='slave' warn='1' qlog='1' rlog='1' aborterr='1' +[connection slave] +==== END include/start_slave.inc ==== + con='slave' warn='1' qlog='1' rlog='1' aborterr='1' connection master; INSERT INTO t SET a=1; connection slave; diff --git a/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test b/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test index 5abedd7eb37..622e66c5263 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test @@ -56,10 +56,13 @@ FLUSH BINARY LOGS; --eval PURGE BINARY LOGS TO '$purge_to_binlog'; # with final removal of the extra domain --eval FLUSH BINARY LOGS DELETE_DOMAIN_ID=($extra_domain_id) - +SELECT @@global.gtid_binlog_pos, @@global.gtid_binlog_state; --connection slave +SELECT @@global.gtid_slave_pos; # start the slave sucessfully +--let rpl_debug=1 --source include/start_slave.inc +--let rpl_debug=0 --connection master # but the following gtid from the *extra* domain will break replication -- cgit v1.2.1 From e6d6b0c08c50124ea4c0f8558f56a75d7a53d77d Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Fri, 24 Nov 2017 01:38:38 +0200 Subject: Updated list of unstable tests for 10.2.11 --- mysql-test/unstable-tests | 196 ++++++++++++++++++++++------------------------ 1 file changed, 95 insertions(+), 101 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests index 76e1a19a40c..6d631ad30f4 100644 --- a/mysql-test/unstable-tests +++ b/mysql-test/unstable-tests @@ -23,84 +23,74 @@ # ############################################################################## +# Based on 10.2 e2dd4e32063b2526d951e5f4ddfdb8b0d69ef634 main.alter_table : Modified in 10.2.10 -main.analyze_format_json : MDEV-11866 - Mismatch main.analyze_stmt_slow_query_log : MDEV-12237 - Wrong result -main.analyze_stmt_orderby : MDEV-11866 - Mismatch main.case : Modified in 10.2.10 -main.check_constraint : Modified in 10.2.9 main.connect2 : MDEV-13885 - Server crash -main.count_distinct : Modified in 10.2.9 -main.cte_nonrecursive : Modified in 10.2.10 +main.cte_grant : Modified in 10.2.11 +main.cte_nonrecursive : Modified in 10.2.11 +main.cte_recursive : Modified in 10.2.11 main.ctype_gbk : Modified in 10.2.10 main.ctype_latin1 : Modified in 10.2.10 main.ctype_ucs : Modified in 10.2.10 main.ctype_utf32 : Modified in 10.2.10 main.ctype_utf8 : Modified in 10.2.10 -main.date_formats : Modified in 10.2.9 -main.default : Modified in 10.2.9 main.delete_returning : Modified in 10.2.10 +main.delimiter_command_case_sensitivity : Added in 10.2.11 +main.derived_cond_pushdown : Modified in 10.2.11 main.distinct : MDEV-14194 - Crash -main.drop-no_root : MDEV-12633 - Valgrind main.events_2 : MDEV-13277 - Crash main.func_in : Modified in 10.2.10 -main.func_json : MDEV-11648 - Crash, valgrind; modified in 10.2.10 -main.func_math : Modified in 10.2.9 -main.func_misc : Modified in 10.2.9 +main.func_json : MDEV-11648 - Crash, valgrind; modified in 10.2.11 +main.func_misc : Modified in 10.2.11 main.func_regexp_pcre : Modified in 10.2.10 main.func_time : Modified in 10.2.10 +main.gis-json : Modified in 10.2.11 main.gis-precise : Modified in 10.2.10 main.gis2 : Modified in 10.2.10 +main.having : Modified in 10.2.11 main.index_merge_innodb : MDEV-7142 - Plan mismatch main.information_schema : Modified in 10.2.10 main.innodb_mysql_lock : MDEV-7861 - Wrong result -main.insert : Modified in 10.2.9 main.kill-2 : MDEV-13257 - Wrong result -main.locale : Modified in 10.2.9 main.log_slow : MDEV-13263 - Wrong result -main.log_tables-big : Modified in 10.2.9 main.mdev13607 : Added in 10.2.10 main.myisam : Modified in 10.2.10 -main.mysql_client_test : MDEV-12633 - Valgrind -main.mysql_client_test_comp : MDEV-12633 - Valgrind -main.mysql_client_test_nonblock : MDEV-12633 - Valgrind, CONC-208 - Error on Power +main.mysql_client_test_nonblock : CONC-208 - Error on Power +main.mysql_upgrade_noengine : MDEV-14355 - Wrong result main.mysql_upgrade_ssl : MDEV-13492 - Unknown SSL error -main.mysqlcheck : MDEV-12633 - Valgrind +main.mysqlbinlog : Modified in 10.2.11 main.mysqld_option_err : MDEV-12747 - Timeout main.mysqlhotcopy_myisam : MDEV-10995 - Hang on debug main.mysqltest : MDEV-13887 - Wrong result -main.old-mode : Modified in 10.2.9 main.openssl_1 : MDEV-13492 - Unknown SSL error +main.order_by : Modified in 10.2.11 +main.order_by_innodb : Modified in 10.2.11 main.partition_datatype : Modified in 10.2.10 -main.partition_symlink : Modified in 10.2.9 -main.ps : Modified in 10.2.10 -main.range_interrupted-13751 : Added in 10.2.9 +main.ps : Modified in 10.2.11 main.range_vs_index_merge : Modified in 10.2.10 main.shm : MDEV-12727 - Mismatch, ERROR 2013 -main.show_check : MDEV-12633 - Valgrind main.show_function_with_pad_char_to_full_length : Added in 10.2.10 -main.sp : MDEV-7866 - Mismatch; modified in 10.2.9 -main.ssl_7937 : MDEV-11546 - Timeout on Windows +main.sp : MDEV-7866 - Mismatch; modified in 10.2.11 main.ssl_ca : MDEV-10895 - SSL connection error on Power main.ssl_cert_verify : MDEV-13735 - Server crash main.ssl_connect : MDEV-13492 - Unknown SSL error main.ssl_timeout : MDEV-11244 - Crash main.stat_tables_par : MDEV-13266 - Wrong result main.status : MDEV-13255 - Wrong result +main.subselect_exists2in : Modified in 10.2.11 main.subselect_mat_cost_bugs : Modified in 10.2.10 -main.symlink : Modified in 10.2.9 main.tc_heuristic_recover : MDEV-14189 - Wrong result; modified in 10.2.10 +main.trigger : Modified in 10.2.11 +main.type_bit : Modified in 10.2.11 +main.type_date : Modified in 10.2.11 main.type_float : Modified in 10.2.10 +main.type_time : Modified in 10.2.11 main.type_varchar : Modified in 10.2.10 main.user_var : Modified in 10.2.10 main.userstat : MDEV-12904 - SSL errors -main.view : Modified in 10.2.9 -main.wait_timeout : Modified in 10.2.9 -main.wait_timeout_not_windows : Modified in 10.2.9 -main.win : Modified in 10.2.9 -main.win_as_arg_to_aggregate_func : Added in 10.2.9 -main.win_insert_select : Modified in 10.2.9 main.xml : Modified in 10.2.10 #---------------------------------------------------------------- @@ -111,6 +101,8 @@ archive.mysqlhotcopy_archive : MDEV-10995 - Hang on debug #---------------------------------------------------------------- binlog.binlog_commit_wait : MDEV-10150 - Mismatch +binlog.binlog_flush_binlogs_delete_domain : MDEV-14431 - Wrong exit code; added in 10.2.11 +binlog.binlog_gtid_delete_domain_debug : Added in 10.2.11 binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint #---------------------------------------------------------------- @@ -134,7 +126,7 @@ connect.mongo_c : Include file modified in 10.2.10 connect.mongo_java_2 : Include file modified in 10.2.10 connect.mongo_java_3 : Include file modified in 10.2.10 connect.tbl : MDEV-10179 - Mismatch, MDEV-9844 - Valgrind, crash -connect.tbl_thread : MDEV-10179 - Mismatch, MDEV-9844 - Valgrind, crash +connect.tbl_thread : MDEV-10179 - Mismatch, MDEV-9844 - Valgrind, crash, MDEV-14214 - Syntax error connect.vcol : MDEV-12374 - Fails on Windows #---------------------------------------------------------------- @@ -142,18 +134,19 @@ connect.vcol : MDEV-12374 - Fails on Windows encryption.create_or_replace : MDEV-9359, MDEV-13516 - Assertion failure, MDEV-12694 - Timeout encryption.debug_key_management : MDEV-13841 - Timeout encryption.encrypt_and_grep : MDEV-13765 - Wrong result +encryption.encryption_force : Modified in 10.2.11 +encryption.filekeys_encfile : Modified in 10.2.11 +encryption.filekeys_encfile_file : Modified in 10.2.11 encryption.innochecksum : MDEV-13644 - Assertion failure encryption.innodb-discard-import-change : MDEV-12632 - Valgrind -encryption.innodb_encryption : Modified in 10.2.9 -encryption.innodb-encryption-alter : MDEV-13566 - Lock wait timeout +encryption.innodb-encryption-alter : MDEV-13566 - Lock wait timeout; modified in 10.2.11 encryption.innodb_encryption_discard_import : MDEV-12903 - Wrong result, MDEV-14045 - Error 192 encryption.innodb_encryption_filekeys : MDEV-9962 - Timeout -encryption.innodb_encrypt_log : Modified in 10.2.9 encryption.innodb_encryption_tables : MDEV-9359 - Assertion failure -encryption.innodb-first-page-read : Modified in 10.2.9 -encryption.innodb_lotoftables : Modified in 10.2.9 -encryption.innodb-redo-badkey : MDEV-13893 - page cannot be decrypted; modified in 10.2.9 -encryption.innodb-spatial-index : MDEV-13746 - Wrong result; modified in 10.2.9 +encryption.innodb-first-page-read : MDEV-14356 - Timeout in wait condition +encryption.innodb_lotoftables : MDEV-11531 - Operation on a dropped tablespace +encryption.innodb-redo-badkey : MDEV-13893 - Page cannot be decrypted +encryption.innodb-spatial-index : MDEV-13746 - Wrong result; modified in 10.2.11 #---------------------------------------------------------------- @@ -164,7 +157,6 @@ engines/rr_trx.* : MDEV-10998 - Not maintained federated.federated_innodb : MDEV-10617 - Wrong checksum federated.federated_transactions : MDEV-10617 - Wrong checksum federated.federatedx : MDEV-10617 - Wrong checksum -federated.net_thd_crash-12951 : Added in 10.2.9 #---------------------------------------------------------------- @@ -177,33 +169,33 @@ galera_3nodes.* : Suite is not stable yet #---------------------------------------------------------------- -gcol.gcol_rollback : Modified in 10.2.9 -gcol.gcol_update : Modified in 10.2.9 +gcol.innodb_virtual_basic : Modified in 10.2.11 +gcol.innodb_virtual_debug : Modified in 10.2.11 gcol.innodb_virtual_debug_purge : MDEV-13568 - Wrong result +gcol.innodb_virtual_rebuild : Added in 10.2.11 #---------------------------------------------------------------- innodb.101_compatibility : MDEV-13891 - Wrong result -innodb.alter_crash : Added in 10.2.9 -innodb.alter_rename_existing : Added in 10.2.9 innodb.alter_table : Modified in 10.2.10 -innodb.create-index-debug : Added in 10.2.9 innodb.deadlock_detect : MDEV-13262 - Wrong error code innodb.defrag_mdl-9155 : Re-enabled in 10.2.10 innodb_defragment_fill_factor : Re-enabled in 10.2.10 -innodb.doublewrite : MDEV-14205 - Crash +innodb.doublewrite : MDEV-12905 - Server crash innodb.group_commit_crash : MDEV-14191 - InnoDB registration failed innodb.group_commit_crash_no_optimize_thread : MDEV-13830 - Assertion failure -innodb.index_tree_operation : Added in 10.2.9 innodb.innodb-16k : Modified in 10.2.10 innodb.innodb-32k : Modified in 10.2.10 -innodb.innodb-64k : MDEV-14132 - Crash; modified in 10.2.10 -innodb.innodb-64k-crash : MDEV-14132 - Crash -innodb.innodb_bug14147491 : MDEV-11808 - Index is corrupt -innodb.innodb_bug34300 : MDEV-14132 - Crash +innodb.innodb-64k : Modified in 10.2.10 innodb.innodb-alter : Modified in 10.2.10 -innodb.innodb-alter-autoinc : Added in 10.2.9 innodb.innodb-alter-table : Modified in 10.2.10 +innodb.innodb-alter-tempfile : MDEV-14485 - Server deadlock on startup +innodb.innodb_bug14147491 : MDEV-11808 - Index is corrupt +innodb.innodb_bulk_create_index : Added in 10.2.11 +innodb.innodb_bulk_create_index_debug : Added in 10.2.11 +innodb.innodb_bulk_create_index_flush : Added in 10.2.11 +innodb.innodb_bulk_create_index_replication : Added in 10.2.11 +innodb.innodb_bulk_create_index_small : Added in 10.2.11 innodb.innodb_defrag_binlog : Re-enabled in 10.2.10 innodb.innodb_defrag_concurrent : Re-enabled in 10.2.10 innodb.innodb_defrag_stats : Re-enabled in 10.2.10 @@ -211,36 +203,36 @@ innodb.innodb_defrag_stats_many_tables : MDEV-14198 - Table is full; re-enabled innodb.innodb_defragment : Re-enabled in 10.2.10 innodb.innodb_defragment_fill_factor : Re-enabled in 10.2.10 innodb.innodb_defragment_small : Re-enabled in 10.2.10 -innodb.innodb-enlarge-blob : Modified in 10.2.9 innodb.innodb-get-fk : MDEV-13276 - Server crash; modified in 10.2.10 -innodb.innodb-index : Modified in 10.2.9 -innodb.innodb-index-debug : Added in 10.2.9 -innodb.innodb-index-online : Added in 10.2.9 -innodb.innodb-index-online-delete : Added in 10.2.9 -innodb.innodb-index-online-fk : Added in 10.2.9 -innodb.innodb-index-online-purge : Added in 10.2.9 innodb.innodb_information_schema : MDEV-8851 - Wrong result +innodb.innodb-on-duplicate-update : Added in 10.2.11 innodb.innodb-online-alter-gis : Modified in 10.2.10 innodb.innodb-page_compression_default : MDEV-13644 - Assertion failure -innodb.innodb-table-online : MDEV-13894 - Wrong result; modified in 10.2.9 +innodb.innodb-page_compression_lzma : MDEV-14353 - Wrong result +innodb.innodb-page_compression_tables : Modified in 10.2.11 +innodb.innodb-replace-debug : Added in 10.2.11 +innodb.innodb-table-online : MDEV-13894 - Wrong result; modified in 10.2.11 innodb.innodb-truncate : Modified in 10.2.10 -innodb.innodb_stats_persistent_debug : Added in 10.2.9 innodb.innodb_sys_semaphore_waits : MDEV-10331 - Semaphore wait -innodb.innodb-wl5522-debug : MDEV-14200 - Wrong errno; modified in 10.2.9 +innodb.innodb-wl5522-debug : MDEV-14200 - Wrong errno innodb.innodb-wl5980-alter : Modified in 10.2.10 +innodb.innodb_zip_innochecksum3 : MDEV-14486 - Resource temporarily unavailable innodb.log_corruption : MDEV-13251 - Wrong result -innodb.log_data_file_size : MDEV-14204 - Server failed to start; modified in 10.2.9 +innodb.log_data_file_size : MDEV-14204 - Server failed to start innodb.log_file_name : MDEV-14193 - Exception innodb.log_file_size : Modified in 10.2.10 innodb.purge_thread_shutdown : MDEV-13792 - Wrong result innodb.read_only_recovery : MDEV-13886 - Server crash +innodb.row_format_redundant : MDEV-14485 - Server deadlock on startup innodb.table_definition_cache_debug : MDEV-14206 - Extra warning; added in 10.2.10 -innodb.table_flags : MDEV-13572 - Wrong result; modified in 10.2.9 +innodb.table_flags : MDEV-13572 - Wrong result innodb.temporary_table : MDEV-13265 - Wrong result innodb.truncate_debug : Modified in 10.2.10 +innodb.truncate_restart : Added in 10.2.11 innodb.undo_log : Added in 10.2.10 +innodb.update_time : Added in 10.2.11 +innodb.update_time_wl6658 : Added in 10.2.11 innodb-wl5980-alter : Re-enabled in 10.2.10 -innodb.xa_recovery : Modified in 10.2.9 innodb_fts.concurrent_insert : Added in 10.2.10 innodb_fts.fulltext : Modified in 10.2.10 @@ -258,7 +250,7 @@ innodb_gis.bug17057168 : Added in 10.2.10 innodb_gis.geometry : Added in 10.2.10 innodb_gis.gis_split_inf : Added in 10.2.10 innodb_gis.gis_split_nan : Added in 10.2.10 -innodb_gis.kill_server : Added in 10.2.10 +innodb_gis.kill_server : MDEV-14218 - Assertion failure; added in 10.2.10 innodb_gis.multi_pk : Added in 10.2.10 innodb_gis.point_basic : Added in 10.2.10 innodb_gis.point_big : Added in 10.2.10 @@ -287,36 +279,39 @@ innodb_gis.update_root : Added in 10.2.10 innodb_zip.16k : Modified in 10.2.10 innodb_zip.4k : Modified in 10.2.10 innodb_zip.8k : Modified in 10.2.10 -innodb_zip.create_options : Modified in 10.2.9 +innodb_zip.cmp_per_index : MDEV-14490 - Table is marked as crashed innodb_zip.innochecksum_3 : MDEV-13279 - Extra warnings innodb_zip.index_large_prefix_4k : Modified in 10.2.10 innodb_zip.index_large_prefix_8k : Modified in 10.2.10 +innodb_zip.prefix_index_liftedlimit : MDEV-14238 - Assertion failure +innodb_zip.wl6470_1 : MDEV-14240 - Assertion failure innodb_zip.wl6501_1 : MDEV-10891 - Can't create UNIX socket -innodb_zip.wl5522_debug_zip : MDEV-11600 - Operating system error number 2; modified in 10.2.9 +innodb_zip.wl5522_debug_zip : MDEV-11600 - Operating system error number 2 innodb_zip.wl6501_scale_1 : MDEV-13254 - Timeout, MDEV-14104 - Error 192 #---------------------------------------------------------------- maria.insert_select : MDEV-12757 - Timeout -maria.maria : Modified in 10.2.10 +maria.maria : MDEV-14430 - Extra warning; modified in 10.2.10 #---------------------------------------------------------------- -mariabackup.apply-log-only : Added in 10.2.9 -mariabackup.apply-log-only-incr : Added in 10.2.9 -mariabackup.auth_plugin_win : Added in 10.2.9 +mariabackup.apply-log-only : MDEV-14192 - Assertion failure +mariabackup.apply-log-only-incr : MDEV-14192 - Assertion failure mariabackup.compress_qpress : Added in 10.2.10 +mariabackup.data_directory : Added in 10.2.11 mariabackup.full_backup : MDEV-13889 - Timeout -mariabackup.incremental_backup : MDEV-14192 - Assertion failure +mariabackup.incremental_backup : MDEV-14192 - Assertion failure; modified in 10.2.11 mariabackup.incremental_encrypted : MDEV-14188 - Wrong result -mariabackup.lock_ddl_per_table : Added in 10.2.9 -mariabackup.partial : Modified in 10.2.9 -mariabackup.xb_aws_key_management : Modified in 10.2.9 +mariabackup.partition_datadir : Added in 10.2.11 mariabackup.xb_file_key_management : Modified in 10.2.10 -mariabackup.xb_page_compress : Modified in 10.2.9 #---------------------------------------------------------------- +mroonga.* : Version-related changes in include files in 10.2.11 +mroonga/storage.* : Massive changes in 10.2.11 +mroonga/wrapper.* : Massive changes in 10.2.11 + mroonga/storage.index_multiple_column_unique_datetime_index_read : MDEV-8643 - Valgrind #---------------------------------------------------------------- @@ -329,16 +324,8 @@ multi_source.simple : MDEV-4633 - Wrong result #---------------------------------------------------------------- parts.partition_alter_maria : Added in 10.2.10 +parts.partition_auto_increment_maria : MDEV-14430 - Extra warning parts.partition_debug_innodb : MDEV-10891 - Can't create UNIX socket -parts.partition_exch_myisam_innodb : Modified in 10.2.9 -parts.partition_exch_qa_10 : Include files modified in 10.2.9 -parts.partition_exch_qa_11 : Include files modified in 10.2.9 -parts.partition_exch_qa_12 : Include files modified in 10.2.9 -parts.partition_exch_qa_14 : Modified in 10.2.9 -parts.partition_exch_qa_15 : Modified in 10.2.9 -parts.partition_exch_qa_2 : Modified in 10.2.9 -parts.partition_exch_qa_3 : Modified in 10.2.9 -parts.partition_exch_qa_6 : Modified in 10.2.9 #---------------------------------------------------------------- @@ -363,6 +350,9 @@ perfschema_stress.* : MDEV-10996 - Not maintained #---------------------------------------------------------------- plugins.feedback_plugin_send : MDEV-7932, MDEV-11118 - Connection problems and such +plugins.server_audit : Modified in 10.2.11 +plugins.thread_pool_server : Modified in 10.2.11 +plugins.thread_pool_server_audit : MDEV-14295 - Wrong result #---------------------------------------------------------------- @@ -380,15 +370,20 @@ rpl.rpl_domain_id_filter_io_crash : MDEV-12729 - Timeout in include file, MDE rpl.rpl_domain_id_filter_restart : MDEV-10684 - Wrong result rpl.rpl_extra_col_master_myisam : MDEV-14203 - Extra warning rpl.rpl_gtid_crash : MDEV-9501 - Failed registering on master, MDEV-13643 - Lost connection -rpl.rpl_gtid_errorhandling : MDEV-13261 - Crash; modified in 10.2.9 +rpl.rpl_gtid_delete_domain : MDEV-14463 - Timeout; added in 10.2.11 +rpl.rpl_gtid_errorhandling : MDEV-13261 - Crash rpl.rpl_gtid_stop_start : MDEV-11621 - Table marked as crashed rpl.rpl_mariadb_slave_capability : MDEV-11018 - Extra lines in binlog +rpl.rpl_non_direct_stm_mixing_engines : MDEV-14489 - Failed sync_slave_with_master rpl.rpl_parallel : MDEV-12730 - Assertion failure rpl.rpl_parallel_mdev6589 : MDEV-12979 - Assertion failure rpl.rpl_parallel_optimistic_nobinlog : MDEV-12746 - Timeouts, mismatch rpl.rpl_parallel_retry : MDEV-11119 - Crash rpl.rpl_parallel_temptable : MDEV-10356 - Crash -rpl.rpl_temporal_mysql56_to_mariadb53 : MDEV-9501 - Failed registering on master +rpl.rpl_row_drop_create_temp_table : MDEV-14487 - Wrong result +rpl.rpl_row_mixing_engines : MDEV-14491 - Long semaphore wait +rpl.rpl_semi_sync : MDEV-11220 - Wrong result +rpl.rpl_semi_sync_after_sync : MDEV-14366 - Wrong result rpl.rpl_set_statement_default_master : MDEV-13258 - Extra warning rpl.rpl_show_slave_hosts : MDEV-10681 - Crash rpl.rpl_skip_replication : MDEV-13258 - Extra warning @@ -396,11 +391,10 @@ rpl.rpl_slave_grp_exec : MDEV-10514 - Deadlock rpl.rpl_slave_load_tmpdir_not_exist : MDEV-14203 - Extra warning rpl.rpl_slow_query_log : MDEV-13250 - Test abort rpl.rpl_sp_effects : MDEV-13249 - Crash -rpl.rpl_sp_variables : Added in 10.2.9 rpl.rpl_start_stop_slave : MDEV-13567 - Sync slave timeout rpl.rpl_stm_multi_query : MDEV-9501 - Failed registering on master rpl.rpl_stm_stop_middle_group : MDEV-13791 - Server crash -rpl.rpl_temporal_format_mariadb53_to_mysql56_dst : Added in 10.2.9 +rpl.rpl_temporal_mysql56_to_mariadb53 : MDEV-9501 - Failed registering on master rpl.rpl_upgrade_master_info : MDEV-11620 - Table marked as crashed rpl/extra/rpl_tests.* : MDEV-10994 - Not maintained @@ -429,16 +423,19 @@ storage_engine.* : Not always timely maintained sys_vars.explicit_defaults_for_timestamp_on : Include file modified in 10.2.10 sys_vars.explicit_defaults_for_timestamp_off : Include file modified in 10.2.10 sys_vars.host_cache_size_auto : Modified in 10.2.10 -sys_vars.innodb_buffer_pool_load_now_basic : MDEV-14196 - Timeout -sys_vars.log_slow_admin_statements_func : MDEV-14132 - Crash -sys_vars.rpl_init_slave_func : MDEV-10149 - Test assertion +sys_vars.innodb_buffer_pool_dump_at_shutdown_basic : MDEV-14280 - Unexpected error +sys_vars.innodb_buffer_pool_dump_now_basic : Modified in 10.2.11 +sys_vars.innodb_buffer_pool_dump_pct_basic : Modified in 10.2.11 +sys_vars.innodb_buffer_pool_load_now_basic : Modified in 10.2.11 +sys_vars.rpl_init_slave_func : MDEV-10149 - Test assertion +sys_vars.slow_query_log_func : MDEV-14273 - Wrong result #---------------------------------------------------------------- tokudb.change_column_all_1000_10 : MDEV-12640 - Lost connection tokudb.change_column_bin : MDEV-12640 - Lost connection tokudb.change_column_char : MDEV-12822 - Lost connection -tokudb.dir_per_db : MDEV-11537 - Wrong result; modified in 10.2.9 +tokudb.dir_per_db : MDEV-11537 - Wrong result tokudb.hotindex-insert-bigchar : MDEV-12640 - Crash tokudb.hotindex-update-1 : MDEV-12640 - Crash tokudb.rows-32m-rand-insert : MDEV-12640 - Crash @@ -455,21 +452,18 @@ tokudb_parts.partition_alter4_tokudb : MDEV-12640 - Lost connection #---------------------------------------------------------------- unit.conc_ps_bugs : MDEV-13252 - not ok 44 test_bug4236 +unit.lf : MDEV-12897 - Signal 11 thrown #---------------------------------------------------------------- -vcol.innodb_virtual_fk : Added in 10.2.9 -vcol.update : Modified in 10.2.9 vcol.vcol_misc : Modified in 10.2.10 -vcol.vcol_supported_sql_funcs : Include file modified in 10.2.9 #---------------------------------------------------------------- wsrep.binlog_format : MDEV-11532 - Could not execute check-testcase -wsrep.foreign_key : Re-enabled in 10.2.9 -wsrep.mdev_6832 : MDEV-14195 - Check testcase failed; option file changed in 10.2.9 -wsrep.mdev_7798 : Option file changed in 10.2.9 +wsrep.mdev_6832 : MDEV-14195 - Check testcase failed wsrep.pool_of_threads : MDEV-12234 - GLIBCXX_3.4.20 not found +wsrep.variables : MDEV-14311 - Wrong result wsrep_info.plugin : MDEV-13569 - No nodes coming from prim view -- cgit v1.2.1 From 316f0d8fe3f3eda61bfe1025ef59a93dde3c753b Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 23 Nov 2017 21:01:00 +0000 Subject: MDEV-14447 mariabackup incremental incorrectly extends system tablespace for multi-file innodb_data_file_path. Use fil_extend_space_to_desired_size() to correctly extend system tablespace. Make sure to get tablespace size from the first tablespace part. --- mysql-test/mysql-test-run.pl | 2 +- mysql-test/suite/mariabackup/mdev-14447.opt | 1 + mysql-test/suite/mariabackup/mdev-14447.result | 19 +++++++++++ mysql-test/suite/mariabackup/mdev-14447.test | 46 ++++++++++++++++++++++++++ 4 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/mariabackup/mdev-14447.opt create mode 100644 mysql-test/suite/mariabackup/mdev-14447.result create mode 100644 mysql-test/suite/mariabackup/mdev-14447.test (limited to 'mysql-test') diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index ac9f493dc84..3b1bb0b5cb0 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -2817,7 +2817,7 @@ sub mysql_server_start($) { # Some InnoDB options are incompatible with the default bootstrap. # If they are used, re-bootstrap if ( $extra_opts and - "@$extra_opts" =~ /--innodb[-_](?:page[-_]size|checksum[-_]algorithm|undo[-_]tablespaces|log[-_]group[-_]home[-_]dir|data[-_]home[-_]dir)/ ) + "@$extra_opts" =~ /--innodb[-_](?:page[-_]size|checksum[-_]algorithm|undo[-_]tablespaces|log[-_]group[-_]home[-_]dir|data[-_]home[-_]dir)|data[-_]file[-_]path/ ) { mysql_install_db($mysqld, undef, $extra_opts); } diff --git a/mysql-test/suite/mariabackup/mdev-14447.opt b/mysql-test/suite/mariabackup/mdev-14447.opt new file mode 100644 index 00000000000..5ac67e950c4 --- /dev/null +++ b/mysql-test/suite/mariabackup/mdev-14447.opt @@ -0,0 +1 @@ +--sequence --innodb-data-file-path=ibdata_first:3M;ibdata_second:1M:autoextend \ No newline at end of file diff --git a/mysql-test/suite/mariabackup/mdev-14447.result b/mysql-test/suite/mariabackup/mdev-14447.result new file mode 100644 index 00000000000..3bca7eb5701 --- /dev/null +++ b/mysql-test/suite/mariabackup/mdev-14447.result @@ -0,0 +1,19 @@ +call mtr.add_suppression("InnoDB: New log files created"); +CREATE TABLE t(a varchar(40) PRIMARY KEY, b varchar(40), c varchar(40), d varchar(40), index(b,c,d)) ENGINE INNODB; +# Create full backup , modify table, then create incremental/differential backup +BEGIN; +INSERT INTO t select uuid(), uuid(), uuid(), uuid() from seq_1_to_100000; +COMMIT; +SELECT count(*) FROM t; +count(*) +100000 +# Prepare full backup, apply incremental one +# Restore and check results +# shutdown server +# remove datadir +# xtrabackup move back +# restart server +SELECT count(*) FROM t; +count(*) +100000 +DROP TABLE t; diff --git a/mysql-test/suite/mariabackup/mdev-14447.test b/mysql-test/suite/mariabackup/mdev-14447.test new file mode 100644 index 00000000000..48f37646231 --- /dev/null +++ b/mysql-test/suite/mariabackup/mdev-14447.test @@ -0,0 +1,46 @@ +call mtr.add_suppression("InnoDB: New log files created"); + +let $basedir=$MYSQLTEST_VARDIR/tmp/backup; +let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1; + +CREATE TABLE t(a varchar(40) PRIMARY KEY, b varchar(40), c varchar(40), d varchar(40), index(b,c,d)) ENGINE INNODB; + +echo # Create full backup , modify table, then create incremental/differential backup; +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir; +--enable_result_log +BEGIN; +INSERT INTO t select uuid(), uuid(), uuid(), uuid() from seq_1_to_100000; +COMMIT; +SELECT count(*) FROM t; + +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir; + +--disable_result_log +echo # Prepare full backup, apply incremental one; +exec $XTRABACKUP --prepare --apply-log-only --target-dir=$basedir; +exec $XTRABACKUP --prepare --apply-log-only --target-dir=$basedir --incremental-dir=$incremental_dir ; + +echo # Restore and check results; +let $targetdir=$basedir; +#-- source include/restart_and_restore.inc + +let $_datadir= `SELECT @@datadir`; +let $innodb_data_file_path=`SELECT @@innodb_data_file_path`; +echo # shutdown server; +--source include/shutdown_mysqld.inc +echo # remove datadir; +rmdir $_datadir; +echo # xtrabackup move back; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=$_datadir "--innodb_data_file_path=$innodb_data_file_path" --target-dir=$targetdir; +echo # restart server; +--source include/start_mysqld.inc + + +--enable_result_log +SELECT count(*) FROM t; +DROP TABLE t; + +# Cleanup +rmdir $basedir; +rmdir $incremental_dir; -- cgit v1.2.1 From ab63290c355f9cce2b2d1d46b5b8be53365606d3 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Fri, 24 Nov 2017 16:26:44 +0200 Subject: Removed "deprecated" warning from explicit_defaults_for_timestamp --- mysql-test/r/mysqld--help.result | 2 +- mysql-test/suite/sys_vars/r/sysvars_server_embedded.result | 2 +- mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result index 266180d7860..dfd64e2c1fe 100644 --- a/mysql-test/r/mysqld--help.result +++ b/mysql-test/r/mysqld--help.result @@ -242,7 +242,7 @@ The following options may be given as the first argument: This option causes CREATE TABLE to create all TIMESTAMP columns as NULL with DEFAULT NULL attribute, Without this option, TIMESTAMP columns are NOT NULL and have implicit - DEFAULT clauses. The old behavior is deprecated. + DEFAULT clauses. --external-locking Use system (external) locking (disabled by default). With this option enabled you can run myisamchk to test (not repair) tables while the MySQL server is running. 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 e52e0d30abe..6fb52700556 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -899,7 +899,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE OFF VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT This option causes CREATE TABLE to create all TIMESTAMP columns as NULL with DEFAULT NULL attribute, Without this option, TIMESTAMP columns are NOT NULL and have implicit DEFAULT clauses. The old behavior is deprecated. +VARIABLE_COMMENT This option causes CREATE TABLE to create all TIMESTAMP columns as NULL with DEFAULT NULL attribute, Without this option, TIMESTAMP columns are NOT NULL and have implicit DEFAULT clauses. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL 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 aadb885135d..8a897052051 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -927,7 +927,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE OFF VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT This option causes CREATE TABLE to create all TIMESTAMP columns as NULL with DEFAULT NULL attribute, Without this option, TIMESTAMP columns are NOT NULL and have implicit DEFAULT clauses. The old behavior is deprecated. +VARIABLE_COMMENT This option causes CREATE TABLE to create all TIMESTAMP columns as NULL with DEFAULT NULL attribute, Without this option, TIMESTAMP columns are NOT NULL and have implicit DEFAULT clauses. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -- cgit v1.2.1 From 62fb0221105c56539fb4ae1c96846d04b5af48ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 27 Nov 2017 11:19:26 +0200 Subject: Adjust the result diffs for innodb.instant_alter --- mysql-test/suite/innodb/r/instant_alter,4k.rdiff | 52 +++++++++++------------ mysql-test/suite/innodb/r/instant_alter,8k.rdiff | 54 ++++++++++++------------ 2 files changed, 53 insertions(+), 53 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/innodb/r/instant_alter,4k.rdiff b/mysql-test/suite/innodb/r/instant_alter,4k.rdiff index 098d9fa3b5d..d274d834faa 100644 --- a/mysql-test/suite/innodb/r/instant_alter,4k.rdiff +++ b/mysql-test/suite/innodb/r/instant_alter,4k.rdiff @@ -9,7 +9,7 @@ connection default; ROLLBACK; connection analyze; -@@ -191,7 +191,7 @@ +@@ -250,7 +250,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -18,7 +18,7 @@ connection default; BEGIN; UPDATE t2 SET d1 = repeat(id, 200); -@@ -202,7 +202,7 @@ +@@ -261,7 +261,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -27,7 +27,7 @@ connection default; ROLLBACK; connection analyze; -@@ -212,7 +212,7 @@ +@@ -271,7 +271,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -36,7 +36,7 @@ connection default; ALTER TABLE t2 DROP p; affected rows: 0 -@@ -317,7 +317,7 @@ +@@ -374,7 +374,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -45,7 +45,7 @@ connection default; ALTER TABLE big ADD COLUMN (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', -@@ -340,7 +340,7 @@ +@@ -397,7 +397,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -54,16 +54,16 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -353,7 +353,7 @@ +@@ -410,7 +410,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size -3 +8 connection default; - DROP TABLE big; - CREATE TABLE t1 -@@ -532,7 +532,7 @@ + InnoDB 0 transactions not purged + DROP TABLE t1,t2,t3,big; +@@ -600,7 +600,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -72,7 +72,7 @@ connection default; ROLLBACK; connection analyze; -@@ -542,7 +542,7 @@ +@@ -610,7 +610,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -81,7 +81,7 @@ connection default; BEGIN; UPDATE t2 SET d1 = repeat(id, 200); -@@ -553,7 +553,7 @@ +@@ -621,7 +621,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -90,7 +90,7 @@ connection default; ROLLBACK; connection analyze; -@@ -563,7 +563,7 @@ +@@ -631,7 +631,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -99,7 +99,7 @@ connection default; ALTER TABLE t2 DROP p; affected rows: 0 -@@ -668,7 +668,7 @@ +@@ -734,7 +734,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -108,7 +108,7 @@ connection default; ALTER TABLE big ADD COLUMN (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', -@@ -691,7 +691,7 @@ +@@ -757,7 +757,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -117,16 +117,16 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -704,7 +704,7 @@ +@@ -770,7 +770,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size -3 +7 connection default; - DROP TABLE big; - CREATE TABLE t1 -@@ -883,7 +883,7 @@ + InnoDB 0 transactions not purged + DROP TABLE t1,t2,t3,big; +@@ -960,7 +960,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -135,7 +135,7 @@ connection default; ROLLBACK; connection analyze; -@@ -893,7 +893,7 @@ +@@ -970,7 +970,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -144,7 +144,7 @@ connection default; BEGIN; UPDATE t2 SET d1 = repeat(id, 200); -@@ -904,7 +904,7 @@ +@@ -981,7 +981,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -153,7 +153,7 @@ connection default; ROLLBACK; connection analyze; -@@ -914,7 +914,7 @@ +@@ -991,7 +991,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -162,7 +162,7 @@ connection default; ALTER TABLE t2 DROP p; affected rows: 0 -@@ -1019,7 +1019,7 @@ +@@ -1094,7 +1094,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -171,7 +171,7 @@ connection default; ALTER TABLE big ADD COLUMN (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', -@@ -1042,7 +1042,7 @@ +@@ -1117,7 +1117,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -180,12 +180,12 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -1055,7 +1055,7 @@ +@@ -1130,7 +1130,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size -3 +7 connection default; - DROP TABLE big; - disconnect analyze; + InnoDB 0 transactions not purged + DROP TABLE t1,t2,t3,big; diff --git a/mysql-test/suite/innodb/r/instant_alter,8k.rdiff b/mysql-test/suite/innodb/r/instant_alter,8k.rdiff index a313765df3a..b96262866e5 100644 --- a/mysql-test/suite/innodb/r/instant_alter,8k.rdiff +++ b/mysql-test/suite/innodb/r/instant_alter,8k.rdiff @@ -1,6 +1,6 @@ --- instant_alter.result +++ instant_alter,8k.result -@@ -181,7 +181,7 @@ +@@ -240,7 +240,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -9,7 +9,7 @@ connection default; ROLLBACK; connection analyze; -@@ -191,7 +191,7 @@ +@@ -250,7 +250,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -18,7 +18,7 @@ connection default; BEGIN; UPDATE t2 SET d1 = repeat(id, 200); -@@ -202,7 +202,7 @@ +@@ -261,7 +261,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -27,7 +27,7 @@ connection default; ROLLBACK; connection analyze; -@@ -212,7 +212,7 @@ +@@ -271,7 +271,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -36,7 +36,7 @@ connection default; ALTER TABLE t2 DROP p; affected rows: 0 -@@ -317,7 +317,7 @@ +@@ -374,7 +374,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -45,7 +45,7 @@ connection default; ALTER TABLE big ADD COLUMN (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', -@@ -340,7 +340,7 @@ +@@ -397,7 +397,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -54,16 +54,16 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -353,7 +353,7 @@ +@@ -410,7 +410,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size -3 +5 connection default; - DROP TABLE big; - CREATE TABLE t1 -@@ -532,7 +532,7 @@ + InnoDB 0 transactions not purged + DROP TABLE t1,t2,t3,big; +@@ -600,7 +600,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -72,7 +72,7 @@ connection default; ROLLBACK; connection analyze; -@@ -542,7 +542,7 @@ +@@ -610,7 +610,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -81,7 +81,7 @@ connection default; BEGIN; UPDATE t2 SET d1 = repeat(id, 200); -@@ -553,7 +553,7 @@ +@@ -621,7 +621,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -90,7 +90,7 @@ connection default; ROLLBACK; connection analyze; -@@ -563,7 +563,7 @@ +@@ -631,7 +631,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -99,7 +99,7 @@ connection default; ALTER TABLE t2 DROP p; affected rows: 0 -@@ -668,7 +668,7 @@ +@@ -734,7 +734,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -108,7 +108,7 @@ connection default; ALTER TABLE big ADD COLUMN (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', -@@ -691,7 +691,7 @@ +@@ -757,7 +757,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -117,16 +117,16 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -704,7 +704,7 @@ +@@ -770,7 +770,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size -3 +5 connection default; - DROP TABLE big; - CREATE TABLE t1 -@@ -883,7 +883,7 @@ + InnoDB 0 transactions not purged + DROP TABLE t1,t2,t3,big; +@@ -960,7 +960,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -135,7 +135,7 @@ connection default; ROLLBACK; connection analyze; -@@ -893,7 +893,7 @@ +@@ -970,7 +970,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -144,7 +144,7 @@ connection default; BEGIN; UPDATE t2 SET d1 = repeat(id, 200); -@@ -904,7 +904,7 @@ +@@ -981,7 +981,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -153,7 +153,7 @@ connection default; ROLLBACK; connection analyze; -@@ -914,7 +914,7 @@ +@@ -991,7 +991,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -162,7 +162,7 @@ connection default; ALTER TABLE t2 DROP p; affected rows: 0 -@@ -1019,7 +1019,7 @@ +@@ -1094,7 +1094,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -171,7 +171,7 @@ connection default; ALTER TABLE big ADD COLUMN (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', -@@ -1042,7 +1042,7 @@ +@@ -1117,7 +1117,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -180,12 +180,12 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -1055,7 +1055,7 @@ +@@ -1130,7 +1130,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size -3 +5 connection default; - DROP TABLE big; - disconnect analyze; + InnoDB 0 transactions not purged + DROP TABLE t1,t2,t3,big; -- cgit v1.2.1 From 77872e4519a9ebba2cd2ab4f5794faccf0a1f879 Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Mon, 27 Nov 2017 12:04:51 +0200 Subject: Additions to the list of unstable tests for 10.2.11 --- mysql-test/unstable-tests | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests index 6d631ad30f4..36ee91694a4 100644 --- a/mysql-test/unstable-tests +++ b/mysql-test/unstable-tests @@ -115,6 +115,7 @@ binlog_encryption.rpl_binlog_errors : MDEV-12742 - Crash binlog_encryption.rpl_parallel : MDEV-10653 - Timeout in include binlog_encryption.rpl_semi_sync : MDEV-11673 - Valgrind binlog_encryption.rpl_skip_replication : MDEV-13571 - Unexpected warning +binlog_encryption.rpl_ssl : MDEV-14507 - Timeouts binlog_encryption.rpl_stm_relay_ign_space : MDEV-13278 - Wrong result (test assertion) #---------------------------------------------------------------- @@ -191,6 +192,7 @@ innodb.innodb-alter : Modified in 10.2.10 innodb.innodb-alter-table : Modified in 10.2.10 innodb.innodb-alter-tempfile : MDEV-14485 - Server deadlock on startup innodb.innodb_bug14147491 : MDEV-11808 - Index is corrupt +innodb.innodb_bug59641 : MDEV-13830 - Assertion failure innodb.innodb_bulk_create_index : Added in 10.2.11 innodb.innodb_bulk_create_index_debug : Added in 10.2.11 innodb.innodb_bulk_create_index_flush : Added in 10.2.11 @@ -216,6 +218,7 @@ innodb.innodb-truncate : Modified in 10.2.10 innodb.innodb_sys_semaphore_waits : MDEV-10331 - Semaphore wait innodb.innodb-wl5522-debug : MDEV-14200 - Wrong errno innodb.innodb-wl5980-alter : Modified in 10.2.10 +innodb.innodb_zip_innochecksum2 : MDEV-13882 - Extra warnings innodb.innodb_zip_innochecksum3 : MDEV-14486 - Resource temporarily unavailable innodb.log_corruption : MDEV-13251 - Wrong result innodb.log_data_file_size : MDEV-14204 - Server failed to start @@ -303,8 +306,10 @@ mariabackup.data_directory : Added in 10.2.11 mariabackup.full_backup : MDEV-13889 - Timeout mariabackup.incremental_backup : MDEV-14192 - Assertion failure; modified in 10.2.11 mariabackup.incremental_encrypted : MDEV-14188 - Wrong result +mariabackup.mdev-14447 : Added in 10.2.11 mariabackup.partition_datadir : Added in 10.2.11 mariabackup.xb_file_key_management : Modified in 10.2.10 +mariabackup.xbstream : MDEV-14192 - Crash #---------------------------------------------------------------- @@ -372,7 +377,9 @@ rpl.rpl_extra_col_master_myisam : MDEV-14203 - Extra warning rpl.rpl_gtid_crash : MDEV-9501 - Failed registering on master, MDEV-13643 - Lost connection rpl.rpl_gtid_delete_domain : MDEV-14463 - Timeout; added in 10.2.11 rpl.rpl_gtid_errorhandling : MDEV-13261 - Crash +rpl.rpl_gtid_reconnect : MDEV-14497 - Crash rpl.rpl_gtid_stop_start : MDEV-11621 - Table marked as crashed +rpl.rpl_manual_change_index_file : MDEV-14309 - Requires Env package rpl.rpl_mariadb_slave_capability : MDEV-11018 - Extra lines in binlog rpl.rpl_non_direct_stm_mixing_engines : MDEV-14489 - Failed sync_slave_with_master rpl.rpl_parallel : MDEV-12730 - Assertion failure -- cgit v1.2.1 From e01d33d773abbffad0ea1739f0e04816eecce89d Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 29 Nov 2017 10:03:51 +0400 Subject: MDEV-14467 Item_param: replace {INT|DECIMAL|REAL|STRING|TIME}_VALUE with Type_handler 1. Removing data type specific constants from enum_item_param_state, adding SHORT_DATA_VALUE instead. 2. Replacing tests for Item_param::state for the removed constants to tests for Type_handler::cmp_type() against {INT|REAL|TIME|DECIAML}_RESULT. Deriving Item_param::PValue from Type_handler_hybrid_field_type, to store the data type handler of the current value of the parameter. 3. Moving Item_param::decimal_value and Item_param::str_value_ptr to Item_param::PValue. Adding Item_param::PValue::m_string and changing Item_param to use it to store string values, instead of Item::str_value. The intent is to replace Item_param::value to a st_value based implementation in the future, to avoid duplicate code. Adding a sub-class Item::PValue_simple, to implement Item_param::PValue::swap() easier. Remaming Item_basic_value::fix_charset_and_length_from_str_value() to fix_charset_and_length() and adding the "CHARSET_INFO" pointer parameter, instead of getting it directly from item->str_value.charset(). Changing Item_param to pass value.m_string.charset() instead of str_value.charset(). Adding a String argument to the overloaded fix_charset_and_length_from_str_value() and changing Item_param to pass value.m_string instead of str_value. 4. Replacing the case in Item_param::save_in_field() to a call for Type_handler::Item_save_in_field(). 5. Adding new methods into Item_param::PValue: val_real(), val_int(), val_decimal(), val_str(). Changing the corresponding Item_param methods to use these new Item_param::PValue methods internally. Adding a helper method Item_param::can_return_value() and removing duplicate code in Item_param::val_xxx(). 6. Removing value.set_handler() from Item_param::set_conversion() and Type_handler_xxx::Item_param_set_from_value(). It's now done inside Item_param::set_param_func(), Item_param::set_value() and Item_param::set_limit_clause_param(). 7. Changing Type_handler_int_result::Item_param_set_from_value() to set max_length using attr->max_length instead of MY_INT64_NUM_DECIMAL_DIGITS, to preserve the data type of the assigned expression more precisely. 8. Adding Type_handler_hybrid_field_type::swap(), using it in Item_param::PValue::swap(). 9. Moving the data-type specific code from Item_param::query_val_str(), Item_param::eq(), Item_param::clone_item() to Item_param::value_query_type_str(), Item_param::value_eq(), Item_param::value_clone_item(), to split the "state" dependent code and the data type dependent code. Later we'll split the data type related code further and add new methods in Type_handler. This will be done after we replace Item_param::PValue to st_value. 10. Adding asserts into set_int(), set_double(), set_decimal(), set_time(), set_str(), set_longdata() to make sure that the value set to Item_param corresponds to the previously set data type handler. 11. Adding tests into t/ps.test and suite/binlog/t/binlog_stm_ps.test, to cover Item_param::print() and Item_param::append_for_log() for LIMIT clause parameters. Note, the patch does not change the behavior covered by the new tests. Adding for better code coverage. 12. Adding tests for more precise integer data type in queries like this: EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 999999999 AS a,? AS b' USING 999999999; The explicit integer literal and the same integer literal passed as a PS parameter now produce columns of the same data type. Re-recording old results in ps.result, gis.result, func_hybrid_type.result accordingly. --- mysql-test/r/func_hybrid_type.result | 4 +- mysql-test/r/gis.result | 6 +-- mysql-test/r/ps.result | 68 ++++++++++++++++++++++++-- mysql-test/suite/binlog/r/binlog_stm_ps.result | 43 ++++++++++++++++ mysql-test/suite/binlog/t/binlog_stm_ps.test | 16 ++++++ mysql-test/t/ps.test | 26 ++++++++++ 6 files changed, 154 insertions(+), 9 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/func_hybrid_type.result b/mysql-test/r/func_hybrid_type.result index fe45338b36f..1bf8231f4dd 100644 --- a/mysql-test/r/func_hybrid_type.result +++ b/mysql-test/r/func_hybrid_type.result @@ -3443,8 +3443,8 @@ EXECUTE stmt USING @a,@a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(21) DEFAULT NULL, - `b` varchar(21) DEFAULT NULL + `a` varchar(20) DEFAULT NULL, + `b` varchar(20) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; # diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index fe67da8001f..3f2e6d39db8 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -4390,7 +4390,7 @@ SELECT ST_BUFFER(Point(1,1), Point(1,1)); ERROR HY000: Illegal parameter data type geometry for operation 'st_buffer' PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_ENVELOPE(?) AS g'; EXECUTE stmt USING 1; -ERROR HY000: Illegal parameter data type bigint for operation 'st_envelope' +ERROR HY000: Illegal parameter data type int for operation 'st_envelope' EXECUTE stmt USING POINT(1,1); SHOW CREATE TABLE t1; Table Create Table @@ -4404,7 +4404,7 @@ DROP TABLE t1; DEALLOCATE PREPARE stmt; PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_BUFFER(?,?) AS g'; EXECUTE stmt USING 1,1; -ERROR HY000: Illegal parameter data type bigint for operation 'st_buffer' +ERROR HY000: Illegal parameter data type int for operation 'st_buffer' EXECUTE stmt USING POINT(1,1),POINT(1,1); ERROR HY000: Illegal parameter data type geometry for operation 'st_buffer' EXECUTE stmt USING POINT(1,1),0; @@ -4455,7 +4455,7 @@ SELECT POINT(1,POINT(1,1)); ERROR HY000: Illegal parameter data type geometry for operation 'point' PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_GEOMFROMTEXT(?,?) AS g'; EXECUTE stmt USING 1,1; -ERROR HY000: Illegal parameter data type bigint for operation 'st_geometryfromtext' +ERROR HY000: Illegal parameter data type int for operation 'st_geometryfromtext' EXECUTE stmt USING POINT(1,1),POINT(1,1); ERROR HY000: Illegal parameter data type geometry for operation 'st_geometryfromtext' EXECUTE stmt USING 'POINT(1 1)',1; diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 2174293b45b..99207f3e800 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -4407,7 +4407,7 @@ EXECUTE stmt USING 10; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` bigint(21) NOT NULL + `c1` int(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; EXECUTE stmt USING 10.123; @@ -4614,10 +4614,10 @@ EXECUTE IMMEDIATE SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bigint(21) NOT NULL, + `a` bigint(20) NOT NULL, `b` decimal(3,1) DEFAULT NULL, `c` double NOT NULL, - `d` varchar(3) NOT NULL + `d` tinytext NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; EXECUTE IMMEDIATE @@ -4626,7 +4626,7 @@ EXECUTE IMMEDIATE SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bigint(21) NOT NULL, + `a` int(2) NOT NULL, `b` decimal(3,1) DEFAULT NULL, `c` double NOT NULL, `d` varchar(3) NOT NULL @@ -5088,3 +5088,63 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; DROP PROCEDURE p1; +# +# MDEV-14467 Item_param: replace {INT|DECIMAL|REAL|STRING|TIME}_VALUE with Type_handler +# +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select 1 AS `1` limit 10 +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10.1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select 1 AS `1` limit 10 +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10.1e0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select 1 AS `1` limit 10 +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING '10'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select 1 AS `1` limit 10 +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING TIME'10:10:10'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select 1 AS `1` limit 101010 +EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 1 AS a,? AS b' USING 1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(1) NOT NULL, + `b` int(1) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 10 AS a,? AS b' USING 10; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(2) NOT NULL, + `b` int(2) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 999999999 AS a,? AS b' USING 999999999; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(9) NOT NULL, + `b` int(9) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 2147483647 AS a,? AS b' USING 2147483647; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(10) NOT NULL, + `b` bigint(10) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; diff --git a/mysql-test/suite/binlog/r/binlog_stm_ps.result b/mysql-test/suite/binlog/r/binlog_stm_ps.result index 0b7491e4364..75f64500878 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_ps.result +++ b/mysql-test/suite/binlog/r/binlog_stm_ps.result @@ -185,3 +185,46 @@ master-bin.000004 # Gtid # # GTID #-#-# master-bin.000004 # Query # # use `test`; DROP PROCEDURE p1 master-bin.000004 # Gtid # # GTID #-#-# master-bin.000004 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ +# +#MDEV-14467 Item_param: replace {INT|DECIMAL|REAL|STRING|TIME}_VALUE with Type_handler +# +FLUSH LOGS; +CREATE TABLE t1 (a INT); +EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING 10; +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted +EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING 10.1; +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted +EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING 10.1e0; +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted +EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING '10'; +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted +EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING TIME'10:10:10'; +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted +DROP TABLE t1; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000005 # Binlog_checkpoint # # master-bin.000005 +master-bin.000005 # Gtid # # GTID #-#-# +master-bin.000005 # Query # # use `test`; CREATE TABLE t1 (a INT) +master-bin.000005 # Gtid # # BEGIN GTID #-#-# +master-bin.000005 # Query # # use `test`; INSERT INTO t1 SELECT 1 LIMIT 10 +master-bin.000005 # Query # # COMMIT +master-bin.000005 # Gtid # # BEGIN GTID #-#-# +master-bin.000005 # Query # # use `test`; INSERT INTO t1 SELECT 1 LIMIT 10 +master-bin.000005 # Query # # COMMIT +master-bin.000005 # Gtid # # BEGIN GTID #-#-# +master-bin.000005 # Query # # use `test`; INSERT INTO t1 SELECT 1 LIMIT 10 +master-bin.000005 # Query # # COMMIT +master-bin.000005 # Gtid # # BEGIN GTID #-#-# +master-bin.000005 # Query # # use `test`; INSERT INTO t1 SELECT 1 LIMIT 10 +master-bin.000005 # Query # # COMMIT +master-bin.000005 # Gtid # # BEGIN GTID #-#-# +master-bin.000005 # Query # # use `test`; INSERT INTO t1 SELECT 1 LIMIT 101010 +master-bin.000005 # Query # # COMMIT +master-bin.000005 # Gtid # # GTID #-#-# +master-bin.000005 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ diff --git a/mysql-test/suite/binlog/t/binlog_stm_ps.test b/mysql-test/suite/binlog/t/binlog_stm_ps.test index e6e54985f6f..b83991b1356 100644 --- a/mysql-test/suite/binlog/t/binlog_stm_ps.test +++ b/mysql-test/suite/binlog/t/binlog_stm_ps.test @@ -99,3 +99,19 @@ DROP TABLE t1; --let $binlog_file = LAST source include/show_binlog_events.inc; + +--echo # +--echo #MDEV-14467 Item_param: replace {INT|DECIMAL|REAL|STRING|TIME}_VALUE with Type_handler +--echo # + +FLUSH LOGS; +CREATE TABLE t1 (a INT); +EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING 10; +EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING 10.1; +EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING 10.1e0; +EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING '10'; +EXECUTE IMMEDIATE 'INSERT INTO t1 SELECT 1 LIMIT ?' USING TIME'10:10:10'; +DROP TABLE t1; + +--let $binlog_file = LAST +source include/show_binlog_events.inc; diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index 139ed1b5e51..bf74067d562 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -4541,3 +4541,29 @@ CREATE TABLE t1 AS SELECT @a AS c1; SHOW CREATE TABLE t1; DROP TABLE t1; DROP PROCEDURE p1; + +--echo # +--echo # MDEV-14467 Item_param: replace {INT|DECIMAL|REAL|STRING|TIME}_VALUE with Type_handler +--echo # + +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10; +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10.1; +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10.1e0; +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING '10'; +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING TIME'10:10:10'; + +EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 1 AS a,? AS b' USING 1; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 10 AS a,? AS b' USING 10; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 999999999 AS a,? AS b' USING 999999999; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 2147483647 AS a,? AS b' USING 2147483647; +SHOW CREATE TABLE t1; +DROP TABLE t1; -- cgit v1.2.1 From 8cee2f136d7cccb4bf8d6ac4ecfc224a495b9cec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Thu, 23 Nov 2017 18:42:28 +0200 Subject: MDEV-13384: "window" seems like a reserved column name but it's not listed as one Window is a reserved keyword according to SQL Standard 2016. However, we can make the grammar slightly flexible by allowing WINDOW keyword everywhere except table aliases. Change yacc grammar to separate between all keywords and table_alias keywords. --- mysql-test/r/win.result | 16 ++++++++++++++++ mysql-test/t/win.test | 21 +++++++++++++++++++++ 2 files changed, 37 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result index bac00adfe54..cfe3ebe6a3c 100644 --- a/mysql-test/r/win.result +++ b/mysql-test/r/win.result @@ -3273,3 +3273,19 @@ row_number() over (partition by i order by i) i 1 1 1 2 DROP TABLE t1; +# +# MDEV-13384: "window" seems like a reserved column name but it's not listed as one +# +# Currently we allow window as an identifier, except for table aliases. +# +CREATE TABLE door (id INT, window VARCHAR(10)); +SELECT id +FROM door as window; +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 'window' at line 2 +SELECT id, window +FROM door; +id window +SELECT id, window +FROM door as window; +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 'window' at line 2 +DROP TABLE door; diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test index 52819061570..1e747e59a1a 100644 --- a/mysql-test/t/win.test +++ b/mysql-test/t/win.test @@ -2036,3 +2036,24 @@ PREPARE stmt FROM "SELECT row_number() over (partition by i order by i), i FROM EXECUTE stmt; DROP TABLE t1; + +--echo # +--echo # MDEV-13384: "window" seems like a reserved column name but it's not listed as one +--echo # +--echo # Currently we allow window as an identifier, except for table aliases. +--echo # + +CREATE TABLE door (id INT, window VARCHAR(10)); + +--error ER_PARSE_ERROR +SELECT id +FROM door as window; + +SELECT id, window +FROM door; + +--error ER_PARSE_ERROR +SELECT id, window +FROM door as window; + +DROP TABLE door; -- cgit v1.2.1 From f59a1826f81e3246735c2ca61daec794170b61d1 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 29 Nov 2017 22:56:23 +0000 Subject: MDEV-14536 : during backup, retry read of log blocks, if there is (possibly intermittent) checksum mismatch. --- .../suite/mariabackup/log_checksum_mismatch.result | 14 ++++++++++ .../suite/mariabackup/log_checksum_mismatch.test | 32 ++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 mysql-test/suite/mariabackup/log_checksum_mismatch.result create mode 100644 mysql-test/suite/mariabackup/log_checksum_mismatch.test (limited to 'mysql-test') diff --git a/mysql-test/suite/mariabackup/log_checksum_mismatch.result b/mysql-test/suite/mariabackup/log_checksum_mismatch.result new file mode 100644 index 00000000000..806a5e62cb6 --- /dev/null +++ b/mysql-test/suite/mariabackup/log_checksum_mismatch.result @@ -0,0 +1,14 @@ +CREATE TABLE t(i INT) ENGINE INNODB; +INSERT INTO t VALUES(1); +# xtrabackup backup +FOUND 1 /Invalid log block checksum/ in backup.log +INSERT INTO t VALUES(2); +# xtrabackup prepare +# shutdown server +# remove datadir +# xtrabackup move back +# restart server +SELECT * FROM t; +i +1 +DROP TABLE t; diff --git a/mysql-test/suite/mariabackup/log_checksum_mismatch.test b/mysql-test/suite/mariabackup/log_checksum_mismatch.test new file mode 100644 index 00000000000..f041b0aeedd --- /dev/null +++ b/mysql-test/suite/mariabackup/log_checksum_mismatch.test @@ -0,0 +1,32 @@ +--source include/have_debug.inc + +CREATE TABLE t(i INT) ENGINE INNODB; +INSERT INTO t VALUES(1); +echo # xtrabackup backup; +let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; +let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log; + +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --dbug=+d,log_intermittent_checksum_mismatch > $backuplog; +--enable_result_log + +--let SEARCH_RANGE = 10000000 +--let SEARCH_PATTERN=Invalid log block checksum +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc +remove_file $backuplog; + + +INSERT INTO t VALUES(2); + + +echo # xtrabackup prepare; +--disable_result_log +exec $XTRABACKUP --prepare --target-dir=$targetdir; +-- source include/restart_and_restore.inc +--enable_result_log + +SELECT * FROM t; +DROP TABLE t; +rmdir $targetdir; + -- cgit v1.2.1 From c65911ac46c4dc002cf0ea219df54ad086ededd8 Mon Sep 17 00:00:00 2001 From: Monty Date: Thu, 30 Nov 2017 17:01:23 +0200 Subject: Mark constant 'null_tables' with table->const_table=1 This was done to make thing consistent. It gives the additional benefit that EXPLAIN EXTENDED now treat null_tables like constant's and replaces columns with NULL, in a similar way that it replaces columns with constants for constant tables. - Null tables are tables where all columns are always NULL. The most common NULL TABLE is a table used in a LEFT_JOIN that is never true. - All result changes comes from replacing columns with NULL for null_tables. - "Impossible where" is now also shows constants for const columns. - Removed duplicated s->type= JT_CONST - Reset found_const_table_map when JOIN is created (safety fix) --- mysql-test/r/range.result | 2 +- mysql-test/r/range_mrr_icp.result | 2 +- mysql-test/r/select.result | 2 +- mysql-test/r/select_jcl6.result | 2 +- mysql-test/r/select_pkeycache.result | 2 +- mysql-test/r/selectivity.result | 4 ++-- mysql-test/r/selectivity_innodb.result | 4 ++-- 7 files changed, 9 insertions(+), 9 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index 80aef096828..61886b2be98 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -2284,7 +2284,7 @@ explain extended select * from t2 where (b > 25 and b < 15) or (a>55 and a<44); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where 0 +Note 1003 select 44 AS `a`,15 AS `b`,NULL AS `c` from `test`.`t2` where 0 drop table t1,t2; # # Start of 10.1 tests diff --git a/mysql-test/r/range_mrr_icp.result b/mysql-test/r/range_mrr_icp.result index b0672eed54e..f6c523f9900 100644 --- a/mysql-test/r/range_mrr_icp.result +++ b/mysql-test/r/range_mrr_icp.result @@ -2286,7 +2286,7 @@ explain extended select * from t2 where (b > 25 and b < 15) or (a>55 and a<44); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where 0 +Note 1003 select 44 AS `a`,15 AS `b`,NULL AS `c` from `test`.`t2` where 0 drop table t1,t2; # # Start of 10.1 tests diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index c7156ddae91..1c1758c83b8 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -5482,7 +5482,7 @@ WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 ); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select 1 AS `i1`,8 AS `j1`,`test`.`t2`.`i2` AS `i2` from `test`.`t2` where 0 +Note 1003 select 1 AS `i1`,8 AS `j1`,NULL AS `i2` from `test`.`t2` where 0 SELECT * FROM t1, t2 WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 ); i1 j1 i2 diff --git a/mysql-test/r/select_jcl6.result b/mysql-test/r/select_jcl6.result index 92be057c62c..fdfb472a32e 100644 --- a/mysql-test/r/select_jcl6.result +++ b/mysql-test/r/select_jcl6.result @@ -5493,7 +5493,7 @@ WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 ); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select 1 AS `i1`,8 AS `j1`,`test`.`t2`.`i2` AS `i2` from `test`.`t2` where 0 +Note 1003 select 1 AS `i1`,8 AS `j1`,NULL AS `i2` from `test`.`t2` where 0 SELECT * FROM t1, t2 WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 ); i1 j1 i2 diff --git a/mysql-test/r/select_pkeycache.result b/mysql-test/r/select_pkeycache.result index c7156ddae91..1c1758c83b8 100644 --- a/mysql-test/r/select_pkeycache.result +++ b/mysql-test/r/select_pkeycache.result @@ -5482,7 +5482,7 @@ WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 ); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select 1 AS `i1`,8 AS `j1`,`test`.`t2`.`i2` AS `i2` from `test`.`t2` where 0 +Note 1003 select 1 AS `i1`,8 AS `j1`,NULL AS `i2` from `test`.`t2` where 0 SELECT * FROM t1, t2 WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 ); i1 j1 i2 diff --git a/mysql-test/r/selectivity.result b/mysql-test/r/selectivity.result index 7400dff3958..cdb210ae2d9 100644 --- a/mysql-test/r/selectivity.result +++ b/mysql-test/r/selectivity.result @@ -784,7 +784,7 @@ select * from t1 where a < 1 and a > 7; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 +Note 1003 select 7 AS `a` from `test`.`t1` where 0 select * from t1 where a < 1 and a > 7; a drop table t1; @@ -1508,7 +1508,7 @@ select * from t2 where col1 < 'b' and col1 > 'd'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where 0 +Note 1003 select 'd' AS `col1` from `test`.`t2` where 0 drop table t1,t2; set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; diff --git a/mysql-test/r/selectivity_innodb.result b/mysql-test/r/selectivity_innodb.result index 960a873c854..47d2e6fd554 100644 --- a/mysql-test/r/selectivity_innodb.result +++ b/mysql-test/r/selectivity_innodb.result @@ -791,7 +791,7 @@ select * from t1 where a < 1 and a > 7; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 +Note 1003 select 7 AS `a` from `test`.`t1` where 0 select * from t1 where a < 1 and a > 7; a drop table t1; @@ -1518,7 +1518,7 @@ select * from t2 where col1 < 'b' and col1 > 'd'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where 0 +Note 1003 select 'd' AS `col1` from `test`.`t2` where 0 drop table t1,t2; set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; -- cgit v1.2.1 From c24d1d665c907c8f8c98fc0e7ec986145b9fc757 Mon Sep 17 00:00:00 2001 From: Monty Date: Thu, 30 Nov 2017 17:03:55 +0200 Subject: Improve error messages - mysql_install_db now prints position to error file, if log-error is used - Warning about compatibility now mentions MySQL 5.6 and 5.7 - Give warning if --show_compatibility_56 is used --- mysql-test/mysql-test-run.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mysql-test') diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 7902c8770a8..ae5d9af30d3 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -4418,7 +4418,7 @@ sub extract_warning_lines ($$) { qr|feedback plugin: failed to retrieve the MAC address|, qr|Plugin 'FEEDBACK' init function returned error|, qr|Plugin 'FEEDBACK' registration as a INFORMATION SCHEMA failed|, - qr|'log-bin-use-v1-row-events' is MySQL 5.6 compatible option|, + qr|'log-bin-use-v1-row-events' is MySQL .* compatible option|, qr|InnoDB: Setting thread \d+ nice to \d+ failed, current nice \d+, errno 13|, # setpriority() fails under valgrind qr|Failed to setup SSL|, qr|SSL error: Failed to set ciphers to use|, -- cgit v1.2.1 From 666070852384c2f5c40685a1ae0702e7d8cee85e Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 1 Dec 2017 12:34:37 +0200 Subject: Changed "const row not found" to "Const row not found" Also changed Unique row not found to use uppercase first. This was done to make these messages consistent with the rest --- mysql-test/r/analyze_stmt_privileges2.result | 6 +-- mysql-test/r/derived.result | 56 +++++++++++----------- mysql-test/r/derived_view.result | 4 +- mysql-test/r/explain.result | 8 ++-- mysql-test/r/explain_json.result | 2 +- mysql-test/r/func_group.result | 2 +- mysql-test/r/func_group_innodb.result | 4 +- mysql-test/r/func_str.result | 4 +- mysql-test/r/join_nested.result | 2 +- mysql-test/r/join_nested_jcl6.result | 2 +- mysql-test/r/limit_rows_examined.result | 6 +-- mysql-test/r/myisam_explain_non_select_all.result | 22 ++++----- mysql-test/r/order_by.result | 2 +- mysql-test/r/outfile.result | Bin 2323 -> 2323 bytes mysql-test/r/partition_pruning.result | 2 +- mysql-test/r/query_cache.result | 2 +- mysql-test/r/select.result | 8 ++-- mysql-test/r/select_found.result | 2 +- mysql-test/r/select_jcl6.result | 8 ++-- mysql-test/r/select_pkeycache.result | 8 ++-- mysql-test/r/subselect.result | 28 +++++------ mysql-test/r/subselect4.result | 20 ++++---- mysql-test/r/subselect_mat.result | 4 +- mysql-test/r/subselect_mat_cost_bugs.result | 2 +- mysql-test/r/subselect_no_exists_to_in.result | 28 +++++------ mysql-test/r/subselect_no_mat.result | 28 +++++------ mysql-test/r/subselect_no_opts.result | 28 +++++------ mysql-test/r/subselect_no_scache.result | 28 +++++------ mysql-test/r/subselect_no_semijoin.result | 28 +++++------ mysql-test/r/union.result | 4 +- mysql-test/r/view.result | 12 ++--- mysql-test/r/view_grant.result | 16 +++---- mysql-test/suite/innodb/r/innodb_mysql.result | 6 +-- 33 files changed, 191 insertions(+), 191 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/analyze_stmt_privileges2.result b/mysql-test/r/analyze_stmt_privileges2.result index 892791dd8f8..cf38810b598 100644 --- a/mysql-test/r/analyze_stmt_privileges2.result +++ b/mysql-test/r/analyze_stmt_privileges2.result @@ -1452,7 +1452,7 @@ id select_type table type possible_keys key key_len ref rows r_rows filtered r_f DELETE FROM t1 USING t1, t2; EXPLAIN DELETE FROM t1 USING t1, t2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 ANALYZE DELETE FROM t1 USING t1, t2; id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra @@ -1797,7 +1797,7 @@ id select_type table type possible_keys key key_len ref rows r_rows filtered r_f DELETE FROM t1 USING t1, t2; EXPLAIN DELETE FROM t1 USING t1, t2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 ANALYZE DELETE FROM t1 USING t1, t2; id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra @@ -1813,7 +1813,7 @@ SELECT * FROM t1; a b EXPLAIN SELECT * FROM t1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found ANALYZE SELECT * FROM t1; id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index 220fd5a8c74..32184c5637b 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -896,34 +896,34 @@ WHERE REF IS NULL AND DIVISION="MIS" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_N A.DIVISION=C1.DIVISION AND A.RECEIVABLE_GROUP=C1.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=C1.CREDIT_LIMIT ORDER BY TOTAL DESC; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found -1 PRIMARY system NULL NULL NULL NULL 0 const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found 29 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table 28 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table 27 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result index 9221c6240bd..d3c9fc1e064 100644 --- a/mysql-test/r/derived_view.result +++ b/mysql-test/r/derived_view.result @@ -2014,7 +2014,7 @@ SELECT t.b, t.c, t1.a FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t WHERE t.b AND t.c = t1.a; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 Const row not found 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) Warnings: @@ -2029,7 +2029,7 @@ SELECT t.b, t.c, t1.a FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t WHERE t.b <> 0 AND t.c = t1.a; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 Const row not found 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) Warnings: diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result index 97e49af96d4..f593e0dfaba 100644 --- a/mysql-test/r/explain.result +++ b/mysql-test/r/explain.result @@ -2,7 +2,7 @@ drop table if exists t1; create table t1 (id int not null, str char(10), unique(str)); explain select * from t1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found insert into t1 values (1, null),(2, null),(3, "foo"),(4, "bar"); select * from t1 where str is null; id str @@ -218,8 +218,8 @@ EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE f1 > ALL( SELECT t.f1 FROM t1,t1 AS t ); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 SUBQUERY t system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 SUBQUERY t system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select 1 AS `1` from `test`.`t1` where 0 SET SESSION sql_mode=@old_sql_mode; @@ -387,7 +387,7 @@ set optimizer_switch='derived_merge=off,derived_with_keys=off'; EXPLAIN EXTENDED SELECT * FROM ( SELECT t1.a FROM t1,t2 WHERE t2.a = t1.a ) AS t; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY system NULL NULL NULL NULL 0 0.00 Const row not found 2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select NULL AS `a` from (/* select#2 */ select NULL AS `a` from `test`.`t1` where 0) `t` diff --git a/mysql-test/r/explain_json.result b/mysql-test/r/explain_json.result index d7cdeac499e..fd342606b3f 100644 --- a/mysql-test/r/explain_json.result +++ b/mysql-test/r/explain_json.result @@ -1204,7 +1204,7 @@ create table t1 (i int) engine=myisam; explain select * from t1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found explain format=json select * from t1; EXPLAIN diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index 3340328cad6..9f3928615ec 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -2066,7 +2066,7 @@ HAVING ('m') IN ( SELECT v FROM t2); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY system NULL NULL NULL NULL 0 const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found 3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table set optimizer_switch=@tmp_optimizer_switch; diff --git a/mysql-test/r/func_group_innodb.result b/mysql-test/r/func_group_innodb.result index e340c04107d..27493ae710b 100644 --- a/mysql-test/r/func_group_innodb.result +++ b/mysql-test/r/func_group_innodb.result @@ -125,14 +125,14 @@ select 1, max(1) from t1i where 1=99; 1 NULL explain select count(*), min(7), max(7) from t1m, t1i; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1m system NULL NULL NULL NULL 0 Const row not found 1 SIMPLE t1i ALL NULL NULL NULL NULL 1 select count(*), min(7), max(7) from t1m, t1i; count(*) min(7) max(7) 0 NULL NULL explain select count(*), min(7), max(7) from t1m, t2i; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1m system NULL NULL NULL NULL 0 Const row not found 1 SIMPLE t2i ALL NULL NULL NULL NULL 1 select count(*), min(7), max(7) from t1m, t2i; count(*) min(7) max(7) diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index b1862d46613..7389eeed5d7 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -1340,12 +1340,12 @@ DROP TABLE t1; create table t1(f1 varchar(4)); explain extended select encode(f1,'zxcv') as 'enc' from t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select encode(NULL,'zxcv') AS `enc` from `test`.`t1` explain extended select decode(f1,'zxcv') as 'enc' from t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select decode(NULL,'zxcv') AS `enc` from `test`.`t1` drop table t1; diff --git a/mysql-test/r/join_nested.result b/mysql-test/r/join_nested.result index 917a31e2a79..708c72fffb5 100644 --- a/mysql-test/r/join_nested.result +++ b/mysql-test/r/join_nested.result @@ -1321,7 +1321,7 @@ c11 c21 5 NULL EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON c11=c21; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21; c11 c21 c31 diff --git a/mysql-test/r/join_nested_jcl6.result b/mysql-test/r/join_nested_jcl6.result index 1ffd94547cc..eb59531b7d2 100644 --- a/mysql-test/r/join_nested_jcl6.result +++ b/mysql-test/r/join_nested_jcl6.result @@ -1332,7 +1332,7 @@ c11 c21 5 NULL EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON c11=c21; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21; c11 c21 c31 diff --git a/mysql-test/r/limit_rows_examined.result b/mysql-test/r/limit_rows_examined.result index c94599235b1..7d1ca948c8b 100644 --- a/mysql-test/r/limit_rows_examined.result +++ b/mysql-test/r/limit_rows_examined.result @@ -98,11 +98,11 @@ create table t0 (c0 int); explain select * from t0 LIMIT ROWS EXAMINED 0; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t0 system NULL NULL NULL NULL 0 Const row not found explain select * from t0 LIMIT ROWS EXAMINED 1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t0 system NULL NULL NULL NULL 0 Const row not found select * from t0 LIMIT ROWS EXAMINED 1; c0 drop table t0; @@ -592,7 +592,7 @@ create table t3_empty like t3; explain select max(c1) from t3_empty LIMIT ROWS EXAMINED 0; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3_empty system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t3_empty system NULL NULL NULL NULL 0 Const row not found select max(c1) from t3_empty LIMIT ROWS EXAMINED 0; max(c1) NULL diff --git a/mysql-test/r/myisam_explain_non_select_all.result b/mysql-test/r/myisam_explain_non_select_all.result index 12c5e627f7a..09e662f5d6a 100644 --- a/mysql-test/r/myisam_explain_non_select_all.result +++ b/mysql-test/r/myisam_explain_non_select_all.result @@ -2184,13 +2184,13 @@ INSERT INTO t1 VALUES (1, 1, 10), (2, 2, 20); # EXPLAIN UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 # Status of EXPLAIN EXTENDED query Variable_name Value @@ -2199,7 +2199,7 @@ FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t1`.`c2` AS `c2`,`test`.`t1`.`c3` AS `c3`,NULL AS `c1`,NULL AS `c2` from `test`.`t1` @@ -2219,13 +2219,13 @@ Handler_read_rnd_next 4 # EXPLAIN UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10 WHERE t1.c3 = 10; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10 WHERE t1.c3 = 10; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value @@ -2234,7 +2234,7 @@ FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c3 = 10; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t1`.`c2` AS `c2`,`test`.`t1`.`c3` AS `c3`,NULL AS `c1`,NULL AS `c2` from `test`.`t1` where `test`.`t1`.`c3` = 10 @@ -2571,12 +2571,12 @@ CREATE VIEW v1 (x) AS SELECT b FROM t2; # EXPLAIN INSERT INTO v1 SELECT * FROM t1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED INSERT INTO v1 SELECT * FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_rnd_next 1 @@ -2584,7 +2584,7 @@ FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a` from `test`.`t1` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -2781,7 +2781,7 @@ CREATE TABLE t2 (id INT); INSERT INTO t1 VALUES (1), (2); EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USING(id) GROUP BY t1.id; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found; Using temporary; Using filesort +1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found; Using temporary; Using filesort 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 DROP TABLE t1,t2; #74 @@ -2879,7 +2879,7 @@ CALL p16(); DROP PROCEDURE p16; CALL p15(); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found DROP PROCEDURE p15; CALL p14(); DROP PROCEDURE p14; diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 5a9f2fae1e0..946ecb51426 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -2635,7 +2635,7 @@ SELECT t1.*, t2.* FROM t1 JOIN t2 ON t1.i1 = t2.i2 LEFT JOIN t3 ON t2.i2 = t3.i3 ORDER BY t1.i1 LIMIT 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 Const row not found 1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 5 100.00 Using index 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.i1 1 100.00 Using index Warnings: diff --git a/mysql-test/r/outfile.result b/mysql-test/r/outfile.result index cafa9d9db4d..4c439c37e4d 100644 Binary files a/mysql-test/r/outfile.result and b/mysql-test/r/outfile.result differ diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result index 0fb24b74218..dc5221a9245 100644 --- a/mysql-test/r/partition_pruning.result +++ b/mysql-test/r/partition_pruning.result @@ -3136,7 +3136,7 @@ drop table t2; create table t1 (s1 int); explain partitions select 1 from t1 union all select 2; id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 Const row not found 2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used drop table t1; create table t1 (a bigint unsigned not null) partition by range(a) ( diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index eb9b1d16011..bb8703b4185 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -235,7 +235,7 @@ select benchmark(1,1) from t1; benchmark(1,1) explain extended select benchmark(1,1) from t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select benchmark(1,1) AS `benchmark(1,1)` from `test`.`t1` show status like "Qcache_queries_in_cache"; diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 1c1758c83b8..4b7aecd675d 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2330,7 +2330,7 @@ insert into t4 values (1,1); explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3 left join t4 on id3 = id4 where id2 = 1 or id4 = 1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t3 system NULL NULL NULL NULL 0 Const row not found 1 SIMPLE t4 const id4 NULL NULL NULL 1 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where @@ -4660,17 +4660,17 @@ DROP TABLE t1; CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL); EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 DROP TABLE t1; diff --git a/mysql-test/r/select_found.result b/mysql-test/r/select_found.result index 8462e19fda8..2c37c2d28d8 100644 --- a/mysql-test/r/select_found.result +++ b/mysql-test/r/select_found.result @@ -83,7 +83,7 @@ UNIQUE KEY e_n (email,name) ); EXPLAIN SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system PRIMARY,kid NULL NULL NULL 0 const row not found; Using temporary +1 SIMPLE t1 system PRIMARY,kid NULL NULL NULL 0 Const row not found; Using temporary 1 SIMPLE t2 ALL NULL NULL NULL NULL 200 SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10; email diff --git a/mysql-test/r/select_jcl6.result b/mysql-test/r/select_jcl6.result index fdfb472a32e..e548da79774 100644 --- a/mysql-test/r/select_jcl6.result +++ b/mysql-test/r/select_jcl6.result @@ -2341,7 +2341,7 @@ insert into t4 values (1,1); explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3 left join t4 on id3 = id4 where id2 = 1 or id4 = 1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t3 system NULL NULL NULL NULL 0 Const row not found 1 SIMPLE t4 const id4 NULL NULL NULL 1 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 1 SIMPLE t2 hash_ALL NULL #hash#$hj 4 test.t1.id1 1 Using where; Using join buffer (flat, BNLH join) @@ -4671,17 +4671,17 @@ DROP TABLE t1; CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL); EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 DROP TABLE t1; diff --git a/mysql-test/r/select_pkeycache.result b/mysql-test/r/select_pkeycache.result index 1c1758c83b8..4b7aecd675d 100644 --- a/mysql-test/r/select_pkeycache.result +++ b/mysql-test/r/select_pkeycache.result @@ -2330,7 +2330,7 @@ insert into t4 values (1,1); explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3 left join t4 on id3 = id4 where id2 = 1 or id4 = 1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t3 system NULL NULL NULL NULL 0 Const row not found 1 SIMPLE t4 const id4 NULL NULL NULL 1 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where @@ -4660,17 +4660,17 @@ DROP TABLE t1; CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL); EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 DROP TABLE t1; diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 7ba8b545e6a..8e46fa91c2c 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -1161,20 +1161,20 @@ drop table t1; CREATE TABLE t1 (a int(1)); EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1` drop table t1; @@ -1644,7 +1644,7 @@ a explain extended select * from t3 where a >= all (select b from t2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2); @@ -1652,7 +1652,7 @@ a explain extended select * from t3 where a >= some (select b from t2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2 group by 1); @@ -1663,7 +1663,7 @@ a explain extended select * from t3 where a >= all (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2 group by 1); @@ -1671,7 +1671,7 @@ a explain extended select * from t3 where a >= some (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where NULL >= any (select b from t2); @@ -3734,7 +3734,7 @@ from t1' at line 1 explain select * from t1 where not exists ((select t11.i from t1 t11) union (select t12.i from t1 t12)); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table 3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table NULL UNION RESULT ALL NULL NULL NULL NULL NULL @@ -6120,7 +6120,7 @@ FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 Const row not found SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR @@ -6134,7 +6134,7 @@ FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3 ) AS alias3; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY system NULL NULL NULL NULL 0 const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 @@ -6720,7 +6720,7 @@ CREATE TABLE t2 (b INT); EXPLAIN SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t2 system NULL NULL NULL NULL 0 Const row not found 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used 3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result index 6126a7ed3f5..d3f46429cf7 100644 --- a/mysql-test/r/subselect4.result +++ b/mysql-test/r/subselect4.result @@ -21,7 +21,7 @@ ORDER BY count(*); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 index NULL a 5 NULL 2 Using index 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where -3 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 0 const row not found +3 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 0 Const row not found # should not crash the next statement SELECT 1 FROM t1 WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3)) @@ -1261,7 +1261,7 @@ SET optimizer_switch='materialization=off'; EXPLAIN SELECT * FROM t1 RIGHT JOIN t2 ON t1.c1 WHERE 's' IN (SELECT c1 FROM t2); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; FirstMatch(t1) 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) SELECT * FROM t1 RIGHT JOIN t2 ON t1.c1 WHERE 's' IN (SELECT c1 FROM t2); @@ -1269,7 +1269,7 @@ c1 c1 EXPLAIN SELECT * FROM t2 LEFT JOIN t1 ON t1.c1 WHERE 's' IN (SELECT c1 FROM t2); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; FirstMatch(t1) 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) SELECT * FROM t2 LEFT JOIN t1 ON t1.c1 WHERE 's' IN (SELECT c1 FROM t2); @@ -1278,7 +1278,7 @@ SET optimizer_switch='materialization=on'; EXPLAIN SELECT * FROM (t2 LEFT JOIN t1 ON t1.c1) LEFT JOIN t3 on t3.c1 WHERE 's' IN (SELECT c1 FROM t2); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where @@ -2191,7 +2191,7 @@ INSERT INTO t2 VALUES (1); EXPLAIN SELECT MAX(a), ( SELECT 1 FROM t2 ) AS bb FROM t1; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 2 SUBQUERY t2 system NULL NULL NULL NULL 1 SELECT MAX(a), ( SELECT 1 FROM t2 ) AS bb FROM t1; MAX(a) bb @@ -2199,7 +2199,7 @@ NULL 1 EXPLAIN SELECT MAX(a), 1 in ( SELECT b FROM t2 ) AS bb FROM t1; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 2 SUBQUERY t2 system NULL NULL NULL NULL 1 SELECT MAX(a), 1 in ( SELECT b FROM t2 ) AS bb FROM t1; MAX(a) bb @@ -2207,7 +2207,7 @@ NULL 1 EXPLAIN SELECT MAX(a), 1 >= ALL ( SELECT b FROM t2 ) AS bb FROM t1; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT MAX(a), 1 >= ALL ( SELECT b FROM t2 ) AS bb FROM t1; MAX(a) bb @@ -2215,7 +2215,7 @@ NULL 1 EXPLAIN SELECT MAX(a), ( SELECT 1 FROM t2 where b = a) AS bb FROM t1; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT MAX(a), ( SELECT 1 FROM t2 where b = a) AS bb FROM t1; MAX(a) bb @@ -2223,7 +2223,7 @@ NULL NULL EXPLAIN SELECT MAX(a), a in ( SELECT b FROM t2 ) AS bb FROM t1; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 SELECT MAX(a), a in ( SELECT b FROM t2 ) AS bb FROM t1; MAX(a) bb @@ -2231,7 +2231,7 @@ NULL NULL EXPLAIN SELECT MAX(a), a >= ALL ( SELECT b FROM t2 ) AS bb FROM t1; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 SELECT MAX(a), a >= ALL ( SELECT b FROM t2 ) AS bb FROM t1; MAX(a) bb diff --git a/mysql-test/r/subselect_mat.result b/mysql-test/r/subselect_mat.result index 350275d2463..6b5db62093e 100644 --- a/mysql-test/r/subselect_mat.result +++ b/mysql-test/r/subselect_mat.result @@ -2544,7 +2544,7 @@ SELECT i FROM t1 LEFT JOIN t2 ON (j) IN (SELECT k FROM t3); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 system NULL NULL NULL NULL 1 1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where -2 MATERIALIZED t3 system NULL NULL NULL NULL 0 const row not found +2 MATERIALIZED t3 system NULL NULL NULL NULL 0 Const row not found SELECT i FROM t1 LEFT JOIN t2 ON (j) IN (SELECT k FROM t3); i 10 @@ -2553,7 +2553,7 @@ SELECT i FROM t1 LEFT JOIN t2 ON (j) IN (SELECT max(k) FROM t3); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 system NULL NULL NULL NULL 1 1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where -2 MATERIALIZED t3 system NULL NULL NULL NULL 0 const row not found +2 MATERIALIZED t3 system NULL NULL NULL NULL 0 Const row not found SELECT i FROM t1 LEFT JOIN t2 ON (j) IN (SELECT max(k) FROM t3); i 10 diff --git a/mysql-test/r/subselect_mat_cost_bugs.result b/mysql-test/r/subselect_mat_cost_bugs.result index b4feb8de200..125da8da517 100644 --- a/mysql-test/r/subselect_mat_cost_bugs.result +++ b/mysql-test/r/subselect_mat_cost_bugs.result @@ -162,7 +162,7 @@ EXPLAIN SELECT * FROM (SELECT * FROM t2) AS a2 WHERE (SELECT distinct SUM(distinct f3 ) FROM t1); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY system NULL NULL NULL NULL 0 const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found 3 SUBQUERY t1 index NULL f3 5 NULL 2 Using index 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table insert into t2 values (1),(2); diff --git a/mysql-test/r/subselect_no_exists_to_in.result b/mysql-test/r/subselect_no_exists_to_in.result index c09f3c94710..51fe0aa80df 100644 --- a/mysql-test/r/subselect_no_exists_to_in.result +++ b/mysql-test/r/subselect_no_exists_to_in.result @@ -1165,20 +1165,20 @@ drop table t1; CREATE TABLE t1 (a int(1)); EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1` drop table t1; @@ -1648,7 +1648,7 @@ a explain extended select * from t3 where a >= all (select b from t2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2); @@ -1656,7 +1656,7 @@ a explain extended select * from t3 where a >= some (select b from t2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2 group by 1); @@ -1667,7 +1667,7 @@ a explain extended select * from t3 where a >= all (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2 group by 1); @@ -1675,7 +1675,7 @@ a explain extended select * from t3 where a >= some (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where NULL >= any (select b from t2); @@ -3737,7 +3737,7 @@ from t1' at line 1 explain select * from t1 where not exists ((select t11.i from t1 t11) union (select t12.i from t1 t12)); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table 3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table NULL UNION RESULT ALL NULL NULL NULL NULL NULL @@ -6120,7 +6120,7 @@ FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 Const row not found SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR @@ -6134,7 +6134,7 @@ FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3 ) AS alias3; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY system NULL NULL NULL NULL 0 const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 @@ -6720,7 +6720,7 @@ CREATE TABLE t2 (b INT); EXPLAIN SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t2 system NULL NULL NULL NULL 0 Const row not found 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used 3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result index 0aefeaf44d9..6381e1939db 100644 --- a/mysql-test/r/subselect_no_mat.result +++ b/mysql-test/r/subselect_no_mat.result @@ -1168,20 +1168,20 @@ drop table t1; CREATE TABLE t1 (a int(1)); EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1` drop table t1; @@ -1651,7 +1651,7 @@ a explain extended select * from t3 where a >= all (select b from t2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2); @@ -1659,7 +1659,7 @@ a explain extended select * from t3 where a >= some (select b from t2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2 group by 1); @@ -1670,7 +1670,7 @@ a explain extended select * from t3 where a >= all (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2 group by 1); @@ -1678,7 +1678,7 @@ a explain extended select * from t3 where a >= some (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where NULL >= any (select b from t2); @@ -3737,7 +3737,7 @@ from t1' at line 1 explain select * from t1 where not exists ((select t11.i from t1 t11) union (select t12.i from t1 t12)); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table 3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table NULL UNION RESULT ALL NULL NULL NULL NULL NULL @@ -6115,7 +6115,7 @@ FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 Const row not found SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR @@ -6129,7 +6129,7 @@ FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3 ) AS alias3; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY system NULL NULL NULL NULL 0 const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 @@ -6715,7 +6715,7 @@ CREATE TABLE t2 (b INT); EXPLAIN SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t2 system NULL NULL NULL NULL 0 Const row not found 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used 3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result index 92defb3c36d..1a56c333887 100644 --- a/mysql-test/r/subselect_no_opts.result +++ b/mysql-test/r/subselect_no_opts.result @@ -1164,20 +1164,20 @@ drop table t1; CREATE TABLE t1 (a int(1)); EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1` drop table t1; @@ -1647,7 +1647,7 @@ a explain extended select * from t3 where a >= all (select b from t2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2); @@ -1655,7 +1655,7 @@ a explain extended select * from t3 where a >= some (select b from t2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2 group by 1); @@ -1666,7 +1666,7 @@ a explain extended select * from t3 where a >= all (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2 group by 1); @@ -1674,7 +1674,7 @@ a explain extended select * from t3 where a >= some (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where NULL >= any (select b from t2); @@ -3733,7 +3733,7 @@ from t1' at line 1 explain select * from t1 where not exists ((select t11.i from t1 t11) union (select t12.i from t1 t12)); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table 3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table NULL UNION RESULT ALL NULL NULL NULL NULL NULL @@ -6111,7 +6111,7 @@ FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 Const row not found SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR @@ -6125,7 +6125,7 @@ FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3 ) AS alias3; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY system NULL NULL NULL NULL 0 const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 @@ -6711,7 +6711,7 @@ CREATE TABLE t2 (b INT); EXPLAIN SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t2 system NULL NULL NULL NULL 0 Const row not found 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used 3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result index b47dab2e79e..26aee4269b6 100644 --- a/mysql-test/r/subselect_no_scache.result +++ b/mysql-test/r/subselect_no_scache.result @@ -1167,20 +1167,20 @@ drop table t1; CREATE TABLE t1 (a int(1)); EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1` drop table t1; @@ -1650,7 +1650,7 @@ a explain extended select * from t3 where a >= all (select b from t2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2); @@ -1658,7 +1658,7 @@ a explain extended select * from t3 where a >= some (select b from t2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2 group by 1); @@ -1669,7 +1669,7 @@ a explain extended select * from t3 where a >= all (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2 group by 1); @@ -1677,7 +1677,7 @@ a explain extended select * from t3 where a >= some (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where NULL >= any (select b from t2); @@ -3740,7 +3740,7 @@ from t1' at line 1 explain select * from t1 where not exists ((select t11.i from t1 t11) union (select t12.i from t1 t12)); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table 3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table NULL UNION RESULT ALL NULL NULL NULL NULL NULL @@ -6126,7 +6126,7 @@ FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 Const row not found SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR @@ -6140,7 +6140,7 @@ FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3 ) AS alias3; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY system NULL NULL NULL NULL 0 const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 @@ -6726,7 +6726,7 @@ CREATE TABLE t2 (b INT); EXPLAIN SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t2 system NULL NULL NULL NULL 0 Const row not found 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used 3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result index 9d04ddd9829..e962add85c8 100644 --- a/mysql-test/r/subselect_no_semijoin.result +++ b/mysql-test/r/subselect_no_semijoin.result @@ -1164,20 +1164,20 @@ drop table t1; CREATE TABLE t1 (a int(1)); EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1` drop table t1; @@ -1647,7 +1647,7 @@ a explain extended select * from t3 where a >= all (select b from t2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2); @@ -1655,7 +1655,7 @@ a explain extended select * from t3 where a >= some (select b from t2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2 group by 1); @@ -1666,7 +1666,7 @@ a explain extended select * from t3 where a >= all (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > (`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2 group by 1); @@ -1674,7 +1674,7 @@ a explain extended select * from t3 where a >= some (select b from t2 group by 1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where ((`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= (`test`.`t3`.`a`))) select * from t3 where NULL >= any (select b from t2); @@ -3733,7 +3733,7 @@ from t1' at line 1 explain select * from t1 where not exists ((select t11.i from t1 t11) union (select t12.i from t1 t12)); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table 3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table NULL UNION RESULT ALL NULL NULL NULL NULL NULL @@ -6111,7 +6111,7 @@ FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 Const row not found SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR @@ -6125,7 +6125,7 @@ FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3 ) AS alias3; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY system NULL NULL NULL NULL 0 const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 @@ -6711,7 +6711,7 @@ CREATE TABLE t2 (b INT); EXPLAIN SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t2 system NULL NULL NULL NULL 0 Const row not found 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used 3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index b193f032146..9ec3b1056fd 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -1634,8 +1634,8 @@ UNION SELECT a FROM t1 ORDER BY a; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found -2 UNION t1 system NULL NULL NULL NULL 0 0.00 const row not found +1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNION t1 system NULL NULL NULL NULL 0 0.00 Const row not found NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Using filesort Warnings: Note 1003 /* select#1 */ select NULL AS `a` from `test`.`t1` union /* select#2 */ select NULL AS `a` from `test`.`t1` order by `a` diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 2d442fe90a9..120a13254a0 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -2934,10 +2934,10 @@ CREATE TABLE t1 (s1 int); CREATE VIEW v1 AS SELECT * FROM t1; EXPLAIN SELECT * FROM t1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found EXPLAIN SELECT * FROM v1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found INSERT INTO t1 VALUES (1), (3), (2); EXPLAIN SELECT * FROM t1 t WHERE t.s1+1 < (SELECT MAX(t1.s1) FROM t1); id select_type table type possible_keys key key_len ref rows Extra @@ -4609,7 +4609,7 @@ WHERE t4.a >= t1.a); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 0 0.00 const row not found +2 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 0 0.00 Const row not found 2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 @@ -4625,7 +4625,7 @@ WHERE t4.a >= v1.a); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 0 0.00 const row not found +2 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 0 0.00 Const row not found 2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'v1.a' of SELECT #2 was resolved in SELECT #1 @@ -4657,7 +4657,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 system NULL NULL NULL NULL 1 100.00 1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 Using where 2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 100.00 -2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1276 Field or reference 'test.t4.b' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select 0 AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c` from `test`.`t4` where `test`.`t4`.`c` <= <`test`.`t4`.`b`>((/* select#2 */ select 0 from dual where 7 > `test`.`t4`.`b`)) @@ -4674,7 +4674,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 system NULL NULL NULL NULL 1 100.00 1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 Using where 2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 100.00 -2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found +2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1276 Field or reference 'v4.b' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select 0 AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c` from `test`.`t4` where `test`.`t4`.`c` <= <`test`.`t4`.`b`>((/* select#2 */ select 0 from dual where 7 > `test`.`t4`.`b`)) diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result index 04ad19c5ddc..82594128d85 100644 --- a/mysql-test/r/view_grant.result +++ b/mysql-test/r/view_grant.result @@ -144,7 +144,7 @@ revoke select on mysqltest.v5 from mysqltest_1@localhost; connection user1; explain select c from mysqltest.v1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found show create view mysqltest.v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v1` AS select `mysqltest`.`t1`.`a` + 1 AS `c`,`mysqltest`.`t1`.`b` + 1 AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci @@ -167,13 +167,13 @@ grant show view on mysqltest.* to mysqltest_1@localhost; connection user1; explain select c from mysqltest.v1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found show create view mysqltest.v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v1` AS select `mysqltest`.`t1`.`a` + 1 AS `c`,`mysqltest`.`t1`.`b` + 1 AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci explain select c from mysqltest.v2; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY system NULL NULL NULL NULL 0 const row not found +1 PRIMARY system NULL NULL NULL NULL 0 Const row not found 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table show create view mysqltest.v2; View Create View character_set_client collation_connection @@ -1190,7 +1190,7 @@ select * from v1; i explain select * from v1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found disconnect test11765687; ... as eugene connect test11765687,localhost,eugene,,mysqltest1; @@ -1238,12 +1238,12 @@ select k from t3; k explain select k from t3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t3 system NULL NULL NULL NULL 0 Const row not found select * from v3; k explain select * from v3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t3 system NULL NULL NULL NULL 0 Const row not found disconnect test11765687; ... as inga connect test11765687,localhost,inga,,mysqltest1; @@ -1284,8 +1284,8 @@ select * from v2; i j explain select * from v2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found -1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found +1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found disconnect test11765687; ... as noam connect test11765687,localhost,noam,,mysqltest1; diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result index cdfdbad9e20..3663c18ea44 100644 --- a/mysql-test/suite/innodb/r/innodb_mysql.result +++ b/mysql-test/suite/innodb/r/innodb_mysql.result @@ -238,14 +238,14 @@ select 1, max(1) from t1i where 1=99; 1 NULL explain select count(*), min(7), max(7) from t1m, t1i; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1m system NULL NULL NULL NULL 0 Const row not found 1 SIMPLE t1i ALL NULL NULL NULL NULL 1 select count(*), min(7), max(7) from t1m, t1i; count(*) min(7) max(7) 0 NULL NULL explain select count(*), min(7), max(7) from t1m, t2i; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1m system NULL NULL NULL NULL 0 Const row not found 1 SIMPLE t2i ALL NULL NULL NULL NULL 1 select count(*), min(7), max(7) from t1m, t2i; count(*) min(7) max(7) @@ -1853,7 +1853,7 @@ explain select b from t1 where a not in (select max(b) from t1,t2 group by a) group by a; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 const row not found +2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 Const row not found 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 1 set optimizer_switch=@save_optimizer_switch; DROP TABLE t1,t2; -- cgit v1.2.1 From d5268a610af093e1bf7c0fc2f0d1aabd040766ad Mon Sep 17 00:00:00 2001 From: Monty Date: Mon, 5 Dec 2016 13:04:47 +0200 Subject: MDEV-7700 Spiral patch 002_mariadb-10.0.15.spider.diff, part 2 Allow partition engines to access table->s->connect_string for engines that uses HTON_CAN_READ_CONNECT_STRING_IN_PARTITION Don't reset table->s->connect_string in ha_partition::open --- mysql-test/suite/federated/federated_partition.result | 5 +++-- mysql-test/suite/federated/federated_partition.test | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/federated/federated_partition.result b/mysql-test/suite/federated/federated_partition.result index a2d5fcffd9b..c8a61d825b6 100644 --- a/mysql-test/suite/federated/federated_partition.result +++ b/mysql-test/suite/federated/federated_partition.result @@ -10,7 +10,8 @@ create table federated.t1_1 (s1 int primary key) engine=myisam; create table federated.t1_2 (s1 int primary key) engine=innodb; connection master; create table t1 (s1 int primary key) engine=federated -partition by list (s1) +CONNECTION="remember_this" + partition by list (s1) (partition p1 values in (1,3) connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_1', partition p2 values in (2,4) @@ -20,7 +21,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `s1` int(11) NOT NULL, PRIMARY KEY (`s1`) -) ENGINE=FEDERATED DEFAULT CHARSET=latin1 +) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION='remember_this' PARTITION BY LIST (`s1`) (PARTITION `p1` VALUES IN (1,3) CONNECTION = 'mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_1' ENGINE = FEDERATED, PARTITION `p2` VALUES IN (2,4) CONNECTION = 'mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_2' ENGINE = FEDERATED) diff --git a/mysql-test/suite/federated/federated_partition.test b/mysql-test/suite/federated/federated_partition.test index ef1e27ec505..47110b5eebf 100644 --- a/mysql-test/suite/federated/federated_partition.test +++ b/mysql-test/suite/federated/federated_partition.test @@ -25,6 +25,7 @@ create table federated.t1_2 (s1 int primary key) engine=innodb; connection master; --replace_result $SLAVE_MYPORT SLAVE_PORT eval create table t1 (s1 int primary key) engine=federated + CONNECTION="remember_this" partition by list (s1) (partition p1 values in (1,3) connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1_1', -- cgit v1.2.1 From 8eeb689e9fc57afe19a8dbff354b5f9f167867a9 Mon Sep 17 00:00:00 2001 From: Monty Date: Wed, 5 Jul 2017 18:20:06 +0300 Subject: Adding multi_range_read support to partitions Other things: - Cleanup of allocated bitmaps done in open(), which simplifies init_partition_bitmaps() - Add needed defines in ha_spider.cc to enable new spider code - Fixed some DBUG_PRINT() to be consistent with normal code - Removed end space - The changes in test cases partition_innodb, partition_range, partition_pruning etc are becasue partitions can now more exactly calculate the number of rows in a range. Contains spider patches: 014,015,023,033,035,037,040,042,044,045,049,050,051,053,059 --- mysql-test/r/partition_innodb.result | 4 +- mysql-test/r/partition_pruning.result | 86 +++++++++++++++---------------- mysql-test/r/partition_range.result | 4 +- mysql-test/suite/parts/r/optimizer.result | 4 +- mysql-test/t/partition.test | 1 + 5 files changed, 50 insertions(+), 49 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result index 09d8728601f..961621af0f7 100644 --- a/mysql-test/r/partition_innodb.result +++ b/mysql-test/r/partition_innodb.result @@ -29,7 +29,7 @@ Table Op Msg_type Msg_text test.t1 analyze status OK EXPLAIN SELECT b FROM t1 WHERE b between 'L' and 'N' AND a > -100; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY,b b 67 NULL 18 Using where; Using index +1 SIMPLE t1 range PRIMARY,b b 67 NULL 34 Using where; Using index DROP TABLE t1; # # Bug#13007154: Crash in keys_to_use_for_scanning with ORDER BY @@ -663,7 +663,7 @@ EXPLAIN SELECT * FROM t1 WHERE col1 = 1 AND col2 = 2 AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00' GROUP BY 1, 2, 3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge PRIMARY,col1,col2 col1,col2 8,8 NULL # Using intersect(col1,col2); Using where; Using index; Using filesort +1 SIMPLE t1 range PRIMARY,col1,col2 PRIMARY 5 NULL # Using where; Using filesort SELECT * FROM t1 USE INDEX () WHERE col1 = 1 AND col2 = 2 AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00' GROUP BY 1, 2, 3; diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result index dc5221a9245..422132dd1c3 100644 --- a/mysql-test/r/partition_pruning.result +++ b/mysql-test/r/partition_pruning.result @@ -18,7 +18,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra # # # # # # # # # 3 # EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 7; id select_type table partitions type possible_keys key key_len ref rows Extra -# # # # # # # # # 10 # +# # # # # # # # # 9 # EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1; id select_type table partitions type possible_keys key key_len ref rows Extra # # # # # # # # # 3 # @@ -105,7 +105,7 @@ a 6 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 7; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index +1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 9 Using where; Using index SELECT * FROM t1 WHERE a <= 1; a -1 @@ -168,7 +168,7 @@ a 6 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 6; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index +1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 9 Using where; Using index SELECT * FROM t1 WHERE a <= 7; a -1 @@ -182,7 +182,7 @@ a 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 7; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index +1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 9 Using where; Using index SELECT * FROM t1 WHERE a = 1; a 1 @@ -424,7 +424,7 @@ a 5 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 6; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4,max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index +1 SIMPLE t1 p0,p1,p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 8 Using where; Using index SELECT * FROM t1 WHERE a <= 1; a -1 @@ -474,7 +474,7 @@ a 5 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 5; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4,max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index +1 SIMPLE t1 p0,p1,p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 8 Using where; Using index SELECT * FROM t1 WHERE a <= 6; a -1 @@ -487,7 +487,7 @@ a 6 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 6; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4,max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index +1 SIMPLE t1 p0,p1,p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 8 Using where; Using index SELECT * FROM t1 WHERE a = 1; a 1 @@ -744,13 +744,13 @@ a 1001-01-01 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 index a a 4 NULL 6 Using where; Using index +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 3 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 index a a 4 NULL 6 Using where; Using index +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 3 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 3 Using where; Using index +1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL,p2001-01-01 range a a 4 NULL 3 Using where; Using index @@ -759,26 +759,26 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p1001-01-01 system a NULL NULL NULL 1 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 index a a 4 NULL 6 Using where; Using index +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 3 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 index a a 4 NULL 6 Using where; Using index +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 3 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 3 Using where; Using index +1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 3 Using where; Using index +1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL ref a a 4 const 1 Using index # Disabling warnings for the invalid date EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL,p2001-01-01 index a a 4 NULL 4 Using where; Using index @@ -790,16 +790,16 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL ref a a 4 const 1 Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 index a a 4 NULL 6 Using where; Using index +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 3 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 index a a 4 NULL 5 Using where; Using index +1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 3 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 index a a 4 NULL 6 Using where; Using index +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 3 Using where; Using index # test without index ALTER TABLE t1 DROP KEY a; SELECT * FROM t1 WHERE a < '1001-01-01'; @@ -1076,7 +1076,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 range a a 4 NULL 3 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 3 Using where; Using index +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 range a a 4 NULL 4 Using where; Using index @@ -1104,10 +1104,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra # Disabling warnings for the invalid date EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p2001-01-01,pNULL index a a 4 NULL 4 Using where; Using index @@ -1119,10 +1119,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL ref a a 4 const 1 Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 3 Using where; Using index +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL,p1001-01-01 index a a 4 NULL 4 Using where; Using index @@ -1405,7 +1405,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 range a a 4 NULL 3 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 3 Using where; Using index +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 range a a 4 NULL 4 Using where; Using index @@ -1433,10 +1433,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra # Disabling warnings for the invalid date EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p2001-01-01,pNULL index a a 4 NULL 4 Using where; Using index @@ -1448,10 +1448,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL ref a a 4 const 1 Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 3 Using where; Using index +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL,p1001-01-01 index a a 4 NULL 4 Using where; Using index @@ -2867,18 +2867,18 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2 ALL NULL NULL NULL NULL 510 Using where explain partitions select * from t2 where b = 4; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 96 +1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 76 explain extended select * from t2 where b = 6; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ref b b 5 const 96 100.00 +1 SIMPLE t2 ref b b 5 const 76 100.00 Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = 6 explain partitions select * from t2 where b = 6; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 96 +1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 76 explain extended select * from t2 where b in (1,3,5); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL b NULL NULL NULL 910 51.65 Using where +1 SIMPLE t2 ALL b NULL NULL NULL 910 40.66 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` in (1,3,5) explain partitions select * from t2 where b in (1,3,5); @@ -2886,7 +2886,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where explain extended select * from t2 where b in (2,4,6); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL b NULL NULL NULL 910 31.65 Using where +1 SIMPLE t2 ALL b NULL NULL NULL 910 25.05 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` in (2,4,6) explain partitions select * from t2 where b in (2,4,6); @@ -2894,7 +2894,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where explain extended select * from t2 where b in (7,8,9); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL b NULL NULL NULL 910 19.12 Using where +1 SIMPLE t2 ALL b NULL NULL NULL 910 36.70 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` in (7,8,9) explain partitions select * from t2 where b in (7,8,9); @@ -2902,7 +2902,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where explain extended select * from t2 where b > 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL b NULL NULL NULL 910 29.23 Using where +1 SIMPLE t2 ALL b NULL NULL NULL 910 44.84 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 5 explain partitions select * from t2 where b > 5; @@ -2910,7 +2910,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where explain extended select * from t2 where b > 5 and b < 8; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL b NULL NULL NULL 910 28.13 Using where +1 SIMPLE t2 ALL b NULL NULL NULL 910 22.09 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 5 and `test`.`t2`.`b` < 8 explain partitions select * from t2 where b > 5 and b < 8; @@ -2918,15 +2918,15 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where explain extended select * from t2 where b > 5 and b < 7; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range b b 5 NULL 96 100.00 Using where +1 SIMPLE t2 range b b 5 NULL 76 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 5 and `test`.`t2`.`b` < 7 explain partitions select * from t2 where b > 5 and b < 7; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p0,p1,p2,p3,p4 range b b 5 NULL 96 Using where +1 SIMPLE t2 p0,p1,p2,p3,p4 range b b 5 NULL 76 Using where explain extended select * from t2 where b > 0 and b < 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL b NULL NULL NULL 910 53.19 Using where +1 SIMPLE t2 ALL b NULL NULL NULL 910 41.65 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 0 and `test`.`t2`.`b` < 5 explain partitions select * from t2 where b > 0 and b < 5; @@ -2960,10 +2960,10 @@ flush status; delete from t2 where b = 7; show status like 'Handler_read_rnd_next'; Variable_name Value -Handler_read_rnd_next 915 +Handler_read_rnd_next 0 show status like 'Handler_read_key'; Variable_name Value -Handler_read_key 0 +Handler_read_key 5 flush status; delete from t2 where b > 5; show status like 'Handler_read_rnd_next'; diff --git a/mysql-test/r/partition_range.result b/mysql-test/r/partition_range.result index dd9e074db0c..7ae029d488c 100644 --- a/mysql-test/r/partition_range.result +++ b/mysql-test/r/partition_range.result @@ -961,7 +961,7 @@ INSERT INTO t2 SELECT * FROM t1; # plans should be identical EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index for group-by +1 SIMPLE t1 range a a 5 NULL 2 Using where; Using index EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range a a 5 NULL 2 Using where; Using index for group-by @@ -972,7 +972,7 @@ a MAX(b) # Should be no more than 4 reads. SHOW status LIKE 'handler_read_key'; Variable_name Value -Handler_read_key 4 +Handler_read_key 2 FLUSH status; SELECT a, MAX(b) FROM t2 WHERE a IN (10, 100) GROUP BY a; a MAX(b) diff --git a/mysql-test/suite/parts/r/optimizer.result b/mysql-test/suite/parts/r/optimizer.result index cdf0b2b83dc..465c6c7d762 100644 --- a/mysql-test/suite/parts/r/optimizer.result +++ b/mysql-test/suite/parts/r/optimizer.result @@ -22,7 +22,7 @@ INSERT INTO t2 SELECT * FROM t1; # plans should be identical EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index for group-by +1 SIMPLE t1 range a a 5 NULL 2 Using where; Using index EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range a a 5 NULL 2 Using where; Using index for group-by @@ -33,7 +33,7 @@ a MAX(b) # Should be no more than 4 reads. SHOW status LIKE 'handler_read_key'; Variable_name Value -Handler_read_key 4 +Handler_read_key 2 FLUSH status; SELECT a, MAX(b) FROM t2 WHERE a IN (10, 100) GROUP BY a; a MAX(b) diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 608c8812e01..767c9a21119 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -2812,6 +2812,7 @@ INSERT INTO t1 VALUES (123,123,'2001-04-14','address123','city123',40,51), (257,257,'2010-03-06','address257','city257',40,47); --enable_query_log +--sorted_result select * from t1 where hours_worked_per_week = 40 and weeks_worked_last_year = 52 and dob < '1949-11-21'; select * from t1 IGNORE INDEX(dob, weeks_worked_last_year, hours_worked_per_week) where hours_worked_per_week = 40 and weeks_worked_last_year = 52 and dob < '1949-11-21'; -- cgit v1.2.1 From da26d16dd1c07b34f46ba4b00527ebf76810d57d Mon Sep 17 00:00:00 2001 From: Monty Date: Sat, 9 Sep 2017 16:20:55 +0300 Subject: Add direct aggregates Spider patches 026 (MDEV-7723), 031 (MDEV-7727) and 058 (MDEV-12532) This allows the storage engine to internally compute sum and count operations. - Enhance sum items to be able to store the sum value directly. - return_record_by_parent() is enabled in spider as HANDLER_HAS_DIRECT_AGGREGATE is defined - Added spd_environ.h to spider. This is loaded first to ensure that all MariaDB specific defines that are used by include files are properly defined. - This code is tested by the existing spider tests direct_aggregate.test and direct_aggregate_part.test and also partition.test --- mysql-test/r/partition.result | 3 +++ mysql-test/t/partition.test | 1 + 2 files changed, 4 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index f398ef07d56..7a614a146a1 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -513,6 +513,9 @@ COUNT(*) SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 ); SUM(c) 400 +SELECT SUM(c+0.0) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 ); +SUM(c+0.0) +400.0 ALTER TABLE t1 DROP INDEX b; SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 ); COUNT(*) diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 767c9a21119..2357b806a18 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -445,6 +445,7 @@ INSERT INTO t1 VALUES (1,1,0), (1,1,1), (1,1,2), (1,1,53), (1,1,4), (1,1,5), (1,19,1); SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 ); SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 ); +SELECT SUM(c+0.0) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 ); ALTER TABLE t1 DROP INDEX b; SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 ); SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 ); -- cgit v1.2.1 From b016e1ba7f649256c53e9cad3b0c61b76c02fcf1 Mon Sep 17 00:00:00 2001 From: Monty Date: Tue, 7 Nov 2017 11:04:45 +0200 Subject: MDEV-7702 Spiral patch 004_mariadb-10.0.15.slave-trx-retry.diff This is about adding more options to force slave retries Two new variables has been added: slave_transaction_retry_errors - Tells the slave thread to retry transaction for replication when a query event returns an error from the provided list. Deadlock and elapsed lock wait timeout errors are automatically added to this list slave-transaction-retry-interval - Interval of the slave SQL thread will retry a transaction in case it failed with a deadlock or elapsed lock wait timeout or listed in slave_transaction_retry_errors Other changes: - Simplifed code for slave_skip_errors (to be aligned with slave_transaction_retry_errors) - Renamed print_slave_skip_errors() to make_slave_skip_errors_printable() - Remove printing error from init_slave_skip_errors as my_bitmap_init() will do that if needed. - Generalize has_temporary_error() --- mysql-test/r/mysqld--help.result | 19 ++- .../r/slave_transaction_retry_errors.result | 21 +++ .../slave_transaction_retry_interval_basic.result | 126 ++++++++++++++ .../r/sysvars_server_notembedded,32bit.rdiff | 43 +++-- .../sys_vars/r/sysvars_server_notembedded.result | 30 +++- .../t/slave_transaction_retry_errors-master.opt | 1 + .../sys_vars/t/slave_transaction_retry_errors.test | 19 +++ .../t/slave_transaction_retry_interval_basic.test | 190 +++++++++++++++++++++ 8 files changed, 428 insertions(+), 21 deletions(-) create mode 100644 mysql-test/suite/sys_vars/r/slave_transaction_retry_errors.result create mode 100644 mysql-test/suite/sys_vars/r/slave_transaction_retry_interval_basic.result create mode 100644 mysql-test/suite/sys_vars/t/slave_transaction_retry_errors-master.opt create mode 100644 mysql-test/suite/sys_vars/t/slave_transaction_retry_errors.test create mode 100644 mysql-test/suite/sys_vars/t/slave_transaction_retry_interval_basic.test (limited to 'mysql-test') diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result index dfd64e2c1fe..0992276227f 100644 --- a/mysql-test/r/mysqld--help.result +++ b/mysql-test/r/mysqld--help.result @@ -1118,8 +1118,19 @@ The following options may be given as the first argument: (Defaults to on; use --skip-slave-sql-verify-checksum to disable.) --slave-transaction-retries=# Number of times the slave SQL thread will retry a - transaction in case it failed with a deadlock or elapsed - lock wait timeout, before giving up and stopping + transaction in case it failed with a deadlock, elapsed + lock wait timeout or listed in + slave_transaction_retry_errors, before giving up and + stopping + --slave-transaction-retry-errors=name + Tells the slave thread to retry transaction for + replication when a query event returns an error from the + provided list. Deadlock and elapsed lock wait timeout + errors are automatically added to this list + --slave-transaction-retry-interval=# + Interval of the slave SQL thread will retry a transaction + in case it failed with a deadlock or elapsed lock wait + timeout or listed in slave_transaction_retry_errors --slave-type-conversions=name Set of slave type conversions that are enabled. If the variable is empty, no conversions are allowed and it is @@ -1585,9 +1596,11 @@ slave-parallel-mode conservative slave-parallel-threads 0 slave-parallel-workers 0 slave-run-triggers-for-rbr NO -slave-skip-errors (No default value) +slave-skip-errors OFF slave-sql-verify-checksum TRUE slave-transaction-retries 10 +slave-transaction-retry-errors 1213,1205 +slave-transaction-retry-interval 0 slave-type-conversions slow-launch-time 2 slow-query-log FALSE diff --git a/mysql-test/suite/sys_vars/r/slave_transaction_retry_errors.result b/mysql-test/suite/sys_vars/r/slave_transaction_retry_errors.result new file mode 100644 index 00000000000..a7815bb3f78 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/slave_transaction_retry_errors.result @@ -0,0 +1,21 @@ +select @@global.slave_transaction_retry_errors; +@@global.slave_transaction_retry_errors +1213,1205,10,20,400 +select @@session.slave_transaction_retry_errors; +ERROR HY000: Variable 'slave_transaction_retry_errors' is a GLOBAL variable +show global variables like 'slave_transaction_retry_errors'; +Variable_name Value +slave_transaction_retry_errors 1213,1205,10,20,400 +show session variables like 'slave_transaction_retry_errors'; +Variable_name Value +slave_transaction_retry_errors 1213,1205,10,20,400 +select * from information_schema.global_variables where variable_name='slave_transaction_retry_errors'; +VARIABLE_NAME VARIABLE_VALUE +SLAVE_TRANSACTION_RETRY_ERRORS 1213,1205,10,20,400 +select * from information_schema.session_variables where variable_name='slave_transaction_retry_errors'; +VARIABLE_NAME VARIABLE_VALUE +SLAVE_TRANSACTION_RETRY_ERRORS 1213,1205,10,20,400 +set global slave_transaction_retry_errors=1; +ERROR HY000: Variable 'slave_transaction_retry_errors' is a read only variable +set session slave_transaction_retry_errors=1; +ERROR HY000: Variable 'slave_transaction_retry_errors' is a read only variable diff --git a/mysql-test/suite/sys_vars/r/slave_transaction_retry_interval_basic.result b/mysql-test/suite/sys_vars/r/slave_transaction_retry_interval_basic.result new file mode 100644 index 00000000000..8be45f83341 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/slave_transaction_retry_interval_basic.result @@ -0,0 +1,126 @@ +SET @start_global_value = @@global.slave_transaction_retry_interval; +SELECT @start_global_value; +@start_global_value +0 +'#--------------------FN_DYNVARS_149_01-------------------------#' +SET @@global.slave_transaction_retry_interval = 50; +SET @@global.slave_transaction_retry_interval = DEFAULT; +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +0 +'#--------------------FN_DYNVARS_149_02-------------------------#' +SET @@global.slave_transaction_retry_interval = DEFAULT; +SELECT @@global.slave_transaction_retry_interval = 10; +@@global.slave_transaction_retry_interval = 10 +0 +'#--------------------FN_DYNVARS_149_03-------------------------#' +SET @@global.slave_transaction_retry_interval = 0; +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +0 +SET @@global.slave_transaction_retry_interval = 1; +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +1 +SET @@global.slave_transaction_retry_interval = 15; +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +15 +SET @@global.slave_transaction_retry_interval = 1024; +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +1024 +SET @@global.slave_transaction_retry_interval = 2147483648; +Warnings: +Warning 1292 Truncated incorrect slave_transaction_retry_interval value: '2147483648' +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +3600 +SET @@global.slave_transaction_retry_interval = 2147483648*2-1; +Warnings: +Warning 1292 Truncated incorrect slave_transaction_retry_interval value: '4294967295' +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +3600 +SET @@global.slave_transaction_retry_interval = 2147483649*2; +Warnings: +Warning 1292 Truncated incorrect slave_transaction_retry_interval value: '4294967298' +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +3600 +SET @@global.slave_transaction_retry_interval = 4294967295; +Warnings: +Warning 1292 Truncated incorrect slave_transaction_retry_interval value: '4294967295' +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +3600 +'#--------------------FN_DYNVARS_149_04-------------------------#' +SET @@slave_transaction_retry_interval = 2; +ERROR HY000: Variable 'slave_transaction_retry_interval' is a GLOBAL variable and should be set with SET GLOBAL +SET @@session.slave_transaction_retry_interval = 3; +ERROR HY000: Variable 'slave_transaction_retry_interval' is a GLOBAL variable and should be set with SET GLOBAL +SET @@local.slave_transaction_retry_interval = 4; +ERROR HY000: Variable 'slave_transaction_retry_interval' is a GLOBAL variable and should be set with SET GLOBAL +'#------------------FN_DYNVARS_149_05-----------------------#' +SET @@global.slave_transaction_retry_interval = -1; +Warnings: +Warning 1292 Truncated incorrect slave_transaction_retry_interval value: '-1' +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +0 +SET @@global.slave_transaction_retry_interval = 2147483649*2147483649; +Warnings: +Warning 1292 Truncated incorrect slave_transaction_retry_interval value: '4611686022722355201' +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +3600 +SET @@global.slave_transaction_retry_interval = 65530.34; +ERROR 42000: Incorrect argument type to variable 'slave_transaction_retry_interval' +SET @@global.slave_transaction_retry_interval = '100'; +ERROR 42000: Incorrect argument type to variable 'slave_transaction_retry_interval' +SET @@global.slave_transaction_retry_interval = 7483649.56; +ERROR 42000: Incorrect argument type to variable 'slave_transaction_retry_interval' +SET @@global.slave_transaction_retry_interval = ON; +ERROR 42000: Incorrect argument type to variable 'slave_transaction_retry_interval' +SET @@global.slave_transaction_retry_interval = OFF; +ERROR 42000: Incorrect argument type to variable 'slave_transaction_retry_interval' +'#------------------FN_DYNVARS_149_06-----------------------#' +SET @@global.slave_transaction_retry_interval = 3000; +SELECT @@global.slave_transaction_retry_interval = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='slave_transaction_retry_interval'; +@@global.slave_transaction_retry_interval = VARIABLE_VALUE +1 +'#------------------FN_DYNVARS_149_07-----------------------#' +SELECT count(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='slave_transaction_retry_interval'; +count(VARIABLE_VALUE) +1 +'#------------------FN_DYNVARS_149_08-----------------------#' +SET @@global.slave_transaction_retry_interval = TRUE; +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +1 +SET @@global.slave_transaction_retry_interval = FALSE; +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +0 +'#---------------------FN_DYNVARS_149_09----------------------#' +SET @@global.slave_transaction_retry_interval = 60*60; +SELECT @@slave_transaction_retry_interval = @@global.slave_transaction_retry_interval; +@@slave_transaction_retry_interval = @@global.slave_transaction_retry_interval +1 +'#---------------------FN_DYNVARS_149_10----------------------#' +SET slave_transaction_retry_interval = 2048; +ERROR HY000: Variable 'slave_transaction_retry_interval' is a GLOBAL variable and should be set with SET GLOBAL +SELECT slave_transaction_retry_interval; +ERROR 42S22: Unknown column 'slave_transaction_retry_interval' in 'field list' +SELECT @@slave_transaction_retry_interval; +@@slave_transaction_retry_interval +3600 +SET global slave_transaction_retry_interval = 99; +SET @@global.slave_transaction_retry_interval = @start_global_value; +SELECT @@global.slave_transaction_retry_interval; +@@global.slave_transaction_retry_interval +0 diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff index b27c493c6c4..8b0749810e9 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff @@ -1176,10 +1176,19 @@ VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED - VARIABLE_COMMENT Number of times the slave SQL thread will retry a transaction in case it failed with a deadlock or elapsed lock wait timeout, before giving up and stopping + VARIABLE_COMMENT Number of times the slave SQL thread will retry a transaction in case it failed with a deadlock, elapsed lock wait timeout or listed in slave_transaction_retry_errors, before giving up and stopping NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 @@ -4426,7 +4426,7 @@ + GLOBAL_VALUE_ORIGIN COMPILE-TIME + DEFAULT_VALUE 0 + VARIABLE_SCOPE GLOBAL +-VARIABLE_TYPE BIGINT UNSIGNED ++VARIABLE_TYPE INT UNSIGNED + VARIABLE_COMMENT Interval of the slave SQL thread will retry a transaction in case it failed with a deadlock or elapsed lock wait timeout or listed in slave_transaction_retry_errors + NUMERIC_MIN_VALUE 0 + NUMERIC_MAX_VALUE 3600 +@@ -4257,7 +4257,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 2 VARIABLE_SCOPE GLOBAL @@ -1188,7 +1197,7 @@ VARIABLE_COMMENT If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 31536000 -@@ -4485,7 +4485,7 @@ +@@ -4316,7 +4316,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Each thread that needs to do a sort allocates a buffer of this size NUMERIC_MIN_VALUE 1024 @@ -1197,7 +1206,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -4790,7 +4790,7 @@ +@@ -4621,7 +4621,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 256 VARIABLE_SCOPE GLOBAL @@ -1206,7 +1215,7 @@ VARIABLE_COMMENT The soft upper limit for number of cached stored routines for one connection. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 524288 -@@ -4888,7 +4888,7 @@ +@@ -4719,7 +4719,7 @@ GLOBAL_VALUE_ORIGIN AUTO DEFAULT_VALUE 400 VARIABLE_SCOPE GLOBAL @@ -1215,7 +1224,7 @@ VARIABLE_COMMENT The number of cached table definitions NUMERIC_MIN_VALUE 400 NUMERIC_MAX_VALUE 524288 -@@ -4902,7 +4902,7 @@ +@@ -4733,7 +4733,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 2000 VARIABLE_SCOPE GLOBAL @@ -1224,7 +1233,7 @@ VARIABLE_COMMENT The number of cached open tables NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 1048576 -@@ -4972,7 +4972,7 @@ +@@ -4761,7 +4761,7 @@ GLOBAL_VALUE_ORIGIN AUTO DEFAULT_VALUE 256 VARIABLE_SCOPE GLOBAL @@ -1233,7 +1242,7 @@ VARIABLE_COMMENT How many threads we should keep in a cache for reuse. These are freed after 5 minutes of idle time NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16384 -@@ -4986,7 +4986,7 @@ +@@ -4775,7 +4775,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10 VARIABLE_SCOPE GLOBAL @@ -1242,7 +1251,7 @@ VARIABLE_COMMENT Permits the application to give the threads system a hint for the desired number of threads that should be run at the same time.This variable has no effect, and is deprecated. It will be removed in a future release. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 512 -@@ -5191,15 +5191,15 @@ +@@ -4980,15 +4980,15 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME TMP_DISK_TABLE_SIZE @@ -1262,7 +1271,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -5213,7 +5213,7 @@ +@@ -5002,7 +5002,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table. Same as tmp_table_size. NUMERIC_MIN_VALUE 1024 @@ -1271,7 +1280,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -5227,7 +5227,7 @@ +@@ -5016,7 +5016,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Alias for tmp_memory_table_size. If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table. NUMERIC_MIN_VALUE 1024 @@ -1280,7 +1289,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -5238,7 +5238,7 @@ +@@ -5027,7 +5027,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 8192 VARIABLE_SCOPE SESSION @@ -1289,7 +1298,7 @@ VARIABLE_COMMENT Allocation block size for transactions to be stored in binary log NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 134217728 -@@ -5252,7 +5252,7 @@ +@@ -5041,7 +5041,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4096 VARIABLE_SCOPE SESSION @@ -1298,7 +1307,7 @@ VARIABLE_COMMENT Persistent buffer for transactions to be stored in binary log NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 134217728 -@@ -5350,7 +5350,7 @@ +@@ -5139,7 +5139,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 28800 VARIABLE_SCOPE SESSION @@ -1307,7 +1316,7 @@ VARIABLE_COMMENT The number of seconds the server waits for activity on a connection before closing it NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -5455,7 +5455,7 @@ +@@ -5243,7 +5243,7 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME OPEN_FILES_LIMIT VARIABLE_SCOPE GLOBAL @@ -1316,7 +1325,7 @@ VARIABLE_COMMENT If this is not 0, then mysqld will use this value to reserve file descriptors to use with setrlimit(). If this value is 0 or autoset then mysqld will reserve max_connections*5 or max_connections + table_cache*2 (whichever is larger) number of file descriptors NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -5468,7 +5468,7 @@ +@@ -5256,7 +5256,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes NUMERIC_MIN_VALUE 0 @@ -1325,7 +1334,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -5478,7 +5478,7 @@ +@@ -5266,7 +5266,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes NUMERIC_MIN_VALUE 0 @@ -1334,7 +1343,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -5573,7 +5573,7 @@ +@@ -5351,7 +5351,7 @@ VARIABLE_NAME LOG_TC_SIZE GLOBAL_VALUE_ORIGIN AUTO VARIABLE_SCOPE GLOBAL 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 8a897052051..1b26180b710 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -4399,13 +4399,41 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10 VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED -VARIABLE_COMMENT Number of times the slave SQL thread will retry a transaction in case it failed with a deadlock or elapsed lock wait timeout, before giving up and stopping +VARIABLE_COMMENT Number of times the slave SQL thread will retry a transaction in case it failed with a deadlock, elapsed lock wait timeout or listed in slave_transaction_retry_errors, before giving up and stopping NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME SLAVE_TRANSACTION_RETRY_ERRORS +SESSION_VALUE NULL +GLOBAL_VALUE 1213,1205 +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE VARCHAR +VARIABLE_COMMENT Tells the slave thread to retry transaction for replication when a query event returns an error from the provided list. Deadlock and elapsed lock wait timeout errors are automatically added to this list +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST NULL +READ_ONLY YES +COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME SLAVE_TRANSACTION_RETRY_INTERVAL +SESSION_VALUE NULL +GLOBAL_VALUE 0 +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE 0 +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_COMMENT Interval of the slave SQL thread will retry a transaction in case it failed with a deadlock or elapsed lock wait timeout or listed in slave_transaction_retry_errors +NUMERIC_MIN_VALUE 0 +NUMERIC_MAX_VALUE 3600 +NUMERIC_BLOCK_SIZE 1 +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME SLAVE_TYPE_CONVERSIONS SESSION_VALUE NULL GLOBAL_VALUE diff --git a/mysql-test/suite/sys_vars/t/slave_transaction_retry_errors-master.opt b/mysql-test/suite/sys_vars/t/slave_transaction_retry_errors-master.opt new file mode 100644 index 00000000000..a93f9f02f70 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/slave_transaction_retry_errors-master.opt @@ -0,0 +1 @@ +--slave_transaction_retry_errors="10,20, 5000, 400" diff --git a/mysql-test/suite/sys_vars/t/slave_transaction_retry_errors.test b/mysql-test/suite/sys_vars/t/slave_transaction_retry_errors.test new file mode 100644 index 00000000000..aa2299cf815 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/slave_transaction_retry_errors.test @@ -0,0 +1,19 @@ +--source include/not_embedded.inc +# +# only global +# +select @@global.slave_transaction_retry_errors; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@session.slave_transaction_retry_errors; +show global variables like 'slave_transaction_retry_errors'; +show session variables like 'slave_transaction_retry_errors'; +select * from information_schema.global_variables where variable_name='slave_transaction_retry_errors'; +select * from information_schema.session_variables where variable_name='slave_transaction_retry_errors'; + +# +# show that it's read-only +# +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +set global slave_transaction_retry_errors=1; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +set session slave_transaction_retry_errors=1; diff --git a/mysql-test/suite/sys_vars/t/slave_transaction_retry_interval_basic.test b/mysql-test/suite/sys_vars/t/slave_transaction_retry_interval_basic.test new file mode 100644 index 00000000000..4d8d55901d1 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/slave_transaction_retry_interval_basic.test @@ -0,0 +1,190 @@ +--source include/not_embedded.inc +# +# only global +# +####### mysql-test\t\slave_transaction_retry_interval_basic.test ############## +# # +# Variable Name: slave_transaction_retry_interval # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: 10 # +# Range: # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable # +# slave_transaction_retry_interval # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/not_embedded.inc +--source include/load_sysvars.inc + +################################################################### +# START OF slave_transaction_retry_interval TESTS # +################################################################### + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.slave_transaction_retry_interval; +SELECT @start_global_value; + +--echo '#--------------------FN_DYNVARS_149_01-------------------------#' +################################################################### +# Display the DEFAULT value of slave_transaction_retry_interval # +################################################################### + +SET @@global.slave_transaction_retry_interval = 50; +SET @@global.slave_transaction_retry_interval = DEFAULT; +SELECT @@global.slave_transaction_retry_interval; + +--echo '#--------------------FN_DYNVARS_149_02-------------------------#' +################################################################### +# Check the DEFAULT value of slave_transaction_retry_interval # +################################################################### + +SET @@global.slave_transaction_retry_interval = DEFAULT; +SELECT @@global.slave_transaction_retry_interval = 10; + +--echo '#--------------------FN_DYNVARS_149_03-------------------------#' +############################################################################### +# Change the value of slave_transaction_retry_interval to a valid value for +# GLOBAL Scope +############################################################################### + +SET @@global.slave_transaction_retry_interval = 0; +SELECT @@global.slave_transaction_retry_interval; +SET @@global.slave_transaction_retry_interval = 1; +SELECT @@global.slave_transaction_retry_interval; +SET @@global.slave_transaction_retry_interval = 15; +SELECT @@global.slave_transaction_retry_interval; +SET @@global.slave_transaction_retry_interval = 1024; +SELECT @@global.slave_transaction_retry_interval; +SET @@global.slave_transaction_retry_interval = 2147483648; +SELECT @@global.slave_transaction_retry_interval; +SET @@global.slave_transaction_retry_interval = 2147483648*2-1; +SELECT @@global.slave_transaction_retry_interval; +SET @@global.slave_transaction_retry_interval = 2147483649*2; +SELECT @@global.slave_transaction_retry_interval; +SET @@global.slave_transaction_retry_interval = 4294967295; +SELECT @@global.slave_transaction_retry_interval; + +--echo '#--------------------FN_DYNVARS_149_04-------------------------#' +############################################################################## +# Check if variable can be access with session scope # +############################################################################## + +--Error ER_GLOBAL_VARIABLE +SET @@slave_transaction_retry_interval = 2; + +--Error ER_GLOBAL_VARIABLE +SET @@session.slave_transaction_retry_interval = 3; + +--Error ER_GLOBAL_VARIABLE +SET @@local.slave_transaction_retry_interval = 4; + + +--echo '#------------------FN_DYNVARS_149_05-----------------------#' +############################################################################ +# Change the value of slave_transaction_retry_interval to an invalid value # +############################################################################ + +SET @@global.slave_transaction_retry_interval = -1; +SELECT @@global.slave_transaction_retry_interval; + +SET @@global.slave_transaction_retry_interval = 2147483649*2147483649; +SELECT @@global.slave_transaction_retry_interval; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.slave_transaction_retry_interval = 65530.34; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.slave_transaction_retry_interval = '100'; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.slave_transaction_retry_interval = 7483649.56; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.slave_transaction_retry_interval = ON; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.slave_transaction_retry_interval = OFF; + +--echo '#------------------FN_DYNVARS_149_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + +SET @@global.slave_transaction_retry_interval = 3000; +SELECT @@global.slave_transaction_retry_interval = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='slave_transaction_retry_interval'; + + +--echo '#------------------FN_DYNVARS_149_07-----------------------#' +########################################################################### +# Check if the value is present in INFORMATION_SCHEMA.SESSION_VARIABLES # +########################################################################### + +SELECT count(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='slave_transaction_retry_interval'; + + +--echo '#------------------FN_DYNVARS_149_08-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +SET @@global.slave_transaction_retry_interval = TRUE; +SELECT @@global.slave_transaction_retry_interval; +SET @@global.slave_transaction_retry_interval = FALSE; +SELECT @@global.slave_transaction_retry_interval; + + +--echo '#---------------------FN_DYNVARS_149_09----------------------#' +############################################################################### +# Check if accessing variable with and without GLOBAL point to same variable # +############################################################################### + + +SET @@global.slave_transaction_retry_interval = 60*60; +SELECT @@slave_transaction_retry_interval = @@global.slave_transaction_retry_interval; + + +--echo '#---------------------FN_DYNVARS_149_10----------------------#' +############################################################################### +# Check if slave_transaction_retry_interval can be accessed without @@ sign +# and scope +############################################################################### + +--Error ER_GLOBAL_VARIABLE +SET slave_transaction_retry_interval = 2048; +--Error ER_BAD_FIELD_ERROR +SELECT slave_transaction_retry_interval; + +SELECT @@slave_transaction_retry_interval; + +#verifying another another syntax for setting value +SET global slave_transaction_retry_interval = 99; + +#################################### +# Restore initial value # +#################################### + +SET @@global.slave_transaction_retry_interval = @start_global_value; +SELECT @@global.slave_transaction_retry_interval; + +######################################################## +# END OF slave_transaction_retry_interval TESTS # +######################################################## -- cgit v1.2.1 From d7b0b8ddacd6a27e0ea1c5fbad75aae60ed03d6b Mon Sep 17 00:00:00 2001 From: Monty Date: Sun, 3 Dec 2017 15:21:53 +0200 Subject: MDEV-10688 rpl.rpl_row_log_innodb failed in buildbot Problem was that Binlog_checkpoint can happen at random times. Fixed by not write binlog_checkpoint for the rpl_log test. Other things: - Removed not used variable "$keep_gtid_events" - Added option for show_binlog_events to skip binlog_checkpoint --- mysql-test/extra/rpl_tests/rpl_log.test | 2 ++ mysql-test/include/filter_file.inc | 11 ++++++++++- mysql-test/include/show_binlog_events.inc | 8 +------- mysql-test/include/show_events.inc | 7 +++++++ mysql-test/suite/rpl/r/rpl_row_log.result | 2 -- mysql-test/suite/rpl/r/rpl_row_log_innodb.result | 2 -- mysql-test/suite/rpl/r/rpl_stm_log.result | 2 -- 7 files changed, 20 insertions(+), 14 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/extra/rpl_tests/rpl_log.test b/mysql-test/extra/rpl_tests/rpl_log.test index 01e8497e4de..934f40306ab 100644 --- a/mysql-test/extra/rpl_tests/rpl_log.test +++ b/mysql-test/extra/rpl_tests/rpl_log.test @@ -65,6 +65,8 @@ flush logs; # To make it predictable, we do a useless update now, but which has the # interest of making the slave catch both rotate events. +let $skip_checkpoint_events=1; + eval create table t3 (a int)ENGINE=$engine_type; # Sync slave and force it to start on another binary log diff --git a/mysql-test/include/filter_file.inc b/mysql-test/include/filter_file.inc index 17c7c1985d7..bfe53896710 100644 --- a/mysql-test/include/filter_file.inc +++ b/mysql-test/include/filter_file.inc @@ -53,6 +53,9 @@ # # $rpl_debug # If set, verbose debug info is printed. +# +# $filter_script +# If set, rows matching this regexp will be filtered out --let $include_filename= filter_file.inc --source include/begin_include_file.inc @@ -67,10 +70,12 @@ if ($rpl_debug) --let _FF_PRE_SCRIPT= $pre_script --let _FF_SCRIPT= $script +--let _FF_FILTER_SCRIPT= $filter_script --let _FF_INPUT_FILE= $input_file --let _FF_OUTPUT_FILE= $output_file --let _FF_SELECT_COLUMNS= $select_columns --let _FF_DEBUG= $rpl_debug + if (!$output_file) { --let _FF_OUTPUT_FILE= $input_file @@ -79,6 +84,7 @@ perl; my $pre_script = $ENV{'_FF_PRE_SCRIPT'}; $pre_script =~ s/DOLLAR/\$/g; my $script = $ENV{'_FF_SCRIPT'}; + my $filter_script = $ENV{'_FF_FILTER_SCRIPT'}; $script =~ s/DOLLAR/\$/g; my $input_file = $ENV{'_FF_INPUT_FILE'}; my $output_file = $ENV{'_FF_OUTPUT_FILE'}; @@ -123,7 +129,10 @@ perl; { ' . $script . ' } - $filtered_contents .= $_."\n"; + if (!$filter_script || ! m/$filter_script/) + { + $filtered_contents .= $_."\n"; + } } close FILE or die "Error closing $input_file: $!"; open FILE, "> $output_file" or die "Error opening $output_file: $!"; diff --git a/mysql-test/include/show_binlog_events.inc b/mysql-test/include/show_binlog_events.inc index b2462e0d1b1..57fe1ffe0e3 100644 --- a/mysql-test/include/show_binlog_events.inc +++ b/mysql-test/include/show_binlog_events.inc @@ -7,7 +7,7 @@ # [--let $binlog_file= [ | LAST]] # [--let $binlog_start= ] # [--let $binlog_limit= 1, 3 ] -# [--let $keep_gtid_events= 1] +# [--let $skip_checkpoint_events= 1] # --source include/show_binlog_events.inc # # Parameters: @@ -26,12 +26,6 @@ # Limit for the 'LIMIT' clause of SHOW BINLOG EVENTS, i.e.: # $binlog_limit= 3 -- print three events # $binlog_limit= 4, 3 -- skip four events, print the three next events -# -# $keep_gtid_events -# By default, Gtid_log_event and Previous_gtid_log_event are -# filtered out, so that the output is independent of whether GTIDs -# are enabled or not. If this flag is set, events are kept but -# the actual GTID values are masked out. --let $include_filename= show_binlog_events.inc --source include/begin_include_file.inc diff --git a/mysql-test/include/show_events.inc b/mysql-test/include/show_events.inc index 368cfc9e3a7..9ee01f73999 100644 --- a/mysql-test/include/show_events.inc +++ b/mysql-test/include/show_events.inc @@ -104,8 +104,15 @@ let $script= s{DOLLARmysqltest_vardir}{MYSQLTEST_VARDIR}g; || --let $pre_script= my DOLLARmysqltest_vardir = DOLLARENV{'MYSQLTEST_VARDIR'}; + --delimiter ; +if ($skip_checkpoint_events) +{ + let $filter_script=Binlog_checkpoint; +} + + #--let $select_columns= 1 3 6 --let $input_file= $output_file --source include/filter_file.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_log.result b/mysql-test/suite/rpl/r/rpl_row_log.result index 83ec26486e0..4ff3d45e2bb 100644 --- a/mysql-test/suite/rpl/r/rpl_row_log.result +++ b/mysql-test/suite/rpl/r/rpl_row_log.result @@ -215,7 +215,6 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Rotate # # master-bin.000002;pos=POS 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 t3 (a int)ENGINE=MyISAM master-bin.000002 # Gtid # # GTID #-#-# @@ -253,7 +252,6 @@ slave-bin.000001 # Query # # use `test`; create table t3 (a int)ENGINE=MyISAM slave-bin.000001 # Rotate # # slave-bin.000002;pos=POS include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info -slave-bin.000002 # Binlog_checkpoint # # slave-bin.000002 slave-bin.000002 # Gtid # # GTID #-#-# slave-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=MyISAM slave-bin.000002 # Gtid # # BEGIN GTID #-#-# diff --git a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result index 3b9733a18e8..c78e0e4816e 100644 --- a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result @@ -215,7 +215,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Rotate # # master-bin.000002;pos=POS 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 t3 (a int)ENGINE=InnoDB master-bin.000002 # Gtid # # GTID #-#-# @@ -253,7 +252,6 @@ slave-bin.000001 # Query # # use `test`; create table t3 (a int)ENGINE=InnoDB slave-bin.000001 # Rotate # # slave-bin.000002;pos=POS include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info -slave-bin.000002 # Binlog_checkpoint # # slave-bin.000002 slave-bin.000002 # Gtid # # GTID #-#-# slave-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=InnoDB slave-bin.000002 # Gtid # # BEGIN GTID #-#-# diff --git a/mysql-test/suite/rpl/r/rpl_stm_log.result b/mysql-test/suite/rpl/r/rpl_stm_log.result index da925035c9c..4d187095d17 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_log.result +++ b/mysql-test/suite/rpl/r/rpl_stm_log.result @@ -215,7 +215,6 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Rotate # # master-bin.000002;pos=POS 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 t3 (a int)ENGINE=MyISAM master-bin.000002 # Gtid # # GTID #-#-# @@ -252,7 +251,6 @@ slave-bin.000001 # Query # # use `test`; create table t3 (a int)ENGINE=MyISAM slave-bin.000001 # Rotate # # slave-bin.000002;pos=POS include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info -slave-bin.000002 # Binlog_checkpoint # # slave-bin.000002 slave-bin.000002 # Gtid # # GTID #-#-# slave-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=MyISAM slave-bin.000002 # Gtid # # BEGIN GTID #-#-# -- cgit v1.2.1 From 60c446584c614f19f9adc9cc38a31954359009d5 Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Wed, 22 Nov 2017 21:09:24 +0200 Subject: MDEV-7773: Aggregate stored functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit implements aggregate stored functions. The basic idea behind the feature is: * Implement a special instruction FETCH GROUP NEXT ROW that will pause the execution of the stored function. When the instruction is reached, execution of the initial query resumes "as if" the function returned. This gives the server the opportunity to advance to the next row in the result set. * Stored aggregates behave like regular aggregate functions. The implementation of thus resides in the class Item_sum_sp. Because it is an aggregate function, for each new row in the group, the Item_sum_sp::add() method will be called. This is when execution resumes and the function does another iteration to "add" one extra element to the final result. * When the end of group is reached, val_xxx() method will be called for the item. This case is handled by another execute step for the stored function, only with a special flag to force a call to the return handler. See Item_sum_sp::execute() for details. To allow this pause and resume semantic, we must preserve the function context across executions. This is stored in Item_sp::sp_query_arena only for aggregate stored functions, but has no impact for regular functions. We also enforce aggregate functions to include the "FETCH GROUP NEXT ROW" instruction. Signed-off-by: Vicențiu Ciorbaru --- mysql-test/r/create_drop_function.result | 4 +- mysql-test/r/custom_aggregate_functions.result | 938 +++++++++++++++++++++ mysql-test/r/information_schema.result | 3 +- mysql-test/r/sp-destruct.result | 12 +- mysql-test/r/sp-error.result | 2 +- mysql-test/r/sp.result | 2 +- mysql-test/r/system_mysql_db.result | 1 + mysql-test/r/system_mysql_db_fix40123.result | 1 + mysql-test/suite/funcs_1/r/is_columns_mysql.result | 2 + .../funcs_1/r/is_columns_mysql_embedded.result | 2 + mysql-test/suite/funcs_1/r/storedproc.result | 50 +- .../suite/innodb/r/instant_alter_debug.result | 2 +- mysql-test/suite/rpl/r/rpl_sp.result | 32 +- mysql-test/t/custom_aggregate_functions.test | 773 +++++++++++++++++ mysql-test/t/information_schema.test | 2 +- mysql-test/t/sp-destruct.test | 2 +- mysql-test/t/sp-error.test | 2 +- mysql-test/t/sp.test | 2 +- 18 files changed, 1775 insertions(+), 57 deletions(-) create mode 100644 mysql-test/r/custom_aggregate_functions.result create mode 100644 mysql-test/t/custom_aggregate_functions.test (limited to 'mysql-test') diff --git a/mysql-test/r/create_drop_function.result b/mysql-test/r/create_drop_function.result index 8e529a587fa..3ba6581d61b 100644 --- a/mysql-test/r/create_drop_function.result +++ b/mysql-test/r/create_drop_function.result @@ -3,8 +3,8 @@ CREATE FUNCTION f1(str char(20)) RETURNS CHAR(100) RETURN CONCAT('Hello, ', str, '!'); SELECT * FROM mysql.proc WHERE name like 'f1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 -test f1 FUNCTION f1 SQL CONTAINS_SQL NO DEFINER str char(20) char(100) CHARSET latin1 RETURN CONCAT('Hello, ', str, '!') root@localhost 2014-09-30 08:00:00 2014-09-30 08:00:00 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci RETURN CONCAT('Hello, ', str, '!') +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate +test f1 FUNCTION f1 SQL CONTAINS_SQL NO DEFINER str char(20) char(100) CHARSET latin1 RETURN CONCAT('Hello, ', str, '!') root@localhost 2014-09-30 08:00:00 2014-09-30 08:00:00 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci RETURN CONCAT('Hello, ', str, '!') NONE SELECT f1('world'); f1('world') Hello, world! diff --git a/mysql-test/r/custom_aggregate_functions.result b/mysql-test/r/custom_aggregate_functions.result new file mode 100644 index 00000000000..ca8612ba652 --- /dev/null +++ b/mysql-test/r/custom_aggregate_functions.result @@ -0,0 +1,938 @@ +create table t2 (sal int(10)); +create aggregate function f1(x INT) returns int +begin +declare continue handler for not found return 0; +loop +fetch group next row; +insert into t2 (sal) values (x); +end loop; +end| +create table t1 (sal int(10),id int(10)); +INSERT INTO t1 (sal,id) VALUES (5000,1); +INSERT INTO t1 (sal,id) VALUES (2000,1); +INSERT INTO t1 (sal,id) VALUES (1000,1); +select f1(sal) from t1 where id>= 1; +f1(sal) +0 +Warnings: +Note 4093 At line 5 in test.f1 +Note 4093 At line 5 in test.f1 +Note 4093 At line 5 in test.f1 +select * from t2; +sal +5000 +2000 +1000 +drop table t2; +drop function f1; +create aggregate function f1(x INT) returns INT +begin +insert into t1(sal) values (x); +return x; +end| +ERROR HY000: Aggregate specific instruction(FETCH GROUP NEXT ROW) missing from the aggregate function +create function f1(x INT) returns INT +begin +set x=5; +fetch group next row; +return x+1; +end | +ERROR HY000: Non-aggregate function contains aggregate specific instructions: (FETCH GROUP NEXT ROW) +create aggregate function f1(x INT) returns INT +begin +declare continue handler for not found return x; +loop +fetch group next row; +end loop; +end | +select f1(1); +f1(1) +1 +show create function f1; +Function sql_mode Create Function character_set_client collation_connection Database Collation +f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` AGGREGATE FUNCTION `f1`(x INT) RETURNS int(11) +begin +declare continue handler for not found return x; +loop +fetch group next row; +end loop; +end latin1 latin1_swedish_ci latin1_swedish_ci +alter function f1 aggregate none; +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 'aggregate none' at line 1 +show create function f1; +Function sql_mode Create Function character_set_client collation_connection Database Collation +f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` AGGREGATE FUNCTION `f1`(x INT) RETURNS int(11) +begin +declare continue handler for not found return x; +loop +fetch group next row; +end loop; +end latin1 latin1_swedish_ci latin1_swedish_ci +select f1(1); +f1(1) +1 +drop function f1; +create aggregate function f2(i int) returns int +begin +FEtCH GROUP NEXT ROW; +if i <= 0 then +return 0; +elseif i = 1 then +return (select count(*) from t1 where id = i); +else +return (select count(*) + f2( i - 1) from t1 where id = i); +end if; +end| +select f2(1)| +f2(1) +3 +select f2(2)| +ERROR HY000: Recursive stored functions and triggers are not allowed +select f2(3)| +ERROR HY000: Recursive stored functions and triggers are not allowed +drop function f2| +create aggregate function f1(x int) returns int +begin +declare mini int default 0; +declare continue handler for not found return mini; +loop +fetch group next row; +set mini= mini+x; +fetch group next row; +end loop; +end| +select f1(10); +f1(10) +10 +select f1(sal) from t1; +f1(sal) +6000 +select f1(sal) from t1 where 1=0; +f1(sal) +NULL +drop function f1; +create aggregate function f1(x int) returns int +begin +declare mini int default 0; +LOOP +FETCH GROUP NEXT ROW; +set mini = mini + x; +END LOOP; +end| +ERROR 42000: No RETURN found in FUNCTION test.f1 +create aggregate function f1(x int) returns int +begin +declare mini int default 0; +LOOP +FETCH GROUP NEXT ROW; +set mini = mini + x; +END LOOP; +return -1; +end| +select f1(sal) from t1| +ERROR 02000: No data - zero rows fetched, selected, or processed +drop function f1| +create aggregate function f1(x int) returns int +begin +declare mini int default 0; +declare continue handler for not found return mini; +FETCH GROUP NEXT ROW; +set mini = mini + x; +end| +select f1(sal) from t1| +ERROR 2F005: FUNCTION f1 ended without RETURN +drop function f1| +create aggregate function f1(x int) returns int +begin +declare mini int default 0; +declare continue handler for not found set mini=-1; +LOOP +FETCH GROUP NEXT ROW; +set mini = mini + x; +END LOOP; +return 0; +end| +select f1(sal) from t1| +ERROR 2F005: FUNCTION f1 ended without RETURN +drop function f1| +drop table t1| +create table t1 (sal int, id int, val int, counter int, primary key(id)); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 10, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 2, 16, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 3, 18, 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 4, 15, 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 5, 11, 5); +create aggregate function f1(x INT) returns double +begin +declare z double default 0; +declare continue handler for not found return z; +loop +fetch group next row; +set z= z+x; +end loop; +end| +select id, f1(sal) from t1 where id>= 1 group by counter order by val; +id f1(sal) +1 3000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1; +id f1(sal) +1 17000 +select id, f1(sal) from t1 where id>= 1; +id f1(sal) +1 17000 +select id, f1(sal) from t1 where id>= 1 group by counter; +id f1(sal) +1 3000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by id; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by val; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by counter order by counter; +id f1(sal) +1 3000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by counter order by val; +id f1(sal) +1 3000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by counter order by id; +id f1(sal) +1 3000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by val order by counter; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by val order by id; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by val order by val; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +drop table t1; +create table t1 (sal int, id int, val int, counter int, primary key(id), unique key(val)); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 10, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 2, NULL, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 3, 18, 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 4, 15, 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 5, 11, 5); +select id, f1(sal) from t1; +id f1(sal) +1 17000 +select id, f1(sal) from t1 where id>= 1; +id f1(sal) +1 17000 +select id, f1(sal) from t1 where id>= 1 group by counter; +id f1(sal) +1 3000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by id; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by val; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by counter order by counter; +id f1(sal) +1 3000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by counter order by val; +id f1(sal) +1 3000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by counter order by id; +id f1(sal) +1 3000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by val order by counter; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by val order by id; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by val order by val; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +drop table t1; +create table t1 (sal int, id int, val int, counter int, primary key(id), INDEX name (val,counter)); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 10, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 2, 10, 4); +INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 3, 18, 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 4, 11, 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 5, 11, 5); +select id, f1(sal) from t1; +id f1(sal) +1 17000 +select id, f1(sal) from t1 where id>= 1; +id f1(sal) +1 17000 +select id, f1(sal) from t1 where id>= 1 group by counter; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by id; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by val; +id f1(sal) +1 3000 +3 6000 +4 8000 +select id, f1(sal) from t1 where id>= 1 group by counter order by counter; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by counter order by val; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by counter order by id; +id f1(sal) +1 1000 +2 2000 +3 6000 +4 5000 +5 3000 +select id, f1(sal) from t1 where id>= 1 group by val order by counter; +id f1(sal) +1 3000 +3 6000 +4 8000 +select id, f1(sal) from t1 where id>= 1 group by val order by id; +id f1(sal) +1 3000 +3 6000 +4 8000 +select id, f1(sal) from t1 where id>= 1 group by val order by val; +id f1(sal) +1 3000 +3 6000 +4 8000 +drop table t1; +drop function f1; +create aggregate function f1(x INT) returns double +begin +declare z double default 0; +declare continue handler for not found return z; +loop +fetch group next row; +set z= z+x; +end loop; +end| +create aggregate function f2() returns double +begin +declare z int default 0; +declare continue handler for not found return z; +loop +fetch group next row; +set z = z+1; +end loop; +end| +create table t1 (sal int, id int, val int, counter int); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 10, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 1, 16, 5); +INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 2, 18, 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 3, 15, 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 4, 11, 4); +prepare test from "select f2() from t1 where id>= ?"; +set @param= 2; +execute test using @param; +f2() +4 +execute test using @param; +f2() +4 +execute test using @param; +f2() +4 +execute test using @param; +f2() +4 +set @param= 1; +execute test using @param; +f2() +5 +set @param= 3; +execute test using @param; +f2() +2 +set @param= 4; +execute test using @param; +f2() +1 +deallocate prepare test; +prepare test from "select f1(sal) from t1 where id>= ?"; +set @param= 2; +execute test using @param; +f1(sal) +15000 +execute test using @param; +f1(sal) +15000 +execute test using @param; +f1(sal) +15000 +execute test using @param; +f1(sal) +15000 +set @param= 1; +execute test using @param; +f1(sal) +17000 +set @param= 3; +execute test using @param; +f1(sal) +8000 +set @param= 4; +execute test using @param; +f1(sal) +3000 +set @param= 5; +execute test using @param; +f1(sal) +NULL +deallocate prepare test; +drop function f2; +prepare test from "select f1(sal) from t1 where id>= ?"; +set @param= 2; +execute test using @param; +f1(sal) +15000 +drop function f1; +create function f1(x int) returns int +return -1; +execute test using @param; +f1(sal) +-1 +-1 +-1 +-1 +drop function f1; +create aggregate function f1(x INT) returns double +begin +declare z double default 0; +declare continue handler for not found return z; +loop +fetch group next row; +set z= z+x; +end loop; +end| +execute test using @param; +f1(sal) +15000 +deallocate prepare test; +drop table t1; +drop function f1; +create table t1 (sal int, id int, val varchar(10), counter int); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 'ab', 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 'cd', 5); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 'ef', 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 3, 'gh', 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 4, 'ij', 4); +create table t2 (sal int, id int, val int, counter int); +INSERT INTO t2 (sal, id, val, counter) VALUES (1000, 2, 10, 2); +INSERT INTO t2 (sal, id, val, counter) VALUES (2000, 1, 16, 5); +INSERT INTO t2 (sal, id, val, counter) VALUES (6000, 2, 18, 1); +INSERT INTO t2 (sal, id, val, counter) VALUES (5000, 3, 15, 3); +INSERT INTO t2 (sal, id, val, counter) VALUES (3000, 4, 11, 4); +create aggregate function f1(x double) returns double +begin +declare z double default 0; +declare continue handler for not found return z; +loop +fetch group next row; +set z= z+x; +end loop; +end| +create aggregate function f2(x INT) returns CHAR(10) +begin +declare mini INT default 0; +declare continue handler for not found return mini; +loop +fetch group next row; +set mini= mini + x; +end loop; +end| +create aggregate function f3(x INT) returns CHAR(10) +begin +declare mini INT default 0; +declare continue handler for not found return mini; +loop +fetch group next row; +set mini= mini + x; +fetch group next row; +set mini= mini - x; +end loop; +end| +create aggregate function f4(x INT, y varchar(10)) returns varchar(1000) +begin +declare str varchar(1000) default ''; +declare continue handler for not found return str; +loop +fetch group next row; +set str= concat(str,y); +end loop; +end| +create aggregate function f5(x INT) returns varchar(1000) +begin +declare z int default 0; +DECLARE cur1 CURSOR FOR SELECT sal FROM test.t2; +declare continue handler for not found return 0; +loop +fetch group next row; +set z = z+x; +end loop; +end| +create function f6(x int) returns int +return (select f1(sal) from t1)| +select f1(sal) from t1; +f1(sal) +5000 +select f1(sal) from t1 where id>= 1 group by counter; +f1(sal) +1000 +1000 +1000 +1000 +1000 +select f3(sal) from t1; +f3(sal) +1000 +select f2(val) from t1; +ERROR 22007: Incorrect integer value: 'ab' for column 'x' at row 1 +select val, id, c from (select f1(sal) as c from t2) as t1, t2; +val id c +10 2 17000 +11 4 17000 +15 3 17000 +16 1 17000 +18 2 17000 +select f1(sal),f1(val), f1(id), f1(sal) from t2; +f1(sal) f1(val) f1(id) f1(sal) +17000 70 12 17000 +select f4(sal, val) from t1; +f4(sal, val) +abcdefghij +select c from (select f1(sal) as c from t2) as t1; +c +17000 +select f1((select val from t2 where 0 > 1)) from t1; +f1((select val from t2 where 0 > 1)) +NULL +select f1((select val from t2 where id= 1)) from t1; +f1((select val from t2 where id= 1)) +80 +select f5(sal) from t1; +f5(sal) +0 +SELECT f1(sal)*f1(sal) FROM t1; +f1(sal)*f1(sal) +25000000 +SELECT (SELECT f1(sal) FROM t1) FROM t2; +(SELECT f1(sal) FROM t1) +5000 +5000 +5000 +5000 +5000 +select id, f1(sal) from t1; +id f1(sal) +2 5000 +select id, f1(sal) from t1 where id>= 1; +id f1(sal) +2 5000 +select f1(sal), f1(sal) from t1 where id>= 1 group by counter; +f1(sal) f1(sal) +1000 1000 +1000 1000 +1000 1000 +1000 1000 +1000 1000 +select f1(sal), f1(sal) from t1 where id>= 1 group by id ; +f1(sal) f1(sal) +1000 1000 +1000 1000 +1000 1000 +2000 2000 +select f1(sal) from t1 where id>= 1 group by id ; +f1(sal) +1000 +1000 +1000 +2000 +select f1(sal) from t1 where id>= 1 order by counter; +f1(sal) +5000 +select f1(sal) from t1 where id>= 1 group by id order by counter; +f1(sal) +2000 +1000 +1000 +1000 +select counter, id, f1(sal) from t1 where id>= 1 group by id order by counter; +counter id f1(sal) +2 2 2000 +3 3 1000 +4 4 1000 +5 1 1000 +select id, f1(sal) from t1 where id>= 1 group by id order by counter; +id f1(sal) +2 2000 +3 1000 +4 1000 +1 1000 +drop table t1; +drop table t2; +drop function f1; +drop function f2; +drop function f3; +drop function f4; +drop function f5; +drop function f6; +create aggregate function f1(x INT) returns INT +begin +declare z double default 1000; +declare continue handler for not found return z; +loop +fetch group next row; +set z= (z&x); +end loop; +end| +create table t1 (sal int, id int, val int, counter int); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 10, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (7000, 1, 16, 5); +INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 2, 18, 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 3, 15, 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 4, 11, 4); +INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 5, 10, 7); +INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 7, 13, 8); +INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 6, 19, 9); +INSERT INTO t1 (sal, id, val, counter) VALUES (7000, 7, 12, 0); +INSERT INTO t1 (sal, id, val, counter) VALUES (4000, 6, 14, 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (8000, 5, 19, 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (9000, 4, 11, 4); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 3, 11, 2); +select f1(sal) from t1 where id>= 1; +f1(sal) +768 +drop function f1; +create aggregate function f1(x INT) returns double +begin +declare z double default 0; +declare count double default 0; +declare continue handler for not found return z/count; +loop +fetch group next row; +set z= z+x; +set count= count+1; +end loop; +end| +select f1(sal) from t1 where id>= 1; +f1(sal) +4923.076923076923 +drop function f1; +create aggregate function f1(x INT) returns INT +begin +declare maxi INT default -1; +declare continue handler for not found return maxi; +loop +fetch group next row; +if maxi < x then +set maxi= x; +end if; +end loop; +end| +select f1(sal) from t1 where id>= 1; +f1(sal) +9000 +drop function f1; +create aggregate function f1(x INT) returns double +begin +declare mini INT default 100000; +declare continue handler for not found return mini; +loop +fetch group next row; +if mini > x then +set mini = x; +end if; +end loop; +end| +select f1(sal) from t1 where id>= 1; +f1(sal) +1000 +drop function f1; +create aggregate function f1(x INT) returns double +begin +declare z double default 0; +declare continue handler for not found return z; +loop +fetch group next row; +set z= z^x; +end loop; +end| +select f1(sal) from t1 where id>= 1; +f1(sal) +16288 +drop function f1; +create aggregate function f1(x INT) returns INT +begin +declare z int default 0; +declare continue handler for not found return z; +loop +fetch group next row; +set z= z+x; +end loop; +end| +select f1(sal) from t1 where id>= 1; +f1(sal) +64000 +create aggregate function f2() returns INT +begin +declare z double default 0; +declare continue handler for not found return z; +loop +fetch group next row; +set z= z+1; +end loop; +end| +select f2() from t1; +f2() +13 +create table t2 (sal int, id int); +INSERT INTO t2 (sal, id) VALUES (NULL, 1); +INSERT INTO t2 (sal, id) VALUES (2000, 1); +INSERT INTO t2 (sal, id) VALUES (3000, 1); +select f1(sal) from t2; +f1(sal) +NULL +select f1(1); +f1(1) +1 +create function f3() returns int +return (select f1(sal) from t1); +select f3(); +f3() +64000 +create function f4() returns INT +return 1; +create aggregate function f5() returns INT +begin +declare z double default 0; +declare continue handler for not found return z; +loop +fetch group next row; +set z= z+f3(); +end loop; +end| +select f5() from t2; +f5() +192000 +Warnings: +Note 4093 At line 6 in test.f5 +Note 4093 At line 6 in test.f5 +Note 4093 At line 6 in test.f5 +create aggregate function f6(x INT) returns INT +begin +declare z int default 0; +declare continue handler for not found return z; +loop +fetch group next row; +if x then +set z= z+(select f1(sal) from t1); +end if; +end loop; +end| +select f6(sal) from t2; +f6(sal) +128000 +Warnings: +Note 4093 At line 6 in test.f6 +Note 4093 At line 6 in test.f6 +select id, f1(sal) from t1 where id>= 1 group by id; +id f1(sal) +1 7000 +2 7000 +3 6000 +4 12000 +5 10000 +6 10000 +7 12000 +select counter, f1(sal) from t1 where id>= 1 group by counter; +counter f1(sal) +0 7000 +1 10000 +2 2000 +3 13000 +4 12000 +5 7000 +7 2000 +8 5000 +9 6000 +select val, f1(sal) from t1 where id>= 1 group by val; +val f1(sal) +10 3000 +11 13000 +12 7000 +13 5000 +14 4000 +15 5000 +16 7000 +18 6000 +19 14000 +select counter, f1(sal) from t1 where id>= 1 group by id order by counter; +counter f1(sal) +0 12000 +2 6000 +2 7000 +4 12000 +5 7000 +7 10000 +9 10000 +select counter, id, f1(sal), f1(sal) from t1 where id>= 1 group by id order by counter; +counter id f1(sal) f1(sal) +0 7 12000 12000 +2 2 7000 7000 +2 3 6000 6000 +4 4 12000 12000 +5 1 7000 7000 +7 5 10000 10000 +9 6 10000 10000 +select counter, id, f1(sal), sum(distinct sal) from t1 where id>= 1 group by id order by counter desc; +counter id f1(sal) sum(distinct sal) +0 7 12000 12000 +2 2 7000 7000 +2 3 6000 6000 +4 4 12000 12000 +5 1 7000 7000 +7 5 10000 10000 +9 6 10000 10000 +create table t3 (i int); +INSERT INTO t3 (i) select f1(sal) from t1; +select * from t3; +i +64000 +create aggregate function f7(x INT) returns INT +begin +declare z int default 0; +DECLARE done BOOLEAN DEFAULT FALSE; +DECLARE a,b,c INT; +DECLARE cur1 CURSOR FOR SELECT id FROM test.t2; +declare continue handler for not found return z; +outer_loop: LOOP +FETCH GROUP NEXT ROW; +set z= z+x; +inner_block: begin +DECLARE cur2 CURSOR FOR SELECT id FROM test.t2; +DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; +OPEN cur2; +read_loop: LOOP +FETCH cur2 INTO a; +IF done THEN +CLOSE cur2; +LEAVE read_loop; +END IF; +END LOOP read_loop; +end inner_block; +END LOOP outer_loop; +end| +select f7(sal) from t1; +f7(sal) +64000 +Warnings: +Note 4093 At line 9 in test.f7 +Note 4093 At line 9 in test.f7 +Note 4093 At line 9 in test.f7 +Note 4093 At line 9 in test.f7 +Note 4093 At line 9 in test.f7 +Note 4093 At line 9 in test.f7 +Note 4093 At line 9 in test.f7 +Note 4093 At line 9 in test.f7 +Note 4093 At line 9 in test.f7 +Note 4093 At line 9 in test.f7 +Note 4093 At line 9 in test.f7 +Note 4093 At line 9 in test.f7 +Note 4093 At line 9 in test.f7 +drop table t1; +drop table t2; +drop table t3; +drop function f1; +drop function f2; +drop function f3; +drop function f4; +drop function f5; +drop function f6; +drop function f7; diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 23fbfad09d4..34f8fe25352 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -665,6 +665,7 @@ proc character_set_client char(32) proc collation_connection char(32) proc db_collation char(32) proc body_utf8 longblob +proc aggregate enum('NONE','GROUP') drop table t115; create procedure p108 () begin declare c cursor for select data_type from information_schema.columns; open c; open c; end;// @@ -1270,7 +1271,7 @@ drop table t1; use mysql; INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL', 'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03', -'2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a'); +'2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a', 'NONE'); select routine_name from information_schema.routines where ROUTINE_SCHEMA='test'; routine_name diff --git a/mysql-test/r/sp-destruct.result b/mysql-test/r/sp-destruct.result index 5bb3b17d4b8..112fdb3978d 100644 --- a/mysql-test/r/sp-destruct.result +++ b/mysql-test/r/sp-destruct.result @@ -1,4 +1,4 @@ -call mtr.add_suppression("Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted"); +call mtr.add_suppression("Column count of mysql.proc is wrong. Expected 21, found 20. The table is probably corrupted"); call mtr.add_suppression("Stored routine .test...bug14233_[123].: invalid value in column mysql.proc"); flush table mysql.proc; use test; @@ -14,13 +14,13 @@ create table t1 (id int); create trigger t1_ai after insert on t1 for each row call bug14233(); alter table mysql.proc drop security_type; call bug14233(); -ERROR HY000: Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted +ERROR HY000: Column count of mysql.proc is wrong. Expected 21, found 20. The table is probably corrupted create view v1 as select bug14233_f(); -ERROR HY000: Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted +ERROR HY000: Column count of mysql.proc is wrong. Expected 21, found 20. The table is probably corrupted insert into t1 values (0); -ERROR HY000: Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted +ERROR HY000: Column count of mysql.proc is wrong. Expected 21, found 20. The table is probably corrupted show procedure status; -ERROR HY000: Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted +ERROR HY000: Column count of mysql.proc is wrong. Expected 21, found 20. The table is probably corrupted flush table mysql.proc; call bug14233(); ERROR HY000: Incorrect information in file: './mysql/proc.frm' @@ -146,7 +146,7 @@ alter table mysql.proc drop column security_type; # The below statement should not cause assertion failure. drop database mysqltest; Warnings: -Error 1805 Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted +Error 1805 Column count of mysql.proc is wrong. Expected 21, found 20. The table is probably corrupted # Restore mysql.proc. drop table mysql.proc; # diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index 40643a97765..ad4b18fc37a 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -1212,7 +1212,7 @@ ERROR 42S02: Unknown table 'c' in field list drop procedure bug15091; drop function if exists bug16896; create aggregate function bug16896() returns int return 1; -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 '() returns int return 1' at line 1 +ERROR HY000: Aggregate specific instruction(FETCH GROUP NEXT ROW) missing from the aggregate function DROP PROCEDURE IF EXISTS bug14702; CREATE IF NOT EXISTS PROCEDURE bug14702() BEGIN diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 2b15bd09cc4..3b8f35e0c79 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -5324,7 +5324,7 @@ DROP PROCEDURE bug21414| set names utf8| drop database if exists това_е_дълго_име_за_база_данни_нали| create database това_е_дълго_име_за_база_данни_нали| -INSERT INTO mysql.proc VALUES ('това_е_дълго_име_за_база_данни_нали','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','PROCEDURE','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','SQL','CONTAINS_SQL','NO','DEFINER','','','bad_body','root@localhost',now(), now(),'','', 'utf8', 'utf8_general_ci', 'utf8_general_ci', 'n/a')| +INSERT INTO mysql.proc VALUES ('това_е_дълго_име_за_база_данни_нали','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','PROCEDURE','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','SQL','CONTAINS_SQL','NO','DEFINER','','','bad_body','root@localhost',now(), now(),'','', 'utf8', 'utf8_general_ci', 'utf8_general_ci', 'n/a', 'NONE')| call това_е_дълго_име_за_база_данни_нали.това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго()| ERROR HY000: Failed to load routine това_е_дълго_име_за_база_данни_нали.това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6) drop database това_е_дълго_име_за_база_данни_нали| diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result index 7ba77e60e42..1227896853d 100644 --- a/mysql-test/r/system_mysql_db.result +++ b/mysql-test/r/system_mysql_db.result @@ -220,6 +220,7 @@ proc CREATE TABLE `proc` ( `collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `body_utf8` longblob DEFAULT NULL, + `aggregate` enum('NONE','GROUP') NOT NULL DEFAULT 'NONE', PRIMARY KEY (`db`,`name`,`type`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Stored Procedures' show create table event; diff --git a/mysql-test/r/system_mysql_db_fix40123.result b/mysql-test/r/system_mysql_db_fix40123.result index 7ba77e60e42..1227896853d 100644 --- a/mysql-test/r/system_mysql_db_fix40123.result +++ b/mysql-test/r/system_mysql_db_fix40123.result @@ -220,6 +220,7 @@ proc CREATE TABLE `proc` ( `collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `body_utf8` longblob DEFAULT NULL, + `aggregate` enum('NONE','GROUP') NOT NULL DEFAULT 'NONE', PRIMARY KEY (`db`,`name`,`type`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Stored Procedures' show create table event; diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql.result b/mysql-test/suite/funcs_1/r/is_columns_mysql.result index 21ffae902a4..4305c40770c 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result @@ -133,6 +133,7 @@ def mysql innodb_table_stats sum_of_other_index_sizes 6 NULL NO bigint NULL NULL def mysql innodb_table_stats table_name 2 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references NEVER NULL def mysql plugin dl 2 '' NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references NEVER NULL def mysql plugin name 1 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) PRI select,insert,update,references NEVER NULL +def mysql proc aggregate 21 'NONE' NO enum 5 15 NULL NULL NULL utf8 utf8_general_ci enum('NONE','GROUP') select,insert,update,references NEVER NULL def mysql proc body 11 NULL NO longblob 4294967295 4294967295 NULL NULL NULL NULL NULL longblob select,insert,update,references NEVER NULL def mysql proc body_utf8 20 NULL YES longblob 4294967295 4294967295 NULL NULL NULL NULL NULL longblob select,insert,update,references NEVER NULL def mysql proc character_set_client 17 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) select,insert,update,references NEVER NULL @@ -488,6 +489,7 @@ NULL mysql proc modified timestamp NULL NULL NULL NULL timestamp 3.0000 mysql proc collation_connection char 32 96 utf8 utf8_bin char(32) 3.0000 mysql proc db_collation char 32 96 utf8 utf8_bin char(32) 1.0000 mysql proc body_utf8 longblob 4294967295 4294967295 NULL NULL longblob +3.0000 mysql proc aggregate enum 5 15 utf8 utf8_general_ci enum('NONE','GROUP') 3.0000 mysql procs_priv Host char 60 180 utf8 utf8_bin char(60) 3.0000 mysql procs_priv Db char 64 192 utf8 utf8_bin char(64) 3.0000 mysql procs_priv User char 80 240 utf8 utf8_bin char(80) diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result index c7d10790325..2f1c9188989 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result @@ -119,6 +119,7 @@ def mysql index_stats prefix_arity 4 NULL NO int NULL NULL 10 0 NULL NULL NULL i def mysql index_stats table_name 2 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI NEVER NULL def mysql plugin dl 2 '' NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) NEVER NULL def mysql plugin name 1 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) PRI NEVER NULL +def mysql proc aggregate 21 'NONE' NO enum 5 15 NULL NULL NULL utf8 utf8_general_ci enum('NONE','GROUP') NEVER NULL def mysql proc body 11 NULL NO longblob 4294967295 4294967295 NULL NULL NULL NULL NULL longblob NEVER NULL def mysql proc body_utf8 20 NULL YES longblob 4294967295 4294967295 NULL NULL NULL NULL NULL longblob NEVER NULL def mysql proc character_set_client 17 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) NEVER NULL @@ -472,6 +473,7 @@ NULL mysql proc modified timestamp NULL NULL NULL NULL timestamp 3.0000 mysql proc collation_connection char 32 96 utf8 utf8_bin char(32) 3.0000 mysql proc db_collation char 32 96 utf8 utf8_bin char(32) 1.0000 mysql proc body_utf8 longblob 4294967295 4294967295 NULL NULL longblob +3.0000 mysql proc aggregate enum 5 15 utf8 utf8_general_ci enum('NONE','GROUP') 3.0000 mysql procs_priv Host char 60 180 utf8 utf8_bin char(60) 3.0000 mysql procs_priv Db char 64 192 utf8 utf8_bin char(64) 3.0000 mysql procs_priv User char 80 240 utf8 utf8_bin char(80) diff --git a/mysql-test/suite/funcs_1/r/storedproc.result b/mysql-test/suite/funcs_1/r/storedproc.result index c86a73618df..dc9c31566d2 100644 --- a/mysql-test/suite/funcs_1/r/storedproc.result +++ b/mysql-test/suite/funcs_1/r/storedproc.result @@ -1771,48 +1771,48 @@ Testcase 4.1.9: drop procedure -------------------------------------------------------------------------------- SELECT * from mysql.proc where specific_name='sp9'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate DROP PROCEDURE IF EXISTS sp9; SELECT * from mysql.proc where specific_name='sp9'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate CREATE PROCEDURE sp9()SELECT * from t1; SELECT * from mysql.proc where specific_name='sp9'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 -db_storedproc sp9 PROCEDURE sp9 SQL CONTAINS_SQL NO DEFINER SELECT * from t1 root@localhost created modified latin1 latin1_swedish_ci latin1_swedish_ci SELECT * from t1 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate +db_storedproc sp9 PROCEDURE sp9 SQL CONTAINS_SQL NO DEFINER SELECT * from t1 root@localhost created modified latin1 latin1_swedish_ci latin1_swedish_ci SELECT * from t1 NONE DROP PROCEDURE sp9; SELECT * from mysql.proc where specific_name='sp9'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate CREATE PROCEDURE sp9()SELECT * from t1; SELECT * from mysql.proc where specific_name='sp9'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 -db_storedproc sp9 PROCEDURE sp9 SQL CONTAINS_SQL NO DEFINER SELECT * from t1 root@localhost created modified latin1 latin1_swedish_ci latin1_swedish_ci SELECT * from t1 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate +db_storedproc sp9 PROCEDURE sp9 SQL CONTAINS_SQL NO DEFINER SELECT * from t1 root@localhost created modified latin1 latin1_swedish_ci latin1_swedish_ci SELECT * from t1 NONE DROP PROCEDURE IF EXISTS sp9; SELECT * from mysql.proc where specific_name='sp9'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate Testcase 4.1.10: ---------------- DROP FUNCTION -------------------------------------------------------------------------------- SELECT * from mysql.proc where specific_name='fn10' and type='function'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate DROP FUNCTION IF EXISTS fn10; SELECT * from mysql.proc where specific_name='fn10' and type='function'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate CREATE FUNCTION fn10() returns int return 100; SELECT * from mysql.proc where specific_name='fn10' and type='function'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 -db_storedproc fn10 FUNCTION fn10 SQL CONTAINS_SQL NO DEFINER int(11) return 100 root@localhost created modified latin1 latin1_swedish_ci latin1_swedish_ci return 100 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate +db_storedproc fn10 FUNCTION fn10 SQL CONTAINS_SQL NO DEFINER int(11) return 100 root@localhost created modified latin1 latin1_swedish_ci latin1_swedish_ci return 100 NONE DROP FUNCTION fn10; SELECT * from mysql.proc where specific_name='fn10' and type='function'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate CREATE FUNCTION fn10() returns int return 100; SELECT * from mysql.proc where specific_name='fn10' and type='function'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 -db_storedproc fn10 FUNCTION fn10 SQL CONTAINS_SQL NO DEFINER int(11) return 100 root@localhost created modified latin1 latin1_swedish_ci latin1_swedish_ci return 100 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate +db_storedproc fn10 FUNCTION fn10 SQL CONTAINS_SQL NO DEFINER int(11) return 100 root@localhost created modified latin1 latin1_swedish_ci latin1_swedish_ci return 100 NONE DROP FUNCTION IF EXISTS fn10; SELECT * from mysql.proc where specific_name='fn10' and type='function'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate Testcase 4.1.11: ---------------- @@ -16172,15 +16172,15 @@ insert into t43 values('abcde', 'a!@#$%^&*('); CREATE PROCEDURE d1.sp4() SELECT * from d1.t43; SELECT * from mysql.proc where specific_name = 'sp4'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 -d1 sp4 PROCEDURE sp4 SQL CONTAINS_SQL NO DEFINER SELECT * from d1.t43 root@localhost modified created latin1 latin1_swedish_ci latin1_swedish_ci SELECT * from d1.t43 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate +d1 sp4 PROCEDURE sp4 SQL CONTAINS_SQL NO DEFINER SELECT * from d1.t43 root@localhost modified created latin1 latin1_swedish_ci latin1_swedish_ci SELECT * from d1.t43 NONE USE db_storedproc; DROP DATABASE d1; CREATE DATABASE d1; USE d1; create table t44(a char(5), b char(10)); SELECT * from mysql.proc where specific_name = 'sp4'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate USE db_storedproc; DROP DATABASE d1; @@ -16222,8 +16222,8 @@ CREATE PROCEDURE sp8 ( n char(20) ) sql security DEFINER comment 'initial' USE d2; alter procedure d1.sp8 sql security DEFINER comment 'updated'; SELECT * from mysql.proc where specific_name='sp8' and db='d1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 -d1 sp8 PROCEDURE sp8 SQL CONTAINS_SQL NO DEFINER n char(20) SELECT * from t1 where t1.f1 = n root@localhost modified created updated latin1 latin1_swedish_ci latin1_swedish_ci SELECT * from t1 where t1.f1 = n +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate +d1 sp8 PROCEDURE sp8 SQL CONTAINS_SQL NO DEFINER n char(20) SELECT * from t1 where t1.f1 = n root@localhost modified created updated latin1 latin1_swedish_ci latin1_swedish_ci SELECT * from t1 where t1.f1 = n NONE Testcase 4.4.9: -------------------------------------------------------------------------------- @@ -16239,7 +16239,7 @@ END// USE d2; alter function d1.fn2 sql security DEFINER comment 'updated'; SELECT * from mysql.proc where specific_name='fn2' and db='d1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate d1 fn2 FUNCTION fn2 SQL CONTAINS_SQL NO DEFINER n int int(11) BEGIN declare a int; set a = 0.9 * n; @@ -16248,7 +16248,7 @@ END root@localhost modified created updated latin1 latin1_swedish_ci latin1_swe declare a int; set a = 0.9 * n; return a; -END +END NONE Testcase 4.4.10: -------------------------------------------------------------------------------- @@ -16258,7 +16258,7 @@ SELECT * from t1 where t1.f1 = n; USE d2; DROP PROCEDURE d1.sp9; SELECT * from mysql.proc where specific_name='sp9' and db='d1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate Testcase 4.4.11: -------------------------------------------------------------------------------- @@ -16272,7 +16272,7 @@ END// USE d2; DROP FUNCTION d1.fn3; SELECT * from mysql.proc where specific_name='fn3' and db='d1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate USE db_storedproc; DROP DATABASE d1; DROP DATABASE d2; diff --git a/mysql-test/suite/innodb/r/instant_alter_debug.result b/mysql-test/suite/innodb/r/instant_alter_debug.result index b1407aad1f3..99a263ae95f 100644 --- a/mysql-test/suite/innodb/r/instant_alter_debug.result +++ b/mysql-test/suite/innodb/r/instant_alter_debug.result @@ -35,7 +35,7 @@ ALTER TABLE t4 ADD COLUMN b INT; SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS LEFT JOIN t4 ON (NUMERIC_SCALE = pk); COUNT(*) -1734 +1735 SET DEBUG_SYNC='innodb_inplace_alter_table_enter SIGNAL enter WAIT_FOR delete'; ALTER TABLE t4 ADD COLUMN c INT; connect dml,localhost,root,,; diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result index fbd81cb7146..486c02eef71 100644 --- a/mysql-test/suite/rpl/r/rpl_sp.result +++ b/mysql-test/suite/rpl/r/rpl_sp.result @@ -17,7 +17,7 @@ insert into t1 values (b); insert into t1 values (unix_timestamp()); end| select * from mysql.proc where name='foo' and db='mysqltest1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate mysqltest1 foo PROCEDURE foo SQL CONTAINS_SQL NO DEFINER begin declare b int; set b = 8; @@ -28,10 +28,10 @@ declare b int; set b = 8; insert into t1 values (b); insert into t1 values (unix_timestamp()); -end +end NONE connection slave; select * from mysql.proc where name='foo' and db='mysqltest1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate mysqltest1 foo PROCEDURE foo SQL CONTAINS_SQL NO DEFINER begin declare b int; set b = 8; @@ -42,7 +42,7 @@ declare b int; set b = 8; insert into t1 values (b); insert into t1 values (unix_timestamp()); -end +end NONE connection master; set timestamp=1000000000; call foo(); @@ -137,19 +137,19 @@ select * from t2; a 20 select * from mysql.proc where name="foo4" and db='mysqltest1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate mysqltest1 foo4 PROCEDURE foo4 SQL CONTAINS_SQL YES DEFINER begin insert into t2 values(20),(20); end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin insert into t2 values(20),(20); -end +end NONE connection master; drop procedure foo4; select * from mysql.proc where name="foo4" and db='mysqltest1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate connection slave; select * from mysql.proc where name="foo4" and db='mysqltest1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate connection master; drop procedure foo; drop procedure foo2; @@ -235,22 +235,22 @@ select fn3(); fn3() 0 select * from mysql.proc where db='mysqltest1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate mysqltest1 fn1 FUNCTION fn1 SQL NO_SQL NO DEFINER int(11) begin return unix_timestamp(); end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin return unix_timestamp(); -end +end NONE mysqltest1 fn2 FUNCTION fn2 SQL NO_SQL NO DEFINER int(11) begin return unix_timestamp(); end zedjzlcsjhd@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin return unix_timestamp(); -end +end NONE mysqltest1 fn3 FUNCTION fn3 SQL READS_SQL_DATA NO DEFINER int(11) begin return 0; end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin return 0; -end +end NONE select * from t1; a 1000000000 @@ -260,22 +260,22 @@ select * from t1; a 1000000000 select * from mysql.proc where db='mysqltest1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate mysqltest1 fn1 FUNCTION fn1 SQL NO_SQL NO DEFINER int(11) begin return unix_timestamp(); end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin return unix_timestamp(); -end +end NONE mysqltest1 fn2 FUNCTION fn2 SQL NO_SQL NO DEFINER int(11) begin return unix_timestamp(); end zedjzlcsjhd@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin return unix_timestamp(); -end +end NONE mysqltest1 fn3 FUNCTION fn3 SQL READS_SQL_DATA NO DEFINER int(11) begin return 0; end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin return 0; -end +end NONE connection master; delete from t2; alter table t2 add unique (a); diff --git a/mysql-test/t/custom_aggregate_functions.test b/mysql-test/t/custom_aggregate_functions.test new file mode 100644 index 00000000000..20fcc35f39f --- /dev/null +++ b/mysql-test/t/custom_aggregate_functions.test @@ -0,0 +1,773 @@ +create table t2 (sal int(10)); +delimiter |; + +create aggregate function f1(x INT) returns int +begin + declare continue handler for not found return 0; + loop + fetch group next row; + insert into t2 (sal) values (x); + end loop; +end| + +delimiter ;| + +create table t1 (sal int(10),id int(10)); +INSERT INTO t1 (sal,id) VALUES (5000,1); +INSERT INTO t1 (sal,id) VALUES (2000,1); +INSERT INTO t1 (sal,id) VALUES (1000,1); +select f1(sal) from t1 where id>= 1; +select * from t2; +drop table t2; +drop function f1; + +delimiter |; +--error ER_INVALID_AGGREGATE_FUNCTION +create aggregate function f1(x INT) returns INT +begin + insert into t1(sal) values (x); + return x; +end| + +--error ER_NOT_AGGREGATE_FUNCTION +create function f1(x INT) returns INT +begin + set x=5; + fetch group next row; +return x+1; +end | + +create aggregate function f1(x INT) returns INT +begin + declare continue handler for not found return x; + loop + fetch group next row; + end loop; +end | +delimiter ;| + +select f1(1); +show create function f1; +--error ER_PARSE_ERROR +alter function f1 aggregate none; +show create function f1; +select f1(1); +drop function f1; + + +delimiter |; + + +create aggregate function f2(i int) returns int +begin + FEtCH GROUP NEXT ROW; + if i <= 0 then + return 0; + elseif i = 1 then + return (select count(*) from t1 where id = i); + else + return (select count(*) + f2( i - 1) from t1 where id = i); + end if; +end| +select f2(1)| +# Since currently recursive functions are disallowed ER_SP_NO_RECURSION +# error will be returned, once we will allow them error about +# insufficient number of locked tables will be returned instead. +--error ER_SP_NO_RECURSION +select f2(2)| +--error ER_SP_NO_RECURSION +select f2(3)| +drop function f2| + +create aggregate function f1(x int) returns int +begin + declare mini int default 0; + declare continue handler for not found return mini; + loop + fetch group next row; + set mini= mini+x; + fetch group next row; + end loop; +end| + + +delimiter ;| + +select f1(10); +select f1(sal) from t1; +select f1(sal) from t1 where 1=0; +drop function f1; +delimiter |; + + +#WITHOUT RETURN STATEMENT IN AGGREGATE FUNCTIONS +--error 1320 +create aggregate function f1(x int) returns int +begin + declare mini int default 0; + LOOP + FETCH GROUP NEXT ROW; + set mini = mini + x; + END LOOP; +end| + +#without handler +create aggregate function f1(x int) returns int +begin + declare mini int default 0; + LOOP + FETCH GROUP NEXT ROW; + set mini = mini + x; + END LOOP; + return -1; +end| + +--error 1329 +select f1(sal) from t1| +drop function f1| + +#without loop +create aggregate function f1(x int) returns int +begin + declare mini int default 0; + declare continue handler for not found return mini; + FETCH GROUP NEXT ROW; + set mini = mini + x; +end| + +--error 1321 +select f1(sal) from t1| +drop function f1| + + +create aggregate function f1(x int) returns int +begin + declare mini int default 0; + declare continue handler for not found set mini=-1; + LOOP + FETCH GROUP NEXT ROW; + set mini = mini + x; + END LOOP; + return 0; +end| + +--error 1321 +select f1(sal) from t1| +drop function f1| +drop table t1| + +delimiter ;| + +# primary indexing + +create table t1 (sal int, id int, val int, counter int, primary key(id)); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 10, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 2, 16, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 3, 18, 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 4, 15, 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 5, 11, 5); + +delimiter |; + +create aggregate function f1(x INT) returns double +begin + declare z double default 0; + declare continue handler for not found return z; + loop + fetch group next row; + set z= z+x; + end loop; +end| + +delimiter ;| + +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by counter order by val; +--sorted_result +select id, f1(sal) from t1; +--sorted_result +select id, f1(sal) from t1 where id>= 1; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by counter; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by id; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by val; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by counter order by counter; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by counter order by val; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by counter order by id; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by val order by counter; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by val order by id; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by val order by val; +drop table t1; + +#unique index + +create table t1 (sal int, id int, val int, counter int, primary key(id), unique key(val)); + +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 10, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 2, NULL, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 3, 18, 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 4, 15, 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 5, 11, 5); + +--sorted_result +select id, f1(sal) from t1; +--sorted_result +select id, f1(sal) from t1 where id>= 1; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by counter; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by id; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by val; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by counter order by counter; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by counter order by val; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by counter order by id; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by val order by counter; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by val order by id; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by val order by val; +drop table t1; + +# compound indexing +create table t1 (sal int, id int, val int, counter int, primary key(id), INDEX name (val,counter)); + +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 10, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 2, 10, 4); +INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 3, 18, 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 4, 11, 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 5, 11, 5); +--sorted_result +select id, f1(sal) from t1; +--sorted_result +select id, f1(sal) from t1 where id>= 1; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by counter; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by id; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by val; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by counter order by counter; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by counter order by val; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by counter order by id; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by val order by counter; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by val order by id; +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by val order by val; +drop table t1; +drop function f1; + +# prepared statement with aggregate functions + +delimiter |; + +create aggregate function f1(x INT) returns double +begin + declare z double default 0; + declare continue handler for not found return z; + loop + fetch group next row; + set z= z+x; + end loop; +end| + +create aggregate function f2() returns double +begin + declare z int default 0; + declare continue handler for not found return z; + loop + fetch group next row; + set z = z+1; + end loop; +end| + +delimiter ;| + +create table t1 (sal int, id int, val int, counter int); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 10, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 1, 16, 5); +INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 2, 18, 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 3, 15, 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 4, 11, 4); + +prepare test from "select f2() from t1 where id>= ?"; +set @param= 2; +execute test using @param; +execute test using @param; +execute test using @param; +execute test using @param; +set @param= 1; +execute test using @param; +set @param= 3; +execute test using @param; +set @param= 4; +execute test using @param; +deallocate prepare test; + +prepare test from "select f1(sal) from t1 where id>= ?"; +set @param= 2; +execute test using @param; +execute test using @param; +execute test using @param; +execute test using @param; +set @param= 1; +execute test using @param; +set @param= 3; +execute test using @param; +set @param= 4; +execute test using @param; +set @param= 5; +execute test using @param; +deallocate prepare test; + +drop function f2; + +prepare test from "select f1(sal) from t1 where id>= ?"; +set @param= 2; +execute test using @param; +drop function f1; + +create function f1(x int) returns int + return -1; + +execute test using @param; + +drop function f1; + +delimiter |; + +create aggregate function f1(x INT) returns double +begin + declare z double default 0; + declare continue handler for not found return z; + loop + fetch group next row; + set z= z+x; + end loop; +end| + +delimiter ;| + +execute test using @param; + +deallocate prepare test; + +drop table t1; +drop function f1; + +create table t1 (sal int, id int, val varchar(10), counter int); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 'ab', 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 'cd', 5); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 'ef', 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 3, 'gh', 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 4, 'ij', 4); + +create table t2 (sal int, id int, val int, counter int); +INSERT INTO t2 (sal, id, val, counter) VALUES (1000, 2, 10, 2); +INSERT INTO t2 (sal, id, val, counter) VALUES (2000, 1, 16, 5); +INSERT INTO t2 (sal, id, val, counter) VALUES (6000, 2, 18, 1); +INSERT INTO t2 (sal, id, val, counter) VALUES (5000, 3, 15, 3); +INSERT INTO t2 (sal, id, val, counter) VALUES (3000, 4, 11, 4); +delimiter |; + +create aggregate function f1(x double) returns double +begin + declare z double default 0; + declare continue handler for not found return z; + loop + fetch group next row; + set z= z+x; + end loop; +end| + +create aggregate function f2(x INT) returns CHAR(10) + begin + declare mini INT default 0; + declare continue handler for not found return mini; + loop + fetch group next row; + set mini= mini + x; + end loop; +end| + +create aggregate function f3(x INT) returns CHAR(10) + begin + declare mini INT default 0; + declare continue handler for not found return mini; + loop + fetch group next row; + set mini= mini + x; + fetch group next row; + set mini= mini - x; + end loop; +end| + +create aggregate function f4(x INT, y varchar(10)) returns varchar(1000) +begin + declare str varchar(1000) default ''; + declare continue handler for not found return str; + loop + fetch group next row; + set str= concat(str,y); + end loop; +end| + +create aggregate function f5(x INT) returns varchar(1000) +begin + declare z int default 0; + DECLARE cur1 CURSOR FOR SELECT sal FROM test.t2; + declare continue handler for not found return 0; + loop + fetch group next row; + set z = z+x; + end loop; +end| + + + +create function f6(x int) returns int +return (select f1(sal) from t1)| + +delimiter ;| + +select f1(sal) from t1; + +# group by test + +--sorted_result +select f1(sal) from t1 where id>= 1 group by counter; + +# multiple fetch statements in the loop +--sorted_result +select f3(sal) from t1; + +# incorrect column type +--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +select f2(val) from t1; + +#subquery +--sorted_result +select val, id, c from (select f1(sal) as c from t2) as t1, t2; + +#multiple calls to an aggregate function +--sorted_result +select f1(sal),f1(val), f1(id), f1(sal) from t2; + +#string type, also more than one areguments +--sorted_result +select f4(sal, val) from t1; + +#select f1((select sal from t2 where id= 1)) from t1; +--sorted_result +select c from (select f1(sal) as c from t2) as t1; + +# this fails as more than one row is returned +#select f1((select val from t2 where id > 1)) from t1; + +select f1((select val from t2 where 0 > 1)) from t1; +select f1((select val from t2 where id= 1)) from t1; + +select f5(sal) from t1; + +SELECT f1(sal)*f1(sal) FROM t1; + +--sorted_result +SELECT (SELECT f1(sal) FROM t1) FROM t2; +--sorted_result +select id, f1(sal) from t1; +--sorted_result +select id, f1(sal) from t1 where id>= 1; +--sorted_result +select f1(sal), f1(sal) from t1 where id>= 1 group by counter; +--sorted_result +select f1(sal), f1(sal) from t1 where id>= 1 group by id ; +--sorted_result +select f1(sal) from t1 where id>= 1 group by id ; +select f1(sal) from t1 where id>= 1 order by counter; +select f1(sal) from t1 where id>= 1 group by id order by counter; +select counter, id, f1(sal) from t1 where id>= 1 group by id order by counter; +select id, f1(sal) from t1 where id>= 1 group by id order by counter; +drop table t1; +drop table t2; +drop function f1; +drop function f2; +drop function f3; +drop function f4; +drop function f5; +drop function f6; + + +delimiter |; + +# aggregate AND function + +create aggregate function f1(x INT) returns INT +begin + declare z double default 1000; + declare continue handler for not found return z; + loop + fetch group next row; + set z= (z&x); + end loop; +end| + +delimiter ;| + +create table t1 (sal int, id int, val int, counter int); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 10, 2); +INSERT INTO t1 (sal, id, val, counter) VALUES (7000, 1, 16, 5); +INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 2, 18, 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 3, 15, 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 4, 11, 4); +INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 5, 10, 7); +INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 7, 13, 8); +INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 6, 19, 9); +INSERT INTO t1 (sal, id, val, counter) VALUES (7000, 7, 12, 0); +INSERT INTO t1 (sal, id, val, counter) VALUES (4000, 6, 14, 1); +INSERT INTO t1 (sal, id, val, counter) VALUES (8000, 5, 19, 3); +INSERT INTO t1 (sal, id, val, counter) VALUES (9000, 4, 11, 4); +INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 3, 11, 2); + +select f1(sal) from t1 where id>= 1; +drop function f1; + +delimiter |; + +# aggregate AVG function + +create aggregate function f1(x INT) returns double +begin + declare z double default 0; + declare count double default 0; + declare continue handler for not found return z/count; + loop + fetch group next row; + set z= z+x; + set count= count+1; + end loop; +end| + +delimiter ;| +select f1(sal) from t1 where id>= 1; +drop function f1; +delimiter |; + +# aggregate MAX function + +create aggregate function f1(x INT) returns INT +begin + declare maxi INT default -1; + declare continue handler for not found return maxi; + loop + fetch group next row; + if maxi < x then + set maxi= x; + end if; + end loop; +end| + +delimiter ;| +select f1(sal) from t1 where id>= 1; +drop function f1; +delimiter |; + +# aggregate MIN function + +create aggregate function f1(x INT) returns double +begin + declare mini INT default 100000; + declare continue handler for not found return mini; + loop + fetch group next row; + if mini > x then + set mini = x; + end if; + end loop; +end| + +delimiter ;| +select f1(sal) from t1 where id>= 1; +drop function f1; +delimiter |; + +# aggregate XOR function + +create aggregate function f1(x INT) returns double +begin + declare z double default 0; + declare continue handler for not found return z; + loop + fetch group next row; + set z= z^x; + end loop; +end| + +delimiter ;| +select f1(sal) from t1 where id>= 1; +drop function f1; +delimiter |; + +# aggregate SUM function + +create aggregate function f1(x INT) returns INT +begin + declare z int default 0; + declare continue handler for not found return z; + loop + fetch group next row; + set z= z+x; + end loop; +end| + +delimiter ;| +select f1(sal) from t1 where id>= 1; +delimiter |; + + +create aggregate function f2() returns INT +begin + declare z double default 0; + declare continue handler for not found return z; + loop + fetch group next row; + set z= z+1; + end loop; +end| + +delimiter ;| + +# no parameters +select f2() from t1; + +create table t2 (sal int, id int); +INSERT INTO t2 (sal, id) VALUES (NULL, 1); +INSERT INTO t2 (sal, id) VALUES (2000, 1); +INSERT INTO t2 (sal, id) VALUES (3000, 1); + +# null values +select f1(sal) from t2; + +# no tables +select f1(1); + +# aggregate function called from regular functions +create function f3() returns int +return (select f1(sal) from t1); +select f3(); + +create function f4() returns INT +return 1; + +# regular functions called from aggregate functions +delimiter |; +create aggregate function f5() returns INT +begin + declare z double default 0; + declare continue handler for not found return z; + loop + fetch group next row; + set z= z+f3(); + end loop; +end| + +delimiter ;| +select f5() from t2; +delimiter |; + +# aggregate functions called from aggregate functions +create aggregate function f6(x INT) returns INT +begin + declare z int default 0; + declare continue handler for not found return z; + loop + fetch group next row; + if x then + set z= z+(select f1(sal) from t1); + end if; + end loop; +end| + +delimiter ;| +select f6(sal) from t2; + +# GROUP BY AND ORDER BY +--sorted_result +select id, f1(sal) from t1 where id>= 1 group by id; +--sorted_result +select counter, f1(sal) from t1 where id>= 1 group by counter; +--sorted_result +select val, f1(sal) from t1 where id>= 1 group by val; +--sorted_result +select counter, f1(sal) from t1 where id>= 1 group by id order by counter; +--sorted_result +select counter, id, f1(sal), f1(sal) from t1 where id>= 1 group by id order by counter; +--sorted_result +select counter, id, f1(sal), sum(distinct sal) from t1 where id>= 1 group by id order by counter desc; + + +##### insert aggregate function value into a table ###### +create table t3 (i int); +INSERT INTO t3 (i) select f1(sal) from t1; +select * from t3; + +delimiter |; + +create aggregate function f7(x INT) returns INT +begin + declare z int default 0; + DECLARE done BOOLEAN DEFAULT FALSE; + DECLARE a,b,c INT; + DECLARE cur1 CURSOR FOR SELECT id FROM test.t2; + declare continue handler for not found return z; + + outer_loop: LOOP + FETCH GROUP NEXT ROW; + set z= z+x; + inner_block: begin + DECLARE cur2 CURSOR FOR SELECT id FROM test.t2; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + OPEN cur2; + + read_loop: LOOP + FETCH cur2 INTO a; + IF done THEN + CLOSE cur2; + LEAVE read_loop; + END IF; + END LOOP read_loop; + + end inner_block; + END LOOP outer_loop; + +end| + +delimiter ;| +select f7(sal) from t1; + +drop table t1; +drop table t2; +drop table t3; +drop function f1; +drop function f2; +drop function f3; +drop function f4; +drop function f5; +drop function f6; +drop function f7; diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index 9c306de0e3f..dcd56c57650 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -867,7 +867,7 @@ drop table t1; use mysql; INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL', 'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03', -'2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a'); +'2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a', 'NONE'); select routine_name from information_schema.routines where ROUTINE_SCHEMA='test'; delete from proc where name=''; use test; diff --git a/mysql-test/t/sp-destruct.test b/mysql-test/t/sp-destruct.test index 31da235d906..0cd80bd5427 100644 --- a/mysql-test/t/sp-destruct.test +++ b/mysql-test/t/sp-destruct.test @@ -10,7 +10,7 @@ -- source include/not_embedded.inc # Supress warnings written to the log file -call mtr.add_suppression("Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted"); +call mtr.add_suppression("Column count of mysql.proc is wrong. Expected 21, found 20. The table is probably corrupted"); call mtr.add_suppression("Stored routine .test...bug14233_[123].: invalid value in column mysql.proc"); # Backup proc table diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index aa537d3596b..0e16948f438 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -1746,7 +1746,7 @@ drop procedure bug15091; drop function if exists bug16896; --enable_warnings ---error ER_PARSE_ERROR +--error ER_INVALID_AGGREGATE_FUNCTION create aggregate function bug16896() returns int return 1; # diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 174419220e7..576512e78a4 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -6317,7 +6317,7 @@ set names utf8| drop database if exists това_е_дълго_име_за_база_данни_нали| --enable_warnings create database това_е_дълго_име_за_база_данни_нали| -INSERT INTO mysql.proc VALUES ('това_е_дълго_име_за_база_данни_нали','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','PROCEDURE','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','SQL','CONTAINS_SQL','NO','DEFINER','','','bad_body','root@localhost',now(), now(),'','', 'utf8', 'utf8_general_ci', 'utf8_general_ci', 'n/a')| +INSERT INTO mysql.proc VALUES ('това_е_дълго_име_за_база_данни_нали','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','PROCEDURE','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','SQL','CONTAINS_SQL','NO','DEFINER','','','bad_body','root@localhost',now(), now(),'','', 'utf8', 'utf8_general_ci', 'utf8_general_ci', 'n/a', 'NONE')| --error ER_SP_PROC_TABLE_CORRUPT call това_е_дълго_име_за_база_данни_нали.това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго()| drop database това_е_дълго_име_за_база_данни_нали| -- cgit v1.2.1 From 1af2d7ba235305ffd4c24a47cccafd5fe6815d9e Mon Sep 17 00:00:00 2001 From: Vesa Pentti Date: Fri, 24 Nov 2017 21:56:13 +0000 Subject: MDEV-12501 -- set --maturity-level by default * Note: breaking change; since this commit, a plugin that has worked so far might get rejected due to plugin maturity * mariabackup is not affected (allows all plugins) * VERSION file defines SERVER_MATURITY, which defines the corresponding numeric value as SERVER_MATURITY_LEVEL in include/mysql_version.h * The default value for 'plugin_maturity' is SERVER_MATURITY_LEVEL - 1 * Logs a warning if a plugin has maturity lower than SERVER_MATURITY_LEVEL * Tests suppress the plugin maturity warning * Tests use --plugin-maturity=unknown by default so as not to fail due to the stricter plugin maturity handling --- mysql-test/include/default_mysqld.cnf | 2 +- mysql-test/include/mtr_warnings.sql | 6 ++++++ mysql-test/r/mysqld--help.result | 1 - mysql-test/suite/galera/galera_2nodes.cnf | 1 + mysql-test/suite/galera/suite.opt | 1 + mysql-test/suite/galera_3nodes/galera_3nodes.cnf | 1 + mysql-test/suite/rpl/suite.opt | 1 + mysql-test/suite/sys_vars/inc/sysvars_server.inc | 1 + .../suite/sys_vars/r/sysvars_server_embedded.result | 15 +-------------- .../suite/sys_vars/r/sysvars_server_notembedded.result | 15 +-------------- mysql-test/t/bootstrap.test | 2 +- mysql-test/t/mysqld--help.test | 2 +- 12 files changed, 16 insertions(+), 32 deletions(-) create mode 100644 mysql-test/suite/galera/suite.opt create mode 100644 mysql-test/suite/rpl/suite.opt (limited to 'mysql-test') diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf index 44a7fd12d27..69a2b58288b 100644 --- a/mysql-test/include/default_mysqld.cnf +++ b/mysql-test/include/default_mysqld.cnf @@ -17,7 +17,7 @@ # Default values that applies to all MySQL Servers [mysqld] disable-getopt-prefix-matching - +plugin-maturity=unknown open-files-limit= 1024 local-infile character-set-server= latin1 diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql index 71c693961c1..b7b2a316dfb 100644 --- a/mysql-test/include/mtr_warnings.sql +++ b/mysql-test/include/mtr_warnings.sql @@ -224,6 +224,12 @@ INSERT INTO global_suppressions VALUES ("Slave I/O: Setting @slave_gtid_ignore_duplicates failed with error.*"), ("Slave I/O: Setting @slave_until_gtid failed with error.*"), ("Slave I/O: Get master GTID position failed with error.*"), + + /* + MDEV-12501 -- set --maturity-level by default + */ + ("Plugin .* is of maturity level .* while the server is .*"), + ("THE_LAST_SUPPRESSION")|| diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result index 0992276227f..f76957fdcba 100644 --- a/mysql-test/r/mysqld--help.result +++ b/mysql-test/r/mysqld--help.result @@ -1535,7 +1535,6 @@ performance-schema-session-connect-attrs-size -1 performance-schema-setup-actors-size 100 performance-schema-setup-objects-size 100 performance-schema-users-size -1 -plugin-maturity unknown port 3306 port-open-timeout 0 preload-buffer-size 32768 diff --git a/mysql-test/suite/galera/galera_2nodes.cnf b/mysql-test/suite/galera/galera_2nodes.cnf index b24f3603894..8de704dbec8 100644 --- a/mysql-test/suite/galera/galera_2nodes.cnf +++ b/mysql-test/suite/galera/galera_2nodes.cnf @@ -4,6 +4,7 @@ [mysqld] wsrep-on=1 binlog-format=row +plugin-maturity=unknown innodb-autoinc-lock-mode=2 default-storage-engine=innodb wsrep-provider=@ENV.WSREP_PROVIDER diff --git a/mysql-test/suite/galera/suite.opt b/mysql-test/suite/galera/suite.opt new file mode 100644 index 00000000000..8374626febe --- /dev/null +++ b/mysql-test/suite/galera/suite.opt @@ -0,0 +1 @@ +--plugin-maturity=unknown diff --git a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf index 91aa53ad7b1..48b3c002c04 100644 --- a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf +++ b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf @@ -3,6 +3,7 @@ [mysqld] binlog-format=row +plugin-maturity=unknown innodb-autoinc-lock-mode=2 default-storage-engine=innodb diff --git a/mysql-test/suite/rpl/suite.opt b/mysql-test/suite/rpl/suite.opt new file mode 100644 index 00000000000..8374626febe --- /dev/null +++ b/mysql-test/suite/rpl/suite.opt @@ -0,0 +1 @@ +--plugin-maturity=unknown diff --git a/mysql-test/suite/sys_vars/inc/sysvars_server.inc b/mysql-test/suite/sys_vars/inc/sysvars_server.inc index b5c800e858a..37491315c3e 100644 --- a/mysql-test/suite/sys_vars/inc/sysvars_server.inc +++ b/mysql-test/suite/sys_vars/inc/sysvars_server.inc @@ -26,6 +26,7 @@ select * from information_schema.system_variables 'lower_case_file_system', 'lower_case_table_names', 'open_files_limit', + 'plugin_maturity', 'rand_seed1', 'rand_seed2', 'system_time_zone', 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 6fb52700556..41dec216ddb 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -15,6 +15,7 @@ variable_name not in ( 'lower_case_file_system', 'lower_case_table_names', 'open_files_limit', +'plugin_maturity', 'rand_seed1', 'rand_seed2', 'system_time_zone', @@ -3188,20 +3189,6 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED -VARIABLE_NAME PLUGIN_MATURITY -SESSION_VALUE NULL -GLOBAL_VALUE unknown -GLOBAL_VALUE_ORIGIN COMPILE-TIME -DEFAULT_VALUE unknown -VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE ENUM -VARIABLE_COMMENT The lowest desirable plugin maturity. Plugins less mature than that will not be installed or loaded -NUMERIC_MIN_VALUE NULL -NUMERIC_MAX_VALUE NULL -NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST unknown,experimental,alpha,beta,gamma,stable -READ_ONLY YES -COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PORT SESSION_VALUE NULL GLOBAL_VALUE MASTER_MYPORT 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 1b26180b710..8591f4b0c28 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -15,6 +15,7 @@ variable_name not in ( 'lower_case_file_system', 'lower_case_table_names', 'open_files_limit', +'plugin_maturity', 'rand_seed1', 'rand_seed2', 'system_time_zone', @@ -3398,20 +3399,6 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED -VARIABLE_NAME PLUGIN_MATURITY -SESSION_VALUE NULL -GLOBAL_VALUE unknown -GLOBAL_VALUE_ORIGIN COMPILE-TIME -DEFAULT_VALUE unknown -VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE ENUM -VARIABLE_COMMENT The lowest desirable plugin maturity. Plugins less mature than that will not be installed or loaded -NUMERIC_MIN_VALUE NULL -NUMERIC_MAX_VALUE NULL -NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST unknown,experimental,alpha,beta,gamma,stable -READ_ONLY YES -COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PORT SESSION_VALUE NULL GLOBAL_VALUE MASTER_MYPORT diff --git a/mysql-test/t/bootstrap.test b/mysql-test/t/bootstrap.test index e8589fa9242..1ae9b13e050 100644 --- a/mysql-test/t/bootstrap.test +++ b/mysql-test/t/bootstrap.test @@ -7,7 +7,7 @@ drop table if exists t1; # Add the datadir to the bootstrap command let $MYSQLD_DATADIR= `select @@datadir`; -let $MYSQLD_BOOTSTRAP_CMD= $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR --default-storage-engine=MyISAM --loose-skip-innodb; +let $MYSQLD_BOOTSTRAP_CMD= $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR --default-storage-engine=MyISAM --loose-skip-innodb --plugin-maturity=unknown; # # Check that --bootstrap reads from stdin # diff --git a/mysql-test/t/mysqld--help.test b/mysql-test/t/mysqld--help.test index 1613f8e7a4f..f859d7dd9d6 100644 --- a/mysql-test/t/mysqld--help.test +++ b/mysql-test/t/mysqld--help.test @@ -19,7 +19,7 @@ exec $MYSQLD_BOOTSTRAP_CMD --symbolic-links=0 --lower-case-table-names=1 --help perl; # Variables which we don't want to display in the result file since # their paths may vary: - @skipvars=qw/basedir open-files-limit general-log-file log plugin-dir + @skipvars=qw/basedir open-files-limit general-log-file log plugin-dir plugin-maturity log-slow-queries pid-file slow-query-log-file log-basename datadir slave-load-tmpdir tmpdir socket thread-pool-size large-files-support lower-case-file-system system-time-zone -- cgit v1.2.1 From 5868a184fadc84265916c7d273e610d3fa4952e6 Mon Sep 17 00:00:00 2001 From: Vesa Pentti Date: Tue, 5 Dec 2017 08:49:28 +0000 Subject: Revert "MDEV-12501 -- set --maturity-level by default" This reverts commit 1af2d7ba235305ffd4c24a47cccafd5fe6815d9e. --- mysql-test/include/default_mysqld.cnf | 2 +- mysql-test/include/mtr_warnings.sql | 6 ------ mysql-test/r/mysqld--help.result | 1 + mysql-test/suite/galera/galera_2nodes.cnf | 1 - mysql-test/suite/galera/suite.opt | 1 - mysql-test/suite/galera_3nodes/galera_3nodes.cnf | 1 - mysql-test/suite/rpl/suite.opt | 1 - mysql-test/suite/sys_vars/inc/sysvars_server.inc | 1 - .../suite/sys_vars/r/sysvars_server_embedded.result | 15 ++++++++++++++- .../suite/sys_vars/r/sysvars_server_notembedded.result | 15 ++++++++++++++- mysql-test/t/bootstrap.test | 2 +- mysql-test/t/mysqld--help.test | 2 +- 12 files changed, 32 insertions(+), 16 deletions(-) delete mode 100644 mysql-test/suite/galera/suite.opt delete mode 100644 mysql-test/suite/rpl/suite.opt (limited to 'mysql-test') diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf index 69a2b58288b..44a7fd12d27 100644 --- a/mysql-test/include/default_mysqld.cnf +++ b/mysql-test/include/default_mysqld.cnf @@ -17,7 +17,7 @@ # Default values that applies to all MySQL Servers [mysqld] disable-getopt-prefix-matching -plugin-maturity=unknown + open-files-limit= 1024 local-infile character-set-server= latin1 diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql index b7b2a316dfb..71c693961c1 100644 --- a/mysql-test/include/mtr_warnings.sql +++ b/mysql-test/include/mtr_warnings.sql @@ -224,12 +224,6 @@ INSERT INTO global_suppressions VALUES ("Slave I/O: Setting @slave_gtid_ignore_duplicates failed with error.*"), ("Slave I/O: Setting @slave_until_gtid failed with error.*"), ("Slave I/O: Get master GTID position failed with error.*"), - - /* - MDEV-12501 -- set --maturity-level by default - */ - ("Plugin .* is of maturity level .* while the server is .*"), - ("THE_LAST_SUPPRESSION")|| diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result index f76957fdcba..0992276227f 100644 --- a/mysql-test/r/mysqld--help.result +++ b/mysql-test/r/mysqld--help.result @@ -1535,6 +1535,7 @@ performance-schema-session-connect-attrs-size -1 performance-schema-setup-actors-size 100 performance-schema-setup-objects-size 100 performance-schema-users-size -1 +plugin-maturity unknown port 3306 port-open-timeout 0 preload-buffer-size 32768 diff --git a/mysql-test/suite/galera/galera_2nodes.cnf b/mysql-test/suite/galera/galera_2nodes.cnf index 8de704dbec8..b24f3603894 100644 --- a/mysql-test/suite/galera/galera_2nodes.cnf +++ b/mysql-test/suite/galera/galera_2nodes.cnf @@ -4,7 +4,6 @@ [mysqld] wsrep-on=1 binlog-format=row -plugin-maturity=unknown innodb-autoinc-lock-mode=2 default-storage-engine=innodb wsrep-provider=@ENV.WSREP_PROVIDER diff --git a/mysql-test/suite/galera/suite.opt b/mysql-test/suite/galera/suite.opt deleted file mode 100644 index 8374626febe..00000000000 --- a/mysql-test/suite/galera/suite.opt +++ /dev/null @@ -1 +0,0 @@ ---plugin-maturity=unknown diff --git a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf index 48b3c002c04..91aa53ad7b1 100644 --- a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf +++ b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf @@ -3,7 +3,6 @@ [mysqld] binlog-format=row -plugin-maturity=unknown innodb-autoinc-lock-mode=2 default-storage-engine=innodb diff --git a/mysql-test/suite/rpl/suite.opt b/mysql-test/suite/rpl/suite.opt deleted file mode 100644 index 8374626febe..00000000000 --- a/mysql-test/suite/rpl/suite.opt +++ /dev/null @@ -1 +0,0 @@ ---plugin-maturity=unknown diff --git a/mysql-test/suite/sys_vars/inc/sysvars_server.inc b/mysql-test/suite/sys_vars/inc/sysvars_server.inc index 37491315c3e..b5c800e858a 100644 --- a/mysql-test/suite/sys_vars/inc/sysvars_server.inc +++ b/mysql-test/suite/sys_vars/inc/sysvars_server.inc @@ -26,7 +26,6 @@ select * from information_schema.system_variables 'lower_case_file_system', 'lower_case_table_names', 'open_files_limit', - 'plugin_maturity', 'rand_seed1', 'rand_seed2', 'system_time_zone', 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 41dec216ddb..6fb52700556 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -15,7 +15,6 @@ variable_name not in ( 'lower_case_file_system', 'lower_case_table_names', 'open_files_limit', -'plugin_maturity', 'rand_seed1', 'rand_seed2', 'system_time_zone', @@ -3189,6 +3188,20 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME PLUGIN_MATURITY +SESSION_VALUE NULL +GLOBAL_VALUE unknown +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE unknown +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE ENUM +VARIABLE_COMMENT The lowest desirable plugin maturity. Plugins less mature than that will not be installed or loaded +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST unknown,experimental,alpha,beta,gamma,stable +READ_ONLY YES +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PORT SESSION_VALUE NULL GLOBAL_VALUE MASTER_MYPORT 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 8591f4b0c28..1b26180b710 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -15,7 +15,6 @@ variable_name not in ( 'lower_case_file_system', 'lower_case_table_names', 'open_files_limit', -'plugin_maturity', 'rand_seed1', 'rand_seed2', 'system_time_zone', @@ -3399,6 +3398,20 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME PLUGIN_MATURITY +SESSION_VALUE NULL +GLOBAL_VALUE unknown +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE unknown +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE ENUM +VARIABLE_COMMENT The lowest desirable plugin maturity. Plugins less mature than that will not be installed or loaded +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST unknown,experimental,alpha,beta,gamma,stable +READ_ONLY YES +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PORT SESSION_VALUE NULL GLOBAL_VALUE MASTER_MYPORT diff --git a/mysql-test/t/bootstrap.test b/mysql-test/t/bootstrap.test index 1ae9b13e050..e8589fa9242 100644 --- a/mysql-test/t/bootstrap.test +++ b/mysql-test/t/bootstrap.test @@ -7,7 +7,7 @@ drop table if exists t1; # Add the datadir to the bootstrap command let $MYSQLD_DATADIR= `select @@datadir`; -let $MYSQLD_BOOTSTRAP_CMD= $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR --default-storage-engine=MyISAM --loose-skip-innodb --plugin-maturity=unknown; +let $MYSQLD_BOOTSTRAP_CMD= $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR --default-storage-engine=MyISAM --loose-skip-innodb; # # Check that --bootstrap reads from stdin # diff --git a/mysql-test/t/mysqld--help.test b/mysql-test/t/mysqld--help.test index f859d7dd9d6..1613f8e7a4f 100644 --- a/mysql-test/t/mysqld--help.test +++ b/mysql-test/t/mysqld--help.test @@ -19,7 +19,7 @@ exec $MYSQLD_BOOTSTRAP_CMD --symbolic-links=0 --lower-case-table-names=1 --help perl; # Variables which we don't want to display in the result file since # their paths may vary: - @skipvars=qw/basedir open-files-limit general-log-file log plugin-dir plugin-maturity + @skipvars=qw/basedir open-files-limit general-log-file log plugin-dir log-slow-queries pid-file slow-query-log-file log-basename datadir slave-load-tmpdir tmpdir socket thread-pool-size large-files-support lower-case-file-system system-time-zone -- cgit v1.2.1 From b1cd5ca2af93fbbe6646e159359c0a84994e292f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 6 Dec 2017 10:35:09 +0200 Subject: Import innodb.virtual_stats from MySQL 5.7 --- mysql-test/suite/innodb/r/virtual_stats.result | 127 +++++++++++++++++++++++++ mysql-test/suite/innodb/t/virtual_stats.test | 52 ++++++++++ 2 files changed, 179 insertions(+) create mode 100644 mysql-test/suite/innodb/r/virtual_stats.result create mode 100644 mysql-test/suite/innodb/t/virtual_stats.test (limited to 'mysql-test') diff --git a/mysql-test/suite/innodb/r/virtual_stats.result b/mysql-test/suite/innodb/r/virtual_stats.result new file mode 100644 index 00000000000..b1ce8db9ae7 --- /dev/null +++ b/mysql-test/suite/innodb/r/virtual_stats.result @@ -0,0 +1,127 @@ +CREATE TABLE t ( +a INT, +b INT, +c INT GENERATED ALWAYS AS(a+b), +d INT GENERATED ALWAYS AS(a+b+b), +KEY idxa (a), +KEY vidxcd (c, d) +) ENGINE=INNODB; +INSERT INTO t (a,b) VALUES (1, 2); +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; +index_name stat_name stat_description +GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID +GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index +GEN_CLUST_INDEX size Number of pages in the index +idxa n_diff_pfx01 a +idxa n_diff_pfx02 a,DB_ROW_ID +idxa n_leaf_pages Number of leaf pages in the index +idxa size Number of pages in the index +vidxcd n_diff_pfx01 c +vidxcd n_diff_pfx02 c,d +vidxcd n_diff_pfx03 c,d,DB_ROW_ID +vidxcd n_leaf_pages Number of leaf pages in the index +vidxcd size Number of pages in the index +ALTER TABLE t ADD COLUMN e INT GENERATED ALWAYS AS(a+a+b), ADD INDEX idxb (b), ALGORITHM=INPLACE; +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; +index_name stat_name stat_description +GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID +GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index +GEN_CLUST_INDEX size Number of pages in the index +idxa n_diff_pfx01 a +idxa n_diff_pfx02 a,DB_ROW_ID +idxa n_leaf_pages Number of leaf pages in the index +idxa size Number of pages in the index +idxb n_diff_pfx01 b +idxb n_diff_pfx02 b,DB_ROW_ID +idxb n_leaf_pages Number of leaf pages in the index +idxb size Number of pages in the index +vidxcd n_diff_pfx01 c +vidxcd n_diff_pfx02 c,d +vidxcd n_diff_pfx03 c,d,DB_ROW_ID +vidxcd n_leaf_pages Number of leaf pages in the index +vidxcd size Number of pages in the index +ALTER TABLE t DROP COLUMN c, DROP INDEX idxa, ALGORITHM=INPLACE; +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; +index_name stat_name stat_description +GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID +GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index +GEN_CLUST_INDEX size Number of pages in the index +idxb n_diff_pfx01 b +idxb n_diff_pfx02 b,DB_ROW_ID +idxb n_leaf_pages Number of leaf pages in the index +idxb size Number of pages in the index +vidxcd n_diff_pfx01 d +vidxcd n_diff_pfx02 d,DB_ROW_ID +vidxcd n_leaf_pages Number of leaf pages in the index +vidxcd size Number of pages in the index +ALTER TABLE t ADD INDEX vidxe (e), ALGORITHM=INPLACE; +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; +index_name stat_name stat_description +GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID +GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index +GEN_CLUST_INDEX size Number of pages in the index +idxb n_diff_pfx01 b +idxb n_diff_pfx02 b,DB_ROW_ID +idxb n_leaf_pages Number of leaf pages in the index +idxb size Number of pages in the index +vidxcd n_diff_pfx01 d +vidxcd n_diff_pfx02 d,DB_ROW_ID +vidxcd n_leaf_pages Number of leaf pages in the index +vidxcd size Number of pages in the index +vidxe n_diff_pfx01 e +vidxe n_diff_pfx02 e,DB_ROW_ID +vidxe n_leaf_pages Number of leaf pages in the index +vidxe size Number of pages in the index +ALTER TABLE t ADD COLUMN f INT GENERATED ALWAYS AS(a + a), ADD INDEX vidxf (f), ALGORITHM=INPLACE; +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; +index_name stat_name stat_description +GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID +GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index +GEN_CLUST_INDEX size Number of pages in the index +idxb n_diff_pfx01 b +idxb n_diff_pfx02 b,DB_ROW_ID +idxb n_leaf_pages Number of leaf pages in the index +idxb size Number of pages in the index +vidxcd n_diff_pfx01 d +vidxcd n_diff_pfx02 d,DB_ROW_ID +vidxcd n_leaf_pages Number of leaf pages in the index +vidxcd size Number of pages in the index +vidxe n_diff_pfx01 e +vidxe n_diff_pfx02 e,DB_ROW_ID +vidxe n_leaf_pages Number of leaf pages in the index +vidxe size Number of pages in the index +vidxf n_diff_pfx01 f +vidxf n_diff_pfx02 f,DB_ROW_ID +vidxf n_leaf_pages Number of leaf pages in the index +vidxf size Number of pages in the index +ALTER TABLE t DROP INDEX vidxcd; +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; +index_name stat_name stat_description +GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID +GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index +GEN_CLUST_INDEX size Number of pages in the index +idxb n_diff_pfx01 b +idxb n_diff_pfx02 b,DB_ROW_ID +idxb n_leaf_pages Number of leaf pages in the index +idxb size Number of pages in the index +vidxe n_diff_pfx01 e +vidxe n_diff_pfx02 e,DB_ROW_ID +vidxe n_leaf_pages Number of leaf pages in the index +vidxe size Number of pages in the index +vidxf n_diff_pfx01 f +vidxf n_diff_pfx02 f,DB_ROW_ID +vidxf n_leaf_pages Number of leaf pages in the index +vidxf size Number of pages in the index +DROP TABLE t; diff --git a/mysql-test/suite/innodb/t/virtual_stats.test b/mysql-test/suite/innodb/t/virtual_stats.test new file mode 100644 index 00000000000..e96bc30d736 --- /dev/null +++ b/mysql-test/suite/innodb/t/virtual_stats.test @@ -0,0 +1,52 @@ +--source include/have_innodb.inc + +# +# BUG#22469660 INNODB DOESN'T UPDATE INDEX STATS WHEN ADDING OR DROPPING VIRTUAL COLUMN +# + +CREATE TABLE t ( + a INT, + b INT, + c INT GENERATED ALWAYS AS(a+b), + d INT GENERATED ALWAYS AS(a+b+b), + KEY idxa (a), + KEY vidxcd (c, d) +) ENGINE=INNODB; + +INSERT INTO t (a,b) VALUES (1, 2); + +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; + +ALTER TABLE t ADD COLUMN e INT GENERATED ALWAYS AS(a+a+b), ADD INDEX idxb (b), ALGORITHM=INPLACE; + +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; + +ALTER TABLE t DROP COLUMN c, DROP INDEX idxa, ALGORITHM=INPLACE; + +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; + +ALTER TABLE t ADD INDEX vidxe (e), ALGORITHM=INPLACE; + +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; + +ALTER TABLE t ADD COLUMN f INT GENERATED ALWAYS AS(a + a), ADD INDEX vidxf (f), ALGORITHM=INPLACE; + +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; + +ALTER TABLE t DROP INDEX vidxcd; + +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; + +DROP TABLE t; -- cgit v1.2.1 From afe6aef5fff54a861d6a5135803880c36b39053b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 6 Dec 2017 10:37:08 +0200 Subject: Adjust the test innodb.virtual_stats and rename to gcol.innodb_virtual_stats --- .../suite/gcol/r/innodb_virtual_stats.result | 127 +++++++++++++++++++++ mysql-test/suite/gcol/t/innodb_virtual_stats.test | 52 +++++++++ mysql-test/suite/innodb/r/virtual_stats.result | 127 --------------------- mysql-test/suite/innodb/t/virtual_stats.test | 52 --------- 4 files changed, 179 insertions(+), 179 deletions(-) create mode 100644 mysql-test/suite/gcol/r/innodb_virtual_stats.result create mode 100644 mysql-test/suite/gcol/t/innodb_virtual_stats.test delete mode 100644 mysql-test/suite/innodb/r/virtual_stats.result delete mode 100644 mysql-test/suite/innodb/t/virtual_stats.test (limited to 'mysql-test') diff --git a/mysql-test/suite/gcol/r/innodb_virtual_stats.result b/mysql-test/suite/gcol/r/innodb_virtual_stats.result new file mode 100644 index 00000000000..4ef499f932f --- /dev/null +++ b/mysql-test/suite/gcol/r/innodb_virtual_stats.result @@ -0,0 +1,127 @@ +CREATE TABLE t ( +a INT, +b INT, +c INT GENERATED ALWAYS AS(a+b), +d INT GENERATED ALWAYS AS(a+b+b), +KEY idxa (a), +KEY vidxcd (c, d) +) ENGINE=INNODB STATS_PERSISTENT=1 STATS_AUTO_RECALC=1; +INSERT INTO t (a,b) VALUES (1, 2); +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; +index_name stat_name stat_description +GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID +GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index +GEN_CLUST_INDEX size Number of pages in the index +idxa n_diff_pfx01 a +idxa n_diff_pfx02 a,DB_ROW_ID +idxa n_leaf_pages Number of leaf pages in the index +idxa size Number of pages in the index +vidxcd n_diff_pfx01 c +vidxcd n_diff_pfx02 c,d +vidxcd n_diff_pfx03 c,d,DB_ROW_ID +vidxcd n_leaf_pages Number of leaf pages in the index +vidxcd size Number of pages in the index +ALTER TABLE t ADD COLUMN e INT GENERATED ALWAYS AS(a+a+b), ADD INDEX idxb (b), ALGORITHM=INPLACE; +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; +index_name stat_name stat_description +GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID +GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index +GEN_CLUST_INDEX size Number of pages in the index +idxa n_diff_pfx01 a +idxa n_diff_pfx02 a,DB_ROW_ID +idxa n_leaf_pages Number of leaf pages in the index +idxa size Number of pages in the index +idxb n_diff_pfx01 b +idxb n_diff_pfx02 b,DB_ROW_ID +idxb n_leaf_pages Number of leaf pages in the index +idxb size Number of pages in the index +vidxcd n_diff_pfx01 c +vidxcd n_diff_pfx02 c,d +vidxcd n_diff_pfx03 c,d,DB_ROW_ID +vidxcd n_leaf_pages Number of leaf pages in the index +vidxcd size Number of pages in the index +ALTER TABLE t DROP COLUMN c, DROP INDEX idxa, ALGORITHM=INPLACE; +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; +index_name stat_name stat_description +GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID +GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index +GEN_CLUST_INDEX size Number of pages in the index +idxb n_diff_pfx01 b +idxb n_diff_pfx02 b,DB_ROW_ID +idxb n_leaf_pages Number of leaf pages in the index +idxb size Number of pages in the index +vidxcd n_diff_pfx01 d +vidxcd n_diff_pfx02 d,DB_ROW_ID +vidxcd n_leaf_pages Number of leaf pages in the index +vidxcd size Number of pages in the index +ALTER TABLE t ADD INDEX vidxe (e), ALGORITHM=INPLACE; +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; +index_name stat_name stat_description +GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID +GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index +GEN_CLUST_INDEX size Number of pages in the index +idxb n_diff_pfx01 b +idxb n_diff_pfx02 b,DB_ROW_ID +idxb n_leaf_pages Number of leaf pages in the index +idxb size Number of pages in the index +vidxcd n_diff_pfx01 d +vidxcd n_diff_pfx02 d,DB_ROW_ID +vidxcd n_leaf_pages Number of leaf pages in the index +vidxcd size Number of pages in the index +vidxe n_diff_pfx01 e +vidxe n_diff_pfx02 e,DB_ROW_ID +vidxe n_leaf_pages Number of leaf pages in the index +vidxe size Number of pages in the index +ALTER TABLE t ADD COLUMN f INT GENERATED ALWAYS AS(a + a), ADD INDEX vidxf (f), ALGORITHM=INPLACE; +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; +index_name stat_name stat_description +GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID +GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index +GEN_CLUST_INDEX size Number of pages in the index +idxb n_diff_pfx01 b +idxb n_diff_pfx02 b,DB_ROW_ID +idxb n_leaf_pages Number of leaf pages in the index +idxb size Number of pages in the index +vidxcd n_diff_pfx01 d +vidxcd n_diff_pfx02 d,DB_ROW_ID +vidxcd n_leaf_pages Number of leaf pages in the index +vidxcd size Number of pages in the index +vidxe n_diff_pfx01 e +vidxe n_diff_pfx02 e,DB_ROW_ID +vidxe n_leaf_pages Number of leaf pages in the index +vidxe size Number of pages in the index +vidxf n_diff_pfx01 f +vidxf n_diff_pfx02 f,DB_ROW_ID +vidxf n_leaf_pages Number of leaf pages in the index +vidxf size Number of pages in the index +ALTER TABLE t DROP INDEX vidxcd; +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; +index_name stat_name stat_description +GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID +GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index +GEN_CLUST_INDEX size Number of pages in the index +idxb n_diff_pfx01 b +idxb n_diff_pfx02 b,DB_ROW_ID +idxb n_leaf_pages Number of leaf pages in the index +idxb size Number of pages in the index +vidxe n_diff_pfx01 e +vidxe n_diff_pfx02 e,DB_ROW_ID +vidxe n_leaf_pages Number of leaf pages in the index +vidxe size Number of pages in the index +vidxf n_diff_pfx01 f +vidxf n_diff_pfx02 f,DB_ROW_ID +vidxf n_leaf_pages Number of leaf pages in the index +vidxf size Number of pages in the index +DROP TABLE t; diff --git a/mysql-test/suite/gcol/t/innodb_virtual_stats.test b/mysql-test/suite/gcol/t/innodb_virtual_stats.test new file mode 100644 index 00000000000..7e3c8f4e00e --- /dev/null +++ b/mysql-test/suite/gcol/t/innodb_virtual_stats.test @@ -0,0 +1,52 @@ +--source include/have_innodb.inc + +# +# BUG#22469660 INNODB DOESN'T UPDATE INDEX STATS WHEN ADDING OR DROPPING VIRTUAL COLUMN +# + +CREATE TABLE t ( + a INT, + b INT, + c INT GENERATED ALWAYS AS(a+b), + d INT GENERATED ALWAYS AS(a+b+b), + KEY idxa (a), + KEY vidxcd (c, d) +) ENGINE=INNODB STATS_PERSISTENT=1 STATS_AUTO_RECALC=1; + +INSERT INTO t (a,b) VALUES (1, 2); + +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; + +ALTER TABLE t ADD COLUMN e INT GENERATED ALWAYS AS(a+a+b), ADD INDEX idxb (b), ALGORITHM=INPLACE; + +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; + +ALTER TABLE t DROP COLUMN c, DROP INDEX idxa, ALGORITHM=INPLACE; + +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; + +ALTER TABLE t ADD INDEX vidxe (e), ALGORITHM=INPLACE; + +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; + +ALTER TABLE t ADD COLUMN f INT GENERATED ALWAYS AS(a + a), ADD INDEX vidxf (f), ALGORITHM=INPLACE; + +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; + +ALTER TABLE t DROP INDEX vidxcd; + +SELECT index_name, stat_name, stat_description +FROM mysql.innodb_index_stats +WHERE database_name = 'test' AND table_name = 't'; + +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/virtual_stats.result b/mysql-test/suite/innodb/r/virtual_stats.result deleted file mode 100644 index b1ce8db9ae7..00000000000 --- a/mysql-test/suite/innodb/r/virtual_stats.result +++ /dev/null @@ -1,127 +0,0 @@ -CREATE TABLE t ( -a INT, -b INT, -c INT GENERATED ALWAYS AS(a+b), -d INT GENERATED ALWAYS AS(a+b+b), -KEY idxa (a), -KEY vidxcd (c, d) -) ENGINE=INNODB; -INSERT INTO t (a,b) VALUES (1, 2); -SELECT index_name, stat_name, stat_description -FROM mysql.innodb_index_stats -WHERE database_name = 'test' AND table_name = 't'; -index_name stat_name stat_description -GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID -GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index -GEN_CLUST_INDEX size Number of pages in the index -idxa n_diff_pfx01 a -idxa n_diff_pfx02 a,DB_ROW_ID -idxa n_leaf_pages Number of leaf pages in the index -idxa size Number of pages in the index -vidxcd n_diff_pfx01 c -vidxcd n_diff_pfx02 c,d -vidxcd n_diff_pfx03 c,d,DB_ROW_ID -vidxcd n_leaf_pages Number of leaf pages in the index -vidxcd size Number of pages in the index -ALTER TABLE t ADD COLUMN e INT GENERATED ALWAYS AS(a+a+b), ADD INDEX idxb (b), ALGORITHM=INPLACE; -SELECT index_name, stat_name, stat_description -FROM mysql.innodb_index_stats -WHERE database_name = 'test' AND table_name = 't'; -index_name stat_name stat_description -GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID -GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index -GEN_CLUST_INDEX size Number of pages in the index -idxa n_diff_pfx01 a -idxa n_diff_pfx02 a,DB_ROW_ID -idxa n_leaf_pages Number of leaf pages in the index -idxa size Number of pages in the index -idxb n_diff_pfx01 b -idxb n_diff_pfx02 b,DB_ROW_ID -idxb n_leaf_pages Number of leaf pages in the index -idxb size Number of pages in the index -vidxcd n_diff_pfx01 c -vidxcd n_diff_pfx02 c,d -vidxcd n_diff_pfx03 c,d,DB_ROW_ID -vidxcd n_leaf_pages Number of leaf pages in the index -vidxcd size Number of pages in the index -ALTER TABLE t DROP COLUMN c, DROP INDEX idxa, ALGORITHM=INPLACE; -SELECT index_name, stat_name, stat_description -FROM mysql.innodb_index_stats -WHERE database_name = 'test' AND table_name = 't'; -index_name stat_name stat_description -GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID -GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index -GEN_CLUST_INDEX size Number of pages in the index -idxb n_diff_pfx01 b -idxb n_diff_pfx02 b,DB_ROW_ID -idxb n_leaf_pages Number of leaf pages in the index -idxb size Number of pages in the index -vidxcd n_diff_pfx01 d -vidxcd n_diff_pfx02 d,DB_ROW_ID -vidxcd n_leaf_pages Number of leaf pages in the index -vidxcd size Number of pages in the index -ALTER TABLE t ADD INDEX vidxe (e), ALGORITHM=INPLACE; -SELECT index_name, stat_name, stat_description -FROM mysql.innodb_index_stats -WHERE database_name = 'test' AND table_name = 't'; -index_name stat_name stat_description -GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID -GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index -GEN_CLUST_INDEX size Number of pages in the index -idxb n_diff_pfx01 b -idxb n_diff_pfx02 b,DB_ROW_ID -idxb n_leaf_pages Number of leaf pages in the index -idxb size Number of pages in the index -vidxcd n_diff_pfx01 d -vidxcd n_diff_pfx02 d,DB_ROW_ID -vidxcd n_leaf_pages Number of leaf pages in the index -vidxcd size Number of pages in the index -vidxe n_diff_pfx01 e -vidxe n_diff_pfx02 e,DB_ROW_ID -vidxe n_leaf_pages Number of leaf pages in the index -vidxe size Number of pages in the index -ALTER TABLE t ADD COLUMN f INT GENERATED ALWAYS AS(a + a), ADD INDEX vidxf (f), ALGORITHM=INPLACE; -SELECT index_name, stat_name, stat_description -FROM mysql.innodb_index_stats -WHERE database_name = 'test' AND table_name = 't'; -index_name stat_name stat_description -GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID -GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index -GEN_CLUST_INDEX size Number of pages in the index -idxb n_diff_pfx01 b -idxb n_diff_pfx02 b,DB_ROW_ID -idxb n_leaf_pages Number of leaf pages in the index -idxb size Number of pages in the index -vidxcd n_diff_pfx01 d -vidxcd n_diff_pfx02 d,DB_ROW_ID -vidxcd n_leaf_pages Number of leaf pages in the index -vidxcd size Number of pages in the index -vidxe n_diff_pfx01 e -vidxe n_diff_pfx02 e,DB_ROW_ID -vidxe n_leaf_pages Number of leaf pages in the index -vidxe size Number of pages in the index -vidxf n_diff_pfx01 f -vidxf n_diff_pfx02 f,DB_ROW_ID -vidxf n_leaf_pages Number of leaf pages in the index -vidxf size Number of pages in the index -ALTER TABLE t DROP INDEX vidxcd; -SELECT index_name, stat_name, stat_description -FROM mysql.innodb_index_stats -WHERE database_name = 'test' AND table_name = 't'; -index_name stat_name stat_description -GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID -GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index -GEN_CLUST_INDEX size Number of pages in the index -idxb n_diff_pfx01 b -idxb n_diff_pfx02 b,DB_ROW_ID -idxb n_leaf_pages Number of leaf pages in the index -idxb size Number of pages in the index -vidxe n_diff_pfx01 e -vidxe n_diff_pfx02 e,DB_ROW_ID -vidxe n_leaf_pages Number of leaf pages in the index -vidxe size Number of pages in the index -vidxf n_diff_pfx01 f -vidxf n_diff_pfx02 f,DB_ROW_ID -vidxf n_leaf_pages Number of leaf pages in the index -vidxf size Number of pages in the index -DROP TABLE t; diff --git a/mysql-test/suite/innodb/t/virtual_stats.test b/mysql-test/suite/innodb/t/virtual_stats.test deleted file mode 100644 index e96bc30d736..00000000000 --- a/mysql-test/suite/innodb/t/virtual_stats.test +++ /dev/null @@ -1,52 +0,0 @@ ---source include/have_innodb.inc - -# -# BUG#22469660 INNODB DOESN'T UPDATE INDEX STATS WHEN ADDING OR DROPPING VIRTUAL COLUMN -# - -CREATE TABLE t ( - a INT, - b INT, - c INT GENERATED ALWAYS AS(a+b), - d INT GENERATED ALWAYS AS(a+b+b), - KEY idxa (a), - KEY vidxcd (c, d) -) ENGINE=INNODB; - -INSERT INTO t (a,b) VALUES (1, 2); - -SELECT index_name, stat_name, stat_description -FROM mysql.innodb_index_stats -WHERE database_name = 'test' AND table_name = 't'; - -ALTER TABLE t ADD COLUMN e INT GENERATED ALWAYS AS(a+a+b), ADD INDEX idxb (b), ALGORITHM=INPLACE; - -SELECT index_name, stat_name, stat_description -FROM mysql.innodb_index_stats -WHERE database_name = 'test' AND table_name = 't'; - -ALTER TABLE t DROP COLUMN c, DROP INDEX idxa, ALGORITHM=INPLACE; - -SELECT index_name, stat_name, stat_description -FROM mysql.innodb_index_stats -WHERE database_name = 'test' AND table_name = 't'; - -ALTER TABLE t ADD INDEX vidxe (e), ALGORITHM=INPLACE; - -SELECT index_name, stat_name, stat_description -FROM mysql.innodb_index_stats -WHERE database_name = 'test' AND table_name = 't'; - -ALTER TABLE t ADD COLUMN f INT GENERATED ALWAYS AS(a + a), ADD INDEX vidxf (f), ALGORITHM=INPLACE; - -SELECT index_name, stat_name, stat_description -FROM mysql.innodb_index_stats -WHERE database_name = 'test' AND table_name = 't'; - -ALTER TABLE t DROP INDEX vidxcd; - -SELECT index_name, stat_name, stat_description -FROM mysql.innodb_index_stats -WHERE database_name = 'test' AND table_name = 't'; - -DROP TABLE t; -- cgit v1.2.1 From 7dc6066dead562e70a68e6727fe4ee65d0bd0c72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 1 Dec 2017 16:51:24 +0200 Subject: MDEV-14511 Use fewer transactions for updating InnoDB persistent statistics dict_stats_exec_sql(): Expect the caller to always provide a transaction. Remove some redundant assertions. The caller must hold dict_sys->mutex, but holding dict_operation_lock is only necessary for accessing data dictionary tables, which we are not accessing. dict_stats_save_index_stat(): Acquire dict_sys->mutex for invoking dict_stats_exec_sql(). dict_stats_save(), dict_stats_update_for_index(), dict_stats_update(), dict_stats_drop_index(), dict_stats_delete_from_table_stats(), dict_stats_delete_from_index_stats(), dict_stats_drop_table(), dict_stats_rename_in_table_stats(), dict_stats_rename_in_index_stats(), dict_stats_rename_table(): Use a single caller-provided transaction that is started and committed or rolled back by the caller. dict_stats_process_entry_from_recalc_pool(): Let the caller provide a transaction object. ha_innobase::open(): Pass a transaction to dict_stats_init(). ha_innobase::create(), ha_innobase::discard_or_import_tablespace(): Pass a transaction to dict_stats_update(). ha_innobase::rename_table(): Pass a transaction to dict_stats_rename_table(). We do not use the same transaction as the one that updated the data dictionary tables, because we already released the dict_operation_lock. (FIXME: there is a race condition; a lock wait on SYS_* tables could occur in another DDL transaction until the data dictionary transaction is committed.) ha_innobase::info_low(): Pass a transaction to dict_stats_update() when calculating persistent statistics. alter_stats_norebuild(), alter_stats_rebuild(): Update the persistent statistics as well. In this way, a single transaction will be used for updating the statistics of a whole table, even for partitioned tables. ha_innobase::commit_inplace_alter_table(): Drop statistics for all partitions when adding or dropping virtual columns, so that the statistics will be recalculated on the next handler::open(). This is a refactored version of Oracle Bug#22469660 fix. RecLock::add_to_waitq(), lock_table_enqueue_waiting(): Do not allow a lock wait to occur for updating statistics in a data dictionary transaction, such as DROP TABLE. Instead, return the previously unused error code DB_QUE_THR_SUSPENDED. row_merge_lock_table(), row_mysql_lock_table(): Remove dead code for handling DB_QUE_THR_SUSPENDED. row_drop_table_for_mysql(), row_truncate_table_for_mysql(): Drop the statistics as part of the data dictionary transaction. After TRUNCATE TABLE, the statistics will be recalculated on subsequent ha_innobase::open(), similar to how the logic after the above-mentioned Oracle Bug#22469660 fix in ha_innobase::commit_inplace_alter_table() works. btr_defragment_thread(): Use a single transaction object for updating defragmentation statistics. dict_stats_save_defrag_stats(), dict_stats_save_defrag_stats(), dict_stats_process_entry_from_defrag_pool(), dict_defrag_process_entries_from_defrag_pool(), dict_stats_save_defrag_summary(), dict_stats_save_defrag_stats(): Add a parameter for the transaction. dict_stats_empty_table(): Make public. This will be called by row_truncate_table_for_mysql() after dropping persistent statistics, to clear the memory-based statistics as well. --- mysql-test/suite/innodb/r/innodb_stats_debug.result | 12 ++++++++++++ mysql-test/suite/innodb/t/innodb_stats_debug.test | 13 +++++++++++++ mysql-test/suite/innodb/t/innodb_stats_drop_locked.test | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/innodb/r/innodb_stats_debug.result create mode 100644 mysql-test/suite/innodb/t/innodb_stats_debug.test (limited to 'mysql-test') diff --git a/mysql-test/suite/innodb/r/innodb_stats_debug.result b/mysql-test/suite/innodb/r/innodb_stats_debug.result new file mode 100644 index 00000000000..8f599acc08c --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_stats_debug.result @@ -0,0 +1,12 @@ +call mtr.add_suppression("InnoDB: Cannot save (table|index) statistics for table `test`\\.`t1`.*: Persistent statistics do not exist"); +CREATE TABLE t1 (a INT, KEY(a)) ENGINE=INNODB STATS_PERSISTENT=1; +SET @save_debug= @@SESSION.debug_dbug; +SET debug_dbug= '+d,stats_index_error'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Operation failed +SET debug_dbug= @save_debug; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb_stats_debug.test b/mysql-test/suite/innodb/t/innodb_stats_debug.test new file mode 100644 index 00000000000..cd41c0b8fb0 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_stats_debug.test @@ -0,0 +1,13 @@ +--source include/have_innodb.inc +--source include/have_debug.inc + +call mtr.add_suppression("InnoDB: Cannot save (table|index) statistics for table `test`\\.`t1`.*: Persistent statistics do not exist"); + +CREATE TABLE t1 (a INT, KEY(a)) ENGINE=INNODB STATS_PERSISTENT=1; +SET @save_debug= @@SESSION.debug_dbug; +SET debug_dbug= '+d,stats_index_error'; +ANALYZE TABLE t1; +SET debug_dbug= @save_debug; +ANALYZE TABLE t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb_stats_drop_locked.test b/mysql-test/suite/innodb/t/innodb_stats_drop_locked.test index 26367b8e6ae..47f363a4bb6 100644 --- a/mysql-test/suite/innodb/t/innodb_stats_drop_locked.test +++ b/mysql-test/suite/innodb/t/innodb_stats_drop_locked.test @@ -57,5 +57,5 @@ SELECT table_name FROM mysql.innodb_index_stats WHERE table_name='innodb_stats_drop_locked'; --disable_query_log -call mtr.add_suppression("Unable to delete statistics for table test.innodb_stats_drop_locked: Lock wait timeout. They can be deleted later using DELETE FROM mysql.innodb_index_stats WHERE database_name"); +call mtr.add_suppression("Unable to delete statistics for table test\\.innodb_stats_drop_locked: Lock wait"); --enable_query_log -- cgit v1.2.1 From 77fb7ccba41e9a901053ffc4fdc461968f6f616f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 4 Dec 2017 16:26:14 +0200 Subject: Follow-up fix to MDEV-13201 Assertion `srv_undo_sources || ...` failed on shutdown during DDL operation Introduce the debug flag trx_t::persistent_stats to suppress the assertion for the updates of persistent statistics during fast shutdown. dict_stats_exec_sql(): Do execute the statement even though shutdown has been initiated. --- mysql-test/suite/innodb/r/truncate_restart.result | 3 +-- mysql-test/suite/innodb/t/truncate_restart.test | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/innodb/r/truncate_restart.result b/mysql-test/suite/innodb/r/truncate_restart.result index 169a56a004e..b6d14124371 100644 --- a/mysql-test/suite/innodb/r/truncate_restart.result +++ b/mysql-test/suite/innodb/r/truncate_restart.result @@ -1,6 +1,5 @@ -call mtr.add_suppression("InnoDB: Cannot save table statistics for table `test`\\.`t1`: Persistent statistics do not exist"); SET GLOBAL innodb_stats_persistent= ON; -CREATE TABLE t1 (t TEXT) ENGINE=InnoDB; +CREATE TABLE t1 (t TEXT) ENGINE=InnoDB STATS_PERSISTENT=1; connect con1,localhost,root,,test; SET DEBUG_SYNC='ib_trunc_table_trunc_completing SIGNAL committed WAIT_FOR ever'; TRUNCATE TABLE t1; diff --git a/mysql-test/suite/innodb/t/truncate_restart.test b/mysql-test/suite/innodb/t/truncate_restart.test index 92f09ac89b1..60a3d83cd81 100644 --- a/mysql-test/suite/innodb/t/truncate_restart.test +++ b/mysql-test/suite/innodb/t/truncate_restart.test @@ -2,10 +2,8 @@ --source include/have_debug.inc --source include/have_debug_sync.inc -call mtr.add_suppression("InnoDB: Cannot save table statistics for table `test`\\.`t1`: Persistent statistics do not exist"); - SET GLOBAL innodb_stats_persistent= ON; -CREATE TABLE t1 (t TEXT) ENGINE=InnoDB; +CREATE TABLE t1 (t TEXT) ENGINE=InnoDB STATS_PERSISTENT=1; --connect (con1,localhost,root,,test) SET DEBUG_SYNC='ib_trunc_table_trunc_completing SIGNAL committed WAIT_FOR ever'; --send -- cgit v1.2.1 From 3aa618a969546234898e6c5110faf2d72d4c10f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 7 Dec 2017 14:35:32 +0200 Subject: MDEV-13820 trx_id_check() fails during row_log_table_apply() When logging ROW_T_INSERT or ROW_T_UPDATE records, we did not normalize the DB_TRX_ID of the current transaction into 0 if the current transaction had started (modifying other tables) before the ALTER TABLE started. MDEV-13654 introduced this normalization for ROW_T_DELETE and for all operations with ADD PRIMARY KEY, in row_log_table_get_pk(). --- mysql-test/suite/innodb/r/ddl_purge.result | 25 +++++++++++++++ mysql-test/suite/innodb/t/ddl_purge.test | 36 ++++++++++++++++++++++ .../t/innodb_default_row_format.combinations | 4 +++ .../suite/innodb/t/innodb_default_row_format.inc | 2 ++ 4 files changed, 67 insertions(+) create mode 100644 mysql-test/suite/innodb/r/ddl_purge.result create mode 100644 mysql-test/suite/innodb/t/ddl_purge.test create mode 100644 mysql-test/suite/innodb/t/innodb_default_row_format.combinations create mode 100644 mysql-test/suite/innodb/t/innodb_default_row_format.inc (limited to 'mysql-test') diff --git a/mysql-test/suite/innodb/r/ddl_purge.result b/mysql-test/suite/innodb/r/ddl_purge.result new file mode 100644 index 00000000000..45f4c99e97b --- /dev/null +++ b/mysql-test/suite/innodb/r/ddl_purge.result @@ -0,0 +1,25 @@ +CREATE TABLE t0 (pk INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t1 (pk INT PRIMARY KEY, b INT) ENGINE=InnoDB; +connect con1,localhost,root,,test; +BEGIN; +INSERT INTO t0 SET pk=1; +connect con2,localhost,root,,test; +BEGIN; +INSERT INTO t0 SET pk=2; +connection default; +SET DEBUG_SYNC='alter_table_inplace_after_lock_downgrade SIGNAL prepared WAIT_FOR logged'; +ALTER TABLE t1 FORCE; +connection con1; +SET DEBUG_SYNC='now WAIT_FOR prepared'; +INSERT INTO t1 SET pk=1; +COMMIT; +disconnect con1; +connection con2; +UPDATE t1 SET b=1; +DELETE FROM t1; +ROLLBACK; +SET DEBUG_SYNC='now SIGNAL logged'; +disconnect con2; +connection default; +SET DEBUG_SYNC='RESET'; +DROP TABLE t0,t1; diff --git a/mysql-test/suite/innodb/t/ddl_purge.test b/mysql-test/suite/innodb/t/ddl_purge.test new file mode 100644 index 00000000000..60d17acead8 --- /dev/null +++ b/mysql-test/suite/innodb/t/ddl_purge.test @@ -0,0 +1,36 @@ +--source innodb_default_row_format.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +CREATE TABLE t0 (pk INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t1 (pk INT PRIMARY KEY, b INT) ENGINE=InnoDB; + +--connect (con1,localhost,root,,test) +BEGIN; +INSERT INTO t0 SET pk=1; + +--connect (con2,localhost,root,,test) +BEGIN; +INSERT INTO t0 SET pk=2; + +--connection default +SET DEBUG_SYNC='alter_table_inplace_after_lock_downgrade SIGNAL prepared WAIT_FOR logged'; +send ALTER TABLE t1 FORCE; + +--connection con1 +SET DEBUG_SYNC='now WAIT_FOR prepared'; +INSERT INTO t1 SET pk=1; +COMMIT; +--disconnect con1 + +--connection con2 +UPDATE t1 SET b=1; +DELETE FROM t1; +ROLLBACK; +SET DEBUG_SYNC='now SIGNAL logged'; +--disconnect con2 + +--connection default +reap; +SET DEBUG_SYNC='RESET'; +DROP TABLE t0,t1; diff --git a/mysql-test/suite/innodb/t/innodb_default_row_format.combinations b/mysql-test/suite/innodb/t/innodb_default_row_format.combinations new file mode 100644 index 00000000000..f3bc2cc0c25 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_default_row_format.combinations @@ -0,0 +1,4 @@ +[redundant] +innodb_default_row_format=redundant +[dynamic] +innodb_default_row_format=dynamic diff --git a/mysql-test/suite/innodb/t/innodb_default_row_format.inc b/mysql-test/suite/innodb/t/innodb_default_row_format.inc new file mode 100644 index 00000000000..15c61dc6342 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_default_row_format.inc @@ -0,0 +1,2 @@ +# See also innodb_default_row_format.combinations +--source include/have_innodb.inc -- cgit v1.2.1 From 6d63a03490298a8b7246e7f4516eb383534f8e8c Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Fri, 8 Dec 2017 12:21:26 +0530 Subject: MDEV-11297: Add support for LIMIT clause in GROUP_CONCAT() --- mysql-test/r/func_gconcat.result | 126 +++++++++++++++++++++++++++++++++++++++ mysql-test/t/func_gconcat.test | 73 +++++++++++++++++++++++ 2 files changed, 199 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result index 097e07ac715..723a1952d79 100644 --- a/mysql-test/r/func_gconcat.result +++ b/mysql-test/r/func_gconcat.result @@ -1254,3 +1254,129 @@ DROP TABLE t1; # # End of 10.2 tests # +# +# Start of 10.3 tests +# +drop table if exists t1, t2; +create table t1 (grp int, a bigint unsigned, c char(10) , d char(10) not null); +insert into t1 values (1,1,NULL,"a"); +insert into t1 values (1,10,"b","a"); +insert into t1 values (1,11,"c","a"); +insert into t1 values (2,2,"c","a"); +insert into t1 values (2,3,"b","b"); +insert into t1 values (3,4,"E","a"); +insert into t1 values (3,5,"C","b"); +insert into t1 values (3,6,"D","c"); +insert into t1 values (3,7,"E","c"); +select grp,group_concat(c) from t1 group by grp; +grp group_concat(c) +1 b,c +2 c,b +3 E,C,D,E +select grp,group_concat(c limit 1 ) from t1 group by grp; +grp group_concat(c limit 1 ) +1 b +2 c +3 E +select grp,group_concat(c limit 1,1 ) from t1 group by grp; +grp group_concat(c limit 1,1 ) +1 c +2 b +3 C +select grp,group_concat(c limit 1,10 ) from t1 group by grp; +grp group_concat(c limit 1,10 ) +1 c +2 b +3 C,D,E +select grp,group_concat(c limit 1000) from t1 group by grp; +grp group_concat(c limit 1000) +1 b,c +2 c,b +3 E,C,D,E +select group_concat(grp limit 0) from t1; +group_concat(grp limit 0) + +select group_concat(grp limit "sdjadjs") from t1 +--error ER_PARSE_ERROR +select grp,group_concat(c limit 5.5) from t1 group by grp ; +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 '"sdjadjs") from t1 +--error ER_PARSE_ERROR +select grp,group_concat(c limit 5.5) f' at line 1 +select grp,group_concat(distinct c limit 1,10 ) from t1 group by grp; +grp group_concat(distinct c limit 1,10 ) +1 c +2 b +3 C,D +select grp,group_concat(c order by a) from t1 group by grp; +grp group_concat(c order by a) +1 b,c +2 c,b +3 E,C,D,E +select grp,group_concat(c order by a limit 2 ) from t1 group by grp; +grp group_concat(c order by a limit 2 ) +1 b,c +2 c,b +3 E,C +select grp,group_concat(c order by a limit 1,1 ) from t1 group by grp; +grp group_concat(c order by a limit 1,1 ) +1 c +2 b +3 C +select grp,group_concat(c order by c) from t1 group by grp; +grp group_concat(c order by c) +1 b,c +2 b,c +3 C,D,E,E +select grp,group_concat(c order by c limit 2) from t1 group by grp; +grp group_concat(c order by c limit 2) +1 b,c +2 b,c +3 C,D +select grp,group_concat(c order by c desc) from t1 group by grp; +grp group_concat(c order by c desc) +1 c,b +2 c,b +3 E,E,D,C +select grp,group_concat(c order by c desc limit 2) from t1 group by grp; +grp group_concat(c order by c desc limit 2) +1 c,b +2 c,b +3 E,E +drop table t1; +create table t2 (a int, b varchar(10)); +insert into t2 values(1,'a'),(1,'b'),(NULL,'c'),(2,'x'),(2,'y'); +select group_concat(a,b limit 2) from t2; +group_concat(a,b limit 2) +1a,1b +set @x=4; +prepare STMT from 'select group_concat(b limit ?) from t2'; +execute STMT using @x; +group_concat(b limit ?) +a,b,c,x +set @x=2; +execute STMT using @x; +group_concat(b limit ?) +a,b +set @x=1000; +execute STMT using @x; +group_concat(b limit ?) +a,b,c,x,y +set @x=0; +execute STMT using @x; +group_concat(b limit ?) + +set @x="adasfa"; +execute STMT using @x; +ERROR HY000: Limit only accepts integer values +set @x=-1; +execute STMT using @x; +ERROR HY000: Incorrect arguments to EXECUTE +set @x=4; +prepare STMT from 'select group_concat(a,b limit ?) from t2'; +execute STMT using @x; +group_concat(a,b limit ?) +1a,1b,2x,2y +drop table t2; +# +# End of 10.3 tests +# diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index 1038fc0f6d0..5cbc6969e02 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -915,3 +915,76 @@ DROP TABLE t1; --echo # --echo # End of 10.2 tests --echo # + + +--echo # +--echo # Start of 10.3 tests +--echo # + +# +# MDEV-11297: Add support for LIMIT clause in GROUP_CONCAT() +# +--disable_warnings +drop table if exists t1, t2; +--enable_warnings + +create table t1 (grp int, a bigint unsigned, c char(10) , d char(10) not null); +insert into t1 values (1,1,NULL,"a"); +insert into t1 values (1,10,"b","a"); +insert into t1 values (1,11,"c","a"); +insert into t1 values (2,2,"c","a"); +insert into t1 values (2,3,"b","b"); +insert into t1 values (3,4,"E","a"); +insert into t1 values (3,5,"C","b"); +insert into t1 values (3,6,"D","c"); +insert into t1 values (3,7,"E","c"); + + +select grp,group_concat(c) from t1 group by grp; +select grp,group_concat(c limit 1 ) from t1 group by grp; +select grp,group_concat(c limit 1,1 ) from t1 group by grp; +select grp,group_concat(c limit 1,10 ) from t1 group by grp; +select grp,group_concat(c limit 1000) from t1 group by grp; +select group_concat(grp limit 0) from t1; +--error ER_PARSE_ERROR +select group_concat(grp limit "sdjadjs") from t1 +--error ER_PARSE_ERROR +select grp,group_concat(c limit 5.5) from t1 group by grp ; +select grp,group_concat(distinct c limit 1,10 ) from t1 group by grp; +select grp,group_concat(c order by a) from t1 group by grp; +select grp,group_concat(c order by a limit 2 ) from t1 group by grp; +select grp,group_concat(c order by a limit 1,1 ) from t1 group by grp; +select grp,group_concat(c order by c) from t1 group by grp; +select grp,group_concat(c order by c limit 2) from t1 group by grp; +select grp,group_concat(c order by c desc) from t1 group by grp; +select grp,group_concat(c order by c desc limit 2) from t1 group by grp; + +drop table t1; + +create table t2 (a int, b varchar(10)); +insert into t2 values(1,'a'),(1,'b'),(NULL,'c'),(2,'x'),(2,'y'); +select group_concat(a,b limit 2) from t2; + +set @x=4; +prepare STMT from 'select group_concat(b limit ?) from t2'; +execute STMT using @x; +set @x=2; +execute STMT using @x; +set @x=1000; +execute STMT using @x; +set @x=0; +execute STMT using @x; +set @x="adasfa"; +--error ER_INVALID_VALUE_TO_LIMIT +execute STMT using @x; +set @x=-1; +--error ER_WRONG_ARGUMENTS +execute STMT using @x; +set @x=4; +prepare STMT from 'select group_concat(a,b limit ?) from t2'; +execute STMT using @x; +drop table t2; + +--echo # +--echo # End of 10.3 tests +--echo # -- cgit v1.2.1 From c4581735d0210beba0733b30df8dd994786663fe Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 8 Dec 2017 11:36:18 +0200 Subject: Cleanups - Remove not used thd_rpl_is_parallel() - Remove not used mysql_notify_thread_having_shared_lock() - Remove not needed LOCK_thread_count from MYSQL_BIN_LOG::reset_logs() - LOCK_thread_count is not protecting against rollback, so this code and comment is not needed - Remove mutex_locks in slave.cc that are not needed. Added THD::assert_not_linked() to ensure that it was safe to remove - Fixed not repeatable test load_data_stmt_view - Updated binlog_killed to test removal of mutex (thanks to Andrei Elkin for test) - More code comments --- mysql-test/suite/binlog/r/binlog_killed.result | 91 ++++++++++++++++++++++ .../suite/binlog/r/load_data_stm_view.result | 1 + mysql-test/suite/binlog/t/binlog_killed.test | 81 +++++++++++++++++++ mysql-test/suite/binlog/t/load_data_stm_view.test | 4 + 4 files changed, 177 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/suite/binlog/r/binlog_killed.result b/mysql-test/suite/binlog/r/binlog_killed.result index cda4e8ad6f4..d751b1f9002 100644 --- a/mysql-test/suite/binlog/r/binlog_killed.result +++ b/mysql-test/suite/binlog/r/binlog_killed.result @@ -179,6 +179,97 @@ RELEASE_LOCK("a") 1 drop table t4; drop function bug27563; +FLUSH LOGS; +connect con3, localhost, root,,; +connection con3; +MI: MyISAM, INNODB +BEGIN; +INSERT INTO t2 VALUES (NULL, 1); +INSERT INTO t1 VALUES (NULL, 1); +connection con1; +KILL ID; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +master-bin.000002 # Gtid_list # # [#-#-#] +master-bin.000002 # Binlog_checkpoint # # master-bin.000001 +master-bin.000002 # Binlog_checkpoint # # master-bin.000002 +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Intvar # # INSERT_ID=3 +master-bin.000002 # Query # # use `test`; INSERT INTO t2 VALUES (NULL, 1) +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Intvar # # INSERT_ID=4 +master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (NULL, 1) +master-bin.000002 # Query # # ROLLBACK +disconnect con3; +connect con3, localhost, root,,; +connection con3; +IM: INNODB, MyISAM +BEGIN; +INSERT INTO t1 VALUES (NULL, 1); +INSERT INTO t2 VALUES (NULL, 1); +connection con1; +KILL ID; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Intvar # # INSERT_ID=4 +master-bin.000002 # Query # # use `test`; INSERT INTO t2 VALUES (NULL, 1) +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Intvar # # INSERT_ID=5 +master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (NULL, 1) +master-bin.000002 # Query # # ROLLBACK +disconnect con3; +connect con3, localhost, root,,; +connection con3; +IMI: INNODB, MyISAM, INNODB +BEGIN; +INSERT INTO t1 VALUES (NULL, 1); +INSERT INTO t2 VALUES (NULL, 1); +INSERT INTO t1 VALUES (NULL, 1); +connection con1; +KILL ID; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Intvar # # INSERT_ID=5 +master-bin.000002 # Query # # use `test`; INSERT INTO t2 VALUES (NULL, 1) +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Intvar # # INSERT_ID=6 +master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (NULL, 1) +master-bin.000002 # Intvar # # INSERT_ID=7 +master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (NULL, 1) +master-bin.000002 # Query # # ROLLBACK +disconnect con3; +connect con3, localhost, root,,; +connection con3; +MI2: MyISAM, INNODB, MyISAM, INNODB +BEGIN; +INSERT INTO t2 VALUES (NULL, 1); +INSERT INTO t1 VALUES (NULL, 1); +INSERT INTO t2 VALUES (NULL, 1); +INSERT INTO t1 VALUES (NULL, 1); +connection con1; +KILL ID; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Intvar # # INSERT_ID=6 +master-bin.000002 # Query # # use `test`; INSERT INTO t2 VALUES (NULL, 1) +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Intvar # # INSERT_ID=7 +master-bin.000002 # Query # # use `test`; INSERT INTO t2 VALUES (NULL, 1) +master-bin.000002 # Query # # COMMIT +master-bin.000002 # Gtid # # BEGIN GTID #-#-# +master-bin.000002 # Intvar # # INSERT_ID=8 +master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (NULL, 1) +master-bin.000002 # Intvar # # INSERT_ID=9 +master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (NULL, 1) +master-bin.000002 # Query # # ROLLBACK connection default; disconnect con1; disconnect con2; diff --git a/mysql-test/suite/binlog/r/load_data_stm_view.result b/mysql-test/suite/binlog/r/load_data_stm_view.result index ddbdb71983f..c21ffb7dcc6 100644 --- a/mysql-test/suite/binlog/r/load_data_stm_view.result +++ b/mysql-test/suite/binlog/r/load_data_stm_view.result @@ -1,3 +1,4 @@ +reset master; create table t1 (i int, j int); create view v1 as select i from t1; LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/3940.data' INTO TABLE v1 (i); diff --git a/mysql-test/suite/binlog/t/binlog_killed.test b/mysql-test/suite/binlog/t/binlog_killed.test index 73759ee5aa5..8ac223603a3 100644 --- a/mysql-test/suite/binlog/t/binlog_killed.test +++ b/mysql-test/suite/binlog/t/binlog_killed.test @@ -349,6 +349,87 @@ drop table t4; drop function bug27563; +# Prove that killing connection in the middle +# of mixed engine transactions affect binlogging +# as specified. + +# keep binlogging for this piece of test in a new file +FLUSH LOGS; + +# Connection con3 as transaction generator thoughout the test +connect (con3, localhost, root,,); + +connection con3; +let $ID= `select connection_id()`; + +--echo MI: MyISAM, INNODB +BEGIN; +INSERT INTO t2 VALUES (NULL, 1); +INSERT INTO t1 VALUES (NULL, 1); + +#Connection con1 as killer throughout the test +connection con1; +--replace_result $ID ID +--eval KILL $ID +let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); +--let $binlog_start= 4 +--source include/show_binlog_events.inc +--let $binlog_killed_pos=query_get_value(SHOW MASTER STATUS, Position, 1) + +disconnect con3; +connect (con3, localhost, root,,); +connection con3; +let $ID= `select connection_id()`; + +--echo IM: INNODB, MyISAM +BEGIN; +INSERT INTO t1 VALUES (NULL, 1); +INSERT INTO t2 VALUES (NULL, 1); + +connection con1; +--replace_result $ID ID +--eval KILL $ID +--let $binlog_start= $binlog_killed_pos +--source include/show_binlog_events.inc +--let $binlog_killed_pos=query_get_value(SHOW MASTER STATUS, Position, 1) + +disconnect con3; +connect (con3, localhost, root,,); +connection con3; +let $ID= `select connection_id()`; + +--echo IMI: INNODB, MyISAM, INNODB +BEGIN; +INSERT INTO t1 VALUES (NULL, 1); +INSERT INTO t2 VALUES (NULL, 1); +INSERT INTO t1 VALUES (NULL, 1); + +connection con1; +--replace_result $ID ID +--eval KILL $ID +--let $binlog_start= $binlog_killed_pos +--source include/show_binlog_events.inc +--let $binlog_killed_pos=query_get_value(SHOW MASTER STATUS, Position, 1) + +disconnect con3; +connect (con3, localhost, root,,); +connection con3; +let $ID= `select connection_id()`; + +--echo MI2: MyISAM, INNODB, MyISAM, INNODB +BEGIN; +INSERT INTO t2 VALUES (NULL, 1); +INSERT INTO t1 VALUES (NULL, 1); +INSERT INTO t2 VALUES (NULL, 1); +INSERT INTO t1 VALUES (NULL, 1); + +connection con1; +--replace_result $ID ID +--eval KILL $ID +--let $binlog_start= $binlog_killed_pos +--source include/show_binlog_events.inc + + # # common cleanup # diff --git a/mysql-test/suite/binlog/t/load_data_stm_view.test b/mysql-test/suite/binlog/t/load_data_stm_view.test index b70651b4e2d..9f64b813eec 100644 --- a/mysql-test/suite/binlog/t/load_data_stm_view.test +++ b/mysql-test/suite/binlog/t/load_data_stm_view.test @@ -8,6 +8,8 @@ 1 EOF +reset master; + create table t1 (i int, j int); create view v1 as select i from t1; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR @@ -15,6 +17,8 @@ create view v1 as select i from t1; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/3940.data' INTO TABLE v1 select * from v1; +--let $binlog_file = LAST --source include/show_binlog_events.inc drop view v1; drop table t1; +--remove_file $MYSQLTEST_VARDIR/3940.data -- cgit v1.2.1 From 68cd543539561710661ad0b4a2291191310e1007 Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 8 Dec 2017 11:37:33 +0200 Subject: Search for galera libraries also in /usr/lib64/galera-3 This is where Codership's offical rpm's puts them --- mysql-test/suite/galera/suite.pm | 6 ++++-- mysql-test/suite/galera_3nodes/suite.pm | 6 ++++-- mysql-test/suite/wsrep/suite.pm | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/galera/suite.pm b/mysql-test/suite/galera/suite.pm index 361743f1243..bad0484be16 100644 --- a/mysql-test/suite/galera/suite.pm +++ b/mysql-test/suite/galera/suite.pm @@ -9,8 +9,10 @@ return "Not run for embedded server" if $::opt_embedded_server; return "WSREP is not compiled in" unless defined $::mysqld_variables{'wsrep-on'}; my ($provider) = grep { -f $_ } $ENV{WSREP_PROVIDER}, - "/usr/lib/galera/libgalera_smm.so", - "/usr/lib64/galera/libgalera_smm.so"; + "/usr/lib64/galera-3/libgalera_smm.so", + "/usr/lib64/galera/libgalera_smm.so", + "/usr/lib/galera-3/libgalera_smm.so", + "/usr/lib/galera/libgalera_smm.so"; return "No wsrep provider library" unless -f $provider; diff --git a/mysql-test/suite/galera_3nodes/suite.pm b/mysql-test/suite/galera_3nodes/suite.pm index c91e6e07d76..3a1237ecf75 100644 --- a/mysql-test/suite/galera_3nodes/suite.pm +++ b/mysql-test/suite/galera_3nodes/suite.pm @@ -9,8 +9,10 @@ return "Not run for embedded server" if $::opt_embedded_server; return "WSREP is not compiled in" unless defined $::mysqld_variables{'wsrep-on'}; my ($provider) = grep { -f $_ } $ENV{WSREP_PROVIDER}, - "/usr/lib/galera/libgalera_smm.so", - "/usr/lib64/galera/libgalera_smm.so"; + "/usr/lib64/galera-3/libgalera_smm.so", + "/usr/lib64/galera/libgalera_smm.so", + "/usr/lib/galera-3/libgalera_smm.so", + "/usr/lib/galera/libgalera_smm.so"; return "No wsrep provider library" unless -f $provider; diff --git a/mysql-test/suite/wsrep/suite.pm b/mysql-test/suite/wsrep/suite.pm index b6c5bf15ca1..03e23b8d7cb 100644 --- a/mysql-test/suite/wsrep/suite.pm +++ b/mysql-test/suite/wsrep/suite.pm @@ -9,8 +9,10 @@ return "Not run for embedded server" if $::opt_embedded_server; return "WSREP is not compiled in" unless defined $::mysqld_variables{'wsrep-on'}; my ($provider) = grep { -f $_ } $ENV{WSREP_PROVIDER}, - "/usr/lib/galera/libgalera_smm.so", - "/usr/lib64/galera/libgalera_smm.so"; + "/usr/lib64/galera-3/libgalera_smm.so", + "/usr/lib64/galera/libgalera_smm.so", + "/usr/lib/galera-3/libgalera_smm.so", + "/usr/lib/galera/libgalera_smm.so"; return "No wsrep provider library" unless -f $provider; -- cgit v1.2.1 From 99bcec295d4d367fe8186cc4db70e95fc4149a49 Mon Sep 17 00:00:00 2001 From: Vesa Pentti Date: Fri, 24 Nov 2017 21:56:13 +0000 Subject: MDEV-12501 -- set --maturity-level by default * Note: breaking change; since this commit, a plugin that has worked so far might get rejected due to plugin maturity * mariabackup is not affected (allows all plugins) * VERSION file defines SERVER_MATURITY, which defines the corresponding numeric value as SERVER_MATURITY_LEVEL in include/mysql_version.h * The default value for 'plugin_maturity' is SERVER_MATURITY_LEVEL - 1 * Logs a warning if a plugin has maturity lower than SERVER_MATURITY_LEVEL * Tests suppress the plugin maturity warning * Tests use --plugin-maturity=unknown by default so as not to fail due to the stricter plugin maturity handling --- mysql-test/include/default_mysqld.cnf | 2 +- mysql-test/include/have_plugin_auth.opt | 2 +- mysql-test/include/mtr_warnings.sql | 6 ++++++ mysql-test/r/mysqld--help.result | 1 - .../include/have_example_key_management_plugin.opt | 1 + mysql-test/suite/galera/galera_2nodes.cnf | 1 + mysql-test/suite/galera/suite.opt | 1 + mysql-test/suite/galera_3nodes/galera_3nodes.cnf | 1 + mysql-test/suite/innodb/suite.opt | 1 + mysql-test/suite/rpl/suite.opt | 1 + mysql-test/suite/sys_vars/inc/sysvars_server.inc | 1 + .../suite/sys_vars/r/sysvars_server_embedded.result | 15 +-------------- .../suite/sys_vars/r/sysvars_server_notembedded.result | 15 +-------------- mysql-test/t/bootstrap.test | 2 +- mysql-test/t/mysqld--help.test | 2 +- 15 files changed, 19 insertions(+), 33 deletions(-) create mode 100644 mysql-test/suite/galera/suite.opt create mode 100644 mysql-test/suite/innodb/suite.opt create mode 100644 mysql-test/suite/rpl/suite.opt (limited to 'mysql-test') diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf index 44a7fd12d27..69a2b58288b 100644 --- a/mysql-test/include/default_mysqld.cnf +++ b/mysql-test/include/default_mysqld.cnf @@ -17,7 +17,7 @@ # Default values that applies to all MySQL Servers [mysqld] disable-getopt-prefix-matching - +plugin-maturity=unknown open-files-limit= 1024 local-infile character-set-server= latin1 diff --git a/mysql-test/include/have_plugin_auth.opt b/mysql-test/include/have_plugin_auth.opt index 0204e148656..12a9334fa22 100644 --- a/mysql-test/include/have_plugin_auth.opt +++ b/mysql-test/include/have_plugin_auth.opt @@ -1 +1 @@ ---plugin-load-add=$AUTH_TEST_PLUGIN_SO +--plugin-load-add=$AUTH_TEST_PLUGIN_SO --plugin-maturity=unknown diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql index 71c693961c1..b7b2a316dfb 100644 --- a/mysql-test/include/mtr_warnings.sql +++ b/mysql-test/include/mtr_warnings.sql @@ -224,6 +224,12 @@ INSERT INTO global_suppressions VALUES ("Slave I/O: Setting @slave_gtid_ignore_duplicates failed with error.*"), ("Slave I/O: Setting @slave_until_gtid failed with error.*"), ("Slave I/O: Get master GTID position failed with error.*"), + + /* + MDEV-12501 -- set --maturity-level by default + */ + ("Plugin .* is of maturity level .* while the server is .*"), + ("THE_LAST_SUPPRESSION")|| diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result index 0992276227f..f76957fdcba 100644 --- a/mysql-test/r/mysqld--help.result +++ b/mysql-test/r/mysqld--help.result @@ -1535,7 +1535,6 @@ performance-schema-session-connect-attrs-size -1 performance-schema-setup-actors-size 100 performance-schema-setup-objects-size 100 performance-schema-users-size -1 -plugin-maturity unknown port 3306 port-open-timeout 0 preload-buffer-size 32768 diff --git a/mysql-test/suite/encryption/include/have_example_key_management_plugin.opt b/mysql-test/suite/encryption/include/have_example_key_management_plugin.opt index ce7f1ddef7e..66aaef98c54 100644 --- a/mysql-test/suite/encryption/include/have_example_key_management_plugin.opt +++ b/mysql-test/suite/encryption/include/have_example_key_management_plugin.opt @@ -1,2 +1,3 @@ --plugin-load-add=$EXAMPLE_KEY_MANAGEMENT_SO --loose-example-key-management +--plugin-maturity=unknown diff --git a/mysql-test/suite/galera/galera_2nodes.cnf b/mysql-test/suite/galera/galera_2nodes.cnf index b24f3603894..8de704dbec8 100644 --- a/mysql-test/suite/galera/galera_2nodes.cnf +++ b/mysql-test/suite/galera/galera_2nodes.cnf @@ -4,6 +4,7 @@ [mysqld] wsrep-on=1 binlog-format=row +plugin-maturity=unknown innodb-autoinc-lock-mode=2 default-storage-engine=innodb wsrep-provider=@ENV.WSREP_PROVIDER diff --git a/mysql-test/suite/galera/suite.opt b/mysql-test/suite/galera/suite.opt new file mode 100644 index 00000000000..8374626febe --- /dev/null +++ b/mysql-test/suite/galera/suite.opt @@ -0,0 +1 @@ +--plugin-maturity=unknown diff --git a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf index 91aa53ad7b1..48b3c002c04 100644 --- a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf +++ b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf @@ -3,6 +3,7 @@ [mysqld] binlog-format=row +plugin-maturity=unknown innodb-autoinc-lock-mode=2 default-storage-engine=innodb diff --git a/mysql-test/suite/innodb/suite.opt b/mysql-test/suite/innodb/suite.opt new file mode 100644 index 00000000000..8374626febe --- /dev/null +++ b/mysql-test/suite/innodb/suite.opt @@ -0,0 +1 @@ +--plugin-maturity=unknown diff --git a/mysql-test/suite/rpl/suite.opt b/mysql-test/suite/rpl/suite.opt new file mode 100644 index 00000000000..8374626febe --- /dev/null +++ b/mysql-test/suite/rpl/suite.opt @@ -0,0 +1 @@ +--plugin-maturity=unknown diff --git a/mysql-test/suite/sys_vars/inc/sysvars_server.inc b/mysql-test/suite/sys_vars/inc/sysvars_server.inc index b5c800e858a..37491315c3e 100644 --- a/mysql-test/suite/sys_vars/inc/sysvars_server.inc +++ b/mysql-test/suite/sys_vars/inc/sysvars_server.inc @@ -26,6 +26,7 @@ select * from information_schema.system_variables 'lower_case_file_system', 'lower_case_table_names', 'open_files_limit', + 'plugin_maturity', 'rand_seed1', 'rand_seed2', 'system_time_zone', 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 6fb52700556..41dec216ddb 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -15,6 +15,7 @@ variable_name not in ( 'lower_case_file_system', 'lower_case_table_names', 'open_files_limit', +'plugin_maturity', 'rand_seed1', 'rand_seed2', 'system_time_zone', @@ -3188,20 +3189,6 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED -VARIABLE_NAME PLUGIN_MATURITY -SESSION_VALUE NULL -GLOBAL_VALUE unknown -GLOBAL_VALUE_ORIGIN COMPILE-TIME -DEFAULT_VALUE unknown -VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE ENUM -VARIABLE_COMMENT The lowest desirable plugin maturity. Plugins less mature than that will not be installed or loaded -NUMERIC_MIN_VALUE NULL -NUMERIC_MAX_VALUE NULL -NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST unknown,experimental,alpha,beta,gamma,stable -READ_ONLY YES -COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PORT SESSION_VALUE NULL GLOBAL_VALUE MASTER_MYPORT 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 1b26180b710..8591f4b0c28 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -15,6 +15,7 @@ variable_name not in ( 'lower_case_file_system', 'lower_case_table_names', 'open_files_limit', +'plugin_maturity', 'rand_seed1', 'rand_seed2', 'system_time_zone', @@ -3398,20 +3399,6 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED -VARIABLE_NAME PLUGIN_MATURITY -SESSION_VALUE NULL -GLOBAL_VALUE unknown -GLOBAL_VALUE_ORIGIN COMPILE-TIME -DEFAULT_VALUE unknown -VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE ENUM -VARIABLE_COMMENT The lowest desirable plugin maturity. Plugins less mature than that will not be installed or loaded -NUMERIC_MIN_VALUE NULL -NUMERIC_MAX_VALUE NULL -NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST unknown,experimental,alpha,beta,gamma,stable -READ_ONLY YES -COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PORT SESSION_VALUE NULL GLOBAL_VALUE MASTER_MYPORT diff --git a/mysql-test/t/bootstrap.test b/mysql-test/t/bootstrap.test index e8589fa9242..1ae9b13e050 100644 --- a/mysql-test/t/bootstrap.test +++ b/mysql-test/t/bootstrap.test @@ -7,7 +7,7 @@ drop table if exists t1; # Add the datadir to the bootstrap command let $MYSQLD_DATADIR= `select @@datadir`; -let $MYSQLD_BOOTSTRAP_CMD= $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR --default-storage-engine=MyISAM --loose-skip-innodb; +let $MYSQLD_BOOTSTRAP_CMD= $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR --default-storage-engine=MyISAM --loose-skip-innodb --plugin-maturity=unknown; # # Check that --bootstrap reads from stdin # diff --git a/mysql-test/t/mysqld--help.test b/mysql-test/t/mysqld--help.test index 1613f8e7a4f..f859d7dd9d6 100644 --- a/mysql-test/t/mysqld--help.test +++ b/mysql-test/t/mysqld--help.test @@ -19,7 +19,7 @@ exec $MYSQLD_BOOTSTRAP_CMD --symbolic-links=0 --lower-case-table-names=1 --help perl; # Variables which we don't want to display in the result file since # their paths may vary: - @skipvars=qw/basedir open-files-limit general-log-file log plugin-dir + @skipvars=qw/basedir open-files-limit general-log-file log plugin-dir plugin-maturity log-slow-queries pid-file slow-query-log-file log-basename datadir slave-load-tmpdir tmpdir socket thread-pool-size large-files-support lower-case-file-system system-time-zone -- cgit v1.2.1