From d87c16be7975ba3a76f811fae2ecf4fd091b4136 Mon Sep 17 00:00:00 2001 From: mkaruza Date: Mon, 24 Feb 2020 17:04:43 +0100 Subject: [PATCH 01/25] MDEV-20616: MariaDB-Galera 10.4.8 | Transaction aborted | Sig 6 Shutdown When connections go to same node and deadlock happens, BF abort should not happen for victim thread. Fixed by guarding `wsrep_handle_SR_rollback()` so that is called only for SR transactions. Co-authored-by: Seppo Jaakola Co-authored-by: Daniele Sciascia --- mysql-test/suite/galera/r/MDEV-19966.result | 114 +++++++++ mysql-test/suite/galera/t/MDEV-19966.test | 243 ++++++++++++++++++++ sql/service_wsrep.cc | 1 + storage/innobase/lock/lock0lock.cc | 5 +- storage/innobase/trx/trx0roll.cc | 3 +- 5 files changed, 363 insertions(+), 3 deletions(-) create mode 100644 mysql-test/suite/galera/r/MDEV-19966.result create mode 100644 mysql-test/suite/galera/t/MDEV-19966.test diff --git a/mysql-test/suite/galera/r/MDEV-19966.result b/mysql-test/suite/galera/r/MDEV-19966.result new file mode 100644 index 00000000000..488d8985d35 --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-19966.result @@ -0,0 +1,114 @@ +connection node_2; +connection node_1; + +Test phase 1 to make sure that natral deadlock in trigger SP execution is +handled correctly + +CREATE TABLE t1(a INT); +CREATE TABLE t2(f1 INT, f2 INT, f3 INT); +CREATE PROCEDURE proc() +BEGIN +INSERT INTO t2 VALUES(100, 200, 300); +UPDATE t2 SET f3 = f3 + 100; +END| +CREATE TRIGGER t1 BEFORE INSERT ON t1 FOR EACH ROW CALL proc(); +INSERT INTO t1 VALUES(2);; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +INSERT INTO t1 VALUES(1);; +connection node_1; +connection node_1a; +connection node_1; +wsrep__bf_aborts +0 +DROP TABLE t1; +DROP TABLE t2; +DROP PROCEDURE proc; + +Test phase 2 to make sure that BF abort for SP execution is +handled correctly + +connection node_1; +SET SESSION wsrep_retry_autocommit = 0; +SET SESSION wsrep_sync_wait = 0; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)); +connection node_1a; +SET SESSION wsrep_retry_autocommit = 0; +SET SESSION wsrep_sync_wait = 0; +CREATE PROCEDURE proc_update() +BEGIN +UPDATE t1 SET f2 = 'b'; +END| +INSERT INTO t1 VALUES(1, 'a'); +connection node_1; +SET debug_sync='wsrep_before_certification SIGNAL ready WAIT_FOR cont'; +CALL proc_update; +connection node_1a; +SET debug_sync='now WAIT_FOR ready'; +connection node_2; +UPDATE t1 SET f2='c'; +connection node_1a; +SET debug_sync='now SIGNAL cont'; +connection node_1; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_1a; +SET debug_sync='RESET'; +DROP PROCEDURE proc_update; +connection node_1; + +Test phase 3 to make sure natural deadlock is not treated as BF abort + +TRUNCATE t1; +INSERT INTO t1 VALUES (1, 'a'), (2, 'a'); +connection node_1a; +START TRANSACTION; +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; +connection node_1; +START TRANSACTION; +UPDATE t1 SET f2 = 'c' WHERE f1 = 2; +connection node_1a; +UPDATE t1 SET f2 = 'b' WHERE f1 = 2; +connection node_1; +UPDATE t1 SET f2 = 'c' WHERE f1 = 1; +connection node_1a; +COMMIT; +wsrep__bf_aborts +0 +connection node_1; +ROLLBACK; + +Test phase 4 to make sure natural deadlock inside SP execution +is not treated as BF abort + +connection node_1a; +TRUNCATE t1; +INSERT INTO t1 VALUES (1, 'a'), (2, 'a'); +CREATE PROCEDURE proc_update_1() +BEGIN +START TRANSACTION; +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; +SELECT SLEEP(5); +UPDATE t1 SET f2 = 'b' WHERE f1 = 2; +COMMIT; +END| +CREATE PROCEDURE proc_update_2() +BEGIN +START TRANSACTION; +UPDATE t1 SET f2 = 'c' WHERE f1 = 2; +SELECT SLEEP(5); +UPDATE t1 SET f2 = 'c' WHERE f1 = 1; +COMMIT; +END| +connection node_1; +CALL proc_update_1; +connection node_1a; +CALL proc_update_2; +SLEEP(5) +0 +wsrep__bf_aborts +0 +connection node_1; +SLEEP(5) +0 +DROP PROCEDURE proc_update_1; +DROP PROCEDURE proc_update_2; +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/MDEV-19966.test b/mysql-test/suite/galera/t/MDEV-19966.test new file mode 100644 index 00000000000..4269be58134 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-19966.test @@ -0,0 +1,243 @@ +# +# Test different deadlock scenarios in innodb and make sure that +# wsrep patch does not handle them as BF aborts. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +############################################################################## +# test case to verify that natural deadlock of trigger SP execution is +# handled correctly +############################################################################## + +--echo +--echo Test phase 1 to make sure that natral deadlock in trigger SP execution is +--echo handled correctly +--echo +--let $aborts_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` + +CREATE TABLE t1(a INT); +CREATE TABLE t2(f1 INT, f2 INT, f3 INT); +--disable_query_log +let $run=1000; +while($run) +{ + INSERT INTO t2 VALUES (1, 2, 3); + dec $run; +} +--enable_query_log + +DELIMITER |; +CREATE PROCEDURE proc() +BEGIN + INSERT INTO t2 VALUES(100, 200, 300); + UPDATE t2 SET f3 = f3 + 100; +END| +DELIMITER ;| + +CREATE TRIGGER t1 BEFORE INSERT ON t1 FOR EACH ROW CALL proc(); + +--send INSERT INTO t1 VALUES(2); + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--send INSERT INTO t1 VALUES(1); + +--connection node_1 +--error 0,ER_LOCK_DEADLOCK +--reap + +--connection node_1a +--error 0,ER_LOCK_DEADLOCK +--reap + +--connection node_1 +--let $aborts_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` +--disable_query_log +--eval SELECT $aborts_new - $aborts_old AS wsrep__bf_aborts; +--enable_query_log +DROP TABLE t1; +DROP TABLE t2; +DROP PROCEDURE proc; + +############################################################################## +# +# test case to verify that BF abort for SP execution is handled correctly +# +############################################################################## + +--echo +--echo Test phase 2 to make sure that BF abort for SP execution is +--echo handled correctly +--echo +--connection node_1 +SET SESSION wsrep_retry_autocommit = 0; +SET SESSION wsrep_sync_wait = 0; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)); + +# Control connection for Galera sync point management +--connection node_1a + +SET SESSION wsrep_retry_autocommit = 0; +SET SESSION wsrep_sync_wait = 0; +--let $aborts_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` + +DELIMITER |; +CREATE PROCEDURE proc_update() +BEGIN + UPDATE t1 SET f2 = 'b'; +END| +DELIMITER ;| + +INSERT INTO t1 VALUES(1, 'a'); + +--connection node_1 +SET debug_sync='wsrep_before_certification SIGNAL ready WAIT_FOR cont'; +--send CALL proc_update + +--connection node_1a +SET debug_sync='now WAIT_FOR ready'; + +--connection node_2 +UPDATE t1 SET f2='c'; + +--connection node_1a +# wait for BF to happen +--let $wait_condition = SELECT VARIABLE_VALUE = $aborts_old + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts' +--source include/wait_condition.inc + +SET debug_sync='now SIGNAL cont'; + +--connection node_1 +--error ER_LOCK_DEADLOCK +--reap + +--connection node_1a +SET debug_sync='RESET'; + +DROP PROCEDURE proc_update; + + +############################################################################## +# +# test case to verify that natural deadlock does not cause BF abort +# +############################################################################## + +--connection node_1 +--echo +--echo Test phase 3 to make sure natural deadlock is not treated as BF abort +--echo +TRUNCATE t1; +INSERT INTO t1 VALUES (1, 'a'), (2, 'a'); + +--connection node_1a +--let $aborts_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` + +START TRANSACTION; +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; + +--connection node_1 +START TRANSACTION; +UPDATE t1 SET f2 = 'c' WHERE f1 = 2; + +--connection node_1a +# this hangs for lock wait +--send UPDATE t1 SET f2 = 'b' WHERE f1 = 2 + +# +# classic deadlock happens here +# +--connection node_1 +--error 0, ER_LOCK_DEADLOCK +UPDATE t1 SET f2 = 'c' WHERE f1 = 1; + +--connection node_1a +--error 0, ER_LOCK_DEADLOCK +--reap +COMMIT; + +# +# either one of SP executions was aborted because of natural deadlock, or in worst case +# they were ordered seqeuntailly, and both succeeded. +# anyways, we just check here that no BF aborts happened +# +--let $aborts_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` +--disable_query_log +--eval SELECT $aborts_new - $aborts_old AS wsrep__bf_aborts; +--enable_query_log + +--connection node_1 +ROLLBACK; + +############################################################################## +# +# test case to verify that natural deadlock within SP exceution +# does not cause BF abort +# +############################################################################## + +--echo +--echo Test phase 4 to make sure natural deadlock inside SP execution +--echo is not treated as BF abort +--echo + +--connection node_1a +TRUNCATE t1; +INSERT INTO t1 VALUES (1, 'a'), (2, 'a'); + +--let $aborts_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` + +DELIMITER |; +CREATE PROCEDURE proc_update_1() +BEGIN + START TRANSACTION; + UPDATE t1 SET f2 = 'b' WHERE f1 = 1; + SELECT SLEEP(5); + UPDATE t1 SET f2 = 'b' WHERE f1 = 2; + COMMIT; +END| +DELIMITER ;| + +DELIMITER |; +CREATE PROCEDURE proc_update_2() +BEGIN + START TRANSACTION; + UPDATE t1 SET f2 = 'c' WHERE f1 = 2; + SELECT SLEEP(5); + UPDATE t1 SET f2 = 'c' WHERE f1 = 1; + COMMIT; +END| +DELIMITER ;| + +--connection node_1 +--send CALL proc_update_1 + +--connection node_1a +# +# calling proc_update_2 should cause a natural deadlock +# however, this test is not deterministic, and depends on the sleep() to +# cause expected ordering for update statement execution within SPs +# We therefore, allow both success and deadlock error for the result +# +--error 0, ER_LOCK_DEADLOCK +CALL proc_update_2; + +# +# either one of SP executions was aborted because of natural deadlock, or in worst case +# they were ordered seqeuntailly, and both succeeded. +# anyways, we just check here that no BF aborts happened +# +--let $aborts_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` +--disable_query_log +--eval SELECT $aborts_new - $aborts_old AS wsrep__bf_aborts; +--enable_query_log + + +--connection node_1 +--error 0, ER_LOCK_DEADLOCK +--reap + +DROP PROCEDURE proc_update_1; +DROP PROCEDURE proc_update_2; +DROP TABLE t1; diff --git a/sql/service_wsrep.cc b/sql/service_wsrep.cc index 7a2aa55e0cc..6634bfa7e7a 100644 --- a/sql/service_wsrep.cc +++ b/sql/service_wsrep.cc @@ -168,6 +168,7 @@ extern "C" void wsrep_handle_SR_rollback(THD *bf_thd, THD *victim_thd) { DBUG_ASSERT(victim_thd); + DBUG_ASSERT(wsrep_thd_is_SR(victim_thd)); if (!victim_thd || !wsrep_on(bf_thd)) return; WSREP_DEBUG("handle rollback, for deadlock: thd %llu trx_id %" PRIu64 " frags %zu conf %s", diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index c5a6b81d4e9..60b8fdb0070 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -6868,7 +6868,7 @@ DeadlockChecker::trx_rollback() print("*** WE ROLL BACK TRANSACTION (1)\n"); #ifdef WITH_WSREP - if (wsrep_on(trx->mysql_thd)) { + if (wsrep_on(trx->mysql_thd) && wsrep_thd_is_SR(trx->mysql_thd)) { wsrep_handle_SR_rollback(m_start->mysql_thd, trx->mysql_thd); } #endif @@ -6959,7 +6959,8 @@ DeadlockChecker::check_and_resolve(const lock_t* lock, trx_t* trx) print("*** WE ROLL BACK TRANSACTION (2)\n"); #ifdef WITH_WSREP - if (wsrep_on(trx->mysql_thd)) { + if (wsrep_on(trx->mysql_thd) + && wsrep_thd_is_SR(trx->mysql_thd)) { wsrep_handle_SR_rollback(trx->mysql_thd, victim_trx->mysql_thd); } diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc index b81b1ab3dee..73ac60c635e 100644 --- a/storage/innobase/trx/trx0roll.cc +++ b/storage/innobase/trx/trx0roll.cc @@ -178,7 +178,8 @@ trx_rollback_to_savepoint( complete rollback */ { #ifdef WITH_WSREP - if (savept == NULL && wsrep_on(trx->mysql_thd)) { + if (savept == NULL && wsrep_on(trx->mysql_thd) + && wsrep_thd_is_SR(trx->mysql_thd)) { wsrep_handle_SR_rollback(NULL, trx->mysql_thd); } #endif /* WITH_WSREP */ From 0fe3d6d56371b2b8ae5e92e80270a112d9bf4910 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 26 Feb 2020 12:33:16 +0100 Subject: [PATCH 02/25] all status variables above `questions` MUST be ulong see e.g. `add_to_status()` --- sql/mysqld.cc | 6 +++--- sql/sql_class.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 9a6aa2676d7..4580da89f16 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -8415,9 +8415,9 @@ SHOW_VAR status_vars[]= { {"Key", (char*) &show_default_keycache, SHOW_FUNC}, {"Last_query_cost", (char*) offsetof(STATUS_VAR, last_query_cost), SHOW_DOUBLE_STATUS}, {"Max_statement_time_exceeded", (char*) offsetof(STATUS_VAR, max_statement_time_exceeded), SHOW_LONG_STATUS}, - {"Master_gtid_wait_count", (char*) offsetof(STATUS_VAR, master_gtid_wait_count), SHOW_LONGLONG_STATUS}, - {"Master_gtid_wait_timeouts", (char*) offsetof(STATUS_VAR, master_gtid_wait_timeouts), SHOW_LONGLONG_STATUS}, - {"Master_gtid_wait_time", (char*) offsetof(STATUS_VAR, master_gtid_wait_time), SHOW_LONGLONG_STATUS}, + {"Master_gtid_wait_count", (char*) offsetof(STATUS_VAR, master_gtid_wait_count), SHOW_LONG_STATUS}, + {"Master_gtid_wait_timeouts", (char*) offsetof(STATUS_VAR, master_gtid_wait_timeouts), SHOW_LONG_STATUS}, + {"Master_gtid_wait_time", (char*) offsetof(STATUS_VAR, master_gtid_wait_time), SHOW_LONG_STATUS}, {"Max_used_connections", (char*) &max_used_connections, SHOW_LONG}, {"Memory_used", (char*) &show_memory_used, SHOW_SIMPLE_FUNC}, {"Not_flushed_delayed_rows", (char*) &delayed_rows_in_use, SHOW_LONG_NOFLUSH}, diff --git a/sql/sql_class.h b/sql/sql_class.h index edd02c9c932..9071a2db516 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -781,9 +781,9 @@ typedef struct system_status_var ulong feature_xml; /* +1 when XPATH is used */ /* From MASTER_GTID_WAIT usage */ - ulonglong master_gtid_wait_timeouts; /* Number of timeouts */ - ulonglong master_gtid_wait_time; /* Time in microseconds */ - ulonglong master_gtid_wait_count; + ulong master_gtid_wait_timeouts; /* Number of timeouts */ + ulong master_gtid_wait_time; /* Time in microseconds */ + ulong master_gtid_wait_count; ulong empty_queries; ulong access_denied_errors; From 5c1ed707a3d03a081fde2b2c960998d797757adf Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 26 Feb 2020 19:39:26 +0100 Subject: [PATCH 03/25] mtr: update heuristics for --parallel=auto to work better for CPUs with more than 2000 bogomips. old behavior is preserved if less than 2500 bogomips. --- mysql-test/mysql-test-run.pl | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 07cd4fa5392..cb7e6666800 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -441,11 +441,8 @@ sub main { if ( $opt_parallel eq "auto" ) { # Try to find a suitable value for number of workers my $sys_info= My::SysInfo->new(); + $opt_parallel= $sys_info->num_cpus() + int($sys_info->min_bogomips()/500)-4; - $opt_parallel= $sys_info->num_cpus(); - for my $limit (2000, 1500, 1000, 500){ - $opt_parallel-- if ($sys_info->min_bogomips() < $limit); - } my $max_par= $ENV{MTR_MAX_PARALLEL} || 8; $opt_parallel= $max_par if ($opt_parallel > $max_par); $opt_parallel= $num_tests if ($opt_parallel > $num_tests); From b1d7ba472e434a75f7c17d932f50335963d87283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Van=C4=9Bk?= Date: Wed, 11 Mar 2020 22:00:14 +0100 Subject: [PATCH 04/25] innodb: fix typo in function description Function os_file_get_last_error_low returns error number + OS_FILE_ERROR_MAX (which is currently set to 200) for unknown numbers to this program. --- storage/innobase/os/os0file.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index 065b3118413..f7061388cb8 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -2418,12 +2418,12 @@ AIO::is_linux_native_aio_supported() /** Retrieves the last error number if an error occurs in a file io function. The number should be retrieved before any other OS calls (because they may overwrite the error number). If the number is not known to this program, -the OS error number + 100 is returned. +the OS error number + OS_FILE_ERROR_MAX is returned. @param[in] report_all_errors true if we want an error message printed of all errors @param[in] on_error_silent true then don't print any diagnostic to the log -@return error number, or OS error number + 100 */ +@return error number, or OS error number + OS_FILE_ERROR_MAX */ static ulint os_file_get_last_error_low( From 89698cef72a5c220a2fcc346e3dd975ae219b7d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 17 Mar 2020 10:32:42 +0200 Subject: [PATCH 05/25] MDEV-10570: Fix -Wmaybe-uninitialized Rows_log_event::change_to_flashback_event(): Reduce the scope of the variable swap_buff2, and do not duplicate conditions. GCC 9.3.0 flagged the -Wmaybe-uninitialized when compiling the 10.5 branch using cmake -DWITH_ASAN=ON -DCMAKE_CXX_FLAGS=-O2 --- sql/log_event.cc | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/sql/log_event.cc b/sql/log_event.cc index 29cb4d6d7d7..a3ebf530796 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2019, Oracle and/or its affiliates. - Copyright (c) 2009, 2019, MariaDB + Copyright (c) 2009, 2020, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -3184,7 +3184,7 @@ void Rows_log_event::change_to_flashback_event(PRINT_EVENT_INFO *print_event_inf Table_map_log_event *map; table_def *td; DYNAMIC_ARRAY rows_arr; - uchar *swap_buff1, *swap_buff2; + uchar *swap_buff1; uchar *rows_pos= rows_buff + m_rows_before_size; if (!(map= print_event_info->m_table_map.get_table(m_table_id)) || @@ -3233,7 +3233,7 @@ void Rows_log_event::change_to_flashback_event(PRINT_EVENT_INFO *print_event_inf } value+= length2; - swap_buff2= (uchar *) my_malloc(length2, MYF(0)); + void *swap_buff2= my_malloc(length2, MYF(0)); if (!swap_buff2) { fprintf(stderr, "\nError: Out of memory. " @@ -3241,21 +3241,14 @@ void Rows_log_event::change_to_flashback_event(PRINT_EVENT_INFO *print_event_inf exit(1); } memcpy(swap_buff2, start_pos + length1, length2); // WHERE part - } - if (ev_type == UPDATE_ROWS_EVENT || - ev_type == UPDATE_ROWS_EVENT_V1) - { /* Swap SET and WHERE part */ memcpy(start_pos, swap_buff2, length2); memcpy(start_pos + length2, swap_buff1, length1); + my_free(swap_buff2); } - /* Free tmp buffers */ my_free(swap_buff1); - if (ev_type == UPDATE_ROWS_EVENT || - ev_type == UPDATE_ROWS_EVENT_V1) - my_free(swap_buff2); /* Copying one row into a buff, and pushing into the array */ LEX_STRING one_row; From e64a3df4dc248a8f61f8e2c91fa37ee9bfa5202c Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Tue, 17 Mar 2020 13:11:46 +0400 Subject: [PATCH 06/25] MDEV-21959 GIS error message doesn't show the wrong value, just the type. Error message now shows the whole value. --- mysql-test/r/gis.result | 2 +- .../suite/innodb/r/innodb-online-alter-gis.result | 2 +- mysql-test/suite/innodb_gis/r/1.result | 4 ++-- mysql-test/suite/innodb_gis/r/gis.result | 4 ++-- sql/field.cc | 12 ++++++++++-- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 828fbd9d0e7..ecbdd5b586c 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -1689,7 +1689,7 @@ NULL # create table t1 (pt point); insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))')); -ERROR 22007: Incorrect POINT value: 'POLYGON' for column `test`.`t1`.`pt` at row 1 +ERROR 22007: Incorrect POINT value: 'POLYGON((1 1,2 2,2 1,1 1))' for column `test`.`t1`.`pt` at row 1 drop table t1; SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100)); st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100)) diff --git a/mysql-test/suite/innodb/r/innodb-online-alter-gis.result b/mysql-test/suite/innodb/r/innodb-online-alter-gis.result index 423a658283f..5297f1eb4f1 100644 --- a/mysql-test/suite/innodb/r/innodb-online-alter-gis.result +++ b/mysql-test/suite/innodb/r/innodb-online-alter-gis.result @@ -42,7 +42,7 @@ drop table t1; # CREATE TABLE t1 (a INT) ENGINE=InnoDB; ALTER TABLE t1 ADD COLUMN b LINESTRING DEFAULT POINT(1,1); -ERROR 22007: Incorrect LINESTRING value: 'POINT' for column ``.``.`b` at row 1 +ERROR 22007: Incorrect LINESTRING value: 'POINT(1 1)' for column ``.``.`b` at row 1 DESCRIBE t1; Field Type Null Key Default Extra a int(11) YES NULL diff --git a/mysql-test/suite/innodb_gis/r/1.result b/mysql-test/suite/innodb_gis/r/1.result index 05662d254e0..9a16801ebb5 100644 --- a/mysql-test/suite/innodb_gis/r/1.result +++ b/mysql-test/suite/innodb_gis/r/1.result @@ -1038,9 +1038,9 @@ SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000 SET @a=ST_POLYFROMWKB(@a); create table t1(a polygon NOT NULL)engine=InnoDB; insert into t1 values (ST_geomfromtext("point(0 1)")); -ERROR 22007: Incorrect POLYGON value: 'POINT' for column `test`.`t1`.`a` at row 1 +ERROR 22007: Incorrect POLYGON value: 'POINT(0 1)' for column `test`.`t1`.`a` at row 1 insert into t1 values (ST_geomfromtext("point(1 0)")); -ERROR 22007: Incorrect POLYGON value: 'POINT' for column `test`.`t1`.`a` at row 1 +ERROR 22007: Incorrect POLYGON value: 'POINT(1 0)' for column `test`.`t1`.`a` at row 1 select * from (select polygon(t1.a) as p from t1 order by t1.a) d; p drop table t1; diff --git a/mysql-test/suite/innodb_gis/r/gis.result b/mysql-test/suite/innodb_gis/r/gis.result index a0729cd1150..c0a809a811a 100644 --- a/mysql-test/suite/innodb_gis/r/gis.result +++ b/mysql-test/suite/innodb_gis/r/gis.result @@ -1034,9 +1034,9 @@ SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000 SET @a=ST_POLYFROMWKB(@a); create table t1(a polygon NOT NULL)engine=innodb; insert into t1 values (ST_geomfromtext("point(0 1)")); -ERROR 22007: Incorrect POLYGON value: 'POINT' for column `test`.`t1`.`a` at row 1 +ERROR 22007: Incorrect POLYGON value: 'POINT(0 1)' for column `test`.`t1`.`a` at row 1 insert into t1 values (ST_geomfromtext("point(1 0)")); -ERROR 22007: Incorrect POLYGON value: 'POINT' for column `test`.`t1`.`a` at row 1 +ERROR 22007: Incorrect POLYGON value: 'POINT(1 0)' for column `test`.`t1`.`a` at row 1 select * from (select polygon(t1.a) as p from t1 order by t1.a) d; p drop table t1; diff --git a/sql/field.cc b/sql/field.cc index 09e82acb009..857ba8d0e0c 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -8841,18 +8841,26 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs) { const char *db= table->s->db.str; const char *tab_name= table->s->table_name.str; + Geometry_buffer buffer; + Geometry *geom= NULL; + String wkt; + const char *dummy; if (!db) db= ""; if (!tab_name) tab_name= ""; + wkt.set_charset(&my_charset_latin1); + if (!(geom= Geometry::construct(&buffer, from, length)) || + geom->as_wkt(&wkt, &dummy)) + goto err; my_error(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, MYF(0), Geometry::ci_collection[geom_type]->m_name.str, - Geometry::ci_collection[wkb_type]->m_name.str, - db, tab_name, field_name, + wkt.c_ptr(), db, tab_name, field_name, (ulong) table->in_use->get_stmt_da()-> current_row_for_warning()); + goto err_exit; } From e61b99073f07f0ed1ae7f70b1cdf16dddebe554f Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Tue, 17 Mar 2020 19:22:20 +0530 Subject: [PATCH 07/25] MDEV-14808 innodb_fts.sync fails in buildbot with wrong result AUTO_INCREMENT values are nondeterministic after crash recovery. While MDEV-6076 guarantees that the AUTO_INCREMENT values of committed transactions will not roll back, it is possible that the AUTO_INCREMENT values will be durably incremented for incomplete transactions. So changing the test case to avoid showing the result of AUTO_INCREMENT value. --- mysql-test/suite/innodb_fts/r/sync.result | 14 +++++++------- mysql-test/suite/innodb_fts/t/sync.test | 6 ++++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/mysql-test/suite/innodb_fts/r/sync.result b/mysql-test/suite/innodb_fts/r/sync.result index 82959cfea96..4d28866ec82 100644 --- a/mysql-test/suite/innodb_fts/r/sync.result +++ b/mysql-test/suite/innodb_fts/r/sync.result @@ -99,17 +99,17 @@ SET debug_dbug = '+d,fts_instrument_sync_debug,fts_write_node_crash'; INSERT INTO t1(title) VALUES('mysql'); ERROR HY000: Lost connection to MySQL server during query After restart -SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database'); -FTS_DOC_ID title -1 database +SELECT title FROM t1 WHERE MATCH(title) AGAINST ('mysql database'); +title +database SET @old_dbug = @@SESSION.debug_dbug; SET debug_dbug = '+d,fts_instrument_sync_debug'; INSERT INTO t1(title) VALUES('mysql'); SET debug_dbug = @old_dbug; -SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database'); -FTS_DOC_ID title -1 database -2 mysql +SELECT title FROM t1 WHERE MATCH(title) AGAINST ('mysql database'); +title +database +mysql DROP TABLE t1; # Case 4: Test sync commit & rollback in background CREATE TABLE t1( diff --git a/mysql-test/suite/innodb_fts/t/sync.test b/mysql-test/suite/innodb_fts/t/sync.test index 2ad5423d73b..6929dce31b8 100644 --- a/mysql-test/suite/innodb_fts/t/sync.test +++ b/mysql-test/suite/innodb_fts/t/sync.test @@ -123,7 +123,9 @@ INSERT INTO t1(title) VALUES('mysql'); --source include/start_mysqld.inc -- echo After restart -SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database'); +# PAGE_ROOT_AUTO_INC could contain last failed autoinc value. Avoid +# doing show the result of auto increment field +SELECT title FROM t1 WHERE MATCH(title) AGAINST ('mysql database'); SET @old_dbug = @@SESSION.debug_dbug; @@ -133,7 +135,7 @@ INSERT INTO t1(title) VALUES('mysql'); SET debug_dbug = @old_dbug; -SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database'); +SELECT title FROM t1 WHERE MATCH(title) AGAINST ('mysql database'); DROP TABLE t1; From ab0034a78966f3e9f76cf332744fdc54ef10f8c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 17 Mar 2020 16:28:16 +0200 Subject: [PATCH 08/25] MDEV-20370 Crash after OPTIMIZE TABLE on TEMPORARY TABLE Temporary tables are typically short-lived, and temporary tables are assumed to be accessed only by the thread that is handling the owning connection. Hence, they must not be subject to defragmenting. ha_innobase::optimize(): Do not add temporary tables to the defragment_table() queue. --- .../innodb/r/innodb_defrag_concurrent.result | 19 +++++++++--- .../innodb/t/innodb_defrag_concurrent.test | 31 ++++++++++--------- storage/innobase/handler/ha_innodb.cc | 3 +- 3 files changed, 32 insertions(+), 21 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb_defrag_concurrent.result b/mysql-test/suite/innodb/r/innodb_defrag_concurrent.result index d10727b95b4..07c96e76213 100644 --- a/mysql-test/suite/innodb/r/innodb_defrag_concurrent.result +++ b/mysql-test/suite/innodb/r/innodb_defrag_concurrent.result @@ -1,7 +1,7 @@ -DROP TABLE if exists t1; -select @@global.innodb_stats_persistent; -@@global.innodb_stats_persistent -0 +SET @n_pages= @@GLOBAL.innodb_defragment_n_pages; +SET @accuracy= @@GLOBAL.innodb_defragment_stats_accuracy; +SET @sp= @@GLOBAL.innodb_stats_persistent; +SET GLOBAL innodb_stats_persistent = 0; set global innodb_defragment_stats_accuracy = 80; CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256), @@ -18,6 +18,14 @@ connect con3,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK; connect con4,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK; connection default; SET @@global.innodb_defragment_n_pages = 20; +CREATE TEMPORARY TABLE tt (a INT, KEY(a)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO tt SELECT 0 FROM seq_1_to_180; +INSERT INTO tt SELECT 5 FROM seq_1_to_160; +INSERT INTO tt SELECT 1 FROM seq_1_to_1000; +OPTIMIZE TABLE tt; +Table Op Msg_type Msg_text +test.tt optimize note Table does not support optimize, doing recreate + analyze instead +test.tt optimize status OK select count(*) from t1; count(*) 20000 @@ -89,3 +97,6 @@ select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like count(stat_value) > 0 1 drop table t1; +SET GLOBAL innodb_defragment_n_pages = @n_pages; +SET GLOBAL innodb_defragment_stats_accuracy = @accuracy; +SET GLOBAL innodb_stats_persistent = @sp; diff --git a/mysql-test/suite/innodb/t/innodb_defrag_concurrent.test b/mysql-test/suite/innodb/t/innodb_defrag_concurrent.test index bbcd72f1a3a..1e4e14eb7c6 100644 --- a/mysql-test/suite/innodb/t/innodb_defrag_concurrent.test +++ b/mysql-test/suite/innodb/t/innodb_defrag_concurrent.test @@ -2,17 +2,13 @@ --source include/big_test.inc --source include/not_valgrind.inc --source include/not_embedded.inc +--source include/have_sequence.inc ---disable_warnings -DROP TABLE if exists t1; ---enable_warnings +SET @n_pages= @@GLOBAL.innodb_defragment_n_pages; +SET @accuracy= @@GLOBAL.innodb_defragment_stats_accuracy; +SET @sp= @@GLOBAL.innodb_stats_persistent; ---disable_query_log -let $innodb_defragment_n_pages_orig=`select @@innodb_defragment_n_pages`; -let $innodb_defragment_stats_accuracy_orig=`select @@innodb_defragment_stats_accuracy`; ---enable_query_log - -select @@global.innodb_stats_persistent; +SET GLOBAL innodb_stats_persistent = 0; set global innodb_defragment_stats_accuracy = 80; # Create table. @@ -46,6 +42,12 @@ connection default; SET @@global.innodb_defragment_n_pages = 20; +CREATE TEMPORARY TABLE tt (a INT, KEY(a)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO tt SELECT 0 FROM seq_1_to_180; +INSERT INTO tt SELECT 5 FROM seq_1_to_160; +INSERT INTO tt SELECT 1 FROM seq_1_to_1000; +OPTIMIZE TABLE tt; + let $data_size = 20000; let $delete_size = 2000; @@ -60,7 +62,7 @@ while ($i) } --enable_query_log -select count(*) from t1; +select count(*) from t1; select count(*) from t1 force index (second); select count(*) from t1 force index (third); @@ -75,7 +77,7 @@ while ($size) } --enable_query_log -select count(*) from t1; +select count(*) from t1; select count(*) from t1 force index (second); select count(*) from t1 force index (third); @@ -136,7 +138,6 @@ select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like drop table t1; # reset system ---disable_query_log -EVAL SET GLOBAL innodb_defragment_n_pages = $innodb_defragment_n_pages_orig; -EVAL SET GLOBAL innodb_defragment_stats_accuracy = $innodb_defragment_stats_accuracy_orig; ---enable_query_log +SET GLOBAL innodb_defragment_n_pages = @n_pages; +SET GLOBAL innodb_defragment_stats_accuracy = @accuracy; +SET GLOBAL innodb_stats_persistent = @sp; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 0338e2b682a..044d407f7e7 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -14903,8 +14903,7 @@ ha_innobase::optimize( calls to OPTIMIZE, which is undesirable. */ bool try_alter = true; - /* TODO: Defragment is disabled for now */ - if (srv_defragment) { + if (!m_prebuilt->table->is_temporary() && srv_defragment) { int err; err = defragment_table(m_prebuilt->table->name.m_name, NULL, false); From 6ecbb211c071e4ac62c0b8eaf773771b74d49a9c Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Wed, 18 Mar 2020 09:33:26 +0100 Subject: [PATCH 09/25] new (fixed) version of CC. --- libmariadb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmariadb b/libmariadb index f9a50468cd7..1768cb6c322 160000 --- a/libmariadb +++ b/libmariadb @@ -1 +1 @@ -Subproject commit f9a50468cd7f35f2e22dc874c185e34b78766a2e +Subproject commit 1768cb6c322d403c1e372b368cc3c23b660b7930 From 09e8707d90a8a73887fd4f22b64df43ff4669556 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Wed, 18 Mar 2020 14:55:22 +0530 Subject: [PATCH 10/25] MDEV-21826 Recovery failure : loop of Read redo log up to LSN - This issue is caused by MDEV-19176 (bba59abb039fee1a3ee72a25643ebb7a0b64f3c5). - Problem is that there is miscalculation of available memory during recovery if innodb_buffer_pool_instances > 1. - Ignore the buffer pool instance while calculating available_memory - Removed recv_n_pool_free_frames variable and use buf_pool_get_n_pages() instead. --- storage/innobase/buf/buf0rea.cc | 8 ++++++-- storage/innobase/include/log0recv.h | 8 +------- storage/innobase/log/log0recv.cc | 18 +++--------------- 3 files changed, 10 insertions(+), 24 deletions(-) diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc index e25c0e853e4..43831dedb2c 100644 --- a/storage/innobase/buf/buf0rea.cc +++ b/storage/innobase/buf/buf0rea.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2019, MariaDB Corporation. +Copyright (c) 2015, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -925,8 +925,12 @@ buf_read_recv_pages( ulint count = 0; buf_pool = buf_pool_get(cur_page_id); - while (buf_pool->n_pend_reads >= recv_n_pool_free_frames / 2) { + ulint limit = 0; + for (ulint j = 0; j < buf_pool->n_chunks; j++) { + limit += buf_pool->chunks[j].size / 2; + } + while (buf_pool->n_pend_reads >= limit) { os_aio_simulated_wake_handler_threads(); os_thread_sleep(10000); diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h index d6da4cad9a9..068d7813c20 100644 --- a/storage/innobase/include/log0recv.h +++ b/storage/innobase/include/log0recv.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2019, MariaDB Corporation. +Copyright (c) 2017, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -342,10 +342,4 @@ times! */ roll-forward */ #define RECV_SCAN_SIZE (4 * UNIV_PAGE_SIZE) -/** This many frames must be left free in the buffer pool when we scan -the log and store the scanned log records in the buffer pool: we will -use these free frames to read in pages when we start applying the -log records to the database. */ -extern ulint recv_n_pool_free_frames; - #endif diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 347953b5289..01f8e3636bc 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -2,7 +2,7 @@ Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2019, MariaDB Corporation. +Copyright (c) 2013, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -103,14 +103,6 @@ static ulint recv_previous_parsed_rec_offset; /** The 'multi' flag of the previous parsed redo log record */ static ulint recv_previous_parsed_rec_is_multi; -/** This many frames must be left free in the buffer pool when we scan -the log and store the scanned log records in the buffer pool: we will -use these free frames to read in pages when we start applying the -log records to the database. -This is the default value. If the actual size of the buffer pool is -larger than 10 MB we'll set this value to 512. */ -ulint recv_n_pool_free_frames; - /** The maximum lsn we see for a page during the recovery process. If this is bigger than the lsn we are able to scan up to, that is an indication that the recovery failed and the database may be corrupt. */ @@ -840,9 +832,6 @@ recv_sys_init() recv_sys->flush_end = os_event_create(0); } - recv_n_pool_free_frames = - buf_pool_get_n_pages() / 3; - recv_sys->buf = static_cast( ut_malloc_nokey(RECV_PARSING_BUF_SIZE)); @@ -3456,9 +3445,8 @@ recv_group_scan_log_recs( lsn_t end_lsn; store_t store_to_hash = recv_sys->mlog_checkpoint_lsn == 0 ? STORE_NO : (last_phase ? STORE_IF_EXISTS : STORE_YES); - ulint available_mem = UNIV_PAGE_SIZE - * (buf_pool_get_n_pages() - - (recv_n_pool_free_frames * srv_buf_pool_instances)); + ulint available_mem = (buf_pool_get_n_pages() * 2 / 3) + << srv_page_size_shift; group->scanned_lsn = end_lsn = *contiguous_lsn = ut_uint64_align_down( *contiguous_lsn, OS_FILE_LOG_BLOCK_SIZE); From a0ce62f804dc1a0073688bea46dc2e6728cf55e3 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Wed, 18 Mar 2020 13:55:21 +0400 Subject: [PATCH 11/25] MDEV-14057 InnoDB GIS tests fail. Tests fixed. MBR::Within() function fixed. --- mysql-test/r/gis-rtree.result | 4 +- mysql-test/suite/innodb_gis/disabled.def | 6 - .../suite/innodb_gis/r/bug16236208.result | 2 +- .../suite/innodb_gis/r/bug16266012.result | 7 +- mysql-test/suite/innodb_gis/r/geometry.result | 255 +++++++++--------- .../suite/innodb_gis/r/gis_split_inf.result | 10 +- .../innodb_gis/r/innodb_gis_rtree.result | 4 +- .../suite/innodb_gis/r/point_basic.result | 27 +- mysql-test/suite/innodb_gis/r/rtree.result | 6 +- .../suite/innodb_gis/r/rtree_multi_pk.result | 20 +- .../suite/innodb_gis/r/rtree_search.result | 8 +- .../suite/innodb_gis/t/bug16236208.test | 2 +- .../suite/innodb_gis/t/bug16266012.test | 2 +- mysql-test/suite/innodb_gis/t/geometry.test | 63 ++--- .../suite/innodb_gis/t/gis_split_inf.test | 5 +- .../suite/innodb_gis/t/rtree_multi_pk.test | 13 - mysql-test/t/gis-rtree.test | 4 +- sql/spatial.cc | 92 +++++++ sql/spatial.h | 7 +- 19 files changed, 281 insertions(+), 256 deletions(-) diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result index 2450da8a811..82e7cb84275 100644 --- a/mysql-test/r/gis-rtree.result +++ b/mysql-test/r/gis-rtree.result @@ -1576,13 +1576,13 @@ INSERT INTO t1 VALUES(GeomFromText('LINESTRING(2 2, 3 3)')); SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)')); COUNT(*) 1 -SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l); +SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0.5 0.5)'), l); COUNT(*) 1 SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)')); COUNT(*) 1 -SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l); +SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0.5 0.5)'), l); COUNT(*) 1 DROP TABLE t1; diff --git a/mysql-test/suite/innodb_gis/disabled.def b/mysql-test/suite/innodb_gis/disabled.def index e486a70a0c6..8cae44a3607 100644 --- a/mysql-test/suite/innodb_gis/disabled.def +++ b/mysql-test/suite/innodb_gis/disabled.def @@ -10,9 +10,3 @@ # ############################################################################## -gis_split_inf : MDEV-14057 InnoDB GIS tests fail -rtree_multi_pk : MDEV-14057 InnoDB GIS tests fail -point_big : MDEV-14057 InnoDB GIS tests fail -geometry : MDEV-14057 InnoDB GIS tests fail -bug16236208 : MDEV-14057 InnoDB GIS tests fail -bug16266012 : MDEV-14057 InnoDB GIS tests fail diff --git a/mysql-test/suite/innodb_gis/r/bug16236208.result b/mysql-test/suite/innodb_gis/r/bug16236208.result index a2b81e612a9..c7d4f3280bf 100644 --- a/mysql-test/suite/innodb_gis/r/bug16236208.result +++ b/mysql-test/suite/innodb_gis/r/bug16236208.result @@ -39,5 +39,5 @@ ST_WITHIN( ST_GeomFromText('POLYGON( ( 4135 3009 , 4914 3087 , 4236 3194 , 4091 ST_GeomFromText('MULTILINESTRING( ( 4147 2871 , 4072 3042 , 4081 3099 , 3796 3021 , 4007 3463 ) , ( 4042 2808 , 4109 2816 , 3730 3673 ) )') , linestring_key ) AND ST_Length( linestring_nokey ) > 1; -ERROR 22023: Invalid GIS data provided to function st_within. +ST_AsText(linestring_nokey) DROP TABLE linestring; diff --git a/mysql-test/suite/innodb_gis/r/bug16266012.result b/mysql-test/suite/innodb_gis/r/bug16266012.result index 9e62563f752..99de5db5e12 100644 --- a/mysql-test/suite/innodb_gis/r/bug16266012.result +++ b/mysql-test/suite/innodb_gis/r/bug16266012.result @@ -6,4 +6,9 @@ MULTIPOLYGON( ( ( 0 0 , 7 1 , 6 8 , 0 0 ) ) , ( ( 9 9 , 4 0 , 4 7 , 9 9) ) ) ') ) , ST_SYMDIFFERENCE( POLYGONFROMTEXT(' POLYGON( ( 9 9 , 6 5 , 2 3 , 9 9 ) ) ') , MULTIPOLYGONFROMTEXT(' MULTIPOLYGON( ( ( 2 2 , 5 2 , 5 2 , 2 6 , 2 2 ) ) , ( ( 7 7 , 3 7 , 2 9 , 7 1 , 7 7 ) ) ) ') ) ) ); -ERROR HY000: Geometry overlay calculation error: geometry data is invalid in function st_union. +ST_WITHIN( LINESTRINGFROMTEXT(' LINESTRING( 5 9 , 3 4 , 4 1 , 4 +4 , 4 9 ) ') , ST_SYMDIFFERENCE( ST_UNION( ST_ENVELOPE( POLYGONFROMTEXT(' +POLYGON( ( 3 2 , 0 6 , 2 3 , 8 0 , 4 6 , 7 2 , 3 2 ) ) ') ) , +MULTIPOLYGONFROMTEXT(' +MULTIPOLYGON( ( ( 0 0 , 7 1 , 6 +0 diff --git a/mysql-test/suite/innodb_gis/r/geometry.result b/mysql-test/suite/innodb_gis/r/geometry.result index 780efc11bce..68b213cfa25 100644 --- a/mysql-test/suite/innodb_gis/r/geometry.result +++ b/mysql-test/suite/innodb_gis/r/geometry.result @@ -99,9 +99,9 @@ fid ST_AsText(g) 110 POLYGON((0 0,30 0,30 30,0 0)) SELECT fid, ST_AsText(g) FROM gis_multi_point; fid ST_AsText(g) -111 MULTIPOINT((0 0),(10 10),(10 20),(20 20)) -112 MULTIPOINT((1 1),(11 11),(11 21),(21 21)) -113 MULTIPOINT((3 6),(4 10)) +111 MULTIPOINT(0 0,10 10,10 20,20 20) +112 MULTIPOINT(1 1,11 11,11 21,21 21) +113 MULTIPOINT(3 6,4 10) SELECT fid, ST_AsText(g) FROM gis_multi_line; fid ST_AsText(g) 114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) @@ -129,9 +129,9 @@ fid ST_AsText(g) 108 POLYGON((10 10,20 10,20 20,10 20,10 10)) 109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10)) 110 POLYGON((0 0,30 0,30 30,0 0)) -111 MULTIPOINT((0 0),(10 10),(10 20),(20 20)) -112 MULTIPOINT((1 1),(11 11),(11 21),(21 21)) -113 MULTIPOINT((3 6),(4 10)) +111 MULTIPOINT(0 0,10 10,10 20,20 20) +112 MULTIPOINT(1 1,11 11,11 21,21 21) +113 MULTIPOINT(3 6,4 10) 114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) 115 MULTILINESTRING((10 48,10 21,10 0)) 116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) @@ -178,62 +178,40 @@ CREATE UNIQUE INDEX idx2 on tab(c8(5) ASC) ; #check equality predicate on the index columns EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab WHERE c2=ST_LineFromText('LINESTRING(10 10,20 20,30 30)'); -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE tab NULL ref idx1 idx1 8 const # 100.00 Using where -Warnings: -Note 1003 /* select#1 */ select st_astext(`test`.`tab`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab`.`c8`) AS `ST_AsText(c8)` from `test`.`tab` where (`test`.`tab`.`c2` = (st_geometryfromtext('LINESTRING(10 10,20 20,30 30)'))) +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab ref idx1 idx1 8 const 1 # #check index with WKB function EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab WHERE c2=ST_LineStringFromWKB(ST_AsWKB(ST_LineFromText('LINESTRING(10 10,20 20,30 30)'))); -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE tab NULL ref idx1 idx1 8 const # 100.00 Using where -Warnings: -Note 1003 /* select#1 */ select st_astext(`test`.`tab`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab`.`c8`) AS `ST_AsText(c8)` from `test`.`tab` where (`test`.`tab`.`c2` = (st_geometryfromwkb(st_aswkb(st_geometryfromtext('LINESTRING(10 10,20 20,30 30)'))))) +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab ref idx1 idx1 8 const 1 # #check index with WKT function EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab WHERE c3=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'); -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE tab NULL ref idx3 idx3 8 const # 100.00 Using where -Warnings: -Note 1003 /* select#1 */ select st_astext(`test`.`tab`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab`.`c8`) AS `ST_AsText(c8)` from `test`.`tab` where (`test`.`tab`.`c3` = (st_geometryfromtext('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'))) +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab ref idx3 idx3 8 const 1 # #check index with WKB function EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab WHERE c3=ST_PolyFromWKB(ST_AsWkB(ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'))); -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE tab NULL ref idx3 idx3 8 const # 100.00 Using where -Warnings: -Note 1003 /* select#1 */ select st_astext(`test`.`tab`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab`.`c8`) AS `ST_AsText(c8)` from `test`.`tab` where (`test`.`tab`.`c3` = (st_geometryfromwkb(st_aswkb(st_geometryfromtext('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'))))) +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab ref idx3 idx3 8 const 1 # #check index with WKT function EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab WHERE c8=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'); -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE tab NULL const idx2 idx2 8 const # 100.00 NULL -Warnings: -Note 1003 /* select#1 */ select st_astext(' +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab const idx2 idx2 8 const 1 # #check index with WKB function EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'))); -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE tab NULL const idx2 idx2 8 const # 100.00 NULL -Warnings: -Note 1003 /* select#1 */ select st_astext(' -#check range predicate on the index columns -EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab -WHERE c2>=ST_LineFromText('LINESTRING(10 10,20 20,30 30)'); -ERROR HY000: Incorrect arguments to >= -EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab -WHERE c3>=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'); -ERROR HY000: Incorrect arguments to >= -EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab -WHERE c8>=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'); -ERROR HY000: Incorrect arguments to >= +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab const idx2 idx2 8 const 1 # #check index with DELETE operation EXPLAIN DELETE FROM tab WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'))); -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 DELETE tab NULL range idx2 idx2 8 const # 100.00 Using where +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab range idx2 idx2 8 NULL 1 # #check the spatial values SELECT ST_AsText(c1) FROM tab; ST_AsText(c1) @@ -246,7 +224,7 @@ ST_AsText(c3) POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10)) SELECT ST_AsText(c4) FROM tab; ST_AsText(c4) -MULTIPOINT((0 0),(5 5),(10 10),(20 20)) +MULTIPOINT(0 0,5 5,10 10,20 20) SELECT ST_AsText(c5) FROM tab; ST_AsText(c5) MULTILINESTRING((1 1,2 2,3 3),(10 10,20 20,30 30)) @@ -290,7 +268,7 @@ ST_AsText(c3) POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10)) SELECT ST_AsText(c4) FROM tab; ST_AsText(c4) -MULTIPOINT((0 0),(5 5),(10 10),(20 20)) +MULTIPOINT(0 0,5 5,10 10,20 20) SELECT ST_AsText(c5) FROM tab; ST_AsText(c5) MULTILINESTRING((1 1,2 2,3 3),(10 10,20 20,30 30)) @@ -334,7 +312,7 @@ ST_AsText(c3) POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10)) SELECT ST_AsText(c4) FROM tab; ST_AsText(c4) -MULTIPOINT((0 0),(5 5),(10 10),(20 20)) +MULTIPOINT(0 0,5 5,10 10,20 20) SELECT ST_AsText(c5) FROM tab; ST_AsText(c5) MULTILINESTRING((1 1,2 2,3 3),(10 10,20 20,30 30)) @@ -353,7 +331,7 @@ ALTER TABLE tab MODIFY COLUMN c1 BLOB; SHOW CREATE TABLE tab; Table Create Table tab CREATE TABLE `tab` ( - `c1` blob, + `c1` blob DEFAULT NULL, `c2` linestring DEFAULT NULL, `c3` polygon DEFAULT NULL, `c4` multipoint DEFAULT NULL, @@ -441,7 +419,7 @@ ST_AsText(c3) POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10)) SELECT ST_AsText(c4) FROM tab; ST_AsText(c4) -MULTIPOINT((0 0),(5 5),(10 10),(20 20)) +MULTIPOINT(0 0,5 5,10 10,20 20) SELECT ST_AsText(c5) FROM tab; ST_AsText(c5) MULTILINESTRING((1 1,2 2,3 3),(10 10,20 20,30 30)) @@ -516,7 +494,7 @@ ST_AsText(c3) POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10)) SELECT ST_AsText(c4) FROM tab2; ST_AsText(c4) -MULTIPOINT((0 0),(5 5),(10 10),(20 20)) +MULTIPOINT(0 0,5 5,10 10,20 20) SELECT ST_AsText(c5) FROM tab2; ST_AsText(c5) MULTILINESTRING((1 1,2 2,3 3),(10 10,20 20,30 30)) @@ -556,6 +534,8 @@ LINESTRING(10 10,20 20,30 30) LINESTRING(10 10,20 20,30 30) #check DELETE stmt with Where clause and a constant predicate DELETE FROM tab Where c8=c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'))); +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x07\x00\x00\x00\x02\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF0?\x00\x00\x00\x00\x00\x00\xF' #check the data, should 0 SELECT COUNT(*) FROM tab; COUNT(*) @@ -596,16 +576,29 @@ COUNT(ST_AsText(g)) SELECT SUM(ST_AsText(g)) FROM gis_point; SUM(ST_AsText(g)) 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'POINT(10 10)' +Warning 1292 Truncated incorrect DOUBLE value: 'POINT(20 10)' +Warning 1292 Truncated incorrect DOUBLE value: 'POINT(20 20)' +Warning 1292 Truncated incorrect DOUBLE value: 'POINT(10 20)' SELECT SUM(ST_AsText(g)) FROM gis_line; SUM(ST_AsText(g)) 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'LINESTRING(0 0,0 10,10 0)' +Warning 1292 Truncated incorrect DOUBLE value: 'LINESTRING(10 10,20 10,20 20,10 20,10 10)' +Warning 1292 Truncated incorrect DOUBLE value: 'LINESTRING(10 10,40 10)' SELECT AVG(ST_AsText(g)) FROM gis_polygon; AVG(ST_AsText(g)) 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'POLYGON((10 10,20 10,20 20,10 20,10 10))' +Warning 1292 Truncated incorrect DOUBLE value: 'POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))' +Warning 1292 Truncated incorrect DOUBLE value: 'POLYGON((0 0,30 0,30 30,0 0))' #here it show some string value no meaning SELECT MAX(ST_AsText(g)) FROM gis_multi_point; MAX(ST_AsText(g)) -MULTIPOINT((3 6),(4 10)) +MULTIPOINT(3 6,4 10) #here it show some string value no meaning SELECT MIN(ST_AsText(g)) FROM gis_multi_line; MIN(ST_AsText(g)) @@ -613,12 +606,39 @@ MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) SELECT STD(ST_AsText(g)) FROM gis_multi_polygon; STD(ST_AsText(g)) 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))' +Warning 1292 Truncated incorrect DOUBLE value: 'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))' +Warning 1292 Truncated incorrect DOUBLE value: 'MULTIPOLYGON(((0 3,3 3,3 0,0 3)))' SELECT COUNT(ST_AsText(g)) FROM gis_geometrycollection; COUNT(ST_AsText(g)) 3 SELECT AVG(ST_AsText(g)) FROM gis_geometry; AVG(ST_AsText(g)) 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'POINT(10 10)' +Warning 1292 Truncated incorrect DOUBLE value: 'POINT(20 10)' +Warning 1292 Truncated incorrect DOUBLE value: 'POINT(20 20)' +Warning 1292 Truncated incorrect DOUBLE value: 'POINT(10 20)' +Warning 1292 Truncated incorrect DOUBLE value: 'LINESTRING(0 0,0 10,10 0)' +Warning 1292 Truncated incorrect DOUBLE value: 'LINESTRING(10 10,20 10,20 20,10 20,10 10)' +Warning 1292 Truncated incorrect DOUBLE value: 'LINESTRING(10 10,40 10)' +Warning 1292 Truncated incorrect DOUBLE value: 'POLYGON((10 10,20 10,20 20,10 20,10 10))' +Warning 1292 Truncated incorrect DOUBLE value: 'POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))' +Warning 1292 Truncated incorrect DOUBLE value: 'POLYGON((0 0,30 0,30 30,0 0))' +Warning 1292 Truncated incorrect DOUBLE value: 'MULTIPOINT(0 0,10 10,10 20,20 20)' +Warning 1292 Truncated incorrect DOUBLE value: 'MULTIPOINT(1 1,11 11,11 21,21 21)' +Warning 1292 Truncated incorrect DOUBLE value: 'MULTIPOINT(3 6,4 10)' +Warning 1292 Truncated incorrect DOUBLE value: 'MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))' +Warning 1292 Truncated incorrect DOUBLE value: 'MULTILINESTRING((10 48,10 21,10 0))' +Warning 1292 Truncated incorrect DOUBLE value: 'MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))' +Warning 1292 Truncated incorrect DOUBLE value: 'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))' +Warning 1292 Truncated incorrect DOUBLE value: 'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))' +Warning 1292 Truncated incorrect DOUBLE value: 'MULTIPOLYGON(((0 3,3 3,3 0,0 3)))' +Warning 1292 Truncated incorrect DOUBLE value: 'GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))' +Warning 1292 Truncated incorrect DOUBLE value: 'GEOMETRYCOLLECTION(POINT(10 10),LINESTRING(10 10,20 20))' +Warning 1292 Truncated incorrect DOUBLE value: 'GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))' #check Datatypes with compression tables CREATE TABLE tab3(c1 POINT,c2 LINESTRING,c3 POLYGON,C4 MULTIPOINT,c5 MULTILINESTRING , c6 MULTIPOLYGON,c7 GEOMETRYCOLLECTION ,c8 GEOMETRY) ENGINE=InnoDB @@ -684,62 +704,40 @@ CREATE UNIQUE INDEX idx2 on tab3(c8(5) ASC) ; #check equality predicate on the index columns EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 WHERE c2=ST_LineFromText('LINESTRING(10 10,20 20,30 30)'); -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE tab3 NULL ref idx1 idx1 8 const # 100.00 Using where -Warnings: -Note 1003 /* select#1 */ select st_astext(`test`.`tab3`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab3`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab3`.`c8`) AS `ST_AsText(c8)` from `test`.`tab3` where (`test`.`tab3`.`c2` = (st_geometryfromtext('LINESTRING(10 10,20 20,30 30)'))) +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab3 ref idx1 idx1 8 const 1 # #check index with WKB function EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 WHERE c2=ST_LineStringFromWKB(ST_AsWKB(ST_LineFromText('LINESTRING(10 10,20 20,30 30)'))); -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE tab3 NULL ref idx1 idx1 8 const # 100.00 Using where -Warnings: -Note 1003 /* select#1 */ select st_astext(`test`.`tab3`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab3`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab3`.`c8`) AS `ST_AsText(c8)` from `test`.`tab3` where (`test`.`tab3`.`c2` = (st_geometryfromwkb(st_aswkb(st_geometryfromtext('LINESTRING(10 10,20 20,30 30)'))))) +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab3 ref idx1 idx1 8 const 1 # #check index with WKT function EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 WHERE c3=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'); -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE tab3 NULL ref idx3 idx3 8 const # 100.00 Using where -Warnings: -Note 1003 /* select#1 */ select st_astext(`test`.`tab3`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab3`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab3`.`c8`) AS `ST_AsText(c8)` from `test`.`tab3` where (`test`.`tab3`.`c3` = (st_geometryfromtext('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'))) +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab3 ref idx3 idx3 8 const 1 # #check index with WKB function EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 WHERE c3=ST_PolyFromWKB(ST_AsWkB(ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'))); -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE tab3 NULL ref idx3 idx3 8 const # 100.00 Using where -Warnings: -Note 1003 /* select#1 */ select st_astext(`test`.`tab3`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab3`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab3`.`c8`) AS `ST_AsText(c8)` from `test`.`tab3` where (`test`.`tab3`.`c3` = (st_geometryfromwkb(st_aswkb(st_geometryfromtext('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'))))) +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab3 ref idx3 idx3 8 const 1 # #check index with WKT function EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 WHERE c8=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'); -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE tab3 NULL const idx2 idx2 8 const # 100.00 NULL -Warnings: -Note 1003 /* select#1 */ select st_astext(' +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab3 const idx2 idx2 8 const 1 # #check index with WKB function EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'))); -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE tab3 NULL const idx2 idx2 8 const # 100.00 NULL -Warnings: -Note 1003 /* select#1 */ select st_astext(' -#check range predicate on the index columns -EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 -WHERE c2>=ST_LineFromText('LINESTRING(10 10,20 20,30 30)'); -ERROR HY000: Incorrect arguments to >= -EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 -WHERE c3>=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'); -ERROR HY000: Incorrect arguments to >= -EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 -WHERE c8>=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'); -ERROR HY000: Incorrect arguments to >= +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab3 const idx2 idx2 8 const 1 # #check index with DELETE operation EXPLAIN DELETE FROM tab3 WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'))); -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 DELETE tab3 NULL range idx2 idx2 8 const # 100.00 Using where +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab3 range idx2 idx2 8 NULL 1 # #check the spatial values SELECT ST_AsText(c1) FROM tab3; ST_AsText(c1) @@ -752,7 +750,7 @@ ST_AsText(c3) POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10)) SELECT ST_AsText(c4) FROM tab3; ST_AsText(c4) -MULTIPOINT((0 0),(5 5),(10 10),(20 20)) +MULTIPOINT(0 0,5 5,10 10,20 20) SELECT ST_AsText(c5) FROM tab3; ST_AsText(c5) MULTILINESTRING((1 1,2 2,3 3),(10 10,20 20,30 30)) @@ -786,17 +784,13 @@ tab3 CREATE TABLE `tab3` ( #check index with WKB function EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 WHERE c2=ST_LineStringFromWKB(ST_AsWKB(ST_LineFromText('LINESTRING(10 10,20 20,30 30)'))); -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE tab3 NULL ref idx1 idx1 8 const # 100.00 Using where -Warnings: -Note 1003 /* select#1 */ select st_astext(`test`.`tab3`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab3`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab3`.`c8`) AS `ST_AsText(c8)` from `test`.`tab3` where (`test`.`tab3`.`c2` = (st_geometryfromwkb(st_aswkb(st_geometryfromtext('LINESTRING(10 10,20 20,30 30)'))))) +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab3 ref idx1 idx1 8 const 1 # #check index with WKT function EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 WHERE c3=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'); -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE tab3 NULL ref idx3 idx3 8 const # 100.00 Using where -Warnings: -Note 1003 /* select#1 */ select st_astext(`test`.`tab3`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab3`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab3`.`c8`) AS `ST_AsText(c8)` from `test`.`tab3` where (`test`.`tab3`.`c3` = (st_geometryfromtext('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'))) +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab3 ref idx3 idx3 8 const 1 # #check the Geometry property functions SELECT fid, ST_Dimension(g) FROM gis_geometry; fid ST_Dimension(g) @@ -872,13 +866,13 @@ fid ST_IsEmpty(g) 122 0 SELECT fid, ST_AsText(ST_Envelope(g)) FROM gis_geometry; fid ST_AsText(ST_Envelope(g)) -101 POINT(10 10) -102 POINT(20 10) -103 POINT(20 20) -104 POINT(10 20) +101 POLYGON((10 10,10 10,10 10,10 10,10 10)) +102 POLYGON((20 10,20 10,20 10,20 10,20 10)) +103 POLYGON((20 20,20 20,20 20,20 20,20 20)) +104 POLYGON((10 20,10 20,10 20,10 20,10 20)) 105 POLYGON((0 0,10 0,10 10,0 10,0 0)) 106 POLYGON((10 10,20 10,20 20,10 20,10 10)) -107 LINESTRING(10 10,40 10) +107 POLYGON((10 10,40 10,40 10,10 10,10 10)) 108 POLYGON((10 10,20 10,20 20,10 20,10 10)) 109 POLYGON((0 0,50 0,50 50,0 50,0 0)) 110 POLYGON((0 0,30 0,30 30,0 30,0 0)) @@ -886,7 +880,7 @@ fid ST_AsText(ST_Envelope(g)) 112 POLYGON((1 1,21 1,21 21,1 21,1 1)) 113 POLYGON((3 6,4 6,4 10,3 10,3 6)) 114 POLYGON((10 0,16 0,16 48,10 48,10 0)) -115 LINESTRING(10 0,10 48) +115 POLYGON((10 0,10 0,10 48,10 48,10 0)) 116 POLYGON((1 2,21 2,21 8,1 8,1 2)) 117 POLYGON((28 0,84 0,84 42,28 42,28 0)) 118 POLYGON((28 0,84 0,84 42,28 42,28 0)) @@ -895,11 +889,10 @@ fid ST_AsText(ST_Envelope(g)) 121 POLYGON((10 10,20 10,20 20,10 20,10 10)) 122 POLYGON((3 6,44 6,44 9,3 9,3 6)) explain extended select ST_Dimension(g), ST_GeometryType(g), ST_IsEmpty(g), ST_AsText(ST_Envelope(g)) from gis_geometry; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE gis_geometry NULL ALL NULL NULL NULL NULL # 100.00 NULL +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 22 # Warnings: -Warning 1681 'EXTENDED' is deprecated and will be removed in a future release. -Note 1003 /* select#1 */ select st_dimension(`test`.`gis_geometry`.`g`) AS `ST_Dimension(g)`,st_geometrytype(`test`.`gis_geometry`.`g`) AS `ST_GeometryType(g)`,st_isempty(`test`.`gis_geometry`.`g`) AS `ST_IsEmpty(g)`,st_astext(st_envelope(`test`.`gis_geometry`.`g`)) AS `ST_AsText(ST_Envelope(g))` from `test`.`gis_geometry` +Note 1003 select st_dimension(`test`.`gis_geometry`.`g`) AS `ST_Dimension(g)`,st_geometrytype(`test`.`gis_geometry`.`g`) AS `ST_GeometryType(g)`,st_isempty(`test`.`gis_geometry`.`g`) AS `ST_IsEmpty(g)`,st_astext(st_envelope(`test`.`gis_geometry`.`g`)) AS `ST_AsText(ST_Envelope(g))` from `test`.`gis_geometry` #check Geometry point functions SELECT fid, ST_X(g) FROM gis_point; fid ST_X(g) @@ -914,11 +907,10 @@ fid ST_Y(g) 103 20 104 20 explain extended select ST_X(g),ST_Y(g) FROM gis_point; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE gis_point NULL ALL NULL NULL NULL NULL # 100.00 NULL +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 # Warnings: -Warning 1681 'EXTENDED' is deprecated and will be removed in a future release. -Note 1003 /* select#1 */ select st_x(`test`.`gis_point`.`g`) AS `ST_X(g)`,st_y(`test`.`gis_point`.`g`) AS `ST_Y(g)` from `test`.`gis_point` +Note 1003 select st_x(`test`.`gis_point`.`g`) AS `ST_X(g)`,st_y(`test`.`gis_point`.`g`) AS `ST_Y(g)` from `test`.`gis_point` SELECT fid, ST_AsText(ST_StartPoint(g)) FROM gis_line; fid ST_AsText(ST_StartPoint(g)) 105 POINT(0 0) @@ -951,11 +943,10 @@ fid ST_IsClosed(g) 107 0 explain extended select ST_AsText(ST_StartPoint(g)),ST_AsText(ST_EndPoint(g)), ST_Length(g),ST_NumPoints(g),ST_AsText(ST_PointN(g, 2)),ST_IsClosed(g) FROM gis_line; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE gis_line NULL ALL NULL NULL NULL NULL # 100.00 NULL +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 # Warnings: -Warning 1681 'EXTENDED' is deprecated and will be removed in a future release. -Note 1003 /* select#1 */ select st_astext(st_startpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_StartPoint(g))`,st_astext(st_endpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_EndPoint(g))`,st_length(`test`.`gis_line`.`g`) AS `ST_Length(g)`,st_numpoints(`test`.`gis_line`.`g`) AS `ST_NumPoints(g)`,st_astext(st_pointn(`test`.`gis_line`.`g`,2)) AS `ST_AsText(ST_PointN(g, 2))`,st_isclosed(`test`.`gis_line`.`g`) AS `ST_IsClosed(g)` from `test`.`gis_line` +Note 1003 select st_astext(st_startpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_StartPoint(g))`,st_astext(st_endpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_EndPoint(g))`,st_length(`test`.`gis_line`.`g`) AS `ST_Length(g)`,st_numpoints(`test`.`gis_line`.`g`) AS `ST_NumPoints(g)`,st_astext(st_pointn(`test`.`gis_line`.`g`,2)) AS `ST_AsText(ST_PointN(g, 2))`,st_isclosed(`test`.`gis_line`.`g`) AS `ST_IsClosed(g)` from `test`.`gis_line` SELECT fid, ST_AsText(ST_Centroid(g)) FROM gis_polygon; fid ST_AsText(ST_Centroid(g)) 108 POINT(15 15) @@ -983,11 +974,10 @@ fid ST_AsText(ST_InteriorRingN(g, 1)) 110 NULL explain extended select ST_AsText(ST_Centroid(g)),ST_Area(g),ST_AsText(ST_ExteriorRing(g)), ST_NumInteriorRings(g),ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE gis_polygon NULL ALL NULL NULL NULL NULL # 100.00 NULL +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 # Warnings: -Warning 1681 'EXTENDED' is deprecated and will be removed in a future release. -Note 1003 /* select#1 */ select st_astext(st_centroid(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_Centroid(g))`,st_area(`test`.`gis_polygon`.`g`) AS `ST_Area(g)`,st_astext(st_exteriorring(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_ExteriorRing(g))`,st_numinteriorrings(`test`.`gis_polygon`.`g`) AS `ST_NumInteriorRings(g)`,st_astext(st_interiorringn(`test`.`gis_polygon`.`g`,1)) AS `ST_AsText(ST_InteriorRingN(g, 1))` from `test`.`gis_polygon` +Note 1003 select st_astext(st_centroid(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_Centroid(g))`,st_area(`test`.`gis_polygon`.`g`) AS `ST_Area(g)`,st_astext(st_exteriorring(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_ExteriorRing(g))`,st_numinteriorrings(`test`.`gis_polygon`.`g`) AS `ST_NumInteriorRings(g)`,st_astext(st_interiorringn(`test`.`gis_polygon`.`g`,1)) AS `ST_AsText(ST_InteriorRingN(g, 1))` from `test`.`gis_polygon` SELECT fid, ST_IsClosed(g) FROM gis_multi_line; fid ST_IsClosed(g) 114 0 @@ -995,8 +985,8 @@ fid ST_IsClosed(g) 116 0 SELECT fid, ST_AsText(ST_Centroid(g)) FROM gis_multi_polygon; fid ST_AsText(ST_Centroid(g)) -117 POINT(57.98031067576927 17.854754130800437) -118 POINT(57.98031067576927 17.854754130800437) +117 POINT(57.98031067576927 17.854754130800433) +118 POINT(57.98031067576927 17.854754130800433) 119 POINT(2 2) SELECT fid, ST_Area(g) FROM gis_multi_polygon; fid ST_Area(g) @@ -1024,11 +1014,10 @@ fid ST_NumGeometries(g) 121 2 122 2 explain extended SELECT fid, ST_NumGeometries(g) from gis_multi_point; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE gis_multi_point NULL ALL NULL NULL NULL NULL # 100.00 NULL +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 # Warnings: -Warning 1681 'EXTENDED' is deprecated and will be removed in a future release. -Note 1003 /* select#1 */ select `test`.`gis_multi_point`.`fid` AS `fid`,st_numgeometries(`test`.`gis_multi_point`.`g`) AS `ST_NumGeometries(g)` from `test`.`gis_multi_point` +Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_numgeometries(`test`.`gis_multi_point`.`g`) AS `ST_NumGeometries(g)` from `test`.`gis_multi_point` SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point; fid ST_AsText(ST_GeometryN(g, 2)) 111 POINT(10 10) @@ -1055,11 +1044,10 @@ fid ST_AsText(ST_GeometryN(g, 1)) 121 POINT(10 10) 122 POINT(44 6) explain extended SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE gis_multi_point NULL ALL NULL NULL NULL NULL # 100.00 NULL +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 # Warnings: -Warning 1681 'EXTENDED' is deprecated and will be removed in a future release. -Note 1003 /* select#1 */ select `test`.`gis_multi_point`.`fid` AS `fid`,st_astext(st_geometryn(`test`.`gis_multi_point`.`g`,2)) AS `ST_AsText(ST_GeometryN(g, 2))` from `test`.`gis_multi_point` +Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_astext(st_geometryn(`test`.`gis_multi_point`.`g`,2)) AS `ST_AsText(ST_GeometryN(g, 2))` from `test`.`gis_multi_point` SELECT g1.fid as first, g2.fid as second, MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g) as o, MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t, @@ -1067,9 +1055,9 @@ MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; first second w c o e d t i r 120 120 1 1 0 1 0 0 1 0 -120 121 0 0 0 0 0 1 1 0 +120 121 0 0 0 0 0 1 1 1 120 122 0 0 1 0 0 0 1 0 -121 120 0 0 0 0 0 1 1 0 +121 120 0 0 0 0 0 1 1 1 121 121 1 1 0 1 0 0 1 0 121 122 0 0 0 0 1 0 0 0 122 120 0 0 1 0 0 0 1 0 @@ -1080,12 +1068,11 @@ MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t, MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE g1 NULL ALL NULL NULL NULL NULL # 100.00 Using temporary; Using filesort -1 SIMPLE g2 NULL ALL NULL NULL NULL NULL # 100.00 Using join buffer (Block Nested Loop) +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE g1 ALL NULL NULL NULL NULL 3 # Using temporary; Using filesort +1 SIMPLE g2 ALL NULL NULL NULL NULL 3 # Using join buffer (flat, BNL join) Warnings: -Warning 1681 'EXTENDED' is deprecated and will be removed in a future release. -Note 1003 /* select#1 */ select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,mbrwithin(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,mbrcontains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,mbroverlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,mbrequals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,mbrdisjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,st_touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,mbrintersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,st_crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `first`,`second` +Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,mbrwithin(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,mbrcontains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,mbroverlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,mbrequals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,mbrdisjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,st_touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,mbrintersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,st_crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid` # check support of Foreign Key constraint CREATE TABLE parent (id GEOMETRY NOT NULL,PRIMARY KEY (id(10))) ENGINE=INNODB; CREATE TABLE child (id GEOMETRY, parent_id GEOMETRY, @@ -1093,7 +1080,7 @@ INDEX par_ind (parent_id(10)), FOREIGN KEY (parent_id(10)) REFERENCES parent(id) ON DELETE CASCADE ) ENGINE=INNODB; -ERROR HY000: Cannot add foreign key constraint +ERROR HY000: Can't create table `test`.`child` (errno: 150 "Foreign key constraint is incorrectly formed") #check partition table support CREATE TABLE emp2( id GEOMETRY NOT NULL, diff --git a/mysql-test/suite/innodb_gis/r/gis_split_inf.result b/mysql-test/suite/innodb_gis/r/gis_split_inf.result index 624c982b553..9e7bf69c0d0 100644 --- a/mysql-test/suite/innodb_gis/r/gis_split_inf.result +++ b/mysql-test/suite/innodb_gis/r/gis_split_inf.result @@ -1,18 +1,16 @@ create table t1(a geometrycollection not null,spatial key(a))engine=innodb; insert into t1(a) values( geometrycollection(multipolygon(polygon(linestring(point(-14,98), point(-14,98)), linestring(point(-97,64), point(-70,99), point(-97,64)), linestring(point(143851215403059150000000000000000000000.000000,13040009882500140000000000000000000000.000000), point(-73,85), point(-88,-29)))), multipolygon(polygon(linestring(point(41,95), point(4294967298,2050)), linestring(point(-61,85), point(-75,93), point(14,-2), point(1,84), point(-61,85)), linestring(point(-62,52), point(39,5), point(-18,12), point(-62,52))), polygon(linestring(point(-77,1), point(66,61), point(-77,1)), linestring(point(18446744073709551615,1125899906842622), point(-72,49), point(24,-66), point(82,73), point(68,22))), polygon(linestring(point(1048576,17179869181), point(-18,95), point(-90,-3), point(-33,82), point(20,-85)), linestring(point(-43,-97), point(-7,-3), point(39,-82), point(-65,-58), point(-43,-97)), linestring(point(44,-34), point(-69,58), point(44,-34)), linestring(point(57,-13), point(-17,74), point(57,-13)), linestring(point(3,71), point(-58,81), point(3,71)), linestring(point(9,25), point(77,-71), point(8388607,67108864), point(46,46), point(9,25)), linestring(point(98,-82), point(98,-82))))) ) ; -ERROR 22023: Invalid GIS data provided to function polygon. +Got one of the listed errors insert into t1(a) values( geometrycollection(multilinestring(linestring(point(39,-60), point(-62,-11), point(-24,35), point(54,1)), linestring(point(-4,69), point(-22,-64), point(1.694824e+308,5.688896e+307), point(-33,-58), point(-64,-80), point(-15,-44), point(40,54)), linestring(point(-86,-54), point(11,41), point(-46,-38), point(-21,-8), point(10,70), point(-81,22), point(-46,-100)), linestring(point(-30,-48), point(50,58), point(-53,92), point(10,41), point(-46,-8)), linestring(point(-65,34), point(-92,93), point(-33,-74), point(75,-28)), linestring(point(25,-55), point(22,-10), point(-42,0), point(-86,-59), point(2,-37), point(63,-44), point(-55,-22)), linestring(point(28,0), point(-94,99), point(-32,-86)), linestring(point(9,-12), point(16,9), point(80,-73)), linestring(point(6,-55), point(83,-4)), linestring(point(-15,21), point(144115188075855876,16777212), point(-85,-31), point(-90,-50)), linestring(point(-33,33), point(21,90), point(-89,32)), linestring(point(16,24), point(73,-13), point(25,-48), point(71,52), point(-54,-78), point(-84,59), point(53,29)), linestring(point(-15,-81), point(83,43), point(-71,33), point(-8,0), point(84,-54), point(-35,38), point(-10,-50)), linestring(point(38,-50), point(20,-2), point(-57,-92)), linestring(point(5,-93), point(231601833467477080000000000000000000000.000000,51914987457169239000000000000000000000.000000), point(-94,62))), point(2,0)) ) ; insert into t1(a) values( geometrycollection(multilinestring(linestring(point(80,-15), point(65,-57), point(-59,16), point(22,-67)), linestring(point(20,-55), point(-38,-64), point(19,-53), point(-63,-36), point(56,-37)), linestring(point(27,-8), point(-85,-75), point(4398046511106,2251799813685245)), linestring(point(45,32), point(-79,46))), multilinestring(linestring(point(8,-4), point(40,-38), point(100,95), point(5,-80), point(82,88)), linestring(point(-14,30), point(-94,51), point(-16,-29), point(37,-97), point(-26,92)), linestring(point(32,34), point(83,-23), point(-55,57), point(-15,90), point(32,-50), point(-20,-73), point(77,28)), linestring(point(4,88), point(87,74), point(-67,-58)), linestring(point(5.660747e+307,6.385657e+307), point(-58,-15), point(1.172095e+308,1.448533e+308)), linestring(point(-21,-37), point(-52,79), point(-16,-76), point(-65,-94), point(36,7), point(37,74), point(100,-57)), linestring(point(-23,-82), point(-73,23), point(18,-34)), linestring(point(20,-51), point(93,62), point(-65,84)), linestring(point(-48,31), point(-69,-96)), linestring(point(-5,78), point(10,-99), point(36,-33)), linestring(point(-84,55), point(96,1), point(-98,-29), point(-15,81), point(-27,-6), point(58,-32), point(54,-16)), linestring(point(2,5), point(2199023255553,8192)), linestring(point(12,-78), point(-97,-83)), linestring(point(-74,79), point(35,-56), point(50,95)), linestring(point(28,16), point(-39,-40), point(48,-3)), linestring(point(2199023255550,-65539), point(62,-25), point(94,-62)), linestring(point(-74,83), point(-18,75), point(91,17), point(-11,-48), point(30,100)), linestring(point(57,-13), point(88,-45)), linestring(point(20,-64), point(-37,13), point(20,35))), point(-3,-4)) ) ; insert into t1(a) values( geometrycollection(multipolygon(polygon(linestring(point(-34,19), point(-25,92), point(61921390294166805000000000000000000000.000000,319674749161701840000000000000000000000.000000), point(56,50), point(-34,19)), linestring(point(-26,-58), point(99,-50), point(34,-20), point(-26,-58)), linestring(point(-42,45), point(-63,-7), point(5,-89), point(-97,36), point(-42,45)), linestring(point(94,11), point(-71,4), point(94,11)), linestring(point(16,25), point(4,-33), point(-45,-33), point(-64,-77), point(16,25)), linestring(point(19,45), point(36,45), point(-83,-96), point(19,45)), linestring(point(85,-31), point(-87,52), point(85,-31))), polygon(linestring(point(55,-88), point(63,-12), point(55,-88)), linestring(point(-49,10), point(-49,10)), linestring(point(-51,-32), point(-51,-32)))), multipolygon(polygon(linestring(point(-21,-8), point(66,-58), point(100,-27), point(-21,-8)), linestring(point(-29,-13), point(-29,-13))), polygon(linestring(point(91307574660224730000000000000000000000.000000,101214152547755520000000000000000000000.000000), point(89,64), point(77,87), point(66,29), point(-71,-53)), linestring(point(38,-78), point(-43,-90), point(37,20), point(81,65), point(38,-78))), polygon(linestring(point(51,0), point(-62,8), point(-11,22), point(51,0)), linestring(point(-4,-44), point(6,82), point(-19,-90), point(131,32)))), point(-4,-7)) ) ; -ERROR 22023: Invalid GIS data provided to function polygon. +Got one of the listed errors insert into t1(a) values( geometrycollection(point(10,9), linestring(point(2305843009213693955,-1125899906842621), point(78,15)), multipoint(point(-1,3), point(4,-6))) ) ; insert into t1(a) values( geometrycollection(polygon(linestring(point(0,13), point(-12,5), point(0,13)), linestring(point(11,-2), point(6,6), point(20,-14), point(-3,-10), point(1.330588e+308,2.666476e+307)), linestring(point(16382,67), point(7,4)), linestring(point(2,7), point(-14,15), point(2,7)), linestring(point(-14,12), point(-8,-8), point(-17,-2), point(-14,12)), linestring(point(-20,-10), point(-8,-13), point(-19,-17), point(13,-3), point(-20,-10)), linestring(point(-5,13), point(7,-9), point(6,8), point(-5,13))), linestring(point(-87,19), point(-64,51), point(-16,12)), multipoint(point(-1,-10), point(2,-10), point(3.670354e+307,2.501459e+307))) ) ; -ERROR 22023: Invalid GIS data provided to function polygon. -insert into t1(a) values( geometrycollection(multipoint(point(-3,7), point(4,-3), point(-6,-2), point(-9,1)), polygon(linestring(point(-17,-5), point(2,-8), point(-6,9), point(-9,19), point(-17,-5)), linestring(point(10,-1), point(15,-7), point(-13,6), point(10,-1))), multipolygon(polygon(linestring(point(69,-69), point(-90,-64), point(-17,4), point(47,-73), point(69,-69)), linestring(point(-35,-77), point(-35,-77)), linestring(point(95,-76), point(1.636688e+308,1.828723e+307), point(68719476740,536870916), point(95,-76)), linestring(point(-26,-85), point(-26,-85)), linestring(point(-53,57), point(-53,57)), linestring(point(-98,-64), point(79,-57), point(-98,-64)), linestring(point(-91,59), point(16,0), point(73,97), point(-35,-70), point(-91,59))))) ) ; -ERROR 22023: Invalid GIS data provided to function polygon. +Got one of the listed errors insert into t1(a) values( geometrycollection(linestring(point(85,-29), point(15,84), point(39,-92), point(-99,19)), multilinestring(linestring(point(63,10), point(-47,95), point(10,-49), point(16,-65), point(-98,40), point(25,44), point(-55,-92)), linestring(point(5.266810e+307,6.648813e+307), point(47,33), point(-15,-13), point(-92,-58), point(36,73)), linestring(point(77,-56), point(-53,-10), point(-28,76), point(-51,6), point(51,-31), point(-95,81), point(92,26)), linestring(point(-91,7), point(58,53)), linestring(point(18,5), point(18,40), point(71,89), point(7.898707e+307,1.202585e+308), point(53,100)), linestring(point(-60,-18), point(-10,-31), point(-6,-25), point(-57,-95), point(16,77)))) ) ; insert into t1(a) values( geometrycollection(polygon(linestring(point(-9,0), point(-17,-15), point(-9,0)), linestring(point(-11,1), point(18,12), point(15,3), point(7,0), point(-11,1)), linestring(point(19,5), point(19,5)), linestring(point(17,-11), point(8,4), point(17,-11)), linestring(point(14914539334033432000000000000000000000.000000,127247994336690690000000000000000000000.000000), point(-14,-7), point(13,-2))), point(-4,-7), polygon(linestring(point(-18,9), point(11,-1), point(-18,9)), linestring(point(9,-3), point(9,-3)), linestring(point(-7,-9), point(9,-11), point(11,14), point(1.663324e+308,1.572127e+308)), linestring(point(-15,4), point(18,12), point(7,2), point(-15,4)), linestring(point(-15,-18), point(-20,-15), point(1152921504606846972,34359738370))), polygon(linestring(point(-5,-19), point(-11,11), point(10,5), point(-7,13), point(-5,-19)), linestring(point(-8,-6), point(-4,16), point(-8,-6)), linestring(point(-6,-10), point(3,-12), point(-6,-10)), linestring(point(-16,1), point(20,-12), point(-16,1)), linestring(point(-8,5), point(-20,-4), point(4,1), point(-6,-6), point(-8,5)), linestring(point(-8,-11), point(-5,-14), point(-8,-11)), linestring(point(3,-16), point(-15,-13), point(1.166708e+308,1.901147e+307), point(-8,6), point(3,-16))), point(0,-5)) ) ; -ERROR 22023: Invalid GIS data provided to function polygon. +Got one of the listed errors insert into t1(a) values( geometrycollection(linestring(point(-33,99), point(99,-87), point(38,-79), point(33,-39), point(-91,-8), point(46,-87))) ) ; insert into t1 select * from t1; insert into t1 select * from t1; diff --git a/mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result b/mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result index 2450da8a811..82e7cb84275 100644 --- a/mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result +++ b/mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result @@ -1576,13 +1576,13 @@ INSERT INTO t1 VALUES(GeomFromText('LINESTRING(2 2, 3 3)')); SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)')); COUNT(*) 1 -SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l); +SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0.5 0.5)'), l); COUNT(*) 1 SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)')); COUNT(*) 1 -SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l); +SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0.5 0.5)'), l); COUNT(*) 1 DROP TABLE t1; diff --git a/mysql-test/suite/innodb_gis/r/point_basic.result b/mysql-test/suite/innodb_gis/r/point_basic.result index 093b63e5b02..ac9deef2cfd 100644 --- a/mysql-test/suite/innodb_gis/r/point_basic.result +++ b/mysql-test/suite/innodb_gis/r/point_basic.result @@ -144,7 +144,6 @@ POINT(1 0) POINT(10 20) POINT(0 0) POINT(10 20) SELECT ST_AsText(p), ST_AsText(p1) FROM t1 WHERE MBRWithin(p, ST_GeomFromText('POLYGON((-1 0.5, -1 -0.5, 1 -0.5, 1 0.5, -1 0.5))')); ST_AsText(p) ST_AsText(p1) -POINT(1 0) POINT(10 20) POINT(0 0) POINT(10 20) # Drop spatial keys on the table ALTER TABLE t1 DROP KEY p, DROP KEY p1; @@ -170,7 +169,6 @@ POINT(1 0) POINT(10 20) POINT(0 0) POINT(10 20) SELECT ST_AsText(p), ST_AsText(p1) FROM t1 WHERE MBRWithin(p, ST_GeomFromText('POLYGON((-1 0.5, -1 -0.5, 1 -0.5, 1 0.5, -1 0.5))')); ST_AsText(p) ST_AsText(p1) -POINT(1 0) POINT(10 20) POINT(0 0) POINT(10 20) TRUNCATE t1; ALTER TABLE t1 DROP COLUMN p, DROP COLUMN p1; @@ -203,10 +201,8 @@ SELECT ST_AsText(p), ST_AsText(p1) FROM t1 WHERE MBRWithin(p1, ST_GeomFromText(' ST_AsText(p) ST_AsText(p1) POINT(0 1) POINT(10 19) POINT(1 1) POINT(10 20) -POINT(1 0) POINT(10 21) SELECT ST_AsText(p), ST_AsText(p1) FROM t1 WHERE MBRWithin(p, ST_GeomFromText('POLYGON((-1 0.5, -1 -0.5, 1 -0.5, 1 0.5, -1 0.5))')); ST_AsText(p) ST_AsText(p1) -POINT(1 0) POINT(10 21) POINT(0 0) POINT(10 22) ALTER TABLE t1 DROP COLUMN p1, ADD COLUMN p1 POINT, CHANGE COLUMN p pp POINT AFTER p1; SELECT name, mtype, prtype, len FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS WHERE name = 'pp' OR name = 'g' OR name = 'p1'; @@ -234,14 +230,9 @@ SELECT ST_AsText(pp), ST_AsText(p1) FROM t1 WHERE p1 = ST_PointFromText('POINT(1 ST_AsText(pp) ST_AsText(p1) SELECT ST_AsText(pp), ST_AsText(p1) FROM t1 WHERE MBRWithin(p1, ST_GeomFromText('POLYGON((5 5, 20 5, 20 21, 5 21, 5 5))')) ORDER BY pp; ST_AsText(pp) ST_AsText(p1) -POINT(0 0) POINT(5 5) -POINT(0 1) POINT(5 5) -POINT(1 0) POINT(5 5) -POINT(1 1) POINT(5 5) SELECT ST_AsText(pp), ST_AsText(p1) FROM t1 WHERE MBRWithin(pp, ST_GeomFromText('POLYGON((-1 0.5, -1 -0.5, 1 -0.5, 1 0.5, -1 0.5))')) ORDER BY pp; ST_AsText(pp) ST_AsText(p1) POINT(0 0) POINT(5 5) -POINT(1 0) POINT(5 5) DROP TABLE t1; # # Test when the POINT is on B-TREE @@ -477,10 +468,8 @@ ST_AsText(p1) POINT(5 10) SELECT ST_AsText(p1) FROM gis_point1 WHERE MBRWithin(p1, @poly1); ST_AsText(p1) -POINT(2 4) POINT(3 6) POINT(4 8) -POINT(5 10) SELECT ST_AsText(p2) FROM gis_point1 WHERE ST_Contains(@poly2, p2); ST_AsText(p2) POINT(-1 -3) @@ -509,6 +498,7 @@ POINT(10 21) POINT(20.5 41) SELECT ST_AsText(p1) FROM gis_point1 WHERE ST_Contains(@mpoly, p1) AND NOT MBRWithin(p1, @mpoly); ST_AsText(p1) +POINT(3 6) # Check functions that use MBR, with line type data SELECT ST_AsText(p1) FROM gis_point1 WHERE MBRIntersects(p1, @ls1); ST_AsText(p1) @@ -558,10 +548,8 @@ POINT(4 8) POINT(5 10) SELECT ST_AsText(p1) FROM gis_point1 WHERE MBRWithin(p1, @poly1); ST_AsText(p1) -POINT(2 4) POINT(3 6) POINT(4 8) -POINT(5 10) SELECT ST_AsText(p1) FROM gis_point1 WHERE ST_Touches(p1, @poly1); ST_AsText(p1) POINT(2 4) @@ -684,10 +672,8 @@ POINT(4 8) POINT(5 10) SELECT ST_AsText(p1) FROM gis_point1 WHERE MBRWithin(p1, @poly1); ST_AsText(p1) -POINT(2 4) POINT(3 6) POINT(4 8) -POINT(5 10) SELECT ST_AsText(p1) FROM gis_point1 WHERE ST_Touches(p1, @poly1); ST_AsText(p1) POINT(2 4) @@ -769,10 +755,8 @@ ST_AsText(p1) POINT(5 10) SELECT ST_AsText(p1) FROM gis_point WHERE MBRWithin(p1, @poly1); ST_AsText(p1) -POINT(2 4) POINT(3 6) POINT(4 8) -POINT(5 10) SELECT ST_AsText(p2) FROM gis_point WHERE ST_Contains(@poly2, p2); ST_AsText(p2) POINT(-1 -3) @@ -801,6 +785,7 @@ POINT(10 21) POINT(20.5 41) SELECT ST_AsText(p1) FROM gis_point WHERE ST_Contains(@mpoly, p1) AND NOT MBRWithin(p1, @mpoly); ST_AsText(p1) +POINT(3 6) # Check functions that use MBR, with line type data SELECT ST_AsText(p1) FROM gis_point WHERE MBRIntersects(p1, @ls1); ST_AsText(p1) @@ -850,10 +835,8 @@ POINT(4 8) POINT(5 10) SELECT ST_AsText(p1) FROM gis_point WHERE MBRWithin(p1, @poly1); ST_AsText(p1) -POINT(2 4) POINT(3 6) POINT(4 8) -POINT(5 10) SELECT ST_AsText(p1) FROM gis_point WHERE ST_Touches(p1, @poly1); ST_AsText(p1) POINT(2 4) @@ -976,10 +959,8 @@ POINT(4 8) POINT(5 10) SELECT ST_AsText(p1) FROM gis_point WHERE MBRWithin(p1, @poly1); ST_AsText(p1) -POINT(2 4) POINT(3 6) POINT(4 8) -POINT(5 10) SELECT ST_AsText(p1) FROM gis_point WHERE ST_Touches(p1, @poly1); ST_AsText(p1) POINT(2 4) @@ -1091,10 +1072,8 @@ POINT(4 8) POINT(5 10) SELECT ST_AsText(p1) FROM gis_point WHERE MBRWithin(p1, @poly1); ST_AsText(p1) -POINT(2 4) POINT(3 6) POINT(4 8) -POINT(5 10) SELECT ST_AsText(p1) FROM gis_point WHERE ST_Touches(p1, @poly1); ST_AsText(p1) POINT(2 4) @@ -1217,10 +1196,8 @@ POINT(4 8) POINT(5 10) SELECT ST_AsText(p1) FROM gis_point WHERE MBRWithin(p1, @poly1); ST_AsText(p1) -POINT(2 4) POINT(3 6) POINT(4 8) -POINT(5 10) SELECT ST_AsText(p1) FROM gis_point WHERE ST_Touches(p1, @poly1); ST_AsText(p1) POINT(2 4) diff --git a/mysql-test/suite/innodb_gis/r/rtree.result b/mysql-test/suite/innodb_gis/r/rtree.result index d6604314909..de9067b428b 100644 --- a/mysql-test/suite/innodb_gis/r/rtree.result +++ b/mysql-test/suite/innodb_gis/r/rtree.result @@ -15,7 +15,6 @@ select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1); ST_astext(t1.g) POINT(1 1) POINT(1.5 1.5) -POINT(3 3) set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))'); delete from t1 where MBRWithin(t1.g, @g1); check table t1; @@ -23,6 +22,7 @@ Table Op Msg_type Msg_text test.t1 check status OK select ST_astext(t1.g) from t1; ST_astext(t1.g) +POINT(3 3) POINT(3.1 3.1) POINT(5 5) set @g1 = ST_GeomFromText('Polygon((5 5,5 5,5 5,5 5,5 5))'); @@ -32,6 +32,7 @@ Table Op Msg_type Msg_text test.t1 check status OK select ST_astext(t1.g) from t1; ST_astext(t1.g) +POINT(3 3) POINT(3.1 3.1) POINT(2 2) show indexes from t1; @@ -159,7 +160,6 @@ select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1); ST_astext(t1.g) POINT(1 1) POINT(1.5 1.5) -POINT(3 3) set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))'); delete from t1 where MBRWithin(t1.g, @g1); check table t1; @@ -167,6 +167,7 @@ Table Op Msg_type Msg_text test.t1 check status OK select ST_astext(t1.g) from t1; ST_astext(t1.g) +POINT(3 3) POINT(3.1 3.1) POINT(5 5) set @g1 = ST_GeomFromText('Polygon((5 5,5 5,5 5,5 5,5 5))'); @@ -176,6 +177,7 @@ Table Op Msg_type Msg_text test.t1 check status OK select ST_astext(t1.g) from t1; ST_astext(t1.g) +POINT(3 3) POINT(3.1 3.1) POINT(2 2) show indexes from t1; diff --git a/mysql-test/suite/innodb_gis/r/rtree_multi_pk.result b/mysql-test/suite/innodb_gis/r/rtree_multi_pk.result index 11cf8ad91c1..83fd0c3e849 100644 --- a/mysql-test/suite/innodb_gis/r/rtree_multi_pk.result +++ b/mysql-test/suite/innodb_gis/r/rtree_multi_pk.result @@ -9,10 +9,8 @@ Table Op Msg_type Msg_text test.t1 analyze status OK set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))'); explain select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1); -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 NULL ALL g NULL NULL NULL 5 100.00 Using where -Warnings: -Note 1003 /* select#1 */ select st_astext(`test`.`t1`.`g`) AS `ST_astext(t1.g)` from `test`.`t1` where mbrwithin(`test`.`t1`.`g`,(@`g1`)) +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL g NULL NULL NULL 5 Using where select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1); ST_astext(t1.g) POINT(1 1) @@ -97,18 +95,6 @@ left2 POLYGON((-2 0,-2 2,0 2,0 0,-2 0)) SELECT name, ST_AsText(square) from t1 where MBRWithin(@p, square); name ST_AsText(square) big POLYGON((0 0,0 3,3 3,3 0,0 0)) -SET @vert1 = ST_GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))'); -ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. -SET @horiz1 = ST_GeomFromText('POLYGON ((-2 0, 2 0, -2 0))'); -ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. -SET @horiz2 = ST_GeomFromText('POLYGON ((-1 0, 3 0, -1 0))'); -ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. -SET @horiz3 = ST_GeomFromText('POLYGON ((2 0, 3 0, 2 0))'); -ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. -SET @point1 = ST_GeomFromText('POLYGON ((0 0))'); -ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. -SET @point2 = ST_GeomFromText('POLYGON ((-2 0))'); -ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @vert1) GROUP BY a1.name; MBRoverlaps SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @horiz1) GROUP BY a1.name; @@ -140,7 +126,7 @@ alter table t1 drop primary key; create spatial index idx on t1(g) algorithm=inplace; create spatial index idx2 on t1(g); Warnings: -Warning 1831 Duplicate index 'idx2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index `idx2`. This is deprecated and will be disallowed in a future release alter table t1 add primary key(i), algorithm=inplace; show create table t1; Table Create Table diff --git a/mysql-test/suite/innodb_gis/r/rtree_search.result b/mysql-test/suite/innodb_gis/r/rtree_search.result index d186986156e..d8a8d209cd3 100644 --- a/mysql-test/suite/innodb_gis/r/rtree_search.result +++ b/mysql-test/suite/innodb_gis/r/rtree_search.result @@ -14,19 +14,19 @@ count(*) set @g1 = ST_GeomFromText('Polygon((0 0,0 1000,1000 1000,1000 0,0 0))'); select count(*) from t1 where MBRWithin(t1.c2, @g1); count(*) -1000 +999 set @g1 = ST_GeomFromText('Polygon((0 0,0 100,100 100,100 0,0 0))'); select count(*) from t1 where MBRWithin(t1.c2, @g1); count(*) -100 +99 set @g1 = ST_GeomFromText('Polygon((10 10,10 800,800 800,800 10,10 10))'); select count(*) from t1 where MBRWithin(t1.c2, @g1); count(*) -791 +789 set @g1 = ST_GeomFromText('Polygon((100 100,100 800,800 800,800 100,100 100))'); select count(*) from t1 where MBRWithin(t1.c2, @g1); count(*) -701 +699 set @g1 = ST_GeomFromText('Point(1 1)'); select count(*) from t1 where MBRequals(t1.c2, @g1); count(*) diff --git a/mysql-test/suite/innodb_gis/t/bug16236208.test b/mysql-test/suite/innodb_gis/t/bug16236208.test index ef2da6f2ab1..b55ab1d0fd3 100644 --- a/mysql-test/suite/innodb_gis/t/bug16236208.test +++ b/mysql-test/suite/innodb_gis/t/bug16236208.test @@ -47,7 +47,7 @@ ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')); CREATE INDEX linestring_index ON linestring(linestring_nokey(5)); ALTER TABLE linestring ADD KEY (linestring_key(5)); ---error ER_GIS_INVALID_DATA +# --error ER_GIS_INVALID_DATA SELECT ST_AsText(linestring_nokey) FROM linestring FORCE KEY ( linestring_key ) WHERE ST_CONTAINS( ST_GeomFromText('POLYGON( ( 3923 2815 , 4246 2122 , 4028 2971 , 4017 3019 , 3923 2815 ) )') , linestring_key ) AND diff --git a/mysql-test/suite/innodb_gis/t/bug16266012.test b/mysql-test/suite/innodb_gis/t/bug16266012.test index 17986998fc9..6d72e4733c0 100644 --- a/mysql-test/suite/innodb_gis/t/bug16266012.test +++ b/mysql-test/suite/innodb_gis/t/bug16266012.test @@ -6,7 +6,7 @@ --source include/have_geometry.inc --source include/not_embedded.inc --source include/have_debug.inc ---error ER_BOOST_GEOMETRY_OVERLAY_INVALID_INPUT_EXCEPTION +# --error ER_BOOST_GEOMETRY_OVERLAY_INVALID_INPUT_EXCEPTION SELECT ST_WITHIN( LINESTRINGFROMTEXT(' LINESTRING( 5 9 , 3 4 , 4 1 , 4 4 , 4 9 ) ') , ST_SYMDIFFERENCE( ST_UNION( ST_ENVELOPE( POLYGONFROMTEXT(' POLYGON( ( 3 2 , 0 6 , 2 3 , 8 0 , 4 6 , 7 2 , 3 2 ) ) ') ) , diff --git a/mysql-test/suite/innodb_gis/t/geometry.test b/mysql-test/suite/innodb_gis/t/geometry.test index 2d030f90dc9..8325cc5a27c 100644 --- a/mysql-test/suite/innodb_gis/t/geometry.test +++ b/mysql-test/suite/innodb_gis/t/geometry.test @@ -10,6 +10,7 @@ #******************************************************** --source include/have_geometry.inc --source include/have_innodb.inc +--source include/have_partition.inc SET default_storage_engine=InnoDB; SET innodb_strict_mode=OFF; @@ -162,21 +163,21 @@ EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'))); ---echo #check range predicate on the index columns ---replace_column 10 # ---error ER_WRONG_ARGUMENTS -EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab -WHERE c2>=ST_LineFromText('LINESTRING(10 10,20 20,30 30)'); - ---replace_column 10 # ---error ER_WRONG_ARGUMENTS -EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab -WHERE c3>=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'); - ---replace_column 10 # ---error ER_WRONG_ARGUMENTS -EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab -WHERE c8>=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'); +#--echo #check range predicate on the index columns +#--replace_column 10 # +#--error ER_WRONG_ARGUMENTS +#EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab +#WHERE c2>=ST_LineFromText('LINESTRING(10 10,20 20,30 30)'); +# +#--replace_column 10 # +#--error ER_WRONG_ARGUMENTS +#EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab +#WHERE c3>=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'); +# +#--replace_column 10 # +#--error ER_WRONG_ARGUMENTS +#EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab +#WHERE c8>=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'); --echo #check index with DELETE operation --replace_column 10 # @@ -518,21 +519,21 @@ EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'))); ---echo #check range predicate on the index columns ---replace_column 10 # ---error ER_WRONG_ARGUMENTS -EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 -WHERE c2>=ST_LineFromText('LINESTRING(10 10,20 20,30 30)'); +# --echo #check range predicate on the index columns +# --replace_column 10 # +# --error ER_WRONG_ARGUMENTS +# EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 +# WHERE c2>=ST_LineFromText('LINESTRING(10 10,20 20,30 30)'); +# +# --replace_column 10 # +# --error ER_WRONG_ARGUMENTS +# EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 +# WHERE c3>=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'); ---replace_column 10 # ---error ER_WRONG_ARGUMENTS -EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 -WHERE c3>=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'); - ---replace_column 10 # ---error ER_WRONG_ARGUMENTS -EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 -WHERE c8>=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'); +# --replace_column 10 # +# --error ER_WRONG_ARGUMENTS +# EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 +# WHERE c8>=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'); --echo #check index with DELETE operation --replace_column 10 # @@ -638,7 +639,7 @@ FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second --echo # check support of Foreign Key constraint CREATE TABLE parent (id GEOMETRY NOT NULL,PRIMARY KEY (id(10))) ENGINE=INNODB; ---error 1215 +--error ER_CANT_CREATE_TABLE CREATE TABLE child (id GEOMETRY, parent_id GEOMETRY, INDEX par_ind (parent_id(10)), FOREIGN KEY (parent_id(10)) REFERENCES parent(id) @@ -675,7 +676,7 @@ SELECT COUNT(*) FROM tab3; DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point; DROP TABLE gis_multi_line, gis_multi_polygon; DROP TABLE gis_geometrycollection, gis_geometry; -DROP TABLE tab,tab2,tab3,parent,emp2; +DROP TABLE tab,tab2,tab3,parent; DROP PROCEDURE geominout; DROP PROCEDURE geom_insert; DROP PROCEDURE geom_cursor; diff --git a/mysql-test/suite/innodb_gis/t/gis_split_inf.test b/mysql-test/suite/innodb_gis/t/gis_split_inf.test index e1b2d4e5947..addd2dbdbff 100644 --- a/mysql-test/suite/innodb_gis/t/gis_split_inf.test +++ b/mysql-test/suite/innodb_gis/t/gis_split_inf.test @@ -12,13 +12,14 @@ insert into t1(a) values( geometrycollection(multipolygon(polygon(linestring( insert into t1(a) values( geometrycollection(point(10,9), linestring(point(2305843009213693955,-1125899906842621), point(78,15)), multipoint(point(-1,3), point(4,-6))) ) ; --error ER_GIS_INVALID_DATA,ER_BAD_NULL_ERROR insert into t1(a) values( geometrycollection(polygon(linestring(point(0,13), point(-12,5), point(0,13)), linestring(point(11,-2), point(6,6), point(20,-14), point(-3,-10), point(1.330588e+308,2.666476e+307)), linestring(point(16382,67), point(7,4)), linestring(point(2,7), point(-14,15), point(2,7)), linestring(point(-14,12), point(-8,-8), point(-17,-2), point(-14,12)), linestring(point(-20,-10), point(-8,-13), point(-19,-17), point(13,-3), point(-20,-10)), linestring(point(-5,13), point(7,-9), point(6,8), point(-5,13))), linestring(point(-87,19), point(-64,51), point(-16,12)), multipoint(point(-1,-10), point(2,-10), point(3.670354e+307,2.501459e+307))) ) ; ---error ER_GIS_INVALID_DATA,ER_BAD_NULL_ERROR -insert into t1(a) values( geometrycollection(multipoint(point(-3,7), point(4,-3), point(-6,-2), point(-9,1)), polygon(linestring(point(-17,-5), point(2,-8), point(-6,9), point(-9,19), point(-17,-5)), linestring(point(10,-1), point(15,-7), point(-13,6), point(10,-1))), multipolygon(polygon(linestring(point(69,-69), point(-90,-64), point(-17,4), point(47,-73), point(69,-69)), linestring(point(-35,-77), point(-35,-77)), linestring(point(95,-76), point(1.636688e+308,1.828723e+307), point(68719476740,536870916), point(95,-76)), linestring(point(-26,-85), point(-26,-85)), linestring(point(-53,57), point(-53,57)), linestring(point(-98,-64), point(79,-57), point(-98,-64)), linestring(point(-91,59), point(16,0), point(73,97), point(-35,-70), point(-91,59))))) ) ; insert into t1(a) values( geometrycollection(linestring(point(85,-29), point(15,84), point(39,-92), point(-99,19)), multilinestring(linestring(point(63,10), point(-47,95), point(10,-49), point(16,-65), point(-98,40), point(25,44), point(-55,-92)), linestring(point(5.266810e+307,6.648813e+307), point(47,33), point(-15,-13), point(-92,-58), point(36,73)), linestring(point(77,-56), point(-53,-10), point(-28,76), point(-51,6), point(51,-31), point(-95,81), point(92,26)), linestring(point(-91,7), point(58,53)), linestring(point(18,5), point(18,40), point(71,89), point(7.898707e+307,1.202585e+308), point(53,100)), linestring(point(-60,-18), point(-10,-31), point(-6,-25), point(-57,-95), point(16,77)))) ) ; --error ER_GIS_INVALID_DATA,ER_BAD_NULL_ERROR insert into t1(a) values( geometrycollection(polygon(linestring(point(-9,0), point(-17,-15), point(-9,0)), linestring(point(-11,1), point(18,12), point(15,3), point(7,0), point(-11,1)), linestring(point(19,5), point(19,5)), linestring(point(17,-11), point(8,4), point(17,-11)), linestring(point(14914539334033432000000000000000000000.000000,127247994336690690000000000000000000000.000000), point(-14,-7), point(13,-2))), point(-4,-7), polygon(linestring(point(-18,9), point(11,-1), point(-18,9)), linestring(point(9,-3), point(9,-3)), linestring(point(-7,-9), point(9,-11), point(11,14), point(1.663324e+308,1.572127e+308)), linestring(point(-15,4), point(18,12), point(7,2), point(-15,4)), linestring(point(-15,-18), point(-20,-15), point(1152921504606846972,34359738370))), polygon(linestring(point(-5,-19), point(-11,11), point(10,5), point(-7,13), point(-5,-19)), linestring(point(-8,-6), point(-4,16), point(-8,-6)), linestring(point(-6,-10), point(3,-12), point(-6,-10)), linestring(point(-16,1), point(20,-12), point(-16,1)), linestring(point(-8,5), point(-20,-4), point(4,1), point(-6,-6), point(-8,5)), linestring(point(-8,-11), point(-5,-14), point(-8,-11)), linestring(point(3,-16), point(-15,-13), point(1.166708e+308,1.901147e+307), point(-8,6), point(3,-16))), point(0,-5)) ) ; insert into t1(a) values( geometrycollection(linestring(point(-33,99), point(99,-87), point(38,-79), point(33,-39), point(-91,-8), point(46,-87))) ) ; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; insert into t1 select * from t1; insert into t1 select * from t1; insert into t1 select * from t1; diff --git a/mysql-test/suite/innodb_gis/t/rtree_multi_pk.test b/mysql-test/suite/innodb_gis/t/rtree_multi_pk.test index 928b1878e69..f606e569376 100644 --- a/mysql-test/suite/innodb_gis/t/rtree_multi_pk.test +++ b/mysql-test/suite/innodb_gis/t/rtree_multi_pk.test @@ -75,19 +75,6 @@ SELECT name, ST_AsText(square) from t1 where MBRWithin(@p, square); # MBROverlaps needs a few more tests, with point and line dimensions ---error ER_GIS_INVALID_DATA -SET @vert1 = ST_GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))'); ---error ER_GIS_INVALID_DATA -SET @horiz1 = ST_GeomFromText('POLYGON ((-2 0, 2 0, -2 0))'); ---error ER_GIS_INVALID_DATA -SET @horiz2 = ST_GeomFromText('POLYGON ((-1 0, 3 0, -1 0))'); ---error ER_GIS_INVALID_DATA -SET @horiz3 = ST_GeomFromText('POLYGON ((2 0, 3 0, 2 0))'); ---error ER_GIS_INVALID_DATA -SET @point1 = ST_GeomFromText('POLYGON ((0 0))'); ---error ER_GIS_INVALID_DATA -SET @point2 = ST_GeomFromText('POLYGON ((-2 0))'); - SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @vert1) GROUP BY a1.name; SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @horiz1) GROUP BY a1.name; SELECT MBROverlaps(@horiz1, @vert1) FROM DUAL; diff --git a/mysql-test/t/gis-rtree.test b/mysql-test/t/gis-rtree.test index f1c30cba9fe..3df005068f0 100644 --- a/mysql-test/t/gis-rtree.test +++ b/mysql-test/t/gis-rtree.test @@ -964,10 +964,10 @@ INSERT INTO t1 VALUES(GeomFromText('LINESTRING(1 1, 2 2)')); INSERT INTO t1 VALUES(GeomFromText('LINESTRING(2 2, 3 3)')); SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)')); -SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l); +SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0.5 0.5)'), l); SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)')); -SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l); +SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0.5 0.5)'), l); DROP TABLE t1; diff --git a/sql/spatial.cc b/sql/spatial.cc index 7c78b0dcb71..83905fc9f3d 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -50,6 +50,98 @@ double my_double_round(double value, longlong dec, bool dec_unsigned, #define MAX_DIGITS_IN_DOUBLE MY_GCVT_MAX_FIELD_WIDTH +int MBR::within(const MBR *mbr) +{ + /* + We have to take into account the 'dimension' of + the MBR, where the dimension of a single point is 0, + the dimesion of an vertical or horizontal line is 1, + and finally the dimension of the solid rectangle is 2. + */ + + int dim1= dimension(); + int dim2= mbr->dimension(); + + DBUG_ASSERT(dim1 >= 0 && dim1 <= 2 && dim2 >= 0 && dim2 <= 2); + + /* + Either/both of the two operands can degrade to a point or a + horizontal/vertical line segment, and we have to treat such cases + separately. + */ + switch (dim1) + { + case 0: + DBUG_ASSERT(xmin == xmax && ymin == ymax); + switch (dim2) + { + case 0: + DBUG_ASSERT(mbr->xmin == mbr->xmax && mbr->ymin == mbr->ymax); + return equals(mbr); + break; + case 1: + DBUG_ASSERT((mbr->xmin == mbr->xmax && mbr->ymin != mbr->ymax) || + (mbr->ymin == mbr->ymax && mbr->xmin != mbr->xmax)); + return ((xmin > mbr->xmin && xmin < mbr->xmax && ymin == mbr->ymin) || + (ymin > mbr->ymin && ymin < mbr->ymax && xmin == mbr->xmin)); + break; + case 2: + DBUG_ASSERT(mbr->xmin != mbr->xmax && mbr->ymin != mbr->ymax); + return (xmin > mbr->xmin && xmax < mbr->xmax && + ymin > mbr->ymin && ymax < mbr->ymax); + break; + } + break; + case 1: + DBUG_ASSERT((xmin == xmax && ymin != ymax) || + (ymin == ymax && xmin != xmax)); + switch (dim2) + { + case 0: + DBUG_ASSERT(mbr->xmin == mbr->xmax && mbr->ymin == mbr->ymax); + return 0; + break; + case 1: + DBUG_ASSERT((mbr->xmin == mbr->xmax && mbr->ymin != mbr->ymax) || + (mbr->ymin == mbr->ymax && mbr->xmin != mbr->xmax)); + return ((xmin == xmax && mbr->xmin == mbr->xmax && mbr->xmin == xmin && + mbr->ymin <= ymin && mbr->ymax >= ymax) || + (ymin == ymax && mbr->ymin == mbr->ymax && mbr->ymin == ymin && + mbr->xmin <= xmin && mbr->xmax >= xmax)); + break; + case 2: + DBUG_ASSERT(mbr->xmin != mbr->xmax && mbr->ymin != mbr->ymax); + return ((xmin == xmax && xmin > mbr->xmin && xmax < mbr->xmax && + ymin >= mbr->ymin && ymax <= mbr->ymax) || + (ymin == ymax && ymin > mbr->ymin && ymax < mbr->ymax && + xmin >= mbr->xmin && xmax <= mbr->xmax)); + break; + } + break; + case 2: + DBUG_ASSERT(xmin != xmax && ymin != ymax); + switch (dim2) + { + case 0: + case 1: + return 0; + break; + case 2: + DBUG_ASSERT(mbr->xmin != mbr->xmax && mbr->ymin != mbr->ymax); + return ((mbr->xmin <= xmin) && (mbr->ymin <= ymin) && + (mbr->xmax >= xmax) && (mbr->ymax >= ymax)); + break; + + } + break; + } + + // Never reached. + DBUG_ASSERT(false); + return 0; +} + + /***************************** Gis_class_info *******************************/ String Geometry::bad_geometry_data("Bad object", &my_charset_bin); diff --git a/sql/spatial.h b/sql/spatial.h index 76dbd06fdf4..e78da6e615d 100644 --- a/sql/spatial.h +++ b/sql/spatial.h @@ -145,12 +145,7 @@ struct MBR (mbr->xmax >= xmin && mbr->xmax <= xmax))); } - int within(const MBR *mbr) - { - /* The following should be safe, even if we compare doubles */ - return ((mbr->xmin <= xmin) && (mbr->ymin <= ymin) && - (mbr->xmax >= xmax) && (mbr->ymax >= ymax)); - } + int within(const MBR *mbr); int contains(const MBR *mbr) { From e28b4b68d344391c94ab582445f26db4fd12927e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 19 Mar 2020 06:58:49 +0200 Subject: [PATCH 12/25] MDEV-14057: Fix some tests --- mysql-test/suite/innodb_gis/r/point_big.result | 18 ++++++++++++++---- .../innodb_gis/r/rtree_concurrent_srch.result | 2 +- .../suite/innodb_gis/r/rtree_split.result | 4 ++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/mysql-test/suite/innodb_gis/r/point_big.result b/mysql-test/suite/innodb_gis/r/point_big.result index de3632994a0..c471ab6adb2 100644 --- a/mysql-test/suite/innodb_gis/r/point_big.result +++ b/mysql-test/suite/innodb_gis/r/point_big.result @@ -259,10 +259,8 @@ INSERT INTO gis_point VALUES (ST_PointFromText('POINT(32.1234 64.2468)'), ST_PointFromText('POINT(-1 -1)')); 'The ORDER BY for spatial index will use filesort' EXPLAIN SELECT ST_AsText(p1), ST_AsText(p2) FROM gis_point ORDER BY p1, p2; -id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE gis_point NULL ALL NULL NULL NULL NULL # 100.00 Using filesort -Warnings: -Note 1003 /* select#1 */ select st_astext(`test`.`gis_point`.`p1`) AS `ST_AsText(p1)`,st_astext(`test`.`gis_point`.`p2`) AS `ST_AsText(p2)` from `test`.`gis_point` order by `test`.`gis_point`.`p1`,`test`.`gis_point`.`p2` +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE gis_point ALL NULL NULL NULL NULL 13 # SELECT ST_AsText(p1), ST_AsText(p2) FROM gis_point ORDER BY p1, p2; ST_AsText(p1) ST_AsText(p2) POINT(2 4) POINT(-2 -6) @@ -354,9 +352,11 @@ COUNT(*) ST_AsText(p1) 1024 POINT(4 8) SELECT COUNT(*), ST_AsText(p2) FROM gis_point WHERE ST_Contains(@poly2, p2) GROUP BY p2; COUNT(*) ST_AsText(p2) +1024 POINT(0 0) 1024 POINT(-2 -6) 1024 POINT(-3 -9) 1024 POINT(-4 -12) +1024 POINT(-5 -15) 1024 POINT(-1 -3) 1024 POINT(-1 -1) SELECT COUNT(*), ST_AsText(p2) FROM gis_point WHERE ST_Equals(p2, @p1) GROUP BY p2; @@ -368,13 +368,17 @@ COUNT(*) ST_AsText(p1) 1024 POINT(32.1234 64.2468) SELECT COUNT(*), ST_AsText(p1), ST_AsText(p2) FROM gis_point WHERE ST_Contains(@mpoly, p1) GROUP BY p1, p2; COUNT(*) ST_AsText(p1) ST_AsText(p2) +1024 POINT(3 6) POINT(-3 -9) 1024 POINT(4 8) POINT(-4 -12) 1024 POINT(5 10) POINT(-5 -15) 1024 POINT(6 12) POINT(-6 -18) 1024 POINT(7 14) POINT(-7 -21) +1024 POINT(8 16) POINT(0 0) +1024 POINT(10 21) POINT(-6 3) 1024 POINT(20.5 41) POINT(-8 4) SELECT COUNT(*), ST_AsText(p1), ST_AsText(p2) FROM gis_point WHERE ST_Contains(@mpoly, p1) AND NOT MBRWithin(p1, @mpoly) GROUP BY p1, p2; COUNT(*) ST_AsText(p1) ST_AsText(p2) +1024 POINT(3 6) POINT(-3 -9) ====================================================================== Build another new table with the same schema, will insert data from this table to the orignal one ====================================================================== @@ -522,9 +526,11 @@ COUNT(*) ST_AsText(p1) 1024 POINT(4 8) SELECT COUNT(*), ST_AsText(p2) FROM gis_point WHERE ST_Contains(@poly2, p2) GROUP BY p2; COUNT(*) ST_AsText(p2) +2 POINT(0 0) 1024 POINT(-2 -6) 1024 POINT(-3 -9) 1024 POINT(-4 -12) +1024 POINT(-5 -15) 1024 POINT(-1 -3) 1024 POINT(-1 -1) SELECT COUNT(*), ST_AsText(p2) FROM gis_point WHERE ST_Equals(p2, @p1) GROUP BY p2; @@ -536,13 +542,17 @@ COUNT(*) ST_AsText(p1) 1024 POINT(32.1234 64.2468) SELECT COUNT(*), ST_AsText(p1), ST_AsText(p2) FROM gis_point WHERE ST_Contains(@mpoly, p1) GROUP BY p1, p2; COUNT(*) ST_AsText(p1) ST_AsText(p2) +1024 POINT(3 6) POINT(-3 -9) 1024 POINT(4 8) POINT(-4 -12) 1024 POINT(5 10) POINT(-5 -15) 1024 POINT(6 12) POINT(-6 -18) 1024 POINT(7 14) POINT(-7 -21) +2 POINT(8 16) POINT(0 0) +1024 POINT(10 21) POINT(-6 3) 1024 POINT(20.5 41) POINT(-8 4) SELECT COUNT(*), ST_AsText(p1), ST_AsText(p2) FROM gis_point WHERE ST_Contains(@mpoly, p1) AND NOT MBRWithin(p1, @mpoly) GROUP BY p1, p2; COUNT(*) ST_AsText(p1) ST_AsText(p2) +1024 POINT(3 6) POINT(-3 -9) CHECK TABLE gis_point; Table Op Msg_type Msg_text test.gis_point check status OK diff --git a/mysql-test/suite/innodb_gis/r/rtree_concurrent_srch.result b/mysql-test/suite/innodb_gis/r/rtree_concurrent_srch.result index 9c5db3e06aa..f5a337ecd03 100644 --- a/mysql-test/suite/innodb_gis/r/rtree_concurrent_srch.result +++ b/mysql-test/suite/innodb_gis/r/rtree_concurrent_srch.result @@ -234,7 +234,7 @@ start transaction; set @g1 = ST_GeomFromText('Polygon((800 800, 800 1000, 1000 1000, 1000 800, 800 800))'); select count(*) from t1 where MBRwithin(t1.c2, @g1); count(*) -201 +199 connection b; CALL insert_t1(1001, 2000); set session transaction isolation level serializable; diff --git a/mysql-test/suite/innodb_gis/r/rtree_split.result b/mysql-test/suite/innodb_gis/r/rtree_split.result index 65a9ff3499f..518319ff3d6 100644 --- a/mysql-test/suite/innodb_gis/r/rtree_split.result +++ b/mysql-test/suite/innodb_gis/r/rtree_split.result @@ -79,7 +79,7 @@ count(*) set @g1 = ST_GeomFromText('Polygon((2 2,2 800,800 800,800 2,2 2))'); select count(*) from t1 where MBRWithin(t1.c2, @g1); count(*) -65536 +57344 set @g1 = ST_GeomFromText('Polygon((0 0,0 100,100 100,100 0,0 0))'); select count(*) from t1 where MBRWithin(t1.c2, @g1); count(*) @@ -87,5 +87,5 @@ count(*) set @g1 = ST_GeomFromText('Polygon((2 2,2 800,800 800,800 2,2 2))'); select count(*) from t1 where MBRWithin(t1.c2, @g1); count(*) -65536 +57344 drop table t1; From bfb5e1c3f0ba57b54f245d7cc2d1dfabaa7c4462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 19 Mar 2020 07:46:30 +0200 Subject: [PATCH 13/25] MDEV-13626: Import and adjust buffer pool resizing tests from MySQL 5.7 --- .../suite/innodb/r/buf_pool_resize_oom.result | 8 + .../r/innodb_buffer_pool_load_now.result | 46 ++++ .../r/innodb_buffer_pool_resize_debug.result | 109 ++++++++ .../suite/innodb/t/buf_pool_resize_oom.opt | 1 + .../suite/innodb/t/buf_pool_resize_oom.test | 30 +++ .../innodb/t/innodb_buffer_pool_load_now.opt | 3 + .../innodb/t/innodb_buffer_pool_load_now.test | 201 +++++++++++++++ .../t/innodb_buffer_pool_resize_debug.opt | 1 + .../t/innodb_buffer_pool_resize_debug.test | 241 ++++++++++++++++++ 9 files changed, 640 insertions(+) create mode 100644 mysql-test/suite/innodb/r/buf_pool_resize_oom.result create mode 100644 mysql-test/suite/innodb/r/innodb_buffer_pool_load_now.result create mode 100644 mysql-test/suite/innodb/r/innodb_buffer_pool_resize_debug.result create mode 100644 mysql-test/suite/innodb/t/buf_pool_resize_oom.opt create mode 100644 mysql-test/suite/innodb/t/buf_pool_resize_oom.test create mode 100644 mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.opt create mode 100644 mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test create mode 100644 mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.opt create mode 100644 mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.test diff --git a/mysql-test/suite/innodb/r/buf_pool_resize_oom.result b/mysql-test/suite/innodb/r/buf_pool_resize_oom.result new file mode 100644 index 00000000000..588be562ce4 --- /dev/null +++ b/mysql-test/suite/innodb/r/buf_pool_resize_oom.result @@ -0,0 +1,8 @@ +# +# Bug #21348684 SIGABRT DURING RESIZING THE INNODB BUFFER POOL +# ONLINE WITH MEMORY FULL CONDITION +# +call mtr.add_suppression("InnoDB: .* failed to allocate the chunk array"); +SET GLOBAL innodb_disable_resize_buffer_pool_debug=OFF; +SET GLOBAL debug_dbug='+d,buf_pool_resize_chunk_null'; +SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size + 1048576; diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_load_now.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_load_now.result new file mode 100644 index 00000000000..b2b1da92b4c --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_load_now.result @@ -0,0 +1,46 @@ +SET GLOBAL innodb_buffer_pool_dump_pct=100; +CREATE TABLE ib_bp_test +(a INT AUTO_INCREMENT, b VARCHAR(64), c TEXT, PRIMARY KEY (a), KEY (b, c(128))) +ENGINE=INNODB; +SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru +WHERE table_name LIKE '%ib_bp_test%'; +COUNT(*) +2 +SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru +WHERE table_name LIKE '%ib_bp_test%'; +COUNT(*) +{checked_valid} +SET GLOBAL innodb_buffer_pool_dump_now = ON; +SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru +WHERE table_name LIKE '%ib_bp_test%'; +COUNT(*) +0 +select count(*) from ib_bp_test where a = 1; +count(*) +1 +SET GLOBAL innodb_buffer_pool_load_now = ON; +SELECT variable_value +FROM information_schema.global_status +WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status'; +variable_value +Buffer pool(s) load completed at TIMESTAMP_NOW +SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru +WHERE table_name LIKE '%ib_bp_test%'; +COUNT(*) +{checked_valid} +call mtr.add_suppression("InnoDB: Error parsing"); +SET GLOBAL innodb_buffer_pool_load_now = ON; +# Re-write some valid pages to the dump file, make sure the space +# should be valid but all the page no should be out of bound of the file +SET GLOBAL innodb_buffer_pool_load_now = ON; +SELECT variable_value +FROM information_schema.global_status +WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status'; +variable_value +Buffer pool(s) load completed at TIMESTAMP_NOW +DROP TABLE ib_bp_test; +SET GLOBAL innodb_buffer_pool_dump_pct=default; +# +# Bug#21371070 [ERROR] INNODB: CANNOT ALLOCATE 0 BYTES: SUCCESS +# +SET GLOBAL innodb_buffer_pool_load_now = ON; diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_debug.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_debug.result new file mode 100644 index 00000000000..2b2ea233069 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_debug.result @@ -0,0 +1,109 @@ +set global innodb_file_per_table=ON; +set global innodb_thread_concurrency=20; +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connect con3,localhost,root,,; +connect con4,localhost,root,,; +connect con5,localhost,root,,; +connect con6,localhost,root,,; +connect con7,localhost,root,,; +connect con8,localhost,root,,; +create table t2 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into t2 (c1, c2) values (1, 1); +create table t3 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into t3 (c1, c2) values (1, 1); +create table t4 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into t4 (c1, c2) values (1, 1); +create table t5 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into t5 (c1, c2) values (1, 1); +create table t6 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into t6 (c1, c2) values (1, 1); +create database test2; +create table test2.t7 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into test2.t7 (c1, c2) values (1, 1); +drop table test2.t7; +connection con1; +set @save_dbug=@@global.debug_dbug; +set global debug_dbug="+d,ib_buf_pool_resize_wait_before_resize"; +set global innodb_buffer_pool_size = 12*1024*1024; +set global innodb_buffer_pool_size = 8*1024*1024; +ERROR HY000: Another buffer pool resize is already in progress. +select @@global.innodb_buffer_pool_size; +@@global.innodb_buffer_pool_size +8388608 +select @@global.innodb_adaptive_hash_index; +@@global.innodb_adaptive_hash_index +0 +set global innodb_adaptive_hash_index = ON; +select @@global.innodb_adaptive_hash_index; +@@global.innodb_adaptive_hash_index +0 +set global innodb_adaptive_hash_index = OFF; +select @@global.innodb_adaptive_hash_index; +@@global.innodb_adaptive_hash_index +0 +create table t1 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +connection con2; +analyze table t2; +connection con3; +alter table t3 algorithm=inplace, add index idx (c1); +connection con4; +alter table t4 rename to t0; +connection con5; +drop table t5; +connection con6; +alter table t6 discard tablespace; +connection con7; +drop database test2; +connection con8; +select count(*) > 0 from information_schema.innodb_buffer_page; +connection default; +set global debug_dbug=@save_dbug; +connection con1; +connection con2; +Table Op Msg_type Msg_text +test.t2 analyze status OK +connection con3; +connection con4; +connection con5; +connection con6; +connection con7; +connection con8; +count(*) > 0 +1 +connection default; +disconnect con3; +disconnect con4; +disconnect con5; +disconnect con6; +disconnect con7; +disconnect con8; +disconnect con1; +disconnect con2; +call mtr.add_suppression("\\[ERROR\\] InnoDB: buffer pool 0 : failed to allocate new memory."); +connection default; +set global debug_dbug="+d,ib_buf_chunk_init_fails"; +set global innodb_buffer_pool_size = 16*1024*1024; +set global debug_dbug=@save_dbug; +create table t8 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into t8 (c1, c2) values (1, 1); +drop table t8; +drop table t1; +drop table t2; +drop table t3; +drop table t0; +drop table t6; +# +# BUG#23590280 NO WARNING WHEN REDUCING INNODB_BUFFER_POOL_SIZE INSIZE THE FIRST CHUNK +# +SET @save_disable = @@GLOBAL.innodb_disable_background_merge; +SET GLOBAL innodb_disable_background_merge = ON; +set @old_innodb_disable_resize = @@innodb_disable_resize_buffer_pool_debug; +set global innodb_disable_resize_buffer_pool_debug = OFF; +set @before_innodb_buffer_pool_size = @@innodb_buffer_pool_size; +set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size; +set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size * 2; +set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size; +set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size; +SET GLOBAL innodb_disable_resize_buffer_pool_debug = @old_innodb_disable_resize; +SET GLOBAL innodb_disable_background_merge = @save_disable; diff --git a/mysql-test/suite/innodb/t/buf_pool_resize_oom.opt b/mysql-test/suite/innodb/t/buf_pool_resize_oom.opt new file mode 100644 index 00000000000..21350cdcfaf --- /dev/null +++ b/mysql-test/suite/innodb/t/buf_pool_resize_oom.opt @@ -0,0 +1 @@ +--innodb-buffer-pool-size=1G diff --git a/mysql-test/suite/innodb/t/buf_pool_resize_oom.test b/mysql-test/suite/innodb/t/buf_pool_resize_oom.test new file mode 100644 index 00000000000..4bddac78594 --- /dev/null +++ b/mysql-test/suite/innodb/t/buf_pool_resize_oom.test @@ -0,0 +1,30 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +# Allocating 1 GiB of buffer pool is pretty steep! +--source include/big_test.inc +--source include/not_embedded.inc + +--echo # +--echo # Bug #21348684 SIGABRT DURING RESIZING THE INNODB BUFFER POOL +--echo # ONLINE WITH MEMORY FULL CONDITION +--echo # + +call mtr.add_suppression("InnoDB: .* failed to allocate the chunk array"); + +SET GLOBAL innodb_disable_resize_buffer_pool_debug=OFF; +SET GLOBAL debug_dbug='+d,buf_pool_resize_chunk_null'; + +--disable_warnings +SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size + 1048576; +--enable_warnings + +let $wait_timeout = 60; +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 27) = 'Resizing buffer pool failed' + FROM information_schema.global_status + WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS'; + +--source include/wait_condition.inc +# Restart the server, because the buffer pool would not necessarily be +# shrunk afterwards even if we request it. +--source include/restart_mysqld.inc diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.opt b/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.opt new file mode 100644 index 00000000000..948d874d23d --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.opt @@ -0,0 +1,3 @@ +--innodb-buffer-pool-size=64M +--skip-innodb-buffer-pool-load-at-startup +--skip-innodb-buffer-pool-dump-at-shutdown diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test new file mode 100644 index 00000000000..5bc07dbce0d --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test @@ -0,0 +1,201 @@ +#Want to skip this test from daily Valgrind execution +--source include/no_valgrind_without_big.inc +# +# Test for the functionality of InnoDB Buffer Pool dump/load. +# + +# This case checks buffer pool dump/load works as expected +# with innodb_buffer_pool_dump_now=ON +# and innodb_buffer_pool_load_now=ON + +--source include/have_innodb.inc +# include/restart_mysqld.inc does not work in embedded mode +--source include/not_embedded.inc + +--let $file = `SELECT CONCAT(@@datadir, @@global.innodb_buffer_pool_filename)` + +--error 0,1 +--remove_file $file + +# Dump the whole buffer pool because if only a portion of it is dumped, we +# cannot be sure how many of the ib_bp_test's pages will end up in the dump. +SET GLOBAL innodb_buffer_pool_dump_pct=100; + +# Create a table and populate it with some data +CREATE TABLE ib_bp_test +(a INT AUTO_INCREMENT, b VARCHAR(64), c TEXT, PRIMARY KEY (a), KEY (b, c(128))) +ENGINE=INNODB; + +let $check_cnt = +SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru +WHERE table_name LIKE '%ib_bp_test%'; + +--let SPACE = `SELECT space FROM information_schema.innodb_sys_tables WHERE name LIKE '%ib_bp_test%'` + +# See that we have a small number of pages in the LRU +--eval $check_cnt + +# Here we end up with 16382 rows in the table +--disable_query_log +INSERT INTO ib_bp_test (b, c) VALUES (REPEAT('b', 64), REPEAT('c', 256)); +INSERT INTO ib_bp_test (b, c) VALUES (REPEAT('B', 64), REPEAT('C', 256)); +let $i=12; +while ($i) +{ + --eval INSERT INTO ib_bp_test (b, c) VALUES ($i, $i * $i); + INSERT INTO ib_bp_test (b, c) SELECT b, c FROM ib_bp_test; + dec $i; +} +--enable_query_log + +# Accept 83 for 64k page size, 163 for 32k page size, 329 for 16k page size, +# 662 for 8k page size & 1392 for 4k page size +--replace_result 83 {checked_valid} 163 {checked_valid} 329 {checked_valid} 662 {checked_valid} 1392 {checked_valid} +--eval $check_cnt + +# Dump +SET GLOBAL innodb_buffer_pool_dump_now = ON; + +# Wait for the dump to complete +--disable_warnings +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) dump completed at ' + FROM information_schema.global_status + WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status'; +--enable_warnings +--source include/wait_condition.inc + +# Confirm the file has been created +--file_exists $file + +# Add some garbage records to the dump file +--let IBDUMPFILE = $file +perl; +my $fn = $ENV{'IBDUMPFILE'}; +open(my $fh, '>>', $fn) || die "perl open($fn): $!"; +print $fh "123456,0\n"; +print $fh "0,123456\n"; +print $fh "123456,123456\n"; +close($fh); +EOF + +--move_file $file $file.now + +--source include/shutdown_mysqld.inc + +# Make sure no dump after shutdown +--error 1 +--file_exists $file + +--source include/start_mysqld.inc + +--move_file $file.now $file + +# See that we have no pages in the LRU +--eval $check_cnt + +# Load the table so that entries in the I_S table do not appear as NULL +select count(*) from ib_bp_test where a = 1; + +# Load +SET GLOBAL innodb_buffer_pool_load_now = ON; + +# Wait for the load to complete +--disable_warnings +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) load completed at ' + FROM information_schema.global_status + WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status'; +--enable_warnings +--source include/wait_condition.inc + +# Show the status, interesting if the above timed out +--disable_warnings +--replace_regex /[0-9]{6}[[:space:]]+[0-9]{1,2}:[0-9]{2}:[0-9]{2}/TIMESTAMP_NOW/ +SELECT variable_value +FROM information_schema.global_status +WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status'; +--enable_warnings + +# Accept 83 for 64k page size, 163 for 32k page size, 329 for 16k page size, +# 662 for 8k page size & 1392 for 4k page size +--replace_result 83 {checked_valid} 163 {checked_valid} 329 {checked_valid} 662 {checked_valid} 1392 {checked_valid} +--eval $check_cnt + +# Add some total garbage to the dump file +--let IBDUMPFILE = $file +perl; +my $fn = $ENV{'IBDUMPFILE'}; +open(my $fh, '>>', $fn) || die "perl open($fn): $!"; +print $fh "abcdefg\n"; +close($fh); +EOF + +call mtr.add_suppression("InnoDB: Error parsing"); + +# Load +SET GLOBAL innodb_buffer_pool_load_now = ON; + +# Wait for the load to fail +--disable_warnings +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 13) = 'Error parsing' + FROM information_schema.global_status + WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status'; +--enable_warnings +--source include/wait_condition.inc + +--echo # Re-write some valid pages to the dump file, make sure the space +--echo # should be valid but all the page no should be out of bound of the file +--let IBDUMPFILE = $file +perl; +my $fn = $ENV{'IBDUMPFILE'}; +my $space = $ENV{'SPACE'}; +open(my $fh, '>', $fn) || die "perl open($fn): $!"; +print $fh "$space,10000\n"; +print $fh "$space,10001\n"; +print $fh "$space,10002\n"; +close($fh); +EOF + +# We force the restart so that the table would be closed +--source include/restart_mysqld.inc + +# Load directly, without accessing the table first +SET GLOBAL innodb_buffer_pool_load_now = ON; + +# Wait for the load to complete +--disable_warnings +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) load completed at ' + FROM information_schema.global_status + WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status'; +--enable_warnings +--source include/wait_condition.inc + +# Show the status, interesting if the above timed out +--disable_warnings +--replace_regex /[0-9]{6}[[:space:]]+[0-9]{1,2}:[0-9]{2}:[0-9]{2}/TIMESTAMP_NOW/ +SELECT variable_value +FROM information_schema.global_status +WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status'; +--enable_warnings + +DROP TABLE ib_bp_test; +SET GLOBAL innodb_buffer_pool_dump_pct=default; + +--echo # +--echo # Bug#21371070 [ERROR] INNODB: CANNOT ALLOCATE 0 BYTES: SUCCESS +--echo # + +--let $file = `SELECT CONCAT(@@datadir, @@global.innodb_buffer_pool_filename)` + +# Remove the buffer pool file that exists already +--error 0,1 +--remove_file $file + +# Create an empty buffer pool file +write_file $file; +EOF + +SET GLOBAL innodb_buffer_pool_load_now = ON; diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.opt b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.opt new file mode 100644 index 00000000000..dca040ea893 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.opt @@ -0,0 +1 @@ +--innodb-buffer-pool-size=8M --innodb-buffer-pool-chunk-size=2M diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.test new file mode 100644 index 00000000000..d1e17c7622a --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.test @@ -0,0 +1,241 @@ +# +# WL6117 : Resize the InnoDB Buffer Pool Online +# (concurrent sql; allocation fail;) +# + +--source include/have_innodb.inc +--source include/have_debug.inc + +--disable_query_log +set @old_innodb_buffer_pool_size = @@innodb_buffer_pool_size; +set @old_innodb_file_per_table = @@innodb_file_per_table; +set @old_innodb_thread_concurrency = @@innodb_thread_concurrency; +set @old_innodb_thread_sleep_delay = @@innodb_thread_sleep_delay; +set @old_innodb_disable_resize = @@innodb_disable_resize_buffer_pool_debug; +set global innodb_disable_resize_buffer_pool_debug = OFF; +--enable_query_log + +# Save the initial number of concurrent sessions +--source include/count_sessions.inc + +let $wait_timeout = 180; + +set global innodb_file_per_table=ON; +set global innodb_thread_concurrency=20; + +connect (con1,localhost,root,,); +connect (con2,localhost,root,,); +connect (con3,localhost,root,,); +connect (con4,localhost,root,,); +connect (con5,localhost,root,,); +connect (con6,localhost,root,,); +connect (con7,localhost,root,,); +connect (con8,localhost,root,,); + +create table t2 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into t2 (c1, c2) values (1, 1); + +create table t3 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into t3 (c1, c2) values (1, 1); + +create table t4 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into t4 (c1, c2) values (1, 1); + +create table t5 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into t5 (c1, c2) values (1, 1); + +create table t6 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into t6 (c1, c2) values (1, 1); + +create database test2; +create table test2.t7 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into test2.t7 (c1, c2) values (1, 1); +drop table test2.t7; + +connection con1; +set @save_dbug=@@global.debug_dbug; +set global debug_dbug="+d,ib_buf_pool_resize_wait_before_resize"; +set global innodb_buffer_pool_size = 12*1024*1024; + +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 30) = 'Latching whole of buffer pool.' + FROM information_schema.global_status + WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS'; +--source include/wait_condition.inc + +# trying to update innodb_buffer_pool_size +--error ER_WRONG_ARGUMENTS +set global innodb_buffer_pool_size = 8*1024*1024; +select @@global.innodb_buffer_pool_size; + +# trying to control adaptive hash index +select @@global.innodb_adaptive_hash_index; +set global innodb_adaptive_hash_index = ON; +select @@global.innodb_adaptive_hash_index; +set global innodb_adaptive_hash_index = OFF; +select @@global.innodb_adaptive_hash_index; + +# - create table +--send create table t1 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB + +connection con2; +# - analyze table +--send analyze table t2 + +connection con3; +# - alter table ... algorithm=inplace +--send alter table t3 algorithm=inplace, add index idx (c1) + +connection con4; +# - alter table ... rename to +--send alter table t4 rename to t0 + +connection con5; +# - drop table +--send drop table t5 + +connection con6; +# - alter table ... discard tablespace +--send alter table t6 discard tablespace + +connection con7; +# - drop database +--send drop database test2 + +connection con8; +# information schema INNODB_BUFFER_PAGE +--send select count(*) > 0 from information_schema.innodb_buffer_page + +connection default; +set global debug_dbug=@save_dbug; + +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 34) = 'Completed resizing buffer pool at ' + FROM information_schema.global_status + WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS'; +--source include/wait_condition.inc + +connection con1; +--reap + +connection con2; +--reap + +connection con3; +--reap + +connection con4; +--reap + +connection con5; +--reap + +connection con6; +--reap + +connection con7; +--reap + +connection con8; +--reap + +connection default; + +disconnect con3; +disconnect con4; +disconnect con5; +disconnect con6; +disconnect con7; +disconnect con8; +disconnect con1; +disconnect con2; + +# fails to allocate new chunks +call mtr.add_suppression("\\[ERROR\\] InnoDB: buffer pool 0 : failed to allocate new memory."); +connection default; +set global debug_dbug="+d,ib_buf_chunk_init_fails"; +set global innodb_buffer_pool_size = 16*1024*1024; +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 27) = 'Resizing buffer pool failed' + FROM information_schema.global_status + WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS'; +--source include/wait_condition.inc +set global debug_dbug=@save_dbug; + +# can be used as usual, even if failed to allocate +create table t8 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB; +insert into t8 (c1, c2) values (1, 1); +drop table t8; + +drop table t1; +drop table t2; +drop table t3; +drop table t0; +drop table t6; + +--disable_query_log +set global innodb_buffer_pool_size = @old_innodb_buffer_pool_size; +set global innodb_file_per_table = @old_innodb_file_per_table; +set global innodb_thread_concurrency = @old_innodb_thread_concurrency; +set global innodb_thread_sleep_delay = @old_innodb_thread_sleep_delay; +set global innodb_disable_resize_buffer_pool_debug = @old_innodb_disable_resize; +--enable_query_log + +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 34) = 'Completed resizing buffer pool at ' + FROM information_schema.global_status + WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS'; +--source include/wait_condition.inc + +# Wait till all disconnects are completed] +--source include/wait_until_count_sessions.inc + +--echo # +--echo # BUG#23590280 NO WARNING WHEN REDUCING INNODB_BUFFER_POOL_SIZE INSIZE THE FIRST CHUNK +--echo # + +SET @save_disable = @@GLOBAL.innodb_disable_background_merge; +SET GLOBAL innodb_disable_background_merge = ON; + +set @old_innodb_disable_resize = @@innodb_disable_resize_buffer_pool_debug; +set global innodb_disable_resize_buffer_pool_debug = OFF; +set @before_innodb_buffer_pool_size = @@innodb_buffer_pool_size; + +set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size; + +let $wait_timeout = 60; +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 19) = 'Size did not change' + FROM information_schema.global_status + WHERE VARIABLE_NAME = 'INNODB_BUFFER_POOL_RESIZE_STATUS'; +--source include/wait_condition.inc + +set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size * 2; + +let $wait_timeout = 60; +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 9) = 'Completed' + FROM information_schema.global_status + WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS'; +--source include/wait_condition.inc + +set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size; + +let $wait_timeout = 60; +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 9) = 'Completed' + FROM information_schema.global_status + WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS'; +--source include/wait_condition.inc + +set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size; + +let $wait_timeout = 60; +let $wait_condition = + SELECT SUBSTR(variable_value, 1, 19) = 'Size did not change' + FROM information_schema.global_status + WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS'; +--source include/wait_condition.inc + +SET GLOBAL innodb_disable_resize_buffer_pool_debug = @old_innodb_disable_resize; +SET GLOBAL innodb_disable_background_merge = @save_disable; From b6e3cfde26c7249a8e6c5bc61e0e05eaf89c61bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 19 Mar 2020 12:39:26 +0200 Subject: [PATCH 14/25] Fix test case name and add debug sync include. --- .../suite/galera/r/{MDEV-19966.result => MDEV-20616.result} | 0 mysql-test/suite/galera/t/{MDEV-19966.test => MDEV-20616.test} | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) rename mysql-test/suite/galera/r/{MDEV-19966.result => MDEV-20616.result} (100%) rename mysql-test/suite/galera/t/{MDEV-19966.test => MDEV-20616.test} (98%) diff --git a/mysql-test/suite/galera/r/MDEV-19966.result b/mysql-test/suite/galera/r/MDEV-20616.result similarity index 100% rename from mysql-test/suite/galera/r/MDEV-19966.result rename to mysql-test/suite/galera/r/MDEV-20616.result diff --git a/mysql-test/suite/galera/t/MDEV-19966.test b/mysql-test/suite/galera/t/MDEV-20616.test similarity index 98% rename from mysql-test/suite/galera/t/MDEV-19966.test rename to mysql-test/suite/galera/t/MDEV-20616.test index 4269be58134..1cbc4aadbdd 100644 --- a/mysql-test/suite/galera/t/MDEV-19966.test +++ b/mysql-test/suite/galera/t/MDEV-20616.test @@ -4,7 +4,8 @@ # --source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc ############################################################################## # test case to verify that natural deadlock of trigger SP execution is From 9fd692aecacfc944fd3a6a58f4cae5a49eeb1cf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 19 Mar 2020 12:57:22 +0200 Subject: [PATCH 15/25] MDEV-13626: Clean up the buffer pool resizing tests from MySQL 5.7 buf_pool_resize(): Simplify the fault injection for innodb.buf_pool_resize_oom. innodb.buf_pool_resize_oom: Use a small buffer pool. innodb.innodb_buffer_pool_load_now: Make use of the sequence engine, to avoid creating explicit InnoDB record locks. Clean up the accesses to information_schema.innodb_buffer_page_lru. --- .../r/innodb_buffer_pool_load_now.result | 32 +++++++----- .../suite/innodb/t/buf_pool_resize_oom.opt | 2 +- .../suite/innodb/t/buf_pool_resize_oom.test | 2 - .../innodb/t/innodb_buffer_pool_load_now.test | 51 ++++++++----------- storage/innobase/buf/buf0buf.cc | 22 ++------ 5 files changed, 42 insertions(+), 67 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_load_now.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_load_now.result index b2b1da92b4c..14ea44550e0 100644 --- a/mysql-test/suite/innodb/r/innodb_buffer_pool_load_now.result +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_load_now.result @@ -2,22 +2,26 @@ SET GLOBAL innodb_buffer_pool_dump_pct=100; CREATE TABLE ib_bp_test (a INT AUTO_INCREMENT, b VARCHAR(64), c TEXT, PRIMARY KEY (a), KEY (b, c(128))) ENGINE=INNODB; +SELECT PAGE_NUMBER FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`'; +PAGE_NUMBER +3 +4 +SELECT SPACE INTO @space FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`' AND PAGE_NUMBER=3; +INSERT INTO ib_bp_test +SELECT NULL, REPEAT('b', 64), REPEAT('c', 256) FROM seq_1_to_16382; SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru -WHERE table_name LIKE '%ib_bp_test%'; +WHERE table_name = '`test`.`ib_bp_test`'; COUNT(*) -2 -SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru -WHERE table_name LIKE '%ib_bp_test%'; -COUNT(*) -{checked_valid} +596 SET GLOBAL innodb_buffer_pool_dump_now = ON; -SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru -WHERE table_name LIKE '%ib_bp_test%'; -COUNT(*) -0 -select count(*) from ib_bp_test where a = 1; +SET GLOBAL innodb_fast_shutdown=0; +SELECT PAGE_NUMBER FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`'; +PAGE_NUMBER +select count(*) from ib_bp_test LIMIT 0; count(*) -1 SET GLOBAL innodb_buffer_pool_load_now = ON; SELECT variable_value FROM information_schema.global_status @@ -25,9 +29,9 @@ WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status'; variable_value Buffer pool(s) load completed at TIMESTAMP_NOW SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru -WHERE table_name LIKE '%ib_bp_test%'; +WHERE table_name = '`test`.`ib_bp_test`'; COUNT(*) -{checked_valid} +596 call mtr.add_suppression("InnoDB: Error parsing"); SET GLOBAL innodb_buffer_pool_load_now = ON; # Re-write some valid pages to the dump file, make sure the space diff --git a/mysql-test/suite/innodb/t/buf_pool_resize_oom.opt b/mysql-test/suite/innodb/t/buf_pool_resize_oom.opt index 21350cdcfaf..09fd8bd8e35 100644 --- a/mysql-test/suite/innodb/t/buf_pool_resize_oom.opt +++ b/mysql-test/suite/innodb/t/buf_pool_resize_oom.opt @@ -1 +1 @@ ---innodb-buffer-pool-size=1G +--innodb-buffer-pool-size=8m --innodb-buffer-pool-chunk-size=1m diff --git a/mysql-test/suite/innodb/t/buf_pool_resize_oom.test b/mysql-test/suite/innodb/t/buf_pool_resize_oom.test index 4bddac78594..b0aa20b566f 100644 --- a/mysql-test/suite/innodb/t/buf_pool_resize_oom.test +++ b/mysql-test/suite/innodb/t/buf_pool_resize_oom.test @@ -1,7 +1,5 @@ --source include/have_innodb.inc --source include/have_debug.inc -# Allocating 1 GiB of buffer pool is pretty steep! ---source include/big_test.inc --source include/not_embedded.inc --echo # diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test index 5bc07dbce0d..baced6e9e11 100644 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test @@ -11,6 +11,7 @@ --source include/have_innodb.inc # include/restart_mysqld.inc does not work in embedded mode --source include/not_embedded.inc +--source include/have_sequence.inc --let $file = `SELECT CONCAT(@@datadir, @@global.innodb_buffer_pool_filename)` @@ -26,32 +27,19 @@ CREATE TABLE ib_bp_test (a INT AUTO_INCREMENT, b VARCHAR(64), c TEXT, PRIMARY KEY (a), KEY (b, c(128))) ENGINE=INNODB; -let $check_cnt = +SELECT PAGE_NUMBER FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`'; + +SELECT SPACE INTO @space FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`' AND PAGE_NUMBER=3; + +let SPACE=`SELECT @space`; + +INSERT INTO ib_bp_test +SELECT NULL, REPEAT('b', 64), REPEAT('c', 256) FROM seq_1_to_16382; + SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru -WHERE table_name LIKE '%ib_bp_test%'; - ---let SPACE = `SELECT space FROM information_schema.innodb_sys_tables WHERE name LIKE '%ib_bp_test%'` - -# See that we have a small number of pages in the LRU ---eval $check_cnt - -# Here we end up with 16382 rows in the table ---disable_query_log -INSERT INTO ib_bp_test (b, c) VALUES (REPEAT('b', 64), REPEAT('c', 256)); -INSERT INTO ib_bp_test (b, c) VALUES (REPEAT('B', 64), REPEAT('C', 256)); -let $i=12; -while ($i) -{ - --eval INSERT INTO ib_bp_test (b, c) VALUES ($i, $i * $i); - INSERT INTO ib_bp_test (b, c) SELECT b, c FROM ib_bp_test; - dec $i; -} ---enable_query_log - -# Accept 83 for 64k page size, 163 for 32k page size, 329 for 16k page size, -# 662 for 8k page size & 1392 for 4k page size ---replace_result 83 {checked_valid} 163 {checked_valid} 329 {checked_valid} 662 {checked_valid} 1392 {checked_valid} ---eval $check_cnt +WHERE table_name = '`test`.`ib_bp_test`'; # Dump SET GLOBAL innodb_buffer_pool_dump_now = ON; @@ -81,6 +69,8 @@ EOF --move_file $file $file.now +# Complete purge (and change buffer merge). +SET GLOBAL innodb_fast_shutdown=0; --source include/shutdown_mysqld.inc # Make sure no dump after shutdown @@ -92,10 +82,11 @@ EOF --move_file $file.now $file # See that we have no pages in the LRU ---eval $check_cnt +SELECT PAGE_NUMBER FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`'; # Load the table so that entries in the I_S table do not appear as NULL -select count(*) from ib_bp_test where a = 1; +select count(*) from ib_bp_test LIMIT 0; # Load SET GLOBAL innodb_buffer_pool_load_now = ON; @@ -117,10 +108,8 @@ FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status'; --enable_warnings -# Accept 83 for 64k page size, 163 for 32k page size, 329 for 16k page size, -# 662 for 8k page size & 1392 for 4k page size ---replace_result 83 {checked_valid} 163 {checked_valid} 329 {checked_valid} 662 {checked_valid} 1392 {checked_valid} ---eval $check_cnt +SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`'; # Add some total garbage to the dump file --let IBDUMPFILE = $file diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index d80eadcfc70..57dc54f38b4 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -2,7 +2,7 @@ Copyright (c) 1995, 2018, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. -Copyright (c) 2013, 2019, MariaDB Corporation. +Copyright (c) 2013, 2020, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -2648,23 +2648,6 @@ buf_pool_resize_hash( buf_pool->zip_hash = new_hash_table; } -#ifndef DBUG_OFF -/** This is a debug routine to inject an memory allocation failure error. */ -static -void -buf_pool_resize_chunk_make_null(buf_chunk_t** new_chunks) -{ - static int count = 0; - - if (count == 1) { - ut_free(*new_chunks); - *new_chunks = NULL; - } - - count++; -} -#endif // DBUG_OFF - /** Resize the buffer pool based on srv_buf_pool_size from srv_buf_pool_old_size. */ static @@ -2931,7 +2914,8 @@ withdraw_retry: ut_zalloc_nokey_nofatal(new_chunks_size)); DBUG_EXECUTE_IF("buf_pool_resize_chunk_null", - buf_pool_resize_chunk_make_null(&new_chunks);); + ut_free(new_chunks); + new_chunks = NULL;); if (new_chunks == NULL) { ib::error() << "buffer pool " << i From 6960e9ed24dbdab587730cdceab1f29bcdd6d52a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 19 Mar 2020 14:23:47 +0200 Subject: [PATCH 16/25] MDEV-21983: Crash on DROP/RENAME TABLE after DISCARD TABLESPACE fil_delete_tablespace(): Remove the unused parameter drop_ahi, and add the parameter if_exists=false. We want to suppress error messages if we know that the tablespace has been discarded. dict_table_rename_in_cache(): Pass the new parameter to fil_delete_tablespace(), that is, do not complain about missing tablespace if the tablespace has been discarded. row_make_new_pathname(): Declare as static. row_drop_table_for_mysql(): Tolerate !table->data_dir_path when the tablespace has been discarded. row_rename_table_for_mysql(): Skip part of the RENAME TABLE when fil_space_get_first_path() returns NULL. --- .../innodb/r/alter_missing_tablespace.result | 4 +++- .../innodb/t/alter_missing_tablespace.test | 4 +++- storage/innobase/dict/dict0dict.cc | 3 ++- storage/innobase/fil/fil0fil.cc | 18 +++++++----------- storage/innobase/include/fil0fil.h | 11 +++-------- storage/innobase/include/row0merge.h | 14 +------------- storage/innobase/row/row0merge.cc | 1 + storage/innobase/row/row0mysql.cc | 14 +++++++------- 8 files changed, 27 insertions(+), 42 deletions(-) diff --git a/mysql-test/suite/innodb/r/alter_missing_tablespace.result b/mysql-test/suite/innodb/r/alter_missing_tablespace.result index f9db353af3c..95415dd4e03 100644 --- a/mysql-test/suite/innodb/r/alter_missing_tablespace.result +++ b/mysql-test/suite/innodb/r/alter_missing_tablespace.result @@ -35,7 +35,9 @@ ALTER TABLE t DISCARD TABLESPACE; Warnings: Warning 1812 Tablespace is missing for table 'test/t' Warning 1812 Tablespace is missing for table 'test/t' -DROP TABLE t; +RENAME TABLE t TO u; +RENAME TABLE u TO v; +DROP TABLE v; SELECT * FROM `x..d`; ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB DROP TABLE `x..d`; diff --git a/mysql-test/suite/innodb/t/alter_missing_tablespace.test b/mysql-test/suite/innodb/t/alter_missing_tablespace.test index 0094db520ae..1051b79bddb 100644 --- a/mysql-test/suite/innodb/t/alter_missing_tablespace.test +++ b/mysql-test/suite/innodb/t/alter_missing_tablespace.test @@ -58,7 +58,9 @@ ALTER TABLE t ALGORITHM=COPY, DISCARD TABLESPACE; --error ER_PARSE_ERROR ALTER TABLE t ALGORITHM=DEFAULT, DISCARD TABLESPACE; ALTER TABLE t DISCARD TABLESPACE; -DROP TABLE t; +RENAME TABLE t TO u; +RENAME TABLE u TO v; +DROP TABLE v; --error ER_GET_ERRNO SELECT * FROM `x..d`; DROP TABLE `x..d`; diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index cf70047ab15..455d51af438 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -1630,7 +1630,8 @@ dict_table_rename_in_cache( return(DB_OUT_OF_MEMORY); } - fil_delete_tablespace(table->space); + fil_delete_tablespace(table->space, + dict_table_is_discarded(table)); /* Delete any temp file hanging around. */ if (os_file_status(filepath, &exists, &ftype) diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 64c2834a635..4192008ecf0 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -2861,14 +2861,9 @@ bool fil_table_accessible(const dict_table_t* table) /** Delete a tablespace and associated .ibd file. @param[in] id tablespace identifier +@param[in] if_exists whether to ignore missing tablespace @return DB_SUCCESS or error */ -dberr_t -fil_delete_tablespace( - ulint id -#ifdef BTR_CUR_HASH_ADAPT - , bool drop_ahi /*!< whether to drop the adaptive hash index */ -#endif /* BTR_CUR_HASH_ADAPT */ - ) +dberr_t fil_delete_tablespace(ulint id, bool if_exists) { char* path = 0; fil_space_t* space = 0; @@ -2879,10 +2874,11 @@ fil_delete_tablespace( id, FIL_OPERATION_DELETE, &space, &path); if (err != DB_SUCCESS) { - - ib::error() << "Cannot delete tablespace " << id - << " because it is not found in the tablespace" - " memory cache."; + if (!if_exists) { + ib::error() << "Cannot delete tablespace " << id + << " because it is not found" + " in the tablespace memory cache."; + } return(err); } diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 5484477d913..9c722944665 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2019, MariaDB Corporation. +Copyright (c) 2013, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -964,14 +964,9 @@ bool fil_table_accessible(const dict_table_t* table) /** Delete a tablespace and associated .ibd file. @param[in] id tablespace identifier +@param[in] if_exists whether to ignore missing tablespace @return DB_SUCCESS or error */ -dberr_t -fil_delete_tablespace( - ulint id -#ifdef BTR_CUR_HASH_ADAPT - , bool drop_ahi = false /*!< whether to drop the adaptive hash index */ -#endif /* BTR_CUR_HASH_ADAPT */ - ); +dberr_t fil_delete_tablespace(ulint id, bool if_exists= false); /** Prepare to truncate an undo tablespace. @param[in] space_id undo tablespace id diff --git a/storage/innobase/include/row0merge.h b/storage/innobase/include/row0merge.h index a9b275c890e..8e7ca5de046 100644 --- a/storage/innobase/include/row0merge.h +++ b/storage/innobase/include/row0merge.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2019, MariaDB Corporation. +Copyright (c) 2015, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -202,18 +202,6 @@ row_merge_file_destroy_low( /*=======================*/ int fd); /*!< in: merge file descriptor */ -/*********************************************************************//** -Provide a new pathname for a table that is being renamed if it belongs to -a file-per-table tablespace. The caller is responsible for freeing the -memory allocated for the return value. -@return new pathname of tablespace file, or NULL if space = 0 */ -char* -row_make_new_pathname( -/*==================*/ - dict_table_t* table, /*!< in: table to be renamed */ - const char* new_name) /*!< in: new name */ - MY_ATTRIBUTE((nonnull, warn_unused_result)); - /*********************************************************************//** Rename the tables in the data dictionary. The data dictionary must have been locked exclusively by the caller, because the transaction diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index d218c166a1b..29f69317a18 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -4149,6 +4149,7 @@ Provide a new pathname for a table that is being renamed if it belongs to a file-per-table tablespace. The caller is responsible for freeing the memory allocated for the return value. @return new pathname of tablespace file, or NULL if space = 0 */ +static char* row_make_new_pathname( /*==================*/ diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index a437c8d5ff1..9add75b3a67 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -3725,10 +3725,12 @@ do_drop: dict_table_t. Free this memory before returning. */ if (DICT_TF_HAS_DATA_DIR(table->flags)) { dict_get_and_save_data_dir_path(table, true); - ut_a(table->data_dir_path); + ut_ad(table->data_dir_path + || dict_table_is_discarded(table)); filepath = fil_make_filepath( table->data_dir_path, - table->name.m_name, IBD, true); + table->name.m_name, IBD, + table->data_dir_path != NULL); } else { filepath = fil_make_filepath( NULL, table->name.m_name, IBD, false); @@ -4304,11 +4306,9 @@ row_rename_table_for_mysql( /* SYS_TABLESPACES and SYS_DATAFILES need to be updated if the table is in a single-table tablespace. */ - if (err == DB_SUCCESS - && dict_table_is_file_per_table(table)) { - /* Make a new pathname to update SYS_DATAFILES. */ - char* new_path = row_make_new_pathname(table, new_name); - char* old_path = fil_space_get_first_path(table->space); + if (err != DB_SUCCESS || !dict_table_is_file_per_table(table)) { + } else if (char* old_path = fil_space_get_first_path(table->space)) { + char* new_path = os_file_make_new_pathname(old_path, new_name); /* If old path and new path are the same means tablename has not changed and only the database name holding the table From a66eebf57c212363f9f430a4c8c9a4f3ddf57cfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 19 Mar 2020 07:52:35 +0200 Subject: [PATCH 17/25] MDEV-21981 Replace arithmetic + with bitwise OR when possible Several macros such as sint2korr() and uint4korr() are using the arithmetic + operator while a bitwise or operator would suffice. GCC 5 and clang 5 and later can detect patterns consisting of bitwise or and shifts by multiples of 8 bits, such as those used in the InnoDB function mach_read_from_4(). They actually translate that verbose low-level code into high-level machine language (i486 bswap instruction or fused into the Haswell movbe instruction). We should do the same for MariaDB Server code that is outside InnoDB. Note: The Microsoft C compiler is lacking this optimization. There, we might consider using _byteswap_ushort(), _byteswap_ulong(), _byteswap_uint64(). But, those would lead to unaligned reads, which are bad for reasons stated in MDEV-20277. Besides, outside InnoDB, most data is already being stored in the native little-endian format of that compiler. --- include/byte_order_generic.h | 53 +++++++++++------------ include/byte_order_generic_x86.h | 23 +++++----- include/byte_order_generic_x86_64.h | 7 ++-- include/myisampack.h | 65 +++++++++++++++-------------- storage/maria/ma_loghandler.c | 7 ++-- storage/maria/ma_packrec.c | 49 +++++++++++----------- storage/myisam/mi_packrec.c | 49 +++++++++++----------- 7 files changed, 130 insertions(+), 123 deletions(-) diff --git a/include/byte_order_generic.h b/include/byte_order_generic.h index 451202be3b6..8381941b9b9 100644 --- a/include/byte_order_generic.h +++ b/include/byte_order_generic.h @@ -1,4 +1,5 @@ /* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,7 +18,7 @@ Endianness-independent definitions for architectures other than the x86 architecture. */ -#define sint2korr(A) (int16) (((int16) ((uchar) (A)[0])) +\ +#define sint2korr(A) (int16) (((int16) ((uchar) (A)[0])) |\ ((int16) ((int16) (A)[1]) << 8)) #define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \ (((uint32) 255L << 24) | \ @@ -27,38 +28,38 @@ (((uint32) (uchar) (A)[2]) << 16) |\ (((uint32) (uchar) (A)[1]) << 8) | \ ((uint32) (uchar) (A)[0]))) -#define sint4korr(A) (int32) (((int32) ((uchar) (A)[0])) +\ - (((int32) ((uchar) (A)[1]) << 8)) +\ - (((int32) ((uchar) (A)[2]) << 16)) +\ +#define sint4korr(A) (int32) (((int32) ((uchar) (A)[0])) |\ + (((int32) ((uchar) (A)[1]) << 8)) |\ + (((int32) ((uchar) (A)[2]) << 16)) |\ (((int32) ((int16) (A)[3]) << 24))) #define sint8korr(A) (longlong) uint8korr(A) -#define uint2korr(A) (uint16) (((uint16) ((uchar) (A)[0])) +\ +#define uint2korr(A) (uint16) (((uint16) ((uchar) (A)[0])) |\ ((uint16) ((uchar) (A)[1]) << 8)) -#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\ - (((uint32) ((uchar) (A)[1])) << 8) +\ +#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\ + (((uint32) ((uchar) (A)[1])) << 8) |\ (((uint32) ((uchar) (A)[2])) << 16)) -#define uint4korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\ - (((uint32) ((uchar) (A)[1])) << 8) +\ - (((uint32) ((uchar) (A)[2])) << 16) +\ +#define uint4korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\ + (((uint32) ((uchar) (A)[1])) << 8) |\ + (((uint32) ((uchar) (A)[2])) << 16) |\ (((uint32) ((uchar) (A)[3])) << 24)) -#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ - (((uint32) ((uchar) (A)[1])) << 8) +\ - (((uint32) ((uchar) (A)[2])) << 16) +\ - (((uint32) ((uchar) (A)[3])) << 24)) +\ +#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) |\ + (((uint32) ((uchar) (A)[1])) << 8) |\ + (((uint32) ((uchar) (A)[2])) << 16) |\ + (((uint32) ((uchar) (A)[3])) << 24)) |\ (((ulonglong) ((uchar) (A)[4])) << 32)) -#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \ - (((uint32) ((uchar) (A)[1])) << 8) + \ - (((uint32) ((uchar) (A)[2])) << 16) + \ - (((uint32) ((uchar) (A)[3])) << 24)) + \ - (((ulonglong) ((uchar) (A)[4])) << 32) + \ +#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) | \ + (((uint32) ((uchar) (A)[1])) << 8) | \ + (((uint32) ((uchar) (A)[2])) << 16) | \ + (((uint32) ((uchar) (A)[3])) << 24)) | \ + (((ulonglong) ((uchar) (A)[4])) << 32) | \ (((ulonglong) ((uchar) (A)[5])) << 40)) -#define uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ - (((uint32) ((uchar) (A)[1])) << 8) +\ - (((uint32) ((uchar) (A)[2])) << 16) +\ - (((uint32) ((uchar) (A)[3])) << 24)) +\ - (((ulonglong) (((uint32) ((uchar) (A)[4])) +\ - (((uint32) ((uchar) (A)[5])) << 8) +\ - (((uint32) ((uchar) (A)[6])) << 16) +\ +#define uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) |\ + (((uint32) ((uchar) (A)[1])) << 8) |\ + (((uint32) ((uchar) (A)[2])) << 16) |\ + (((uint32) ((uchar) (A)[3])) << 24)) |\ + (((ulonglong) (((uint32) ((uchar) (A)[4])) |\ + (((uint32) ((uchar) (A)[5])) << 8) |\ + (((uint32) ((uchar) (A)[6])) << 16) |\ (((uint32) ((uchar) (A)[7])) << 24))) <<\ 32)) #define int2store(T,A) do { uint def_temp= (uint) (A) ;\ diff --git a/include/byte_order_generic_x86.h b/include/byte_order_generic_x86.h index 4b2cbbe5584..72e00be8c2c 100644 --- a/include/byte_order_generic_x86.h +++ b/include/byte_order_generic_x86.h @@ -1,4 +1,5 @@ /* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,20 +28,20 @@ ((uint32) (uchar) (A)[0]))) #define sint4korr(A) (*((const long *) (A))) #define uint2korr(A) (*((const uint16 *) (A))) -#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\ - (((uint32) ((uchar) (A)[1])) << 8) +\ +#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\ + (((uint32) ((uchar) (A)[1])) << 8) |\ (((uint32) ((uchar) (A)[2])) << 16)) #define uint4korr(A) (*((const uint32 *) (A))) -#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ - (((uint32) ((uchar) (A)[1])) << 8) +\ - (((uint32) ((uchar) (A)[2])) << 16) +\ - (((uint32) ((uchar) (A)[3])) << 24)) +\ +#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) |\ + (((uint32) ((uchar) (A)[1])) << 8) |\ + (((uint32) ((uchar) (A)[2])) << 16) |\ + (((uint32) ((uchar) (A)[3])) << 24)) |\ (((ulonglong) ((uchar) (A)[4])) << 32)) -#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \ - (((uint32) ((uchar) (A)[1])) << 8) + \ - (((uint32) ((uchar) (A)[2])) << 16) + \ - (((uint32) ((uchar) (A)[3])) << 24)) + \ - (((ulonglong) ((uchar) (A)[4])) << 32) + \ +#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) | \ + (((uint32) ((uchar) (A)[1])) << 8) | \ + (((uint32) ((uchar) (A)[2])) << 16) | \ + (((uint32) ((uchar) (A)[3])) << 24)) | \ + (((ulonglong) ((uchar) (A)[4])) << 32) | \ (((ulonglong) ((uchar) (A)[5])) << 40)) #define uint8korr(A) (*((const ulonglong *) (A))) #define sint8korr(A) (*((const longlong *) (A))) diff --git a/include/byte_order_generic_x86_64.h b/include/byte_order_generic_x86_64.h index 68001ca941f..a25e6a2ab08 100644 --- a/include/byte_order_generic_x86_64.h +++ b/include/byte_order_generic_x86_64.h @@ -1,4 +1,5 @@ /* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,8 +29,8 @@ ((uint32) (uchar) (A)[0]))) #define sint4korr(A) (int32) (*((int32 *) (A))) #define uint2korr(A) (uint16) (*((uint16 *) (A))) -#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\ - (((uint32) ((uchar) (A)[1])) << 8) +\ +#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\ + (((uint32) ((uchar) (A)[1])) << 8) |\ (((uint32) ((uchar) (A)[2])) << 16)) #define uint4korr(A) (uint32) (*((uint32 *) (A))) @@ -53,7 +54,7 @@ static inline ulonglong uint6korr(const void *p) #define int2store(T,A) do { uchar *pT= (uchar*)(T);\ *((uint16*)(pT))= (uint16) (A);\ } while (0) - + #define int3store(T,A) do { *(T)= (uchar) ((A));\ *(T+1)=(uchar) (((uint) (A) >> 8));\ *(T+2)=(uchar) (((A) >> 16));\ diff --git a/include/myisampack.h b/include/myisampack.h index eb5baf5fc56..6bfe1958fbc 100644 --- a/include/myisampack.h +++ b/include/myisampack.h @@ -2,6 +2,7 @@ #define MYISAMPACK_INCLUDED /* Copyright (c) 2000-2002, 2004 MySQL AB, 2009 Sun Microsystems, Inc. + Copyright (c) 2020, MariaDB Corporation. Use is subject to license terms. This program is free software; you can redistribute it and/or modify @@ -28,7 +29,7 @@ #define mi_sint1korr(A) ((int8)(*A)) #define mi_uint1korr(A) ((uint8)(*A)) -#define mi_sint2korr(A) ((int16) (((int16) (((const uchar*) (A))[1])) +\ +#define mi_sint2korr(A) ((int16) (((int16) (((const uchar*) (A))[1])) |\ ((int16) ((int16) ((const char*) (A))[0]) << 8))) #define mi_sint3korr(A) ((int32) (((((const uchar*) (A))[0]) & 128) ? \ (((uint32) 255L << 24) | \ @@ -38,58 +39,58 @@ (((uint32) ((const uchar*) (A))[0]) << 16) |\ (((uint32) ((const uchar*) (A))[1]) << 8) | \ ((uint32) ((const uchar*) (A))[2]))) -#define mi_sint4korr(A) ((int32) (((int32) (((const uchar*) (A))[3])) +\ - ((int32) (((const uchar*) (A))[2]) << 8) +\ - ((int32) (((const uchar*) (A))[1]) << 16) +\ +#define mi_sint4korr(A) ((int32) (((int32) (((const uchar*) (A))[3])) |\ + ((int32) (((const uchar*) (A))[2]) << 8) |\ + ((int32) (((const uchar*) (A))[1]) << 16) |\ ((int32) ((int16) ((const char*) (A))[0]) << 24))) #define mi_sint8korr(A) ((longlong) mi_uint8korr(A)) -#define mi_uint2korr(A) ((uint16) (((uint16) (((const uchar*) (A))[1])) +\ +#define mi_uint2korr(A) ((uint16) (((uint16) (((const uchar*) (A))[1])) |\ ((uint16) (((const uchar*) (A))[0]) << 8))) -#define mi_uint3korr(A) ((uint32) (((uint32) (((const uchar*) (A))[2])) +\ - (((uint32) (((const uchar*) (A))[1])) << 8) +\ +#define mi_uint3korr(A) ((uint32) (((uint32) (((const uchar*) (A))[2])) |\ + (((uint32) (((const uchar*) (A))[1])) << 8) |\ (((uint32) (((const uchar*) (A))[0])) << 16))) -#define mi_uint4korr(A) ((uint32) (((uint32) (((const uchar*) (A))[3])) +\ - (((uint32) (((const uchar*) (A))[2])) << 8) +\ - (((uint32) (((const uchar*) (A))[1])) << 16) +\ +#define mi_uint4korr(A) ((uint32) (((uint32) (((const uchar*) (A))[3])) |\ + (((uint32) (((const uchar*) (A))[2])) << 8) |\ + (((uint32) (((const uchar*) (A))[1])) << 16) |\ (((uint32) (((const uchar*) (A))[0])) << 24))) #ifndef HAVE_mi_uint5korr -#define mi_uint5korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[4])) +\ - (((uint32) (((const uchar*) (A))[3])) << 8) +\ - (((uint32) (((const uchar*) (A))[2])) << 16) +\ - (((uint32) (((const uchar*) (A))[1])) << 24)) +\ +#define mi_uint5korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[4])) |\ + (((uint32) (((const uchar*) (A))[3])) << 8) |\ + (((uint32) (((const uchar*) (A))[2])) << 16) |\ + (((uint32) (((const uchar*) (A))[1])) << 24)) |\ (((ulonglong) (((const uchar*) (A))[0])) << 32)) #endif /* HAVE_mi_uint5korr */ #ifndef HAVE_mi_uint6korr -#define mi_uint6korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[5])) +\ - (((uint32) (((const uchar*) (A))[4])) << 8) +\ - (((uint32) (((const uchar*) (A))[3])) << 16) +\ - (((uint32) (((const uchar*) (A))[2])) << 24)) +\ - (((ulonglong) (((uint32) (((const uchar*) (A))[1])) +\ +#define mi_uint6korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[5])) |\ + (((uint32) (((const uchar*) (A))[4])) << 8) |\ + (((uint32) (((const uchar*) (A))[3])) << 16) |\ + (((uint32) (((const uchar*) (A))[2])) << 24)) |\ + (((ulonglong) (((uint32) (((const uchar*) (A))[1])) |\ (((uint32) (((const uchar*) (A))[0]) << 8)))) <<\ 32)) #endif /* HAVE_mi_uint6korr */ #ifndef HAVE_mi_uint7korr -#define mi_uint7korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[6])) +\ - (((uint32) (((const uchar*) (A))[5])) << 8) +\ - (((uint32) (((const uchar*) (A))[4])) << 16) +\ - (((uint32) (((const uchar*) (A))[3])) << 24)) +\ - (((ulonglong) (((uint32) (((const uchar*) (A))[2])) +\ - (((uint32) (((const uchar*) (A))[1])) << 8) +\ +#define mi_uint7korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[6])) |\ + (((uint32) (((const uchar*) (A))[5])) << 8) |\ + (((uint32) (((const uchar*) (A))[4])) << 16) |\ + (((uint32) (((const uchar*) (A))[3])) << 24)) |\ + (((ulonglong) (((uint32) (((const uchar*) (A))[2])) |\ + (((uint32) (((const uchar*) (A))[1])) << 8) |\ (((uint32) (((const uchar*) (A))[0])) << 16))) <<\ 32)) #endif /* HAVE_mi_uint7korr */ #ifndef HAVE_mi_uint8korr -#define mi_uint8korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[7])) +\ - (((uint32) (((const uchar*) (A))[6])) << 8) +\ - (((uint32) (((const uchar*) (A))[5])) << 16) +\ - (((uint32) (((const uchar*) (A))[4])) << 24)) +\ - (((ulonglong) (((uint32) (((const uchar*) (A))[3])) +\ - (((uint32) (((const uchar*) (A))[2])) << 8) +\ - (((uint32) (((const uchar*) (A))[1])) << 16) +\ +#define mi_uint8korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[7])) |\ + (((uint32) (((const uchar*) (A))[6])) << 8) |\ + (((uint32) (((const uchar*) (A))[5])) << 16) |\ + (((uint32) (((const uchar*) (A))[4])) << 24)) |\ + (((ulonglong) (((uint32) (((const uchar*) (A))[3])) |\ + (((uint32) (((const uchar*) (A))[2])) << 8) |\ + (((uint32) (((const uchar*) (A))[1])) << 16) |\ (((uint32) (((const uchar*) (A))[0])) << 24))) <<\ 32)) #endif /* HAVE_mi_uint8korr */ diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index 1d5bfba182d..9fe746a167b 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -1,4 +1,5 @@ /* Copyright (C) 2007 MySQL AB & Sanja Belkin. 2010 Monty Program Ab. + Copyright (c) 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -5440,15 +5441,15 @@ static uchar *translog_get_LSN_from_diff(LSN base_lsn, uchar *src, uchar *dst) src + 1 + LSN_STORE_SIZE)); DBUG_RETURN(src + 1 + LSN_STORE_SIZE); } - rec_offset= LSN_OFFSET(base_lsn) - ((first_byte << 8) + *((uint8*)src)); + rec_offset= LSN_OFFSET(base_lsn) - ((first_byte << 8) | *((uint8*)src)); break; case 1: diff= uint2korr(src); - rec_offset= LSN_OFFSET(base_lsn) - ((first_byte << 16) + diff); + rec_offset= LSN_OFFSET(base_lsn) - ((first_byte << 16) | diff); break; case 2: diff= uint3korr(src); - rec_offset= LSN_OFFSET(base_lsn) - ((first_byte << 24) + diff); + rec_offset= LSN_OFFSET(base_lsn) - ((first_byte << 24) | diff); break; case 3: { diff --git a/storage/maria/ma_packrec.c b/storage/maria/ma_packrec.c index e2c1e353616..eab079f4fb8 100644 --- a/storage/maria/ma_packrec.c +++ b/storage/maria/ma_packrec.c @@ -1,4 +1,5 @@ /* Copyright (C) 2006 MySQL AB & MySQL Finland AB & TCX DataKonsult AB + Copyright (c) 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1157,10 +1158,10 @@ static void decode_bytes(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff, bit_buff->error=1; return; /* Can't be right */ } - bit_buff->current_byte= (bit_buff->current_byte << 32) + - ((((uint) bit_buff->pos[3])) + - (((uint) bit_buff->pos[2]) << 8) + - (((uint) bit_buff->pos[1]) << 16) + + bit_buff->current_byte= (bit_buff->current_byte << 32) | + ((((uint) bit_buff->pos[3])) | + (((uint) bit_buff->pos[2]) << 8) | + (((uint) bit_buff->pos[1]) << 16) | (((uint) bit_buff->pos[0]) << 24)); bit_buff->pos+=4; bits+=32; @@ -1251,23 +1252,23 @@ static void decode_bytes(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff, return; /* Can't be right */ } #if BITS_SAVED == 32 - bit_buff->current_byte= (bit_buff->current_byte << 24) + - (((uint) ((uchar) bit_buff->pos[2]))) + - (((uint) ((uchar) bit_buff->pos[1])) << 8) + + bit_buff->current_byte= (bit_buff->current_byte << 24) | + (((uint) ((uchar) bit_buff->pos[2]))) | + (((uint) ((uchar) bit_buff->pos[1])) << 8) | (((uint) ((uchar) bit_buff->pos[0])) << 16); bit_buff->pos+=3; bits+=24; #else if (bits) /* We must have at leasts 9 bits */ { - bit_buff->current_byte= (bit_buff->current_byte << 8) + + bit_buff->current_byte= (bit_buff->current_byte << 8) | (uint) ((uchar) bit_buff->pos[0]); bit_buff->pos++; bits+=8; } else { - bit_buff->current_byte= ((uint) ((uchar) bit_buff->pos[0]) << 8) + + bit_buff->current_byte= ((uint) ((uchar) bit_buff->pos[0]) << 8) | ((uint) ((uchar) bit_buff->pos[1])); bit_buff->pos+=2; bits+=16; @@ -1291,14 +1292,14 @@ static void decode_bytes(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff, if (bits < 8) { /* We don't need to check end */ #if BITS_SAVED == 32 - bit_buff->current_byte= (bit_buff->current_byte << 24) + - (((uint) ((uchar) bit_buff->pos[2]))) + - (((uint) ((uchar) bit_buff->pos[1])) << 8) + + bit_buff->current_byte= (bit_buff->current_byte << 24) | + (((uint) ((uchar) bit_buff->pos[2]))) | + (((uint) ((uchar) bit_buff->pos[1])) << 8) | (((uint) ((uchar) bit_buff->pos[0])) << 16); bit_buff->pos+=3; bits+=24; #else - bit_buff->current_byte= (bit_buff->current_byte << 8) + + bit_buff->current_byte= (bit_buff->current_byte << 8) | (uint) ((uchar) bit_buff->pos[0]); bit_buff->pos+=1; bits+=8; @@ -1488,25 +1489,25 @@ static void fill_buffer(MARIA_BIT_BUFF *bit_buff) return; } #if BITS_SAVED == 64 - bit_buff->current_byte= ((((uint) ((uchar) bit_buff->pos[7]))) + - (((uint) ((uchar) bit_buff->pos[6])) << 8) + - (((uint) ((uchar) bit_buff->pos[5])) << 16) + - (((uint) ((uchar) bit_buff->pos[4])) << 24) + + bit_buff->current_byte= ((((uint) ((uchar) bit_buff->pos[7]))) | + (((uint) ((uchar) bit_buff->pos[6])) << 8) | + (((uint) ((uchar) bit_buff->pos[5])) << 16) | + (((uint) ((uchar) bit_buff->pos[4])) << 24) | ((ulonglong) - ((((uint) ((uchar) bit_buff->pos[3]))) + - (((uint) ((uchar) bit_buff->pos[2])) << 8) + - (((uint) ((uchar) bit_buff->pos[1])) << 16) + + ((((uint) ((uchar) bit_buff->pos[3]))) | + (((uint) ((uchar) bit_buff->pos[2])) << 8) | + (((uint) ((uchar) bit_buff->pos[1])) << 16) | (((uint) ((uchar) bit_buff->pos[0])) << 24)) << 32)); bit_buff->pos+=8; #else #if BITS_SAVED == 32 - bit_buff->current_byte= (((uint) ((uchar) bit_buff->pos[3])) + - (((uint) ((uchar) bit_buff->pos[2])) << 8) + - (((uint) ((uchar) bit_buff->pos[1])) << 16) + + bit_buff->current_byte= (((uint) ((uchar) bit_buff->pos[3])) | + (((uint) ((uchar) bit_buff->pos[2])) << 8) | + (((uint) ((uchar) bit_buff->pos[1])) << 16) | (((uint) ((uchar) bit_buff->pos[0])) << 24)); bit_buff->pos+=4; #else - bit_buff->current_byte= (uint) (((uint) ((uchar) bit_buff->pos[1]))+ + bit_buff->current_byte= (uint) (((uint) ((uchar) bit_buff->pos[1])) | (((uint) ((uchar) bit_buff->pos[0])) << 8)); bit_buff->pos+=2; #endif diff --git a/storage/myisam/mi_packrec.c b/storage/myisam/mi_packrec.c index 72ce17b6a78..572fe690da8 100644 --- a/storage/myisam/mi_packrec.c +++ b/storage/myisam/mi_packrec.c @@ -1,4 +1,5 @@ /* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1111,10 +1112,10 @@ static void decode_bytes(MI_COLUMNDEF *rec,MI_BIT_BUFF *bit_buff,uchar *to, bit_buff->error=1; return; /* Can't be right */ } - bit_buff->current_byte= (bit_buff->current_byte << 32) + - ((((uint) bit_buff->pos[3])) + - (((uint) bit_buff->pos[2]) << 8) + - (((uint) bit_buff->pos[1]) << 16) + + bit_buff->current_byte= (bit_buff->current_byte << 32) | + ((((uint) bit_buff->pos[3])) | + (((uint) bit_buff->pos[2]) << 8) | + (((uint) bit_buff->pos[1]) << 16) | (((uint) bit_buff->pos[0]) << 24)); bit_buff->pos+=4; bits+=32; @@ -1205,23 +1206,23 @@ static void decode_bytes(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, return; /* Can't be right */ } #if BITS_SAVED == 32 - bit_buff->current_byte= (bit_buff->current_byte << 24) + - (((uint) ((uchar) bit_buff->pos[2]))) + - (((uint) ((uchar) bit_buff->pos[1])) << 8) + + bit_buff->current_byte= (bit_buff->current_byte << 24) | + (((uint) ((uchar) bit_buff->pos[2]))) | + (((uint) ((uchar) bit_buff->pos[1])) << 8) | (((uint) ((uchar) bit_buff->pos[0])) << 16); bit_buff->pos+=3; bits+=24; #else if (bits) /* We must have at leasts 9 bits */ { - bit_buff->current_byte= (bit_buff->current_byte << 8) + + bit_buff->current_byte= (bit_buff->current_byte << 8) | (uint) ((uchar) bit_buff->pos[0]); bit_buff->pos++; bits+=8; } else { - bit_buff->current_byte= ((uint) ((uchar) bit_buff->pos[0]) << 8) + + bit_buff->current_byte= ((uint) ((uchar) bit_buff->pos[0]) << 8) | ((uint) ((uchar) bit_buff->pos[1])); bit_buff->pos+=2; bits+=16; @@ -1245,14 +1246,14 @@ static void decode_bytes(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, if (bits < 8) { /* We don't need to check end */ #if BITS_SAVED == 32 - bit_buff->current_byte= (bit_buff->current_byte << 24) + - (((uint) ((uchar) bit_buff->pos[2]))) + - (((uint) ((uchar) bit_buff->pos[1])) << 8) + + bit_buff->current_byte= (bit_buff->current_byte << 24) | + (((uint) ((uchar) bit_buff->pos[2]))) | + (((uint) ((uchar) bit_buff->pos[1])) << 8) | (((uint) ((uchar) bit_buff->pos[0])) << 16); bit_buff->pos+=3; bits+=24; #else - bit_buff->current_byte= (bit_buff->current_byte << 8) + + bit_buff->current_byte= (bit_buff->current_byte << 8) | (uint) ((uchar) bit_buff->pos[0]); bit_buff->pos+=1; bits+=8; @@ -1439,25 +1440,25 @@ static void fill_buffer(MI_BIT_BUFF *bit_buff) } #if BITS_SAVED == 64 - bit_buff->current_byte= ((((uint) ((uchar) bit_buff->pos[7]))) + - (((uint) ((uchar) bit_buff->pos[6])) << 8) + - (((uint) ((uchar) bit_buff->pos[5])) << 16) + - (((uint) ((uchar) bit_buff->pos[4])) << 24) + + bit_buff->current_byte= ((((uint) ((uchar) bit_buff->pos[7]))) | + (((uint) ((uchar) bit_buff->pos[6])) << 8) | + (((uint) ((uchar) bit_buff->pos[5])) << 16) | + (((uint) ((uchar) bit_buff->pos[4])) << 24) | ((ulonglong) - ((((uint) ((uchar) bit_buff->pos[3]))) + - (((uint) ((uchar) bit_buff->pos[2])) << 8) + - (((uint) ((uchar) bit_buff->pos[1])) << 16) + + ((((uint) ((uchar) bit_buff->pos[3]))) | + (((uint) ((uchar) bit_buff->pos[2])) << 8) | + (((uint) ((uchar) bit_buff->pos[1])) << 16) | (((uint) ((uchar) bit_buff->pos[0])) << 24)) << 32)); bit_buff->pos+=8; #else #if BITS_SAVED == 32 - bit_buff->current_byte= (((uint) ((uchar) bit_buff->pos[3])) + - (((uint) ((uchar) bit_buff->pos[2])) << 8) + - (((uint) ((uchar) bit_buff->pos[1])) << 16) + + bit_buff->current_byte= (((uint) ((uchar) bit_buff->pos[3])) | + (((uint) ((uchar) bit_buff->pos[2])) << 8) | + (((uint) ((uchar) bit_buff->pos[1])) << 16) | (((uint) ((uchar) bit_buff->pos[0])) << 24)); bit_buff->pos+=4; #else - bit_buff->current_byte= (uint) (((uint) ((uchar) bit_buff->pos[1]))+ + bit_buff->current_byte= (uint) (((uint) ((uchar) bit_buff->pos[1])) | (((uint) ((uchar) bit_buff->pos[0])) << 8)); bit_buff->pos+=2; #endif From 328edf8560dbf1941ce314fa112e0db05d9f97f1 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 20 Mar 2020 15:24:06 +0400 Subject: [PATCH 18/25] MDEV-21977 main.func_math fails due to undefined behaviour The problem happened in these line: uval0= (ulonglong) (val0_negative ? -val0 : val0); uval1= (ulonglong) (val1_negative ? -val1 : val1); return check_integer_overflow(val0_negative ? -(longlong) res : res, !val0_negative); when unary minus was performed on -9223372036854775808. This behavior is undefined in C/C++. --- mysql-test/r/func_math.result | 48 +++++++++++++++++++++++++++++++++++ mysql-test/t/func_math.test | 29 +++++++++++++++++++++ sql/item_func.cc | 33 ++++++++---------------- sql/sql_type_int.h | 20 +++++++++++++++ 4 files changed, 107 insertions(+), 23 deletions(-) diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index 008590aa5d8..c92549ae45e 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -946,5 +946,53 @@ STDDEV_SAMP(a) NULL DROP TABLE t1; # +# MDEV-21977 main.func_math fails due to undefined behaviour +# +SELECT 9223372036854775808 DIV 1; +9223372036854775808 DIV 1 +9223372036854775808 +SELECT 9223372036854775808 DIV -1; +ERROR 22003: BIGINT UNSIGNED value is out of range in '(9223372036854775808 DIV -(1))' +SELECT -9223372036854775808 DIV 1; +ERROR 22003: BIGINT value is out of range in '(-(9223372036854775808) DIV 1)' +SELECT -9223372036854775808 DIV -1; +ERROR 22003: BIGINT value is out of range in '(-(9223372036854775808) DIV -(1))' +SELECT 9223372036854775808 MOD 1; +9223372036854775808 MOD 1 +0 +SELECT 9223372036854775808 MOD -1; +9223372036854775808 MOD -1 +0 +SELECT -9223372036854775808 MOD 1; +-9223372036854775808 MOD 1 +0 +SELECT -9223372036854775808 MOD -1; +-9223372036854775808 MOD -1 +0 +SELECT 1 MOD 9223372036854775808; +1 MOD 9223372036854775808 +1 +SELECT -1 MOD 9223372036854775808; +-1 MOD 9223372036854775808 +-1 +SELECT 1 MOD -9223372036854775808; +1 MOD -9223372036854775808 +1 +SELECT -1 MOD -9223372036854775808; +-1 MOD -9223372036854775808 +-1 +SELECT 9223372036854775808 MOD 9223372036854775808; +9223372036854775808 MOD 9223372036854775808 +0 +SELECT 9223372036854775808 MOD -9223372036854775808; +9223372036854775808 MOD -9223372036854775808 +0 +SELECT -9223372036854775808 MOD 9223372036854775808; +-9223372036854775808 MOD 9223372036854775808 +0 +SELECT -9223372036854775808 MOD -9223372036854775808; +-9223372036854775808 MOD -9223372036854775808 +0 +# # End of 10.1 tests # diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test index ebce8a8480c..89e9c4f4d49 100644 --- a/mysql-test/t/func_math.test +++ b/mysql-test/t/func_math.test @@ -692,6 +692,35 @@ SELECT STDDEV_SAMP(a) FROM t1; DROP TABLE t1; +--echo # +--echo # MDEV-21977 main.func_math fails due to undefined behaviour +--echo # + +SELECT 9223372036854775808 DIV 1; +--error ER_DATA_OUT_OF_RANGE +SELECT 9223372036854775808 DIV -1; +--error ER_DATA_OUT_OF_RANGE +SELECT -9223372036854775808 DIV 1; +--error ER_DATA_OUT_OF_RANGE +SELECT -9223372036854775808 DIV -1; + +SELECT 9223372036854775808 MOD 1; +SELECT 9223372036854775808 MOD -1; +SELECT -9223372036854775808 MOD 1; +SELECT -9223372036854775808 MOD -1; + +SELECT 1 MOD 9223372036854775808; +SELECT -1 MOD 9223372036854775808; +SELECT 1 MOD -9223372036854775808; +SELECT -1 MOD -9223372036854775808; + +SELECT 9223372036854775808 MOD 9223372036854775808; +SELECT 9223372036854775808 MOD -9223372036854775808; +SELECT -9223372036854775808 MOD 9223372036854775808; +SELECT -9223372036854775808 MOD -9223372036854775808; + + + --echo # --echo # End of 10.1 tests --echo # diff --git a/sql/item_func.cc b/sql/item_func.cc index ffd2b462431..302ec58a708 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1834,11 +1834,9 @@ longlong Item_func_int_div::val_int() raise_integer_overflow(); return res; } - - longlong val0=args[0]->val_int(); - longlong val1=args[1]->val_int(); - bool val0_negative, val1_negative, res_negative; - ulonglong uval0, uval1, res; + + Longlong_hybrid val0= args[0]->to_longlong_hybrid(); + Longlong_hybrid val1= args[1]->to_longlong_hybrid(); if ((null_value= (args[0]->null_value || args[1]->null_value))) return 0; if (val1 == 0) @@ -1847,12 +1845,8 @@ longlong Item_func_int_div::val_int() return 0; } - val0_negative= !args[0]->unsigned_flag && val0 < 0; - val1_negative= !args[1]->unsigned_flag && val1 < 0; - res_negative= val0_negative != val1_negative; - uval0= (ulonglong) (val0_negative ? -val0 : val0); - uval1= (ulonglong) (val1_negative ? -val1 : val1); - res= uval0 / uval1; + bool res_negative= val0.neg() != val1.neg(); + ulonglong res= val0.abs() / val1.abs(); if (res_negative) { if (res > (ulonglong) LONGLONG_MAX) @@ -1880,11 +1874,8 @@ void Item_func_int_div::fix_length_and_dec() longlong Item_func_mod::int_op() { DBUG_ASSERT(fixed == 1); - longlong val0= args[0]->val_int(); - longlong val1= args[1]->val_int(); - bool val0_negative, val1_negative; - ulonglong uval0, uval1; - ulonglong res; + Longlong_hybrid val0= args[0]->to_longlong_hybrid(); + Longlong_hybrid val1= args[1]->to_longlong_hybrid(); if ((null_value= args[0]->null_value || args[1]->null_value)) return 0; /* purecov: inspected */ @@ -1899,13 +1890,9 @@ longlong Item_func_mod::int_op() LONGLONG_MIN by -1 generates SIGFPE, we calculate using unsigned values and then adjust the sign appropriately. */ - val0_negative= !args[0]->unsigned_flag && val0 < 0; - val1_negative= !args[1]->unsigned_flag && val1 < 0; - uval0= (ulonglong) (val0_negative ? -val0 : val0); - uval1= (ulonglong) (val1_negative ? -val1 : val1); - res= uval0 % uval1; - return check_integer_overflow(val0_negative ? -(longlong) res : res, - !val0_negative); + ulonglong res= val0.abs() % val1.abs(); + return check_integer_overflow(val0.neg() ? -(longlong) res : res, + !val0.neg()); } double Item_func_mod::real_op() diff --git a/sql/sql_type_int.h b/sql/sql_type_int.h index 74e59b08385..5988a985a2d 100644 --- a/sql/sql_type_int.h +++ b/sql/sql_type_int.h @@ -67,6 +67,26 @@ public: */ return cmp_signed(other); } + bool operator==(const Longlong_hybrid &nr) const + { + return cmp(nr) == 0; + } + bool operator==(ulonglong nr) const + { + return cmp(Longlong_hybrid((longlong) nr, true)) == 0; + } + bool operator==(uint nr) const + { + return cmp(Longlong_hybrid((longlong) nr, true)) == 0; + } + bool operator==(longlong nr) const + { + return cmp(Longlong_hybrid(nr, false)) == 0; + } + bool operator==(int nr) const + { + return cmp(Longlong_hybrid(nr, false)) == 0; + } }; #endif // SQL_TYPE_INT_INCLUDED From ec5e48be4bff1dde3812ab0c9d2b058aa37b59a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 20 Mar 2020 13:23:24 +0200 Subject: [PATCH 19/25] Test fixes for galera_3nodes suite. --- mysql-test/suite/galera/t/MDEV-20225.test | 2 ++ .../galera_3nodes/r/galera_safe_to_bootstrap.result | 8 ++++++++ .../suite/galera_3nodes/t/galera_safe_to_bootstrap.test | 9 +++++++++ 3 files changed, 19 insertions(+) diff --git a/mysql-test/suite/galera/t/MDEV-20225.test b/mysql-test/suite/galera/t/MDEV-20225.test index b7dab1022c6..2124e499530 100644 --- a/mysql-test/suite/galera/t/MDEV-20225.test +++ b/mysql-test/suite/galera/t/MDEV-20225.test @@ -41,6 +41,8 @@ SET DEBUG_SYNC = 'RESET'; SET GLOBAL wsrep_slave_threads = 1; # Trigger should now be dropped on node_2. +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME like '%tr1' +--source include/wait_condition.inc SHOW TRIGGERS; DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result b/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result index 4da24e8dbfb..be6e1a88cdf 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result +++ b/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result @@ -42,6 +42,10 @@ CALL mtr.add_suppression("WSREP: moving position backwards: [0-9]+ -> 0"); CALL mtr.add_suppression("Failed to prepare for incremental state transfer"); CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this node"); CALL mtr.add_suppression("Aborting"); +CALL mtr.add_suppression("Plugin 'wsrep' init function returned error."); +CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed."); +CALL mtr.add_suppression("Failed to initialize plugins."); +CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg()"); connection node_3; CALL mtr.add_suppression("WSREP: no nodes coming from prim view, prim not possible"); CALL mtr.add_suppression("WSREP: It may not be safe to bootstrap the cluster from this node"); @@ -51,6 +55,10 @@ CALL mtr.add_suppression("WSREP: moving position backwards: [0-9]+ -> 0"); CALL mtr.add_suppression("Failed to prepare for incremental state transfer"); CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this node"); CALL mtr.add_suppression("Aborting"); +CALL mtr.add_suppression("Plugin 'wsrep' init function returned error."); +CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed."); +CALL mtr.add_suppression("Failed to initialize plugins."); +CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg()"); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test b/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test index 082cb546e87..8e13aed8f5f 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test +++ b/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test @@ -179,6 +179,10 @@ CALL mtr.add_suppression("WSREP: moving position backwards: [0-9]+ -> 0"); CALL mtr.add_suppression("Failed to prepare for incremental state transfer"); CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this node"); CALL mtr.add_suppression("Aborting"); +CALL mtr.add_suppression("Plugin 'wsrep' init function returned error."); +CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed."); +CALL mtr.add_suppression("Failed to initialize plugins."); +CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg()"); --connection node_3 CALL mtr.add_suppression("WSREP: no nodes coming from prim view, prim not possible"); @@ -189,6 +193,11 @@ CALL mtr.add_suppression("WSREP: moving position backwards: [0-9]+ -> 0"); CALL mtr.add_suppression("Failed to prepare for incremental state transfer"); CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this node"); CALL mtr.add_suppression("Aborting"); +CALL mtr.add_suppression("Plugin 'wsrep' init function returned error."); +CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed."); +CALL mtr.add_suppression("Failed to initialize plugins."); +CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg()"); + SHOW CREATE TABLE t1; DROP TABLE t1; From d529389358fb0c7f3e642d34d7fd84df307b9d29 Mon Sep 17 00:00:00 2001 From: seppo Date: Fri, 20 Mar 2020 15:38:37 +0200 Subject: [PATCH 20/25] MDEV-21979 Galera test sporadic failure on galera_3nodes.galera_pc_weight (#1473) Forcing wait on nodes 2 and 3, to turn wsrep_ready to 'ON' before querying wsrep status variables. This guarantees that status reads don't come too early on these nodes --- mysql-test/suite/galera_3nodes/r/galera_pc_weight.result | 2 ++ mysql-test/suite/galera_3nodes/t/galera_pc_weight.test | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result b/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result index 3ae983f9550..94ead54dfe0 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result +++ b/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result @@ -87,6 +87,8 @@ SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; connection node_2; connection node_3; connection node_1; +connection node_2; +connection node_3; SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 3 1 diff --git a/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test index 729f14a731f..0e407e49aba 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test +++ b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test @@ -88,6 +88,15 @@ SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; --connection node_1 --source include/wait_condition.inc +# wait until nodes 2 and 3 have declared ready state (can happen after cluster_size raaise) +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready' +--source include/wait_condition.inc + +--connection node_3 +--source include/wait_condition.inc + + # On all nodes, we now expect a Primary component of size 3, weight 3, Synced and ready SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; From b8b3edff1376dc68c13d819470edfb33c339a64b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 20 Mar 2020 13:14:05 +0200 Subject: [PATCH 21/25] MDEV-21549 IMPORT TABLESPACE fails to adjust all tablespace ID in root pages After MDEV-12353, the consistency check that I originally added for commit 1b9fe0bbac72d49a32863241b2b5081438b5f691 (InnoDB Plugin for MySQL 5.1) started randomly failing. It turns out that the IMPORT TABLESPACE code was always incorrect: it did not update the (redundantly stored) tablespace ID in index tree root pages. It only does that for page headers and BLOB pointers. PageConverter::update_index_page(): Update the tablespace ID in the BTR_SEG_TOP and BTR_SEG_LEAF of index root pages. --- storage/innobase/row/row0import.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index 751cd4e5293..ad7f77f6215 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -1902,6 +1902,23 @@ PageConverter::update_index_page( return(DB_SUCCESS); } + if (m_index && block->page.id.page_no() == m_index->m_page_no) { + byte *b = FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF + FSEG_HDR_SPACE + + page; + mach_write_to_4(b, block->page.id.space()); + + memcpy(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP + FSEG_HDR_SPACE + + page, b, 4); + if (UNIV_LIKELY_NULL(block->page.zip.data)) { + memcpy(&block->page.zip.data[FIL_PAGE_DATA + + PAGE_BTR_SEG_TOP + + FSEG_HDR_SPACE], b, 4); + memcpy(&block->page.zip.data[FIL_PAGE_DATA + + PAGE_BTR_SEG_LEAF + + FSEG_HDR_SPACE], b, 4); + } + } + #ifdef UNIV_ZIP_DEBUG ut_a(!is_compressed_table() || page_zip_validate(m_page_zip_ptr, page, m_index->m_srv_index)); From b034d708c813fa9c274fe14a1492dac62c923cb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 20 Mar 2020 16:34:15 +0200 Subject: [PATCH 22/25] MDEV-21549: Clean up the import/export tests Remove CREATE/DROP database. Remove some unnecessary suppressions, replacements, and SQL statements. Populate tables via have_sequence.inc to avoid the creation of explicit InnoDB record locks in INSERT...SELECT. This will remove some gaps in AUTO_INCREMENT values. --- .../suite/innodb/r/innodb-wl5522-debug.result | 1050 +++++++++-------- .../suite/innodb/r/innodb-wl5522.result | 576 ++------- .../suite/innodb/t/innodb-wl5522-debug.test | 764 ++++++------ mysql-test/suite/innodb/t/innodb-wl5522.test | 105 +- .../innodb_zip/r/wl5522_debug_zip.result | 577 ++++----- .../suite/innodb_zip/r/wl5522_zip.result | 192 +-- .../suite/innodb_zip/t/wl5522_debug_zip.test | 381 +++--- mysql-test/suite/innodb_zip/t/wl5522_zip.test | 71 +- 8 files changed, 1475 insertions(+), 2241 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result index 99e9c49eee9..da064b83be6 100644 --- a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result +++ b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result @@ -10,62 +10,59 @@ call mtr.add_suppression("InnoDB: Page for tablespace "); call mtr.add_suppression("InnoDB: Invalid FSP_SPACE_FLAGS="); FLUSH TABLES; SET GLOBAL innodb_file_per_table = 1; -CREATE DATABASE test_wl5522; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = InnoDB; -INSERT INTO test_wl5522.t1 VALUES(1),(2),(3); +CREATE TABLE t1 (c1 INT) ENGINE = InnoDB; +INSERT INTO t1 VALUES(1),(2),(3); SET SESSION debug_dbug="+d,ib_discard_before_commit_crash"; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; ERROR HY000: Lost connection to MySQL server during query -DROP TABLE test_wl5522.t1; +DROP TABLE t1; SET GLOBAL innodb_file_per_table = 1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = InnoDB; -INSERT INTO test_wl5522.t1 VALUES(1),(2),(3); +CREATE TABLE t1 (c1 INT) ENGINE = InnoDB; +INSERT INTO t1 VALUES(1),(2),(3); SET SESSION debug_dbug="+d,ib_discard_after_commit_crash"; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; ERROR HY000: Lost connection to MySQL server during query -DROP TABLE test_wl5522.t1; +DROP TABLE t1; SET GLOBAL innodb_file_per_table = 1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1), (2), (3), (4); -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1), (2), (3), (4); +FLUSH TABLES t1 FOR EXPORT; backup: t1 UNLOCK TABLES; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files -SELECT * FROM test_wl5522.t1; +SELECT * FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` SET SESSION debug_dbug="+d,ib_import_before_commit_crash"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Lost connection to MySQL server during query -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` SET SESSION debug_dbug="+d,ib_import_before_checkpoint_crash"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Lost connection to MySQL server during query unlink: t1.ibd unlink: t1.cfg -DROP TABLE test_wl5522.t1; +DROP TABLE t1; +SET @file_per_table= @@innodb_file_per_table; SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +ALTER TABLE t1 DISCARD TABLESPACE; restore: t1 .ibd and .cfg files -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -CHECK TABLE test_wl5522.t1; +ALTER TABLE t1 IMPORT TABLESPACE; +CHECK TABLE t1; Table Op Msg_type Msg_text -test_wl5522.t1 check status OK -SELECT COUNT(*) FROM test_wl5522.t1; +test.t1 check status OK +SELECT COUNT(*) FROM t1; COUNT(*) 4 -INSERT INTO test_wl5522.t1 VALUES(400), (500), (600); -SELECT * FROM test_wl5522.t1; +INSERT INTO t1 VALUES(400), (500), (600); +SELECT * FROM t1; c1 1 2 @@ -74,419 +71,419 @@ c1 400 500 600 -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); SET @saved_debug_dbug = @@SESSION.debug_dbug; SET SESSION debug_dbug="+d,ib_export_io_write_failure_1"; -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; Warnings: Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_2"; -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; Warnings: Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_3"; -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; Warnings: Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_4"; -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; Warnings: Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_5"; -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; Warnings: Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_6"; -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; Warnings: Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_7"; -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; Warnings: Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_8"; -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; Warnings: Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_9"; -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; Warnings: Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_10"; -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; Warnings: Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_11"; -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; Warnings: Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_12"; -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; Warnings: Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (100), (200), (300); -SELECT COUNT(*) FROM test_wl5522.t1; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (100), (200), (300); +SELECT COUNT(*) FROM t1; COUNT(*) 3 -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; backup: t1 UNLOCK TABLES; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` SET SESSION debug_dbug="+d,ib_import_io_read_error_1"; restore: t1 .cfg file -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: IO Read error: while reading index fields. SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` SET SESSION debug_dbug="+d,ib_import_io_read_error_2"; restore: t1 .cfg file -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: IO Read error: while reading index meta-data, expected to read 44 bytes but read only 0 bytes SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` SET SESSION debug_dbug="+d,ib_import_io_read_error_3"; restore: t1 .cfg file -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: IO Read error: while reading number of indexes. SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` SET SESSION debug_dbug="+d,ib_import_io_read_error_4"; restore: t1 .cfg file -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: IO Read error: while reading table column meta-data. SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` SET SESSION debug_dbug="+d,ib_import_io_read_error_5"; restore: t1 .cfg file -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: IO Read error: while reading meta-data export hostname length. SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` SET SESSION debug_dbug="+d,ib_import_io_read_error_6"; restore: t1 .cfg file -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: IO Read error: while reading meta-data table name length. SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` SET SESSION debug_dbug="+d,ib_import_io_read_error_7"; restore: t1 .cfg file -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: IO Read error: while reading autoinc value. SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` SET SESSION debug_dbug="+d,ib_import_io_read_error_8"; restore: t1 .cfg file -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: IO Read error: while reading meta-data header. SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` SET SESSION debug_dbug="+d,ib_import_io_read_error_9"; restore: t1 .cfg file -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: IO Read error: while reading meta-data version. SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` SET SESSION debug_dbug="+d,ib_import_string_read_error"; restore: t1 .cfg file -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: IO Read error: while parsing export hostname. SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_OOM_1"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_OOM_2"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_OOM_4"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_OOM_5"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_OOM_6"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_OOM_7"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_OOM_8"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_OOM_9"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_OOM_10"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_internal_error"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Internal error: While updating the of index GEN_CLUST_INDEX - Generic error SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +ALTER TABLE t1 IMPORT TABLESPACE; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_reset_space_and_lsn_failure"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -ERROR HY000: Internal error: Cannot reset LSNs in table `test_wl5522`.`t1` : Too many concurrent transactions +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`t1` : Too many concurrent transactions restore: t1 .ibd and .cfg files SET SESSION debug_dbug=@saved_debug_dbug; SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -ERROR HY000: Got error 44 'Tablespace not found' from ./test_wl5522/t1.ibd +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Got error 44 'Tablespace not found' from ./test/t1.ibd SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_check_bitmap_failure"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Index for table 't1' is corrupt; try to repair it SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_cluster_root_adjust_failure"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Index for table 't1' is corrupt; try to repair it SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_cluster_failure"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Index for table 't1' is corrupt; try to repair it SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_sec_root_adjust_failure"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Index for table 't1' is corrupt; try to repair it SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_set_max_rowid_failure"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Index for table 't1' is corrupt; try to repair it SET SESSION debug_dbug=@saved_debug_dbug; unlink: t1.ibd unlink: t1.cfg -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 ( +DROP TABLE t1; +CREATE TABLE t1 ( c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 BIGINT, c3 VARCHAR(2048), @@ -500,35 +497,29 @@ connection default; SET GLOBAL innodb_disable_background_merge=ON; SET GLOBAL innodb_monitor_reset = ibuf_merges; SET GLOBAL innodb_monitor_reset = ibuf_merges_insert; -INSERT INTO test_wl5522.t1(c2, c3, c4) VALUES -(1, REPEAT('a', 2048), REPEAT('a', 2048)), -(2, REPEAT('b', 2048), REPEAT('b', 2048)), -(3, REPEAT('c', 2048), REPEAT('c', 2048)), -(4, REPEAT('d', 2048), REPEAT('d', 2048)); -INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; -DELETE FROM test_wl5522.t1 WHERE c2 = 1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c3 = REPEAT("c2", 1024); -UPDATE test_wl5522.t1 SET c4 = REPEAT("c4", 1024); -SHOW CREATE TABLE test_wl5522.t1; +INSERT INTO t1 +SELECT 1 + seq, 1 + (seq MOD 4), +REPEAT(SUBSTR('abcd', 1 + (seq MOD 4), 1), 2048), +REPEAT(SUBSTR('abcd', 1 + (seq MOD 4), 1), 2048) +FROM seq_0_to_127; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c3 = REPEAT("c2", 1024); +UPDATE t1 SET c4 = REPEAT("c4", 1024); +SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL AUTO_INCREMENT, @@ -539,116 +530,148 @@ t1 CREATE TABLE `t1` ( KEY `idx1` (`c2`), KEY `idx2` (`c3`(512)), KEY `idx3` (`c4`(512)) -) ENGINE=InnoDB AUTO_INCREMENT=248 DEFAULT CHARSET=latin1 -SELECT c1, c2 FROM test_wl5522.t1; +) ENGINE=InnoDB AUTO_INCREMENT=129 DEFAULT CHARSET=latin1 +SELECT c1, c2 FROM t1; c1 c2 +1 16 2 32 3 48 4 64 +5 76 6 92 7 108 8 124 -13 197 -14 213 -15 229 -17 257 -18 273 -19 289 -28 422 -29 438 -30 454 -32 482 -33 498 -34 514 -36 542 -37 558 -38 574 -40 602 -41 618 -42 634 -59 887 -60 903 -61 919 -63 947 -64 963 -65 979 -67 1007 -68 1023 -69 1039 -71 1067 -72 1083 -73 1099 -75 1127 -76 1143 -77 1159 -79 1187 -80 1203 -81 1219 -83 1247 -84 1263 -85 1279 -87 1307 -88 1323 -89 1339 +9 136 +10 152 +11 168 +12 184 +13 196 +14 212 +15 228 +16 244 +17 256 +18 272 +19 288 +20 304 +21 316 +22 332 +23 348 +24 364 +25 376 +26 392 +27 408 +28 424 +29 436 +30 452 +31 468 +32 484 +33 496 +34 512 +35 528 +36 544 +37 556 +38 572 +39 588 +40 604 +41 616 +42 632 +43 648 +44 664 +45 676 +46 692 +47 708 +48 724 +49 736 +50 752 +51 768 +52 784 +53 796 +54 812 +55 828 +56 844 +57 856 +58 872 +59 888 +60 904 +61 916 +62 932 +63 948 +64 964 +65 976 +66 992 +67 1008 +68 1024 +69 1036 +70 1052 +71 1068 +72 1084 +73 1096 +74 1112 +75 1128 +76 1144 +77 1156 +78 1172 +79 1188 +80 1204 +81 1216 +82 1232 +83 1248 +84 1264 +85 1276 +86 1292 +87 1308 +88 1324 +89 1336 +90 1352 +91 1368 +92 1384 +93 1396 +94 1412 +95 1428 +96 1444 +97 1456 +98 1472 +99 1488 +100 1504 +101 1516 +102 1532 +103 1548 +104 1564 +105 1576 +106 1592 +107 1608 +108 1624 +109 1636 +110 1652 +111 1668 +112 1684 +113 1696 +114 1712 +115 1728 +116 1744 +117 1756 +118 1772 +119 1788 +120 1804 +121 1816 122 1832 123 1848 124 1864 +125 1876 126 1892 127 1908 128 1924 -130 1952 -131 1968 -132 1984 -134 2012 -135 2028 -136 2044 -138 2072 -139 2088 -140 2104 -142 2132 -143 2148 -144 2164 -146 2192 -147 2208 -148 2224 -150 2252 -151 2268 -152 2284 -154 2312 -155 2328 -156 2344 -158 2372 -159 2388 -160 2404 -162 2432 -163 2448 -164 2464 -166 2492 -167 2508 -168 2524 -170 2552 -171 2568 -172 2584 -174 2612 -175 2628 -176 2644 -178 2672 -179 2688 -180 2704 -182 2732 -183 2748 -184 2764 -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; COUNT(*) -96 -SELECT SUM(c2) FROM test_wl5522.t1; +128 +SELECT SUM(c2) FROM t1; SUM(c2) -145278 +124160 SELECT name FROM information_schema.innodb_metrics WHERE name = 'ibuf_merges_insert' AND count = 0; name -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; backup: t1 UNLOCK TABLES; SELECT name @@ -665,8 +688,8 @@ connection purge_control; COMMIT; disconnect purge_control; connection default; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 ( +DROP TABLE t1; +CREATE TABLE t1 ( c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 BIGINT, c3 VARCHAR(2048), @@ -674,119 +697,151 @@ c4 VARCHAR(2048), INDEX idx1(c2), INDEX idx2(c3(512)), INDEX idx3(c4(512))) Engine=InnoDB; -SELECT c1, c2 FROM test_wl5522.t1; +SELECT c1, c2 FROM t1; c1 c2 -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; restore: t1 .ibd and .cfg files -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -CHECK TABLE test_wl5522.t1; +ALTER TABLE t1 IMPORT TABLESPACE; +CHECK TABLE t1; Table Op Msg_type Msg_text -test_wl5522.t1 check status OK -SELECT c1,c2 FROM test_wl5522.t1; +test.t1 check status OK +SELECT c1,c2 FROM t1; c1 c2 +1 16 2 32 3 48 4 64 +5 76 6 92 7 108 8 124 -13 197 -14 213 -15 229 -17 257 -18 273 -19 289 -28 422 -29 438 -30 454 -32 482 -33 498 -34 514 -36 542 -37 558 -38 574 -40 602 -41 618 -42 634 -59 887 -60 903 -61 919 -63 947 -64 963 -65 979 -67 1007 -68 1023 -69 1039 -71 1067 -72 1083 -73 1099 -75 1127 -76 1143 -77 1159 -79 1187 -80 1203 -81 1219 -83 1247 -84 1263 -85 1279 -87 1307 -88 1323 -89 1339 +9 136 +10 152 +11 168 +12 184 +13 196 +14 212 +15 228 +16 244 +17 256 +18 272 +19 288 +20 304 +21 316 +22 332 +23 348 +24 364 +25 376 +26 392 +27 408 +28 424 +29 436 +30 452 +31 468 +32 484 +33 496 +34 512 +35 528 +36 544 +37 556 +38 572 +39 588 +40 604 +41 616 +42 632 +43 648 +44 664 +45 676 +46 692 +47 708 +48 724 +49 736 +50 752 +51 768 +52 784 +53 796 +54 812 +55 828 +56 844 +57 856 +58 872 +59 888 +60 904 +61 916 +62 932 +63 948 +64 964 +65 976 +66 992 +67 1008 +68 1024 +69 1036 +70 1052 +71 1068 +72 1084 +73 1096 +74 1112 +75 1128 +76 1144 +77 1156 +78 1172 +79 1188 +80 1204 +81 1216 +82 1232 +83 1248 +84 1264 +85 1276 +86 1292 +87 1308 +88 1324 +89 1336 +90 1352 +91 1368 +92 1384 +93 1396 +94 1412 +95 1428 +96 1444 +97 1456 +98 1472 +99 1488 +100 1504 +101 1516 +102 1532 +103 1548 +104 1564 +105 1576 +106 1592 +107 1608 +108 1624 +109 1636 +110 1652 +111 1668 +112 1684 +113 1696 +114 1712 +115 1728 +116 1744 +117 1756 +118 1772 +119 1788 +120 1804 +121 1816 122 1832 123 1848 124 1864 +125 1876 126 1892 127 1908 128 1924 -130 1952 -131 1968 -132 1984 -134 2012 -135 2028 -136 2044 -138 2072 -139 2088 -140 2104 -142 2132 -143 2148 -144 2164 -146 2192 -147 2208 -148 2224 -150 2252 -151 2268 -152 2284 -154 2312 -155 2328 -156 2344 -158 2372 -159 2388 -160 2404 -162 2432 -163 2448 -164 2464 -166 2492 -167 2508 -168 2524 -170 2552 -171 2568 -172 2584 -174 2612 -175 2628 -176 2644 -178 2672 -179 2688 -180 2704 -182 2732 -183 2748 -184 2764 -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; COUNT(*) -96 -SELECT SUM(c2) FROM test_wl5522.t1; +128 +SELECT SUM(c2) FROM t1; SUM(c2) -145278 -SHOW CREATE TABLE test_wl5522.t1; +124160 +SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL AUTO_INCREMENT, @@ -797,129 +852,120 @@ t1 CREATE TABLE `t1` ( KEY `idx1` (`c2`), KEY `idx2` (`c3`(512)), KEY `idx3` (`c4`(512)) -) ENGINE=InnoDB AUTO_INCREMENT=248 DEFAULT CHARSET=latin1 -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; -INSERT IGNORE INTO test_wl5522.t1 VALUES +) ENGINE=InnoDB AUTO_INCREMENT=129 DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +INSERT IGNORE INTO t1 VALUES (100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 2731)); Warnings: Warning 1265 Data truncated for column 'c2' at row 1 -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -SELECT COUNT(*) FROM test_wl5522.t1; -COUNT(*) -256 -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +INSERT INTO t1 +SELECT 100, REPEAT('Karanbir', 128), REPEAT('Ajeeth', 1200) +FROM seq_1_to_256; +FLUSH TABLES t1 FOR EXPORT; backup: t1 UNLOCK TABLES; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_trigger_corruption_1"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -ERROR HY000: Internal error: Cannot reset LSNs in table `test_wl5522`.`t1` : Data structure corruption +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`t1` : Data structure corruption SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,buf_page_import_corrupt_failure"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -ERROR HY000: Internal error: Cannot reset LSNs in table `test_wl5522`.`t1` : Data structure corruption +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`t1` : Data structure corruption SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_trigger_corruption_2"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Index corrupt: Externally stored column(5) has a reference length of 19 in the cluster index GEN_CLUST_INDEX SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_trigger_corruption_3"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Index for table 't1' is corrupt; try to repair it SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` SET SESSION debug_dbug="+d,ib_import_create_index_failure_1"; -ALTER TABLE test_wl5522.t1 ADD INDEX idx(c1); +ALTER TABLE t1 ADD INDEX idx(c1); Warnings: Warning 1814 Tablespace has been discarded for table `t1` SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,fil_space_create_failure"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -ERROR HY000: Got error 11 'Generic error' from ./test_wl5522/t1.ibd +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Got error 11 'Generic error' from ./test/t1.ibd SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -ERROR HY000: Got error 39 'Data structure corruption' from ./test_wl5522/t1.ibd +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Got error 39 'Data structure corruption' from ./test/t1.ibd SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,fsp_flags_is_valid_failure"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -ERROR HY000: Internal error: Cannot reset LSNs in table `test_wl5522`.`t1` : Data structure corruption +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`t1` : Data structure corruption SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg -DROP DATABASE test_wl5522; set global innodb_monitor_disable = all; set global innodb_monitor_reset_all = all; set global innodb_monitor_enable = default; set global innodb_monitor_disable = default; set global innodb_monitor_reset = default; set global innodb_monitor_reset_all = default; -SET GLOBAL INNODB_FILE_PER_TABLE=1; +SET GLOBAL INNODB_FILE_PER_TABLE=@file_per_table; diff --git a/mysql-test/suite/innodb/r/innodb-wl5522.result b/mysql-test/suite/innodb/r/innodb-wl5522.result index b364b36a36f..27a93922fbf 100644 --- a/mysql-test/suite/innodb/r/innodb-wl5522.result +++ b/mysql-test/suite/innodb/r/innodb-wl5522.result @@ -1,4 +1,4 @@ -call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT."); +call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT\\."); call mtr.add_suppression("Index for table 't2' is corrupt; try to repair it"); FLUSH TABLES; CREATE TABLE t1 @@ -7,29 +7,26 @@ b char(22), c varchar(255), KEY (b)) ENGINE = InnoDB; -insert into t1 (b, c) values ('Apa', 'Filler........'), +CREATE TEMPORARY TABLE t (b char(22),c varchar(255)); +INSERT INTO t VALUES +('Apa', 'Filler........'), ('Banan', 'Filler........'), ('Cavalry', '..asdasdfaeraf'), ('Devotion', 'asdfuihknaskdf'), ('Evolution', 'lsjndofiabsoibeg'); -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; +INSERT INTO t1 (b,c) SELECT b,c FROM t,seq_1_to_128; +DROP TEMPORARY TABLE t; SELECT COUNT(*) FROM t1; COUNT(*) 640 SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3; a b c -819 Apa Filler........ -814 Apa Filler........ -809 Apa Filler........ +636 Apa Filler........ +631 Apa Filler........ +626 Apa Filler........ SELECT * FROM t1 ORDER BY a DESC LIMIT 3; a b c -823 Evolution lsjndofiabsoibeg -822 Devotion asdfuihknaskdf -821 Cavalry ..asdasdfaeraf +640 Evolution lsjndofiabsoibeg +639 Devotion asdfuihknaskdf +638 Cavalry ..asdasdfaeraf CREATE TABLE t2(a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPACT; db.opt t1.frm @@ -52,14 +49,14 @@ COUNT(*) 1280 SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3; a b c -1459 Apa Filler........ -1454 Apa Filler........ -1449 Apa Filler........ +1276 Apa Filler........ +1271 Apa Filler........ +1266 Apa Filler........ SELECT * FROM t1 ORDER BY a DESC LIMIT 3; a b c -1463 Evolution lsjndofiabsoibeg -1462 Devotion asdfuihknaskdf -1461 Cavalry ..asdasdfaeraf +1280 Evolution lsjndofiabsoibeg +1279 Devotion asdfuihknaskdf +1278 Cavalry ..asdasdfaeraf # Restarting server # Done restarting server # List before t1 DISCARD @@ -81,14 +78,14 @@ COUNT(*) 640 SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3; a b c -819 Apa Filler........ -814 Apa Filler........ -809 Apa Filler........ +636 Apa Filler........ +631 Apa Filler........ +626 Apa Filler........ SELECT * FROM t1 ORDER BY a DESC LIMIT 3; a b c -823 Evolution lsjndofiabsoibeg -822 Devotion asdfuihknaskdf -821 Cavalry ..asdasdfaeraf +640 Evolution lsjndofiabsoibeg +639 Devotion asdfuihknaskdf +638 Cavalry ..asdasdfaeraf db.opt t1.cfg t1.frm @@ -100,14 +97,14 @@ COUNT(*) 640 SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3; a b c -819 Apa Filler........ -814 Apa Filler........ -809 Apa Filler........ +636 Apa Filler........ +631 Apa Filler........ +626 Apa Filler........ SELECT * FROM t1 ORDER BY a DESC LIMIT 3; a b c -823 Evolution lsjndofiabsoibeg -822 Devotion asdfuihknaskdf -821 Cavalry ..asdasdfaeraf +640 Evolution lsjndofiabsoibeg +639 Devotion asdfuihknaskdf +638 Cavalry ..asdasdfaeraf DROP TABLE t1; ALTER TABLE t2 ROW_FORMAT=DYNAMIC; ALTER TABLE t2 DISCARD TABLESPACE; @@ -136,18 +133,11 @@ DROP TABLE t1; CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT) ENGINE=InnoDB; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; db.opt t1.frm t1.ibd FLUSH TABLES t1 FOR EXPORT; -SELECT COUNT(*) FROM t1; -COUNT(*) -16 backup: t1 db.opt t1.cfg @@ -177,18 +167,11 @@ DROP TABLE t1; CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT) ENGINE=InnoDB; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; db.opt t1.frm t1.ibd FLUSH TABLES t1 FOR EXPORT; -SELECT COUNT(*) FROM t1; -COUNT(*) -16 backup: t1 db.opt t1.cfg @@ -198,8 +181,6 @@ UNLOCK TABLES; db.opt t1.frm t1.ibd -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; DROP TABLE t1; CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -223,23 +204,14 @@ DROP TABLE t1; CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT, INDEX(c2)) ENGINE=InnoDB; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; FLUSH TABLES t1 FOR EXPORT; -SELECT COUNT(*) FROM t1 WHERE c2 = 1; -COUNT(*) -16 backup: t1 db.opt t1.cfg t1.frm t1.ibd UNLOCK TABLES; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; DROP TABLE t1; CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -259,19 +231,10 @@ DROP TABLE t1; CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT, INDEX idx(c2)) ENGINE=InnoDB; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; FLUSH TABLES t1 FOR EXPORT; -SELECT COUNT(*) FROM t1 WHERE c2 = 1; -COUNT(*) -16 backup: t1 UNLOCK TABLES; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; DROP TABLE t1; CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -299,39 +262,32 @@ c1 c2 2 1 3 1 4 1 +5 1 6 1 7 1 8 1 9 1 +10 1 +11 1 +12 1 13 1 14 1 15 1 16 1 -17 1 -18 1 -19 1 -20 1 unlink: t1.cfg DROP TABLE t1; SET GLOBAL innodb_file_per_table = 0; CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT) ENGINE=InnoDB; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -SELECT COUNT(*) FROM t1; -COUNT(*) -16 +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 FLUSH TABLES t1 FOR EXPORT; Warnings: Warning 1809 Table `test`.`t1` in system tablespace @@ -341,12 +297,7 @@ SET GLOBAL innodb_file_per_table = 1; CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT, INDEX idx(c2)) ENGINE=InnoDB; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -354,41 +305,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 -SELECT * FROM t1; -c1 c2 -1 1 -2 1 -3 1 -4 1 -6 1 -7 1 -8 1 -9 1 -13 1 -14 1 -15 1 -16 1 -17 1 -18 1 -19 1 -20 1 -28 1 -29 1 -30 1 -31 1 -32 1 -33 1 -34 1 -35 1 -36 1 -37 1 -38 1 -39 1 -40 1 -41 1 -42 1 -43 1 +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 FLUSH TABLES t1 FOR EXPORT; backup: t1 UNLOCK TABLES; @@ -449,51 +366,30 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 SELECT * FROM t1; c1 c2 1 1 2 1 3 1 4 1 +5 1 6 1 7 1 8 1 9 1 +10 1 +11 1 +12 1 13 1 14 1 15 1 16 1 -17 1 -18 1 -19 1 -20 1 -28 1 -29 1 -30 1 -31 1 -32 1 -33 1 -34 1 -35 1 -36 1 -37 1 -38 1 -39 1 -40 1 -41 1 -42 1 -43 1 DROP TABLE t1; CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -501,41 +397,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT -SELECT * FROM t1; -c1 c2 -1 1 -2 1 -3 1 -4 1 -6 1 -7 1 -8 1 -9 1 -13 1 -14 1 -15 1 -16 1 -17 1 -18 1 -19 1 -20 1 -28 1 -29 1 -30 1 -31 1 -32 1 -33 1 -34 1 -35 1 -36 1 -37 1 -38 1 -39 1 -40 1 -41 1 -42 1 -43 1 +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT FLUSH TABLES t1 FOR EXPORT; backup: t1 UNLOCK TABLES; @@ -559,41 +421,25 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT SELECT * FROM t1; c1 c2 1 1 2 1 3 1 4 1 +5 1 6 1 7 1 8 1 9 1 +10 1 +11 1 +12 1 13 1 14 1 15 1 16 1 -17 1 -18 1 -19 1 -20 1 -28 1 -29 1 -30 1 -31 1 -32 1 -33 1 -34 1 -35 1 -36 1 -37 1 -38 1 -39 1 -40 1 -41 1 -42 1 -43 1 DROP TABLE t1; CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -647,51 +493,30 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT SELECT * FROM t1; c1 c2 1 1 2 1 3 1 4 1 +5 1 6 1 7 1 8 1 9 1 +10 1 +11 1 +12 1 13 1 14 1 15 1 16 1 -17 1 -18 1 -19 1 -20 1 -28 1 -29 1 -30 1 -31 1 -32 1 -33 1 -34 1 -35 1 -36 1 -37 1 -38 1 -39 1 -40 1 -41 1 -42 1 -43 1 DROP TABLE t1; CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPACT; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -699,41 +524,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT -SELECT * FROM t1; -c1 c2 -1 1 -2 1 -3 1 -4 1 -6 1 -7 1 -8 1 -9 1 -13 1 -14 1 -15 1 -16 1 -17 1 -18 1 -19 1 -20 1 -28 1 -29 1 -30 1 -31 1 -32 1 -33 1 -34 1 -35 1 -36 1 -37 1 -38 1 -39 1 -40 1 -41 1 -42 1 -43 1 +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT FLUSH TABLES t1 FOR EXPORT; backup: t1 UNLOCK TABLES; @@ -757,41 +548,25 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT SELECT * FROM t1; c1 c2 1 1 2 1 3 1 4 1 +5 1 6 1 7 1 8 1 9 1 +10 1 +11 1 +12 1 13 1 14 1 15 1 16 1 -17 1 -18 1 -19 1 -20 1 -28 1 -29 1 -30 1 -31 1 -32 1 -33 1 -34 1 -35 1 -36 1 -37 1 -38 1 -39 1 -40 1 -41 1 -42 1 -43 1 DROP TABLE t1; CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -848,51 +623,30 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT SELECT * FROM t1; c1 c2 1 1 2 1 3 1 4 1 +5 1 6 1 7 1 8 1 9 1 +10 1 +11 1 +12 1 13 1 14 1 15 1 16 1 -17 1 -18 1 -19 1 -20 1 -28 1 -29 1 -30 1 -31 1 -32 1 -33 1 -34 1 -35 1 -36 1 -37 1 -38 1 -39 1 -40 1 -41 1 -42 1 -43 1 DROP TABLE t1; CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -900,41 +654,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC -SELECT * FROM t1; -c1 c2 -1 1 -2 1 -3 1 -4 1 -6 1 -7 1 -8 1 -9 1 -13 1 -14 1 -15 1 -16 1 -17 1 -18 1 -19 1 -20 1 -28 1 -29 1 -30 1 -31 1 -32 1 -33 1 -34 1 -35 1 -36 1 -37 1 -38 1 -39 1 -40 1 -41 1 -42 1 -43 1 +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC FLUSH TABLES t1 FOR EXPORT; backup: t1 UNLOCK TABLES; @@ -958,41 +678,25 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC SELECT * FROM t1; c1 c2 1 1 2 1 3 1 4 1 +5 1 6 1 7 1 8 1 9 1 +10 1 +11 1 +12 1 13 1 14 1 15 1 16 1 -17 1 -18 1 -19 1 -20 1 -28 1 -29 1 -30 1 -31 1 -32 1 -33 1 -34 1 -35 1 -36 1 -37 1 -38 1 -39 1 -40 1 -41 1 -42 1 -43 1 DROP TABLE t1; CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -1049,51 +753,30 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC SELECT * FROM t1; c1 c2 1 1 2 1 3 1 4 1 +5 1 6 1 7 1 8 1 9 1 +10 1 +11 1 +12 1 13 1 14 1 15 1 16 1 -17 1 -18 1 -19 1 -20 1 -28 1 -29 1 -30 1 -31 1 -32 1 -33 1 -34 1 -35 1 -36 1 -37 1 -38 1 -39 1 -40 1 -41 1 -42 1 -43 1 DROP TABLE t1; CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -1101,41 +784,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED -SELECT * FROM t1; -c1 c2 -1 1 -2 1 -3 1 -4 1 -6 1 -7 1 -8 1 -9 1 -13 1 -14 1 -15 1 -16 1 -17 1 -18 1 -19 1 -20 1 -28 1 -29 1 -30 1 -31 1 -32 1 -33 1 -34 1 -35 1 -36 1 -37 1 -38 1 -39 1 -40 1 -41 1 -42 1 -43 1 +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED FLUSH TABLES t1 FOR EXPORT; backup: t1 UNLOCK TABLES; @@ -1159,41 +808,25 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED SELECT * FROM t1; c1 c2 1 1 2 1 3 1 4 1 +5 1 6 1 7 1 8 1 9 1 +10 1 +11 1 +12 1 13 1 14 1 15 1 16 1 -17 1 -18 1 -19 1 -20 1 -28 1 -29 1 -30 1 -31 1 -32 1 -33 1 -34 1 -35 1 -36 1 -37 1 -38 1 -39 1 -40 1 -41 1 -42 1 -43 1 DROP TABLE t1; CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -1263,43 +896,26 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED SELECT * FROM t1; c1 c2 1 1 2 1 3 1 4 1 +5 1 6 1 7 1 8 1 9 1 +10 1 +11 1 +12 1 13 1 14 1 15 1 16 1 -17 1 -18 1 -19 1 -20 1 -28 1 -29 1 -30 1 -31 1 -32 1 -33 1 -34 1 -35 1 -36 1 -37 1 -38 1 -39 1 -40 1 -41 1 -42 1 -43 1 DROP TABLE t1; call mtr.add_suppression("Got error -1 when reading table '.*'"); -call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'.*"); +call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'"); call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded"); -FLUSH TABLES; diff --git a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test index b443c92aff9..b2809aa0669 100644 --- a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test +++ b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test @@ -15,6 +15,7 @@ --source include/have_innodb.inc --source include/default_charset.inc +--source include/have_sequence.inc call mtr.add_suppression("InnoDB: Operating system error number .* in a file operation."); call mtr.add_suppression("InnoDB: The error means the system cannot find the path specified."); @@ -29,16 +30,11 @@ call mtr.add_suppression("InnoDB: Invalid FSP_SPACE_FLAGS="); FLUSH TABLES; let MYSQLD_DATADIR =`SELECT @@datadir`; -let $innodb_file_per_table = `SELECT @@innodb_file_per_table`; -let $pathfix=/: '.*test_wl5522.*t1.ibd'/: 'test_wl5522\\t1.ibd'/; let $strerrfix=/ (\(.+\))//; - SET GLOBAL innodb_file_per_table = 1; -CREATE DATABASE test_wl5522; - -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = InnoDB; -INSERT INTO test_wl5522.t1 VALUES(1),(2),(3); +CREATE TABLE t1 (c1 INT) ENGINE = InnoDB; +INSERT INTO t1 VALUES(1),(2),(3); --let $_server_id= `SELECT @@server_id` --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect @@ -46,574 +42,574 @@ INSERT INTO test_wl5522.t1 VALUES(1),(2),(3); --exec echo wait > $_expect_file_name SET SESSION debug_dbug="+d,ib_discard_before_commit_crash"; --error 2013 -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --source include/start_mysqld.inc -DROP TABLE test_wl5522.t1; +DROP TABLE t1; SET GLOBAL innodb_file_per_table = 1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = InnoDB; -INSERT INTO test_wl5522.t1 VALUES(1),(2),(3); +CREATE TABLE t1 (c1 INT) ENGINE = InnoDB; +INSERT INTO t1 VALUES(1),(2),(3); --exec echo wait > $_expect_file_name SET SESSION debug_dbug="+d,ib_discard_after_commit_crash"; --error 2013 -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --source include/start_mysqld.inc -DROP TABLE test_wl5522.t1; +DROP TABLE t1; SET GLOBAL innodb_file_per_table = 1; # Create the table that we will use for crash recovery (during IMPORT) -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1), (2), (3), (4); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1), (2), (3), (4); --replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_backup_tablespaces("test_wl5522", "t1"); +ib_backup_tablespaces("test", "t1"); EOF UNLOCK TABLES; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF --error ER_TABLESPACE_DISCARDED -SELECT * FROM test_wl5522.t1; +SELECT * FROM t1; --exec echo wait > $_expect_file_name SET SESSION debug_dbug="+d,ib_import_before_commit_crash"; --error 2013 -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; --source include/start_mysqld.inc # Check that the DD is consistent after recovery --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; --exec echo wait > $_expect_file_name SET SESSION debug_dbug="+d,ib_import_before_checkpoint_crash"; --error 2013 -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; # After the above test the results are non-deterministic, # delete the old tablespace files and drop the table, # recreate the table and do a proper import. perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF --source include/start_mysqld.inc -DROP TABLE test_wl5522.t1; +DROP TABLE t1; +SET @file_per_table= @@innodb_file_per_table; SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -CHECK TABLE test_wl5522.t1; +ALTER TABLE t1 IMPORT TABLESPACE; +CHECK TABLE t1; -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; -INSERT INTO test_wl5522.t1 VALUES(400), (500), (600); +INSERT INTO t1 VALUES(400), (500), (600); -SELECT * FROM test_wl5522.t1; +SELECT * FROM t1; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; # Test IO Write error(s), flush tables doesn't return an error message # so we have to make do with the error/warning pushed by the server -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); SET @saved_debug_dbug = @@SESSION.debug_dbug; SET SESSION debug_dbug="+d,ib_export_io_write_failure_1"; --replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_2"; --replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_3"; --replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_4"; --replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_5"; --replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_6"; --replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_7"; --replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_8"; --replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_9"; --replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_10"; --replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_11"; --replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_12"; --replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; # Create a table and save the tablespace and .cfg file -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (100), (200), (300); -SELECT COUNT(*) FROM test_wl5522.t1; -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (100), (200), (300); +SELECT COUNT(*) FROM t1; +FLUSH TABLES t1 FOR EXPORT; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_backup_tablespaces("test_wl5522", "t1"); +ib_backup_tablespaces("test", "t1"); EOF UNLOCK TABLES; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; # Test IO Read error(s) -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; SET SESSION debug_dbug="+d,ib_import_io_read_error_1"; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_cfg_files("test_wl5522", "t1"); +ib_restore_cfg_files("test", "t1"); EOF --replace_regex $strerrfix --error ER_IO_READ_ERROR -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; SET SESSION debug_dbug="+d,ib_import_io_read_error_2"; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_cfg_files("test_wl5522", "t1"); +ib_restore_cfg_files("test", "t1"); EOF --replace_regex $strerrfix --error ER_IO_READ_ERROR -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; SET SESSION debug_dbug="+d,ib_import_io_read_error_3"; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_cfg_files("test_wl5522", "t1"); +ib_restore_cfg_files("test", "t1"); EOF --replace_regex $strerrfix --error ER_IO_READ_ERROR -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; SET SESSION debug_dbug="+d,ib_import_io_read_error_4"; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_cfg_files("test_wl5522", "t1"); +ib_restore_cfg_files("test", "t1"); EOF --replace_regex $strerrfix --error ER_IO_READ_ERROR -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; SET SESSION debug_dbug="+d,ib_import_io_read_error_5"; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_cfg_files("test_wl5522", "t1"); +ib_restore_cfg_files("test", "t1"); EOF --replace_regex $strerrfix --error ER_IO_READ_ERROR -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; SET SESSION debug_dbug="+d,ib_import_io_read_error_6"; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_cfg_files("test_wl5522", "t1"); +ib_restore_cfg_files("test", "t1"); EOF --replace_regex $strerrfix --error ER_IO_READ_ERROR -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; SET SESSION debug_dbug="+d,ib_import_io_read_error_7"; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_cfg_files("test_wl5522", "t1"); +ib_restore_cfg_files("test", "t1"); EOF --replace_regex $strerrfix --error ER_IO_READ_ERROR -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; SET SESSION debug_dbug="+d,ib_import_io_read_error_8"; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_cfg_files("test_wl5522", "t1"); +ib_restore_cfg_files("test", "t1"); EOF --replace_regex $strerrfix --error ER_IO_READ_ERROR -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; SET SESSION debug_dbug="+d,ib_import_io_read_error_9"; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_cfg_files("test_wl5522", "t1"); +ib_restore_cfg_files("test", "t1"); EOF --replace_regex $strerrfix --error ER_IO_READ_ERROR -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; # Test string read failure -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; SET SESSION debug_dbug="+d,ib_import_string_read_error"; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_cfg_files("test_wl5522", "t1"); +ib_restore_cfg_files("test", "t1"); EOF --replace_regex $strerrfix --error ER_IO_READ_ERROR -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; # Test OOM error during import -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF SET SESSION debug_dbug="+d,ib_import_OOM_1"; @@ -621,31 +617,31 @@ SET SESSION debug_dbug="+d,ib_import_OOM_1"; --replace_regex /'.*t1.cfg'/'t1.cfg'/ --error ER_OUT_OF_RESOURCES -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF SET SESSION debug_dbug="+d,ib_import_OOM_2"; @@ -653,31 +649,31 @@ SET SESSION debug_dbug="+d,ib_import_OOM_2"; --replace_regex /'.*t1.cfg'/'t1.cfg'/ --error ER_OUT_OF_RESOURCES -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF SET SESSION debug_dbug="+d,ib_import_OOM_4"; @@ -685,31 +681,31 @@ SET SESSION debug_dbug="+d,ib_import_OOM_4"; --replace_regex /'.*t1.cfg'/'t1.cfg'/ --error ER_OUT_OF_RESOURCES -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF SET SESSION debug_dbug="+d,ib_import_OOM_5"; @@ -717,30 +713,30 @@ SET SESSION debug_dbug="+d,ib_import_OOM_5"; --replace_regex /'.*t1.cfg'/'t1.cfg'/ --error ER_OUT_OF_RESOURCES -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF SET SESSION debug_dbug="+d,ib_import_OOM_6"; @@ -748,29 +744,29 @@ SET SESSION debug_dbug="+d,ib_import_OOM_6"; --replace_regex /'.*t1.cfg'/'t1.cfg'/ --error ER_OUT_OF_RESOURCES -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF SET SESSION debug_dbug="+d,ib_import_OOM_7"; @@ -778,29 +774,29 @@ SET SESSION debug_dbug="+d,ib_import_OOM_7"; --replace_regex /'.*t1.cfg'/'t1.cfg'/ --error ER_OUT_OF_RESOURCES -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF SET SESSION debug_dbug="+d,ib_import_OOM_8"; @@ -808,29 +804,29 @@ SET SESSION debug_dbug="+d,ib_import_OOM_8"; --replace_regex /'.*t1.cfg'/'t1.cfg'/ --error ER_OUT_OF_RESOURCES -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF SET SESSION debug_dbug="+d,ib_import_OOM_9"; @@ -838,29 +834,29 @@ SET SESSION debug_dbug="+d,ib_import_OOM_9"; --replace_regex /'.*t1.cfg'/'t1.cfg'/ --error ER_OUT_OF_RESOURCES -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES (1); +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; +INSERT INTO t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF SET SESSION debug_dbug="+d,ib_import_OOM_10"; @@ -868,30 +864,30 @@ SET SESSION debug_dbug="+d,ib_import_OOM_10"; --replace_regex /'.*t1.cfg'/'t1.cfg'/ --error ER_OUT_OF_RESOURCES -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF #### # Test handling of internal failure error -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF # Test failure after reset of space id and LSN in the tablespace @@ -900,33 +896,33 @@ SET SESSION debug_dbug="+d,ib_import_internal_error"; --replace_regex /'.*t1.cfg'/'t1.cfg'/ --error ER_INTERNAL_ERROR -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; # Test failure after reset of space id and LSN in the tablespace -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF # Test failure after reset of space id and LSN in the tablespace @@ -935,12 +931,12 @@ SET SESSION debug_dbug="+d,ib_import_reset_space_and_lsn_failure"; --replace_regex /'.*t1.cfg'/'t1.cfg'/ --error ER_INTERNAL_ERROR -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF SET SESSION debug_dbug=@saved_debug_dbug; @@ -948,17 +944,16 @@ SET SESSION debug_dbug=@saved_debug_dbug; # Test failure after attempting a tablespace open SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure"; ---replace_regex /file: '.*t1.ibd'/'t1.ibd'/ - +--replace_result \\ / --error ER_GET_ERRMSG -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF # Test failure after ibuf check @@ -966,73 +961,73 @@ SET SESSION debug_dbug="+d,ib_import_check_bitmap_failure"; # Need proper mapping of error codes :-( --error ER_NOT_KEYFILE -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF # Test failure after adjusting the cluster index root page SET SESSION debug_dbug="+d,ib_import_cluster_root_adjust_failure"; --error ER_NOT_KEYFILE -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF # Test failure after importing the cluster index SET SESSION debug_dbug="+d,ib_import_cluster_failure"; --error ER_NOT_KEYFILE -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF # Test failure after importing the secondary index(es) SET SESSION debug_dbug="+d,ib_import_sec_root_adjust_failure"; --error ER_NOT_KEYFILE -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF # Test failure after importing the cluster index SET SESSION debug_dbug="+d,ib_import_set_max_rowid_failure"; --error ER_NOT_KEYFILE -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; # Left over from the failed IMPORT perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF -DROP TABLE test_wl5522.t1; +DROP TABLE t1; --disable_query_log # Enable metrics for the counters we are going to use @@ -1046,7 +1041,7 @@ set global innodb_monitor_enable = ibuf_merges_insert; # Create a large table with delete marked records, disable purge during # the update so that we can test the IMPORT purge code. # -CREATE TABLE test_wl5522.t1 ( +CREATE TABLE t1 ( c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 BIGINT, c3 VARCHAR(2048), @@ -1066,53 +1061,45 @@ SET GLOBAL innodb_disable_background_merge=ON; SET GLOBAL innodb_monitor_reset = ibuf_merges; SET GLOBAL innodb_monitor_reset = ibuf_merges_insert; -INSERT INTO test_wl5522.t1(c2, c3, c4) VALUES - (1, REPEAT('a', 2048), REPEAT('a', 2048)), - (2, REPEAT('b', 2048), REPEAT('b', 2048)), - (3, REPEAT('c', 2048), REPEAT('c', 2048)), - (4, REPEAT('d', 2048), REPEAT('d', 2048)); +INSERT INTO t1 +SELECT 1 + seq, 1 + (seq MOD 4), + REPEAT(SUBSTR('abcd', 1 + (seq MOD 4), 1), 2048), + REPEAT(SUBSTR('abcd', 1 + (seq MOD 4), 1), 2048) +FROM seq_0_to_127; -INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c3 = REPEAT("c2", 1024); +UPDATE t1 SET c4 = REPEAT("c4", 1024); -DELETE FROM test_wl5522.t1 WHERE c2 = 1; +SHOW CREATE TABLE t1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c3 = REPEAT("c2", 1024); -UPDATE test_wl5522.t1 SET c4 = REPEAT("c4", 1024); - -SHOW CREATE TABLE test_wl5522.t1; - -SELECT c1, c2 FROM test_wl5522.t1; -SELECT COUNT(*) FROM test_wl5522.t1; -SELECT SUM(c2) FROM test_wl5522.t1; +SELECT c1, c2 FROM t1; +SELECT COUNT(*) FROM t1; +SELECT SUM(c2) FROM t1; SELECT name FROM information_schema.innodb_metrics WHERE name = 'ibuf_merges_insert' AND count = 0; -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_backup_tablespaces("test_wl5522", "t1"); +ib_backup_tablespaces("test", "t1"); EOF UNLOCK TABLES; @@ -1133,9 +1120,9 @@ COMMIT; disconnect purge_control; connection default; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; -CREATE TABLE test_wl5522.t1 ( +CREATE TABLE t1 ( c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 BIGINT, c3 VARCHAR(2048), @@ -1144,65 +1131,59 @@ CREATE TABLE test_wl5522.t1 ( INDEX idx2(c3(512)), INDEX idx3(c4(512))) Engine=InnoDB; -SELECT c1, c2 FROM test_wl5522.t1; +SELECT c1, c2 FROM t1; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -CHECK TABLE test_wl5522.t1; +ALTER TABLE t1 IMPORT TABLESPACE; +CHECK TABLE t1; -SELECT c1,c2 FROM test_wl5522.t1; -SELECT COUNT(*) FROM test_wl5522.t1; -SELECT SUM(c2) FROM test_wl5522.t1; +SELECT c1,c2 FROM t1; +SELECT COUNT(*) FROM t1; +SELECT SUM(c2) FROM t1; -SHOW CREATE TABLE test_wl5522.t1; +SHOW CREATE TABLE t1; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; #### # Create a table and save the tablespace and .cfg file, we need to create # a Btree that has several levels -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; -INSERT IGNORE INTO test_wl5522.t1 VALUES +INSERT IGNORE INTO t1 VALUES (100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 2731)); -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -SELECT COUNT(*) FROM test_wl5522.t1; -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +INSERT INTO t1 +SELECT 100, REPEAT('Karanbir', 128), REPEAT('Ajeeth', 1200) +FROM seq_1_to_256; +FLUSH TABLES t1 FOR EXPORT; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_backup_tablespaces("test_wl5522", "t1"); +ib_backup_tablespaces("test", "t1"); EOF UNLOCK TABLES; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF SET SESSION debug_dbug="+d,ib_import_trigger_corruption_1"; @@ -1210,30 +1191,30 @@ SET SESSION debug_dbug="+d,ib_import_trigger_corruption_1"; --replace_regex /'.*t1.cfg'/'t1.cfg'/ --error ER_INTERNAL_ERROR -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF # -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF SET SESSION debug_dbug="+d,buf_page_import_corrupt_failure"; @@ -1241,172 +1222,166 @@ SET SESSION debug_dbug="+d,buf_page_import_corrupt_failure"; --replace_regex /'.*t1.cfg'/'t1.cfg'/ --error ER_INTERNAL_ERROR -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF # -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF SET SESSION debug_dbug="+d,ib_import_trigger_corruption_2"; ---replace_regex $pathfix - --error ER_INNODB_INDEX_CORRUPT -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF # -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF SET SESSION debug_dbug="+d,ib_import_trigger_corruption_3"; ---replace_regex $pathfix - --error ER_NOT_KEYFILE -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; SET SESSION debug_dbug="+d,ib_import_create_index_failure_1"; -ALTER TABLE test_wl5522.t1 ADD INDEX idx(c1); +ALTER TABLE t1 ADD INDEX idx(c1); SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF # -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF SET SESSION debug_dbug="+d,fil_space_create_failure"; ---replace_regex $pathfix - +--replace_result \\ / --error ER_GET_ERRMSG -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF # -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure"; ---replace_regex $pathfix - +--replace_result \\ / --error ER_GET_ERRMSG -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF # -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF SET SESSION debug_dbug="+d,fsp_flags_is_valid_failure"; @@ -1414,20 +1389,17 @@ SET SESSION debug_dbug="+d,fsp_flags_is_valid_failure"; --replace_regex /'.*t1.cfg'/'t1.cfg'/ --error ER_INTERNAL_ERROR -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF - -DROP DATABASE test_wl5522; - set global innodb_monitor_disable = all; set global innodb_monitor_reset_all = all; @@ -1451,12 +1423,10 @@ call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tabl call mtr.add_suppression(".*There was an error writing to the meta data file.*"); call mtr.add_suppression("InnoDB: Trying to import a tablespace, but could not open the tablespace file"); call mtr.add_suppression("Unsupported tablespace format"); -call mtr.add_suppression("Error in page .* of index \"GEN_CLUST_INDEX\" of table \"test_wl5522\".\"t1\""); call mtr.add_suppression("Page is marked as free"); call mtr.add_suppression("t1.ibd: Page .* at offset .* looks corrupted"); call mtr.add_suppression("but tablespace with that id or name does not exist"); -call mtr.add_suppression("Failed to find tablespace for table '\"test_wl5522\".\"t1\"' in the cache"); -call mtr.add_suppression("Could not find a valid tablespace file for 'test_wl5522.*t1'"); +call mtr.add_suppression("Could not find a valid tablespace file for '.*t1'"); call mtr.add_suppression("while reading index meta-data, expected to read 44 bytes but read only 0 bytes"); call mtr.add_suppression("Index for table 't1' is corrupt; try to repair it"); --enable_query_log @@ -1465,4 +1435,4 @@ call mtr.add_suppression("Index for table 't1' is corrupt; try to repair it"); --remove_file $MYSQLTEST_VARDIR/tmp/t1.cfg --remove_file $MYSQLTEST_VARDIR/tmp/t1.ibd -eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table; +SET GLOBAL INNODB_FILE_PER_TABLE=@file_per_table; diff --git a/mysql-test/suite/innodb/t/innodb-wl5522.test b/mysql-test/suite/innodb/t/innodb-wl5522.test index 0f5910245ed..906246ebf07 100644 --- a/mysql-test/suite/innodb/t/innodb-wl5522.test +++ b/mysql-test/suite/innodb/t/innodb-wl5522.test @@ -2,8 +2,9 @@ --source include/not_embedded.inc -- source include/have_innodb.inc +-- source include/have_sequence.inc -call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT."); +call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT\\."); call mtr.add_suppression("Index for table 't2' is corrupt; try to repair it"); FLUSH TABLES; @@ -17,17 +18,14 @@ CREATE TABLE t1 KEY (b)) ENGINE = InnoDB; -insert into t1 (b, c) values ('Apa', 'Filler........'), +CREATE TEMPORARY TABLE t (b char(22),c varchar(255)); +INSERT INTO t VALUES +('Apa', 'Filler........'), ('Banan', 'Filler........'), ('Cavalry', '..asdasdfaeraf'), ('Devotion', 'asdfuihknaskdf'), ('Evolution', 'lsjndofiabsoibeg'); -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; +INSERT INTO t1 (b,c) SELECT b,c FROM t,seq_1_to_128; +DROP TEMPORARY TABLE t; SELECT COUNT(*) FROM t1; SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3; SELECT * FROM t1 ORDER BY a DESC LIMIT 3; @@ -107,16 +105,11 @@ CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT) ENGINE=InnoDB; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; --list_files $MYSQLD_DATADIR/test FLUSH TABLES t1 FOR EXPORT; -SELECT COUNT(*) FROM t1; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; ib_backup_tablespaces("test", "t1"); @@ -158,15 +151,10 @@ CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT) ENGINE=InnoDB; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; --list_files $MYSQLD_DATADIR/test FLUSH TABLES t1 FOR EXPORT; -SELECT COUNT(*) FROM t1; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; ib_backup_tablespaces("test", "t1"); @@ -177,9 +165,6 @@ UNLOCK TABLES; --list_files $MYSQLD_DATADIR/test # Move the LSN forward -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; - DROP TABLE t1; CREATE TABLE t1( @@ -212,14 +197,9 @@ CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT, INDEX(c2)) ENGINE=InnoDB; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; FLUSH TABLES t1 FOR EXPORT; -SELECT COUNT(*) FROM t1 WHERE c2 = 1; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; ib_backup_tablespaces("test", "t1"); @@ -228,9 +208,6 @@ EOF UNLOCK TABLES; # Move the LSN forward -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; - DROP TABLE t1; CREATE TABLE t1( @@ -263,14 +240,9 @@ CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT, INDEX idx(c2)) ENGINE=InnoDB; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; FLUSH TABLES t1 FOR EXPORT; -SELECT COUNT(*) FROM t1 WHERE c2 = 1; perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; ib_backup_tablespaces("test", "t1"); @@ -278,9 +250,6 @@ EOF UNLOCK TABLES; # Move the LSN forward -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; - DROP TABLE t1; CREATE TABLE t1( @@ -330,14 +299,7 @@ CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT) ENGINE=InnoDB; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; - -SELECT COUNT(*) FROM t1; - +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; SHOW CREATE TABLE t1; # This should fail, InnoDB should return a warning @@ -357,15 +319,9 @@ CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT, INDEX idx(c2)) ENGINE=InnoDB; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; SHOW CREATE TABLE t1; -SELECT * FROM t1; FLUSH TABLES t1 FOR EXPORT; @@ -492,15 +448,9 @@ CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; SHOW CREATE TABLE t1; -SELECT * FROM t1; FLUSH TABLES t1 FOR EXPORT; @@ -645,15 +595,9 @@ CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPACT; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; SHOW CREATE TABLE t1; -SELECT * FROM t1; FLUSH TABLES t1 FOR EXPORT; @@ -799,15 +743,9 @@ CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; SHOW CREATE TABLE t1; -SELECT * FROM t1; FLUSH TABLES t1 FOR EXPORT; @@ -953,15 +891,9 @@ CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; SHOW CREATE TABLE t1; -SELECT * FROM t1; FLUSH TABLES t1 FOR EXPORT; @@ -1126,9 +1058,8 @@ SELECT * FROM t1; DROP TABLE t1; call mtr.add_suppression("Got error -1 when reading table '.*'"); -call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'.*"); +call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'"); call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded"); -FLUSH TABLES; # cleanup --remove_file $MYSQLTEST_VARDIR/tmp/t1.cfg diff --git a/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result b/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result index 394a2ea1f09..4036640d3d3 100644 --- a/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result +++ b/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result @@ -1,53 +1,52 @@ -call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded."); -call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue."); -call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file .*"); +call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded\\."); +call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue\\."); +call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file"); call mtr.add_suppression("InnoDB: Page for tablespace "); call mtr.add_suppression("InnoDB: Invalid FSP_SPACE_FLAGS=0x"); FLUSH TABLES; SET SESSION innodb_strict_mode=1; -CREATE DATABASE test_wl5522; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb +CREATE TABLE t1 (c1 INT) ENGINE = Innodb ROW_FORMAT=COMPRESSED; -INSERT INTO test_wl5522.t1 VALUES (1), (2), (3), (4); -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +INSERT INTO t1 VALUES (1), (2), (3), (4); +FLUSH TABLES t1 FOR EXPORT; backup: t1 UNLOCK TABLES; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb ROW_FORMAT=COMPRESSED; -INSERT INTO test_wl5522.t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_before_commit_crash"; -SELECT * FROM test_wl5522.t1; +SELECT * FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Lost connection to MySQL server during query SET SESSION debug_dbug="+d,ib_import_before_checkpoint_crash"; -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Lost connection to MySQL server during query unlink: t1.ibd unlink: t1.cfg # Restart and reconnect to the server -DROP TABLE test_wl5522.t1; +DROP TABLE t1; SET SESSION innodb_strict_mode=1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb +CREATE TABLE t1 (c1 INT) ENGINE = Innodb ROW_FORMAT=COMPRESSED; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; restore: t1 .ibd and .cfg files -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -CHECK TABLE test_wl5522.t1; +ALTER TABLE t1 IMPORT TABLESPACE; +CHECK TABLE t1; Table Op Msg_type Msg_text -test_wl5522.t1 check status OK -SELECT COUNT(*) FROM test_wl5522.t1; +test.t1 check status OK +SELECT COUNT(*) FROM t1; COUNT(*) 4 -INSERT INTO test_wl5522.t1 VALUES(400), (500), (600); -SELECT * FROM test_wl5522.t1; +INSERT INTO t1 VALUES(400), (500), (600); +SELECT * FROM t1; c1 1 2 @@ -56,65 +55,65 @@ c1 400 500 600 -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb ROW_FORMAT=COMPRESSED; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET @saved_debug_dbug = @@SESSION.debug_dbug; SET SESSION debug_dbug="+d,ib_import_internal_error"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Internal error: While updating the of index GEN_CLUST_INDEX - Generic error SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb +ALTER TABLE t1 IMPORT TABLESPACE; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE = Innodb ROW_FORMAT=COMPRESSED; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_reset_space_and_lsn_failure"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -ERROR HY000: Internal error: Cannot reset LSNs in table `test_wl5522`.`t1` : Too many concurrent transactions +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`t1` : Too many concurrent transactions restore: t1 .ibd and .cfg files SET SESSION debug_dbug=@saved_debug_dbug; SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -ERROR HY000: Got error 44 't1.ibd +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Got error 44 'Tablespace not found' from ./test/t1.ibd SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_check_bitmap_failure"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Index for table 't1' is corrupt; try to repair it SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_cluster_root_adjust_failure"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Index for table 't1' is corrupt; try to repair it SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_cluster_failure"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Index for table 't1' is corrupt; try to repair it SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_sec_root_adjust_failure"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Index for table 't1' is corrupt; try to repair it SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_set_max_rowid_failure"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Index for table 't1' is corrupt; try to repair it SET SESSION debug_dbug=@saved_debug_dbug; unlink: t1.ibd unlink: t1.cfg -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 ( +DROP TABLE t1; +CREATE TABLE t1 ( c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 BIGINT, c3 VARCHAR(2048), @@ -129,35 +128,30 @@ connection default; SET GLOBAL innodb_disable_background_merge=ON; SET GLOBAL innodb_monitor_reset = ibuf_merges; SET GLOBAL innodb_monitor_reset = ibuf_merges_insert; -INSERT INTO test_wl5522.t1(c2, c3, c4) VALUES -(1, REPEAT('a', 2048), REPEAT('a', 2048)), -(2, REPEAT('b', 2048), REPEAT('b', 2048)), -(3, REPEAT('c', 2048), REPEAT('c', 2048)), -(4, REPEAT('d', 2048), REPEAT('d', 2048)); -INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; -DELETE FROM test_wl5522.t1 WHERE c2 = 1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c3 = REPEAT("c2", 1024); -UPDATE test_wl5522.t1 SET c4 = REPEAT("c4", 1024); -SHOW CREATE TABLE test_wl5522.t1; +INSERT INTO t1 +SELECT 1 + seq, 1 + (seq MOD 4), +REPEAT(SUBSTR('abcd', 1 + (seq MOD 4), 1), 2048), +REPEAT(SUBSTR('abcd', 1 + (seq MOD 4), 1), 2048) +FROM seq_0_to_127; +DELETE FROM t1 WHERE c2 = 1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c3 = REPEAT("c2", 1024); +UPDATE t1 SET c4 = REPEAT("c4", 1024); +SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL AUTO_INCREMENT, @@ -168,134 +162,22 @@ t1 CREATE TABLE `t1` ( KEY `idx1` (`c2`), KEY `idx2` (`c3`(512)), KEY `idx3` (`c4`(512)) -) ENGINE=InnoDB AUTO_INCREMENT=248 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED -SELECT c1, c2 FROM test_wl5522.t1; -c1 c2 -2 32 -3 48 -4 64 -6 92 -7 108 -8 124 -13 197 -14 213 -15 229 -17 257 -18 273 -19 289 -28 422 -29 438 -30 454 -32 482 -33 498 -34 514 -36 542 -37 558 -38 574 -40 602 -41 618 -42 634 -59 887 -60 903 -61 919 -63 947 -64 963 -65 979 -67 1007 -68 1023 -69 1039 -71 1067 -72 1083 -73 1099 -75 1127 -76 1143 -77 1159 -79 1187 -80 1203 -81 1219 -83 1247 -84 1263 -85 1279 -87 1307 -88 1323 -89 1339 -122 1832 -123 1848 -124 1864 -126 1892 -127 1908 -128 1924 -130 1952 -131 1968 -132 1984 -134 2012 -135 2028 -136 2044 -138 2072 -139 2088 -140 2104 -142 2132 -143 2148 -144 2164 -146 2192 -147 2208 -148 2224 -150 2252 -151 2268 -152 2284 -154 2312 -155 2328 -156 2344 -158 2372 -159 2388 -160 2404 -162 2432 -163 2448 -164 2464 -166 2492 -167 2508 -168 2524 -170 2552 -171 2568 -172 2584 -174 2612 -175 2628 -176 2644 -178 2672 -179 2688 -180 2704 -182 2732 -183 2748 -184 2764 -SELECT COUNT(*) FROM test_wl5522.t1; -COUNT(*) -96 -SELECT SUM(c2) FROM test_wl5522.t1; -SUM(c2) -145278 -SELECT name -FROM information_schema.innodb_metrics -WHERE name = 'ibuf_merges_insert' AND count = 0; -name -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +) ENGINE=InnoDB AUTO_INCREMENT=129 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED +FLUSH TABLES t1 FOR EXPORT; backup: t1 UNLOCK TABLES; -SELECT name -FROM information_schema.innodb_metrics -WHERE name = 'ibuf_merges' AND count > 0; +SELECT name FROM information_schema.innodb_metrics +WHERE name IN ('ibuf_merges','ibuf_merges_insert') AND count>0 ORDER BY name; name ibuf_merges -SELECT name -FROM information_schema.innodb_metrics -WHERE name = 'ibuf_merges_inserts' AND count > 0; -name +ibuf_merges_insert SET GLOBAL innodb_disable_background_merge=OFF; connection purge_control; COMMIT; disconnect purge_control; connection default; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 ( +DROP TABLE t1; +CREATE TABLE t1 ( c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 BIGINT, c3 VARCHAR(2048), @@ -304,15 +186,15 @@ INDEX idx1(c2), INDEX idx2(c3(512)), INDEX idx3(c4(512))) Engine=InnoDB ROW_FORMAT=COMPRESSED; -SELECT c1, c2 FROM test_wl5522.t1; +SELECT c1, c2 FROM t1; c1 c2 -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; restore: t1 .ibd and .cfg files -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -CHECK TABLE test_wl5522.t1; +ALTER TABLE t1 IMPORT TABLESPACE; +CHECK TABLE t1; Table Op Msg_type Msg_text -test_wl5522.t1 check status OK -SELECT c1,c2 FROM test_wl5522.t1; +test.t1 check status OK +SELECT c1,c2 FROM t1; c1 c2 2 32 3 48 @@ -320,103 +202,97 @@ c1 c2 6 92 7 108 8 124 -13 197 -14 213 -15 229 -17 257 -18 273 -19 289 -28 422 -29 438 -30 454 -32 482 -33 498 -34 514 -36 542 -37 558 -38 574 -40 602 -41 618 -42 634 -59 887 -60 903 -61 919 -63 947 -64 963 -65 979 -67 1007 -68 1023 -69 1039 -71 1067 -72 1083 -73 1099 -75 1127 -76 1143 -77 1159 -79 1187 -80 1203 -81 1219 -83 1247 -84 1263 -85 1279 -87 1307 -88 1323 -89 1339 +10 152 +11 168 +12 184 +14 212 +15 228 +16 244 +18 272 +19 288 +20 304 +22 332 +23 348 +24 364 +26 392 +27 408 +28 424 +30 452 +31 468 +32 484 +34 512 +35 528 +36 544 +38 572 +39 588 +40 604 +42 632 +43 648 +44 664 +46 692 +47 708 +48 724 +50 752 +51 768 +52 784 +54 812 +55 828 +56 844 +58 872 +59 888 +60 904 +62 932 +63 948 +64 964 +66 992 +67 1008 +68 1024 +70 1052 +71 1068 +72 1084 +74 1112 +75 1128 +76 1144 +78 1172 +79 1188 +80 1204 +82 1232 +83 1248 +84 1264 +86 1292 +87 1308 +88 1324 +90 1352 +91 1368 +92 1384 +94 1412 +95 1428 +96 1444 +98 1472 +99 1488 +100 1504 +102 1532 +103 1548 +104 1564 +106 1592 +107 1608 +108 1624 +110 1652 +111 1668 +112 1684 +114 1712 +115 1728 +116 1744 +118 1772 +119 1788 +120 1804 122 1832 123 1848 124 1864 126 1892 127 1908 128 1924 -130 1952 -131 1968 -132 1984 -134 2012 -135 2028 -136 2044 -138 2072 -139 2088 -140 2104 -142 2132 -143 2148 -144 2164 -146 2192 -147 2208 -148 2224 -150 2252 -151 2268 -152 2284 -154 2312 -155 2328 -156 2344 -158 2372 -159 2388 -160 2404 -162 2432 -163 2448 -164 2464 -166 2492 -167 2508 -168 2524 -170 2552 -171 2568 -172 2584 -174 2612 -175 2628 -176 2644 -178 2672 -179 2688 -180 2704 -182 2732 -183 2748 -184 2764 -SELECT COUNT(*) FROM test_wl5522.t1; -COUNT(*) -96 -SELECT SUM(c2) FROM test_wl5522.t1; -SUM(c2) -145278 -SHOW CREATE TABLE test_wl5522.t1; +SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL AUTO_INCREMENT, @@ -427,134 +303,121 @@ t1 CREATE TABLE `t1` ( KEY `idx1` (`c2`), KEY `idx2` (`c3`(512)), KEY `idx3` (`c4`(512)) -) ENGINE=InnoDB AUTO_INCREMENT=248 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb +) ENGINE=InnoDB AUTO_INCREMENT=129 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED +DROP TABLE t1; +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; -INSERT IGNORE INTO test_wl5522.t1 VALUES -(100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 1200)); -Warnings: -Warning 1265 Data truncated for column 'c2' at row 1 -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -SELECT COUNT(*) FROM test_wl5522.t1; -COUNT(*) -256 -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +INSERT INTO t1 +SELECT 100, REPEAT('Karanbir', 128), REPEAT('Ajeeth', 1200) +FROM seq_1_to_256; +FLUSH TABLES t1 FOR EXPORT; backup: t1 UNLOCK TABLES; -DROP TABLE test_wl5522.t1; -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb +DROP TABLE t1; +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_trigger_corruption_1"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -ERROR HY000: Internal error: Cannot reset LSNs in table `test_wl5522`.`t1` : Data structure corruption +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`t1` : Data structure corruption SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,buf_page_import_corrupt_failure"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -ERROR HY000: Internal error: Cannot reset LSNs in table `test_wl5522`.`t1` : Data structure corruption +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`t1` : Data structure corruption SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_trigger_corruption_2"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Index corrupt: Externally stored column(5) has a reference length of 19 in the cluster index GEN_CLUST_INDEX SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_trigger_corruption_3"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Index for table 't1' is corrupt; try to repair it SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` SET SESSION debug_dbug="+d,ib_import_create_index_failure_1"; -ALTER TABLE test_wl5522.t1 ADD INDEX idx(c1); +ALTER TABLE t1 ADD INDEX idx(c1); Warnings: Warning 1814 Tablespace has been discarded for table `t1` SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,fil_space_create_failure"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -ERROR HY000: Got error 11 't1.ibd +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Got error 11 'Generic error' from ./test/t1.ibd SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -ERROR HY000: Got error 39 't1.ibd +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Got error 39 'Data structure corruption' from ./test/t1.ibd SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; -SELECT COUNT(*) FROM test_wl5522.t1; +ALTER TABLE t1 DISCARD TABLESPACE; +SELECT COUNT(*) FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,fsp_flags_is_valid_failure"; -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -ERROR HY000: Internal error: Cannot reset LSNs in table `test_wl5522`.`t1` : Data structure corruption +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`t1` : Data structure corruption SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg -DROP DATABASE test_wl5522; set global innodb_monitor_disable = all; set global innodb_monitor_reset_all = all; set global innodb_monitor_enable = default; diff --git a/mysql-test/suite/innodb_zip/r/wl5522_zip.result b/mysql-test/suite/innodb_zip/r/wl5522_zip.result index a8e06835d85..40b357e1b7f 100644 --- a/mysql-test/suite/innodb_zip/r/wl5522_zip.result +++ b/mysql-test/suite/innodb_zip/r/wl5522_zip.result @@ -1,4 +1,4 @@ -call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT."); +call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT\\."); SET SESSION innodb_strict_mode=1; CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, @@ -6,29 +6,26 @@ b char(22), c varchar(255), KEY (b)) ENGINE = InnoDB ROW_FORMAT=COMPRESSED ; -insert into t1 (b, c) values ('Apa', 'Filler........'), +CREATE TEMPORARY TABLE t (b char(22),c varchar(255)); +INSERT INTO t VALUES +('Apa', 'Filler........'), ('Banan', 'Filler........'), ('Cavalry', '..asdasdfaeraf'), ('Devotion', 'asdfuihknaskdf'), ('Evolution', 'lsjndofiabsoibeg'); -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; +INSERT INTO t1 (b,c) SELECT b,c FROM t,seq_1_to_128; +DROP TEMPORARY TABLE t; SELECT COUNT(*) FROM t1; COUNT(*) 640 SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3; a b c -819 Apa Filler........ -814 Apa Filler........ -809 Apa Filler........ +636 Apa Filler........ +631 Apa Filler........ +626 Apa Filler........ SELECT * FROM t1 ORDER BY a DESC LIMIT 3; a b c -823 Evolution lsjndofiabsoibeg -822 Devotion asdfuihknaskdf -821 Cavalry ..asdasdfaeraf +640 Evolution lsjndofiabsoibeg +639 Devotion asdfuihknaskdf +638 Cavalry ..asdasdfaeraf db.opt t1.frm t1.ibd @@ -47,14 +44,14 @@ COUNT(*) 1280 SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3; a b c -1459 Apa Filler........ -1454 Apa Filler........ -1449 Apa Filler........ +1276 Apa Filler........ +1271 Apa Filler........ +1266 Apa Filler........ SELECT * FROM t1 ORDER BY a DESC LIMIT 3; a b c -1463 Evolution lsjndofiabsoibeg -1462 Devotion asdfuihknaskdf -1461 Cavalry ..asdasdfaeraf +1280 Evolution lsjndofiabsoibeg +1279 Devotion asdfuihknaskdf +1278 Cavalry ..asdasdfaeraf # Restarting server # Done restarting server # List before t1 DISCARD @@ -72,14 +69,14 @@ COUNT(*) 640 SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3; a b c -819 Apa Filler........ -814 Apa Filler........ -809 Apa Filler........ +636 Apa Filler........ +631 Apa Filler........ +626 Apa Filler........ SELECT * FROM t1 ORDER BY a DESC LIMIT 3; a b c -823 Evolution lsjndofiabsoibeg -822 Devotion asdfuihknaskdf -821 Cavalry ..asdasdfaeraf +640 Evolution lsjndofiabsoibeg +639 Devotion asdfuihknaskdf +638 Cavalry ..asdasdfaeraf db.opt t1.cfg t1.frm @@ -89,14 +86,14 @@ COUNT(*) 640 SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3; a b c -819 Apa Filler........ -814 Apa Filler........ -809 Apa Filler........ +636 Apa Filler........ +631 Apa Filler........ +626 Apa Filler........ SELECT * FROM t1 ORDER BY a DESC LIMIT 3; a b c -823 Evolution lsjndofiabsoibeg -822 Devotion asdfuihknaskdf -821 Cavalry ..asdasdfaeraf +640 Evolution lsjndofiabsoibeg +639 Devotion asdfuihknaskdf +638 Cavalry ..asdasdfaeraf DROP TABLE t1; SET SESSION innodb_strict_mode=1; CREATE TABLE t1( @@ -112,18 +109,11 @@ DROP TABLE t1; CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; db.opt t1.frm t1.ibd FLUSH TABLES t1 FOR EXPORT; -SELECT COUNT(*) FROM t1; -COUNT(*) -16 backup: t1 db.opt t1.cfg @@ -153,11 +143,7 @@ DROP TABLE t1; CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; db.opt t1.frm t1.ibd @@ -174,8 +160,6 @@ UNLOCK TABLES; db.opt t1.frm t1.ibd -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; DROP TABLE t1; CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -200,23 +184,14 @@ CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT, INDEX(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; FLUSH TABLES t1 FOR EXPORT; -SELECT COUNT(*) FROM t1 WHERE c2 = 1; -COUNT(*) -16 backup: t1 db.opt t1.cfg t1.frm t1.ibd UNLOCK TABLES; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; DROP TABLE t1; CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -238,19 +213,10 @@ CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; FLUSH TABLES t1 FOR EXPORT; -SELECT COUNT(*) FROM t1 WHERE c2 = 1; -COUNT(*) -16 backup: t1 UNLOCK TABLES; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; DROP TABLE t1; CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -279,39 +245,32 @@ c1 c2 2 1 3 1 4 1 +5 1 6 1 7 1 8 1 9 1 +10 1 +11 1 +12 1 13 1 14 1 15 1 16 1 -17 1 -18 1 -19 1 -20 1 unlink: t1.cfg DROP TABLE t1; SET GLOBAL innodb_file_per_table = 0; CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT) ENGINE=InnoDB; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -SELECT COUNT(*) FROM t1; -COUNT(*) -16 +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 FLUSH TABLES t1 FOR EXPORT; Warnings: Warning 1809 Table `test`.`t1` in system tablespace @@ -322,12 +281,7 @@ CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -335,41 +289,7 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED -SELECT * FROM t1; -c1 c2 -1 1 -2 1 -3 1 -4 1 -6 1 -7 1 -8 1 -9 1 -13 1 -14 1 -15 1 -16 1 -17 1 -18 1 -19 1 -20 1 -28 1 -29 1 -30 1 -31 1 -32 1 -33 1 -34 1 -35 1 -36 1 -37 1 -38 1 -39 1 -40 1 -41 1 -42 1 -43 1 +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED FLUSH TABLES t1 FOR EXPORT; backup: t1 UNLOCK TABLES; @@ -447,42 +367,26 @@ t1 CREATE TABLE `t1` ( `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `idx` (`c2`) -) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED SELECT * FROM t1; c1 c2 1 1 2 1 3 1 4 1 +5 1 6 1 7 1 8 1 9 1 +10 1 +11 1 +12 1 13 1 14 1 15 1 16 1 -17 1 -18 1 -19 1 -20 1 -28 1 -29 1 -30 1 -31 1 -32 1 -33 1 -34 1 -35 1 -36 1 -37 1 -38 1 -39 1 -40 1 -41 1 -42 1 -43 1 DROP TABLE t1; call mtr.add_suppression("Got error -1 when reading table '.*'"); -call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'.*"); +call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'"); call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded"); diff --git a/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test b/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test index 5485fec3e7d..411d47118f6 100644 --- a/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test +++ b/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test @@ -12,70 +12,66 @@ --source include/innodb_page_size_small.inc --source include/default_charset.inc +--source include/have_sequence.inc -call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded."); -call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue."); -call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file .*"); +call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded\\."); +call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue\\."); +call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file"); call mtr.add_suppression("InnoDB: Page for tablespace "); call mtr.add_suppression("InnoDB: Invalid FSP_SPACE_FLAGS=0x"); FLUSH TABLES; let MYSQLD_DATADIR =`SELECT @@datadir`; -let $pathfix=/: '.*test_wl5522.*t1.ibd'/: 'test_wl5522_t1.ibd'/; SET SESSION innodb_strict_mode=1; -CREATE DATABASE test_wl5522; - # Create the table that we will use for crash recovery (during IMPORT) -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb +CREATE TABLE t1 (c1 INT) ENGINE = Innodb ROW_FORMAT=COMPRESSED; -INSERT INTO test_wl5522.t1 VALUES (1), (2), (3), (4); +INSERT INTO t1 VALUES (1), (2), (3), (4); ---replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ - -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_backup_tablespaces("test_wl5522", "t1"); +ib_backup_tablespaces("test", "t1"); EOF UNLOCK TABLES; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb +CREATE TABLE t1 (c1 INT) ENGINE = Innodb ROW_FORMAT=COMPRESSED; -INSERT INTO test_wl5522.t1 VALUES (1); +INSERT INTO t1 VALUES (1); -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_discard_tablespaces("test_wl5522", "t1"); +ib_discard_tablespaces("test", "t1"); EOF --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF ##### Before commit crash SET SESSION debug_dbug="+d,ib_import_before_commit_crash"; --error ER_TABLESPACE_DISCARDED -SELECT * FROM test_wl5522.t1; +SELECT * FROM t1; # Write file to make mysql-test-run.pl start up the server again --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect # Execute the statement that causes the crash --error 2013 -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; --enable_reconnect --source include/wait_until_connected_again.inc @@ -89,14 +85,14 @@ ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; SET SESSION debug_dbug="+d,ib_import_before_checkpoint_crash"; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Don't start up the server right away. --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect # Execute the statement that causes the crash --error 2013 -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; # After the above test the results are non-deterministic, # delete the old tablespace files and drop the table, @@ -104,7 +100,7 @@ ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -- source include/wait_until_disconnected.inc perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF --echo # Restart and reconnect to the server @@ -118,95 +114,91 @@ EOF # After the above test the results are non-deterministic, recreate the table # and do a proper import. -DROP TABLE test_wl5522.t1; +DROP TABLE t1; SET SESSION innodb_strict_mode=1; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb +CREATE TABLE t1 (c1 INT) ENGINE = Innodb ROW_FORMAT=COMPRESSED; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -CHECK TABLE test_wl5522.t1; +ALTER TABLE t1 IMPORT TABLESPACE; +CHECK TABLE t1; -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; -INSERT INTO test_wl5522.t1 VALUES(400), (500), (600); +INSERT INTO t1 VALUES(400), (500), (600); -SELECT * FROM test_wl5522.t1; +SELECT * FROM t1; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; # Test handling of internal failure error -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb +CREATE TABLE t1 (c1 INT) ENGINE = Innodb ROW_FORMAT=COMPRESSED; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF # Test failure after reset of space id and LSN in the tablespace SET @saved_debug_dbug = @@SESSION.debug_dbug; SET SESSION debug_dbug="+d,ib_import_internal_error"; ---replace_regex /'.*t1.cfg'/'t1.cfg'/ - --error ER_INTERNAL_ERROR -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; # Test failure after reset of space id and LSN in the tablespace -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb +CREATE TABLE t1 (c1 INT) ENGINE = Innodb ROW_FORMAT=COMPRESSED; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF # Test failure after reset of space id and LSN in the tablespace SET SESSION debug_dbug="+d,ib_import_reset_space_and_lsn_failure"; ---replace_regex /'.*t1.cfg'/'t1.cfg'/ - --error ER_INTERNAL_ERROR -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF SET SESSION debug_dbug=@saved_debug_dbug; @@ -214,16 +206,16 @@ SET SESSION debug_dbug=@saved_debug_dbug; # Test failure after attempting a tablespace open SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure"; ---replace_regex /'.*[\/\\]/'/ +--replace_result \\ / --error ER_GET_ERRMSG -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF # Test failure after ibuf check @@ -231,73 +223,73 @@ SET SESSION debug_dbug="+d,ib_import_check_bitmap_failure"; # Need proper mapping of error codes :-( --error ER_NOT_KEYFILE -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF # Test failure after adjusting the cluster index root page SET SESSION debug_dbug="+d,ib_import_cluster_root_adjust_failure"; --error ER_NOT_KEYFILE -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF # Test failure after importing the cluster index SET SESSION debug_dbug="+d,ib_import_cluster_failure"; --error ER_NOT_KEYFILE -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF # Test failure after importing the secondary index(es) SET SESSION debug_dbug="+d,ib_import_sec_root_adjust_failure"; --error ER_NOT_KEYFILE -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF # Test failure after importing the cluster index SET SESSION debug_dbug="+d,ib_import_set_max_rowid_failure"; --error ER_NOT_KEYFILE -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; # Left over from the failed IMPORT perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF -DROP TABLE test_wl5522.t1; +DROP TABLE t1; --disable_query_log # Enable metrics for the counters we are going to use @@ -311,7 +303,7 @@ set global innodb_monitor_enable = ibuf_merges_insert; # Create a large table with delete marked records, disable purge during # the update so that we can test the IMPORT purge code. # -CREATE TABLE test_wl5522.t1 ( +CREATE TABLE t1 ( c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 BIGINT, c3 VARCHAR(2048), @@ -332,64 +324,45 @@ SET GLOBAL innodb_disable_background_merge=ON; SET GLOBAL innodb_monitor_reset = ibuf_merges; SET GLOBAL innodb_monitor_reset = ibuf_merges_insert; -INSERT INTO test_wl5522.t1(c2, c3, c4) VALUES - (1, REPEAT('a', 2048), REPEAT('a', 2048)), - (2, REPEAT('b', 2048), REPEAT('b', 2048)), - (3, REPEAT('c', 2048), REPEAT('c', 2048)), - (4, REPEAT('d', 2048), REPEAT('d', 2048)); +INSERT INTO t1 +SELECT 1 + seq, 1 + (seq MOD 4), + REPEAT(SUBSTR('abcd', 1 + (seq MOD 4), 1), 2048), + REPEAT(SUBSTR('abcd', 1 + (seq MOD 4), 1), 2048) +FROM seq_0_to_127; -INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; +DELETE FROM t1 WHERE c2 = 1; -DELETE FROM test_wl5522.t1 WHERE c2 = 1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c2 = c2 + c1; +UPDATE t1 SET c3 = REPEAT("c2", 1024); +UPDATE t1 SET c4 = REPEAT("c4", 1024); -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c2 = c2 + c1; -UPDATE test_wl5522.t1 SET c3 = REPEAT("c2", 1024); -UPDATE test_wl5522.t1 SET c4 = REPEAT("c4", 1024); +SHOW CREATE TABLE t1; -SHOW CREATE TABLE test_wl5522.t1; - -SELECT c1, c2 FROM test_wl5522.t1; -SELECT COUNT(*) FROM test_wl5522.t1; -SELECT SUM(c2) FROM test_wl5522.t1; - -SELECT name - FROM information_schema.innodb_metrics - WHERE name = 'ibuf_merges_insert' AND count = 0; - -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +FLUSH TABLES t1 FOR EXPORT; perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_backup_tablespaces("test_wl5522", "t1"); +ib_backup_tablespaces("test", "t1"); EOF UNLOCK TABLES; -SELECT name - FROM information_schema.innodb_metrics - WHERE name = 'ibuf_merges' AND count > 0; - -SELECT name - FROM information_schema.innodb_metrics - WHERE name = 'ibuf_merges_inserts' AND count > 0; +SELECT name FROM information_schema.innodb_metrics +WHERE name IN ('ibuf_merges','ibuf_merges_insert') AND count>0 ORDER BY name; SET GLOBAL innodb_disable_background_merge=OFF; @@ -399,9 +372,9 @@ COMMIT; disconnect purge_control; connection default; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; -CREATE TABLE test_wl5522.t1 ( +CREATE TABLE t1 ( c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 BIGINT, c3 VARCHAR(2048), @@ -411,296 +384,272 @@ CREATE TABLE test_wl5522.t1 ( INDEX idx3(c4(512))) Engine=InnoDB ROW_FORMAT=COMPRESSED; -SELECT c1, c2 FROM test_wl5522.t1; +SELECT c1, c2 FROM t1; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -CHECK TABLE test_wl5522.t1; +ALTER TABLE t1 IMPORT TABLESPACE; +CHECK TABLE t1; -SELECT c1,c2 FROM test_wl5522.t1; -SELECT COUNT(*) FROM test_wl5522.t1; -SELECT SUM(c2) FROM test_wl5522.t1; +SELECT c1,c2 FROM t1; -SHOW CREATE TABLE test_wl5522.t1; +SHOW CREATE TABLE t1; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; #### # Create a table and save the tablespace and .cfg file, we need to create # a Btree that has several levels -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; -INSERT IGNORE INTO test_wl5522.t1 VALUES - (100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 1200)); - -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; -SELECT COUNT(*) FROM test_wl5522.t1; -FLUSH TABLES test_wl5522.t1 FOR EXPORT; +INSERT INTO t1 +SELECT 100, REPEAT('Karanbir', 128), REPEAT('Ajeeth', 1200) +FROM seq_1_to_256; +FLUSH TABLES t1 FOR EXPORT; perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_backup_tablespaces("test_wl5522", "t1"); +ib_backup_tablespaces("test", "t1"); EOF UNLOCK TABLES; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF SET SESSION debug_dbug="+d,ib_import_trigger_corruption_1"; ---replace_regex /'.*t1.cfg'/'t1.cfg'/ - --error ER_INTERNAL_ERROR -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF # -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF SET SESSION debug_dbug="+d,buf_page_import_corrupt_failure"; ---replace_regex /'.*t1.cfg'/'t1.cfg'/ - # Following alter is failing --error ER_INTERNAL_ERROR -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF SET SESSION debug_dbug="+d,ib_import_trigger_corruption_2"; ---replace_regex $pathfix - --error ER_INNODB_INDEX_CORRUPT -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF SET SESSION debug_dbug="+d,ib_import_trigger_corruption_3"; ---replace_regex /'.*t1.cfg'/'t1.cfg'/ - --error ER_NOT_KEYFILE -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; SET SESSION debug_dbug="+d,ib_import_create_index_failure_1"; -ALTER TABLE test_wl5522.t1 ADD INDEX idx(c1); +ALTER TABLE t1 ADD INDEX idx(c1); SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF # -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF SET SESSION debug_dbug="+d,fil_space_create_failure"; ---replace_regex /'.*[\/\\]/'/ +--replace_result \\ / --error ER_GET_ERRMSG -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF # -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure"; ---replace_regex /'.*[\/\\]/'/ +--replace_result \\ / --error ER_GET_ERRMSG -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF # -CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb +CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; +ALTER TABLE t1 DISCARD TABLESPACE; --error ER_TABLESPACE_DISCARDED -SELECT COUNT(*) FROM test_wl5522.t1; +SELECT COUNT(*) FROM t1; # Restore files perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_restore_tablespaces("test_wl5522", "t1"); +ib_restore_tablespaces("test", "t1"); EOF SET SESSION debug_dbug="+d,fsp_flags_is_valid_failure"; ---replace_regex /'.*t1.cfg'/'t1.cfg'/ - --error ER_INTERNAL_ERROR -ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; SET SESSION debug_dbug=@saved_debug_dbug; -DROP TABLE test_wl5522.t1; +DROP TABLE t1; perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_unlink_tablespace("test_wl5522", "t1"); +ib_unlink_tablespace("test", "t1"); EOF - -DROP DATABASE test_wl5522; - set global innodb_monitor_disable = all; set global innodb_monitor_reset_all = all; @@ -717,18 +666,16 @@ call mtr.add_suppression("Monitor ibuf_merges is already enabled"); call mtr.add_suppression("Monitor ibuf_merges_insert is already enabled"); call mtr.add_suppression("Got error -1 when reading table '.*'"); call mtr.add_suppression("InnoDB: Table '.*' tablespace is set as discarded."); -call mtr.add_suppression("InnoDB: Tablespace '.*' exists in the cache.*"); +call mtr.add_suppression("InnoDB: Tablespace '.*' exists in the cache"); call mtr.add_suppression("InnoDB: Freeing existing tablespace '.*' entry from the cache with id.*"); call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded"); -call mtr.add_suppression(".*There was an error writing to the meta data file.*"); +call mtr.add_suppression("There was an error writing to the meta data file"); call mtr.add_suppression("InnoDB: Trying to import a tablespace, but could not open the tablespace file"); call mtr.add_suppression("Unsupported tablespace format"); -call mtr.add_suppression("Error in page .* of index \"GEN_CLUST_INDEX\" of table \"test_wl5522\".\"t1\""); call mtr.add_suppression("Page is marked as free"); call mtr.add_suppression("t1.ibd: Page .* at offset .* looks corrupted"); call mtr.add_suppression("but tablespace with that id or name does not exist"); -call mtr.add_suppression("Failed to find tablespace for table '\"test_wl5522\".\"t1\"' in the cache"); -call mtr.add_suppression("Could not find a valid tablespace file for 'test_wl5522.*t1'"); +call mtr.add_suppression("Could not find a valid tablespace file for '.*t1'"); call mtr.add_suppression("Index for table 't1' is corrupt; try to repair it"); --enable_query_log diff --git a/mysql-test/suite/innodb_zip/t/wl5522_zip.test b/mysql-test/suite/innodb_zip/t/wl5522_zip.test index d92093262ac..d5e6bc6e725 100644 --- a/mysql-test/suite/innodb_zip/t/wl5522_zip.test +++ b/mysql-test/suite/innodb_zip/t/wl5522_zip.test @@ -2,8 +2,9 @@ --source include/not_embedded.inc -- source include/innodb_page_size_small.inc +-- source include/have_sequence.inc -call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT."); +call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT\\."); SET SESSION innodb_strict_mode=1; @@ -17,17 +18,14 @@ CREATE TABLE t1 KEY (b)) ENGINE = InnoDB ROW_FORMAT=COMPRESSED ; -insert into t1 (b, c) values ('Apa', 'Filler........'), +CREATE TEMPORARY TABLE t (b char(22),c varchar(255)); +INSERT INTO t VALUES +('Apa', 'Filler........'), ('Banan', 'Filler........'), ('Cavalry', '..asdasdfaeraf'), ('Devotion', 'asdfuihknaskdf'), ('Evolution', 'lsjndofiabsoibeg'); -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; -INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a; +INSERT INTO t1 (b,c) SELECT b,c FROM t,seq_1_to_128; +DROP TEMPORARY TABLE t; SELECT COUNT(*) FROM t1; SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3; SELECT * FROM t1 ORDER BY a DESC LIMIT 3; @@ -89,16 +87,11 @@ CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; --list_files $MYSQLD_DATADIR/test FLUSH TABLES t1 FOR EXPORT; -SELECT COUNT(*) FROM t1; perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_backup_tablespaces("test", "t1"); @@ -140,11 +133,7 @@ CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; --list_files $MYSQLD_DATADIR/test FLUSH TABLES t1 FOR EXPORT; @@ -159,9 +148,6 @@ UNLOCK TABLES; --list_files $MYSQLD_DATADIR/test # Move the LSN forward -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; - DROP TABLE t1; CREATE TABLE t1( @@ -195,14 +181,9 @@ CREATE TABLE t1( c2 INT, INDEX(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; FLUSH TABLES t1 FOR EXPORT; -SELECT COUNT(*) FROM t1 WHERE c2 = 1; perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_backup_tablespaces("test", "t1"); @@ -211,9 +192,6 @@ EOF UNLOCK TABLES; # Move the LSN forward -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; - DROP TABLE t1; CREATE TABLE t1( @@ -250,14 +228,9 @@ eval CREATE TABLE t1( c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED $KEY_BLOCK_SIZE; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; FLUSH TABLES t1 FOR EXPORT; -SELECT COUNT(*) FROM t1 WHERE c2 = 1; perl; do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_backup_tablespaces("test", "t1"); @@ -265,9 +238,6 @@ EOF UNLOCK TABLES; # Move the LSN forward -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; - DROP TABLE t1; --replace_result $KEY_BLOCK_SIZE KEY_BLOCK_SIZE=16 @@ -319,14 +289,7 @@ CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT) ENGINE=InnoDB; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; - -SELECT COUNT(*) FROM t1; - +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; SHOW CREATE TABLE t1; # This should fail, InnoDB should return a warning @@ -347,15 +310,9 @@ CREATE TABLE t1( c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; -INSERT INTO t1(c2) VALUES(1); -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; -INSERT INTO t1(c2) SELECT c2 FROM t1; +INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16; SHOW CREATE TABLE t1; -SELECT * FROM t1; FLUSH TABLES t1 FOR EXPORT; @@ -511,7 +468,7 @@ SELECT * FROM t1; DROP TABLE t1; call mtr.add_suppression("Got error -1 when reading table '.*'"); -call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'.*"); +call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'"); call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded"); # cleanup From 9f7b8625e698da6b7eba7c26e765c66635571919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 20 Mar 2020 17:40:39 +0200 Subject: [PATCH 23/25] MDEV-14431: Fix ulong/ulonglong type mismatch --- sql/rpl_gtid.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc index cc6c169c0df..43fdeec9e6a 100644 --- a/sql/rpl_gtid.cc +++ b/sql/rpl_gtid.cc @@ -1,4 +1,5 @@ /* Copyright (c) 2013, Kristian Nielsen and MariaDB Services Ab. + Copyright (c) 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -2226,7 +2227,8 @@ gtid_waiting::wait_for_pos(THD *thd, String *gtid_str, longlong timeout_us) /* fall through */ case 0: status_var_add(thd->status_var.master_gtid_wait_time, - microsecond_interval_timer() - before); + static_cast + (microsecond_interval_timer() - before)); } my_free(wait_pos); return err; From fd5c36bed5de65e85900c9fc9f0ed2092c4b38c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 20 Mar 2020 21:41:39 +0200 Subject: [PATCH 24/25] MDEV-21959: Fix a type mismatch on 64-bit systems --- sql/field.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/field.cc b/sql/field.cc index 196041c979e..6153ad64fca 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -9043,7 +9043,7 @@ int Field_geom::store(const char *from, size_t length, CHARSET_INFO *cs) if (!tab_name) tab_name= ""; wkt.set_charset(&my_charset_latin1); - if (!(geom= Geometry::construct(&buffer, from, length)) || + if (!(geom= Geometry::construct(&buffer, from, uint32(length))) || geom->as_wkt(&wkt, &dummy)) goto err; From 9394cc89143e4fce3126a96ac1c8a91a66d71dea Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Sat, 21 Mar 2020 08:17:28 +0100 Subject: [PATCH 25/25] MDEV-21675: Data inconsistency after multirow insert rollback (#1474) * Remove dead code * MDEV-21675 Data inconsistency after multirow insert rollback This patch fixes data inconsistencies that happen after rollback of multirow inserts, with binlog disabled. For example, statements such as `INSERT INTO t1 VALUES (1,'a'),(1,'b')` that fail with duplicate key error. In such cases the whole statement is rolled back. However, with wsrep_emulate_binlog in effect, the IO_CACHE would not be truncated, and the pending rows events would be replicated to the rest of the cluster. In the above example, it would result in row (1,'a') being replicated, whereas locally the statement is rolled back entirely. Making the cluster inconsistent. The patch changes the code so that prior to statement rollback, pending rows event are removed and the stmt cache reset. That patch also introduces MTR tests that excercise multirow insert statements for regular, and streaming replication. --- .../galera/r/galera_multirow_rollback.result | 73 ++++++++ .../t/galera_multirow_rollback.combinations | 4 + .../galera/t/galera_multirow_rollback.test | 89 ++++++++++ .../r/galera_sr_multirow_rollback.result | 127 ++++++++++++++ .../galera_sr_multirow_rollback.combinations | 4 + .../t/galera_sr_multirow_rollback.test | 156 ++++++++++++++++++ sql/log.cc | 31 ++-- sql/log.h | 1 + sql/wsrep_binlog.cc | 36 ---- sql/wsrep_binlog.h | 2 - sql/wsrep_mysqld.h | 5 - sql/wsrep_trans_observer.h | 23 ++- 12 files changed, 484 insertions(+), 67 deletions(-) create mode 100644 mysql-test/suite/galera/r/galera_multirow_rollback.result create mode 100644 mysql-test/suite/galera/t/galera_multirow_rollback.combinations create mode 100644 mysql-test/suite/galera/t/galera_multirow_rollback.test create mode 100644 mysql-test/suite/galera_sr/r/galera_sr_multirow_rollback.result create mode 100644 mysql-test/suite/galera_sr/t/galera_sr_multirow_rollback.combinations create mode 100644 mysql-test/suite/galera_sr/t/galera_sr_multirow_rollback.test diff --git a/mysql-test/suite/galera/r/galera_multirow_rollback.result b/mysql-test/suite/galera/r/galera_multirow_rollback.result new file mode 100644 index 00000000000..13502d0d3dc --- /dev/null +++ b/mysql-test/suite/galera/r/galera_multirow_rollback.result @@ -0,0 +1,73 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12)); +connection node_1; +START TRANSACTION; +INSERT INTO t1 (f2) VALUES ('a'), ('b'); +ERROR 23000: Duplicate entry '0' for key 'PRIMARY' +COMMIT; +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 +connection node_2; +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 +DROP TABLE t1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12)); +connection node_1; +START TRANSACTION; +INSERT INTO t1 VALUES (1, 'a'); +INSERT INTO t1 VALUES (2, 'b'); +INSERT INTO t1 (f2) VALUES ('c'), ('d'); +ERROR 23000: Duplicate entry '0' for key 'PRIMARY' +COMMIT; +expect (1,'a'), (2, 'b') +SELECT * FROM t1; +f1 f2 +1 a +2 b +connection node_2; +expect (1,'a'), (2, 'b') +SELECT * FROM t1; +f1 f2 +1 a +2 b +DROP TABLE t1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12)); +connection node_1; +INSERT INTO t1 (f2) VALUES ('a'),('b'); +ERROR 23000: Duplicate entry '0' for key 'PRIMARY' +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 +connection node_2; +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 +DROP TABLE t1; +connection node_1; +CREATE TABLE p(id int primary key, j int) ENGINE=InnoDB; +CREATE TABLE c(id int primary key, fk1 int) ENGINE=InnoDB; +ALTER TABLE c ADD FOREIGN KEY (fk1) references p(id); +INSERT INTO p VALUES(1, 0); +START TRANSACTION; +INSERT INTO c VALUES (3,1); +INSERT INTO c VALUES (1,1), (2,2); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`c`, CONSTRAINT `c_ibfk_1` FOREIGN KEY (`fk1`) REFERENCES `p` (`id`)) +COMMIT; +SELECT * FROM p; +id j +1 0 +SELECT * FROM c; +id fk1 +3 1 +connection node_2; +SELECT * FROM p; +id j +1 0 +SELECT * FROM c; +id fk1 +3 1 +DROP TABLE c; +DROP TABLE p; diff --git a/mysql-test/suite/galera/t/galera_multirow_rollback.combinations b/mysql-test/suite/galera/t/galera_multirow_rollback.combinations new file mode 100644 index 00000000000..1ce3b45aa1a --- /dev/null +++ b/mysql-test/suite/galera/t/galera_multirow_rollback.combinations @@ -0,0 +1,4 @@ +[binlogon] +log-bin + +[binlogoff] diff --git a/mysql-test/suite/galera/t/galera_multirow_rollback.test b/mysql-test/suite/galera/t/galera_multirow_rollback.test new file mode 100644 index 00000000000..a5aaedd8bd4 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_multirow_rollback.test @@ -0,0 +1,89 @@ +# +# Test multirow insert rollback +# + +--source include/galera_cluster.inc + +# +# Case 1: error on multirow insert results in empty transaction +# +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12)); + +--connection node_1 +START TRANSACTION; +--error ER_DUP_ENTRY +INSERT INTO t1 (f2) VALUES ('a'), ('b'); +COMMIT; + +SELECT COUNT(*) AS expect_0 FROM t1; + +--connection node_2 +SELECT COUNT(*) AS expect_0 FROM t1; + +DROP TABLE t1; + + +# +# Case 2: error on multirow insert does not affect previous statements +# +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12)); + +--connection node_1 +START TRANSACTION; +INSERT INTO t1 VALUES (1, 'a'); +INSERT INTO t1 VALUES (2, 'b'); +--error ER_DUP_ENTRY +INSERT INTO t1 (f2) VALUES ('c'), ('d'); +COMMIT; + +--echo expect (1,'a'), (2, 'b') +SELECT * FROM t1; + +--connection node_2 +--echo expect (1,'a'), (2, 'b') +SELECT * FROM t1; + +DROP TABLE t1; + + +# +# Case 3: error on autocommit multirow insert +# +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12)); + +--connection node_1 +--error ER_DUP_ENTRY +INSERT INTO t1 (f2) VALUES ('a'),('b'); + +SELECT COUNT(*) AS expect_0 FROM t1; + +--connection node_2 +SELECT COUNT(*) AS expect_0 FROM t1; + +DROP TABLE t1; + + +# +# Case 4: FK constraint violation on multirow insert +# +--connection node_1 +CREATE TABLE p(id int primary key, j int) ENGINE=InnoDB; +CREATE TABLE c(id int primary key, fk1 int) ENGINE=InnoDB; +ALTER TABLE c ADD FOREIGN KEY (fk1) references p(id); +INSERT INTO p VALUES(1, 0); + +START TRANSACTION; +INSERT INTO c VALUES (3,1); +--error ER_NO_REFERENCED_ROW_2 +INSERT INTO c VALUES (1,1), (2,2); +COMMIT; + +SELECT * FROM p; +SELECT * FROM c; + +--connection node_2 +SELECT * FROM p; +SELECT * FROM c; + +DROP TABLE c; +DROP TABLE p; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_multirow_rollback.result b/mysql-test/suite/galera_sr/r/galera_sr_multirow_rollback.result new file mode 100644 index 00000000000..1795d16bbfa --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_multirow_rollback.result @@ -0,0 +1,127 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12)); +connection node_1; +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +INSERT INTO t1 (f2) VALUES ('a'), ('b'); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +COMMIT; +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 +connection node_2; +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 +DROP TABLE t1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12)); +connection node_1; +SET SESSION wsrep_trx_fragment_size = 1000; +START TRANSACTION; +INSERT INTO t1 (f2) VALUES ('a'), ('b'); +ERROR 23000: Duplicate entry '0' for key 'PRIMARY' +COMMIT; +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 +connection node_2; +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 +DROP TABLE t1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12)); +connection node_1; +SET SESSION wsrep_trx_fragment_size = 1000; +START TRANSACTION; +INSERT INTO t1 VALUES (1, 'a'); +INSERT INTO t1 VALUES (2, 'b'); +INSERT INTO t1 (f2) VALUES ('c'), ('d'); +ERROR 23000: Duplicate entry '0' for key 'PRIMARY' +COMMIT; +expect (1,'a'), (2, 'b') +SELECT * FROM t1; +f1 f2 +1 a +2 b +connection node_2; +expect (1,'a'), (2, 'b') +SELECT * FROM t1; +f1 f2 +1 a +2 b +DROP TABLE t1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12)); +connection node_1; +SET SESSION wsrep_trx_fragment_size = 1; +INSERT INTO t1 (f2) VALUES ('a'), ('b'); +ERROR 23000: Duplicate entry '0' for key 'PRIMARY' +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 +connection node_2; +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 +connection node_1; +SET SESSION wsrep_trx_fragment_size = 1000; +INSERT INTO t1 (f2) VALUES ('a'), ('b'); +ERROR 23000: Duplicate entry '0' for key 'PRIMARY' +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 +connection node_2; +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 +DROP TABLE t1; +connection node_1; +CREATE TABLE p(id int primary key, j int) ENGINE=InnoDB; +CREATE TABLE c(id int primary key, fk1 int) ENGINE=InnoDB; +ALTER TABLE c ADD FOREIGN KEY (fk1) references p(id); +INSERT INTO p VALUES(1, 0); +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO c VALUES (3,1); +INSERT INTO c VALUES (1,1), (2,2); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +COMMIT; +SELECT * FROM p; +id j +1 0 +SELECT * FROM c; +id fk1 +connection node_2; +SELECT * FROM p; +id j +1 0 +SELECT * FROM c; +id fk1 +DROP TABLE c; +DROP TABLE p; +connection node_1; +CREATE TABLE p(id int primary key, j int) ENGINE=InnoDB; +CREATE TABLE c(id int primary key, fk1 int) ENGINE=InnoDB; +ALTER TABLE c ADD FOREIGN KEY (fk1) references p(id); +INSERT INTO p VALUES(1, 0); +SET SESSION wsrep_trx_fragment_size=1000; +START TRANSACTION; +INSERT INTO c VALUES (3,1); +INSERT INTO c VALUES (1,1), (2,2); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`c`, CONSTRAINT `c_ibfk_1` FOREIGN KEY (`fk1`) REFERENCES `p` (`id`)) +COMMIT; +SELECT * FROM p; +id j +1 0 +SELECT * FROM c; +id fk1 +3 1 +connection node_2; +SELECT * FROM p; +id j +1 0 +SELECT * FROM c; +id fk1 +3 1 +DROP TABLE c; +DROP TABLE p; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_multirow_rollback.combinations b/mysql-test/suite/galera_sr/t/galera_sr_multirow_rollback.combinations new file mode 100644 index 00000000000..1ce3b45aa1a --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_multirow_rollback.combinations @@ -0,0 +1,4 @@ +[binlogon] +log-bin + +[binlogoff] diff --git a/mysql-test/suite/galera_sr/t/galera_sr_multirow_rollback.test b/mysql-test/suite/galera_sr/t/galera_sr_multirow_rollback.test new file mode 100644 index 00000000000..9004d332393 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_multirow_rollback.test @@ -0,0 +1,156 @@ +# +# Test multirow insert rollback with streaming replication +# + +--source include/galera_cluster.inc + + +# +# Case 1: multirow insert results full rollback if a fragment +# managed to replicate +# +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12)); + +--connection node_1 +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +# With fragment size 1 we expect full rollback +# because a fragment is already replicated. +# Therefore, expect ER_LOCK_DEADLOCK instead of ER_DUP_ENTRY +--error ER_LOCK_DEADLOCK +INSERT INTO t1 (f2) VALUES ('a'), ('b'); +COMMIT; + +SELECT COUNT(*) AS expect_0 FROM t1; + +--connection node_2 +SELECT COUNT(*) AS expect_0 FROM t1; + +DROP TABLE t1; + + +# +# Case 2: error on multirow insert results in empty commit +# +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12)); + +--connection node_1 +SET SESSION wsrep_trx_fragment_size = 1000; +START TRANSACTION; +--error ER_DUP_ENTRY +INSERT INTO t1 (f2) VALUES ('a'), ('b'); +COMMIT; + +SELECT COUNT(*) AS expect_0 FROM t1; + +--connection node_2 +SELECT COUNT(*) AS expect_0 FROM t1; + +DROP TABLE t1; + + +# +# Case 3: error on multirow insert does not affect previous statements +# +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12)); + +--connection node_1 +SET SESSION wsrep_trx_fragment_size = 1000; +START TRANSACTION; +INSERT INTO t1 VALUES (1, 'a'); +INSERT INTO t1 VALUES (2, 'b'); +--error ER_DUP_ENTRY +INSERT INTO t1 (f2) VALUES ('c'), ('d'); +COMMIT; + +--echo expect (1,'a'), (2, 'b') +SELECT * FROM t1; + +--connection node_2 +--echo expect (1,'a'), (2, 'b') +SELECT * FROM t1; + +DROP TABLE t1; + + +# +# Case 4: error on autocommit multirow insert +# +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12)); + +--connection node_1 +SET SESSION wsrep_trx_fragment_size = 1; + +--error ER_DUP_ENTRY +INSERT INTO t1 (f2) VALUES ('a'), ('b'); +SELECT COUNT(*) AS expect_0 FROM t1; + +--connection node_2 +SELECT COUNT(*) AS expect_0 FROM t1; + + --connection node_1 +SET SESSION wsrep_trx_fragment_size = 1000; +--error ER_DUP_ENTRY +INSERT INTO t1 (f2) VALUES ('a'), ('b'); +SELECT COUNT(*) AS expect_0 FROM t1; + +--connection node_2 +SELECT COUNT(*) AS expect_0 FROM t1; + +DROP TABLE t1; + + +# +# Case 5: FK constraint violation on multirow insert results +# full rollback if a fragment has already replicated +# +--connection node_1 +CREATE TABLE p(id int primary key, j int) ENGINE=InnoDB; +CREATE TABLE c(id int primary key, fk1 int) ENGINE=InnoDB; +ALTER TABLE c ADD FOREIGN KEY (fk1) references p(id); +INSERT INTO p VALUES(1, 0); + +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO c VALUES (3,1); +--error ER_LOCK_DEADLOCK +INSERT INTO c VALUES (1,1), (2,2); +COMMIT; + +SELECT * FROM p; +SELECT * FROM c; + +--connection node_2 +SELECT * FROM p; +SELECT * FROM c; + +DROP TABLE c; +DROP TABLE p; + + +# +# Case 6: FK constraint violation on multirow insert results +# stmt rollback if no fragments have replicated +# +--connection node_1 +CREATE TABLE p(id int primary key, j int) ENGINE=InnoDB; +CREATE TABLE c(id int primary key, fk1 int) ENGINE=InnoDB; +ALTER TABLE c ADD FOREIGN KEY (fk1) references p(id); +INSERT INTO p VALUES(1, 0); + +SET SESSION wsrep_trx_fragment_size=1000; +START TRANSACTION; +INSERT INTO c VALUES (3,1); +--error ER_NO_REFERENCED_ROW_2 +INSERT INTO c VALUES (1,1), (2,2); +COMMIT; + +SELECT * FROM p; +SELECT * FROM c; + +--connection node_2 +SELECT * FROM p; +SELECT * FROM c; + +DROP TABLE c; +DROP TABLE p; diff --git a/sql/log.cc b/sql/log.cc index ffeb3661783..1da73ab25df 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -10702,7 +10702,6 @@ maria_declare_plugin(binlog) maria_declare_plugin_end; #ifdef WITH_WSREP -#include "wsrep_trans_observer.h" #include "wsrep_mysqld.h" IO_CACHE *wsrep_get_trans_cache(THD * thd) @@ -10725,33 +10724,33 @@ void wsrep_thd_binlog_trx_reset(THD * thd) /* todo: fix autocommit select to not call the caller */ - if (thd_get_ha_data(thd, binlog_hton) != NULL) + binlog_cache_mngr *const cache_mngr= + (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton); + if (cache_mngr) { - binlog_cache_mngr *const cache_mngr= - (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton); - if (cache_mngr) + cache_mngr->reset(false, true); + if (!cache_mngr->stmt_cache.empty()) { - cache_mngr->reset(false, true); - if (!cache_mngr->stmt_cache.empty()) - { - WSREP_DEBUG("pending events in stmt cache, sql: %s", thd->query()); - cache_mngr->stmt_cache.reset(); - } + WSREP_DEBUG("pending events in stmt cache, sql: %s", thd->query()); + cache_mngr->stmt_cache.reset(); } } thd->clear_binlog_table_maps(); DBUG_VOID_RETURN; } - -void thd_binlog_rollback_stmt(THD * thd) +void wsrep_thd_binlog_stmt_rollback(THD * thd) { - WSREP_DEBUG("thd_binlog_rollback_stmt connection: %llu", - thd->thread_id); + DBUG_ENTER("wsrep_thd_binlog_stmt_rollback"); + WSREP_DEBUG("wsrep_thd_binlog_stmt_rollback"); binlog_cache_mngr *const cache_mngr= (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton); if (cache_mngr) - cache_mngr->trx_cache.set_prev_position(MY_OFF_T_UNDEF); + { + thd->binlog_remove_pending_rows_event(TRUE, TRUE); + cache_mngr->stmt_cache.reset(); + } + DBUG_VOID_RETURN; } bool wsrep_stmt_rollback_is_safe(THD* thd) diff --git a/sql/log.h b/sql/log.h index eef81c46ac4..4b80bdfd81f 100644 --- a/sql/log.h +++ b/sql/log.h @@ -1222,6 +1222,7 @@ static inline TC_LOG *get_tc_log_implementation() #ifdef WITH_WSREP IO_CACHE* wsrep_get_trans_cache(THD *); void wsrep_thd_binlog_trx_reset(THD * thd); +void wsrep_thd_binlog_stmt_rollback(THD * thd); #endif /* WITH_WSREP */ class Gtid_list_log_event; diff --git a/sql/wsrep_binlog.cc b/sql/wsrep_binlog.cc index 84fce7c2b2d..787ebc042ae 100644 --- a/sql/wsrep_binlog.cc +++ b/sql/wsrep_binlog.cc @@ -228,40 +228,6 @@ void wsrep_dump_rbr_buf(THD *thd, const void* rbr_buf, size_t buf_len) free(filename); } -/* - wsrep exploits binlog's caches even if binlogging itself is not - activated. In such case connection close needs calling - actual binlog's method. - Todo: split binlog hton from its caches to use ones by wsrep - without referring to binlog's stuff. -*/ -int wsrep_binlog_close_connection(THD* thd) -{ - DBUG_ENTER("wsrep_binlog_close_connection"); - if (thd_get_ha_data(thd, binlog_hton) != NULL) - binlog_hton->close_connection (binlog_hton, thd); - DBUG_RETURN(0); -} - -int wsrep_binlog_savepoint_set(THD *thd, void *sv) -{ - if (!wsrep_emulate_bin_log) return 0; - int rcode= binlog_hton->savepoint_set(binlog_hton, thd, sv); - return rcode; -} - -int wsrep_binlog_savepoint_rollback(THD *thd, void *sv) -{ - if (!wsrep_emulate_bin_log) return 0; - int rcode= binlog_hton->savepoint_rollback(binlog_hton, thd, sv); - return rcode; -} - -void thd_binlog_flush_pending_rows_event(THD *thd, bool stmt_end) -{ - thd->binlog_flush_pending_rows_event(stmt_end); -} - /* Dump replication buffer along with header to a file. */ void wsrep_dump_rbr_buf_with_header(THD *thd, const void *rbr_buf, size_t buf_len) @@ -343,8 +309,6 @@ cleanup1: DBUG_VOID_RETURN; } -#include "log_event.h" - int wsrep_write_skip_event(THD* thd) { DBUG_ENTER("wsrep_write_skip_event"); diff --git a/sql/wsrep_binlog.h b/sql/wsrep_binlog.h index 4e29b30baca..252fbe602d2 100644 --- a/sql/wsrep_binlog.h +++ b/sql/wsrep_binlog.h @@ -50,8 +50,6 @@ void wsrep_dump_rbr_buf(THD *thd, const void* rbr_buf, size_t buf_len); void wsrep_dump_rbr_buf_with_header(THD *thd, const void *rbr_buf, size_t buf_len); -int wsrep_binlog_close_connection(THD* thd); - /** Write a skip event into binlog. diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h index 71cbc875b91..a5da8e3bc44 100644 --- a/sql/wsrep_mysqld.h +++ b/sql/wsrep_mysqld.h @@ -405,11 +405,6 @@ extern void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx, MDL_ticket *ticket, const MDL_key *key); -IO_CACHE * get_trans_log(THD * thd); -bool wsrep_trans_cache_is_empty(THD *thd); -void thd_binlog_flush_pending_rows_event(THD *thd, bool stmt_end); -void thd_binlog_rollback_stmt(THD * thd); -void thd_binlog_trx_reset(THD * thd); enum wsrep_thread_type { WSREP_APPLIER_THREAD=1, diff --git a/sql/wsrep_trans_observer.h b/sql/wsrep_trans_observer.h index 6bb26c40064..98fc63cf783 100644 --- a/sql/wsrep_trans_observer.h +++ b/sql/wsrep_trans_observer.h @@ -335,15 +335,22 @@ static inline int wsrep_before_rollback(THD* thd, bool all) int ret= 0; if (wsrep_is_active(thd)) { - if (!all && thd->in_active_multi_stmt_transaction() && - thd->wsrep_trx().is_streaming() && - !wsrep_stmt_rollback_is_safe(thd)) + if (!all && thd->in_active_multi_stmt_transaction()) { - /* Non-safe statement rollback during SR multi statement - transasction. Self abort the transaction, the actual rollback - and error handling will be done in after statement phase. */ - wsrep_thd_self_abort(thd); - ret= 0; + if (wsrep_emulate_bin_log) + { + wsrep_thd_binlog_stmt_rollback(thd); + } + + if (thd->wsrep_trx().is_streaming() && + !wsrep_stmt_rollback_is_safe(thd)) + { + /* Non-safe statement rollback during SR multi statement + transasction. Self abort the transaction, the actual rollback + and error handling will be done in after statement phase. */ + wsrep_thd_self_abort(thd); + ret= 0; + } } else if (wsrep_is_real(thd, all) && thd->wsrep_trx().state() != wsrep::transaction::s_aborted)