summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-06-18 09:16:20 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2021-06-18 09:16:20 +0300
commitb630f0b1b98e462225c13176113946f4580ea8d4 (patch)
treecb452513c6526a30a2e06d489b5a5d7cf9e69c24
parentb7d87bf0a988e6471b793c4c148837a460641102 (diff)
parent78bd7d86a4a0b3733ba38373213645a6b3a9b9c6 (diff)
downloadmariadb-git-b630f0b1b98e462225c13176113946f4580ea8d4.tar.gz
Merge 10.5 into 10.6
-rw-r--r--mysql-test/include/platform.combinations2
-rw-r--r--mysql-test/lib/My/Platform.pm11
-rw-r--r--mysql-test/main/mysqld--help,aix.rdiff0
-rw-r--r--mysql-test/suite.pm8
-rw-r--r--mysql-test/suite/innodb/r/innodb-fk.result15
-rw-r--r--mysql-test/suite/innodb/t/innodb-fk.test16
-rw-r--r--mysql-test/suite/sys_vars/inc/sysvars_server.inc1
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_notembedded,aix.rdiff105
-rw-r--r--sql/sql_table.cc9
-rw-r--r--tpool/aio_simulated.cc5
10 files changed, 167 insertions, 5 deletions
diff --git a/mysql-test/include/platform.combinations b/mysql-test/include/platform.combinations
index 4681ac05314..4f0660b7a40 100644
--- a/mysql-test/include/platform.combinations
+++ b/mysql-test/include/platform.combinations
@@ -1,4 +1,6 @@
[win]
+[aix]
+
[unix]
diff --git a/mysql-test/lib/My/Platform.pm b/mysql-test/lib/My/Platform.pm
index db1206f187e..b8bc9f8ec84 100644
--- a/mysql-test/lib/My/Platform.pm
+++ b/mysql-test/lib/My/Platform.pm
@@ -22,7 +22,7 @@ use File::Basename;
use File::Path;
use base qw(Exporter);
-our @EXPORT= qw(IS_CYGWIN IS_WINDOWS IS_WIN32PERL
+our @EXPORT= qw(IS_CYGWIN IS_WINDOWS IS_WIN32PERL IS_AIX
native_path posix_path mixed_path
check_socket_path_length process_alive open_for_append);
@@ -54,6 +54,15 @@ BEGIN {
}
}
+BEGIN {
+ if ($^O eq "aix") {
+ eval 'sub IS_AIX { 1 }';
+ }
+ else {
+ eval 'sub IS_AIX { 0 }';
+ }
+}
+
#
# native_path
diff --git a/mysql-test/main/mysqld--help,aix.rdiff b/mysql-test/main/mysqld--help,aix.rdiff
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/mysql-test/main/mysqld--help,aix.rdiff
diff --git a/mysql-test/suite.pm b/mysql-test/suite.pm
index 8ff2e95c083..faab55e9741 100644
--- a/mysql-test/suite.pm
+++ b/mysql-test/suite.pm
@@ -17,7 +17,13 @@ sub skip_combinations {
unless $ENV{DEBUG_KEY_MANAGEMENT_SO};
# don't run tests for the wrong platform
- $skip{'include/platform.combinations'} = [ (IS_WINDOWS) ? 'unix' : 'win' ];
+ if (IS_WINDOWS) {
+ $skip{'include/platform.combinations'} = [ 'aix', 'unix' ];
+ } elsif (IS_AIX) {
+ $skip{'include/platform.combinations'} = [ 'win', 'unix' ];
+ } else {
+ $skip{'include/platform.combinations'} = [ 'aix', 'win' ];
+ }
$skip{'include/maybe_debug.combinations'} =
[ defined $::mysqld_variables{'debug-dbug'} ? 'release' : 'debug' ];
diff --git a/mysql-test/suite/innodb/r/innodb-fk.result b/mysql-test/suite/innodb/r/innodb-fk.result
index 901b468d1ab..7982c5f1f49 100644
--- a/mysql-test/suite/innodb/r/innodb-fk.result
+++ b/mysql-test/suite/innodb/r/innodb-fk.result
@@ -206,3 +206,18 @@ c0123456789012345678 int,
FOREIGN KEY (a012345678901234567,c0123456789012345678,b) REFERENCES tx (x1,x2,x3)
) ENGINE=InnoDB;
ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
+#
+# MDEV-25642 InnoDB rename table copy DDL fails
+# while dropping the table
+#
+call mtr.add_suppression("InnoDB: In ALTER TABLE `test`.`t1` has or is referenced in foreign key constraints which are not compatible with the new table definition.");
+CREATE TABLE t1 (a VARCHAR(10) NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t1_fk (a VARCHAR(40), KEY a (a), FULLTEXT KEY(a), CONSTRAINT fk FOREIGN KEY(a) REFERENCES t1 (a) ON UPDATE CASCADE) ENGINE=InnoDB;
+ALTER TABLE t1 RENAME TO tm1, ALGORITHM=COPY;
+SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
+ID FOR_NAME REF_NAME N_COLS TYPE
+test/fk test/t1_fk test/t1 1 4
+SET FOREIGN_KEY_CHECKS=0;
+CREATE TABLE t1 (c1 BIGINT NOT NULL, c2 BIGINT NOT NULL, PRIMARY KEY(c1), UNIQUE KEY(c2)) ENGINE=MEMORY;
+ALTER TABLE t1 ENGINE=InnoDB, ALGORITHM=COPY;
+DROP TABLE t1, tm1, t1_fk;
diff --git a/mysql-test/suite/innodb/t/innodb-fk.test b/mysql-test/suite/innodb/t/innodb-fk.test
index fcab4b22eb1..6d5307a1f84 100644
--- a/mysql-test/suite/innodb/t/innodb-fk.test
+++ b/mysql-test/suite/innodb/t/innodb-fk.test
@@ -244,3 +244,19 @@ CREATE TABLE t1 (
c0123456789012345678 int,
FOREIGN KEY (a012345678901234567,c0123456789012345678,b) REFERENCES tx (x1,x2,x3)
) ENGINE=InnoDB;
+
+--echo #
+--echo # MDEV-25642 InnoDB rename table copy DDL fails
+--echo # while dropping the table
+--echo #
+call mtr.add_suppression("InnoDB: In ALTER TABLE `test`.`t1` has or is referenced in foreign key constraints which are not compatible with the new table definition.");
+
+CREATE TABLE t1 (a VARCHAR(10) NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t1_fk (a VARCHAR(40), KEY a (a), FULLTEXT KEY(a), CONSTRAINT fk FOREIGN KEY(a) REFERENCES t1 (a) ON UPDATE CASCADE) ENGINE=InnoDB;
+ALTER TABLE t1 RENAME TO tm1, ALGORITHM=COPY;
+SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
+# Enable SET FOREIGN_KEY_CHECKS after fixing MDEV-25885
+SET FOREIGN_KEY_CHECKS=0;
+CREATE TABLE t1 (c1 BIGINT NOT NULL, c2 BIGINT NOT NULL, PRIMARY KEY(c1), UNIQUE KEY(c2)) ENGINE=MEMORY;
+ALTER TABLE t1 ENGINE=InnoDB, ALGORITHM=COPY;
+DROP TABLE t1, tm1, t1_fk;
diff --git a/mysql-test/suite/sys_vars/inc/sysvars_server.inc b/mysql-test/suite/sys_vars/inc/sysvars_server.inc
index 025f8a8922d..8fca98e0383 100644
--- a/mysql-test/suite/sys_vars/inc/sysvars_server.inc
+++ b/mysql-test/suite/sys_vars/inc/sysvars_server.inc
@@ -1,5 +1,6 @@
--source include/have_perfschema.inc
--source include/word_size.inc
+--source include/platform.inc
--vertical_results
# need stable timestamp, because its current value is printed below
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,aix.rdiff b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,aix.rdiff
new file mode 100644
index 00000000000..3fd273569c9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,aix.rdiff
@@ -0,0 +1,105 @@
+diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
+index bb3378139f2..ddab28508ec 100644
+--- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
++++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
+@@ -4259,99 +4259,9 @@ VARIABLE_COMMENT Define threads usage for handling queries
+ NUMERIC_MIN_VALUE NULL
+ NUMERIC_MAX_VALUE NULL
+ NUMERIC_BLOCK_SIZE NULL
+-ENUM_VALUE_LIST one-thread-per-connection,no-threads,pool-of-threads
++ENUM_VALUE_LIST one-thread-per-connection,no-threads
+ READ_ONLY YES
+ COMMAND_LINE_ARGUMENT REQUIRED
+-VARIABLE_NAME THREAD_POOL_DEDICATED_LISTENER
+-VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BOOLEAN
+-VARIABLE_COMMENT If set to 1,listener thread will not pick up queries
+-NUMERIC_MIN_VALUE NULL
+-NUMERIC_MAX_VALUE NULL
+-NUMERIC_BLOCK_SIZE NULL
+-ENUM_VALUE_LIST OFF,ON
+-READ_ONLY NO
+-COMMAND_LINE_ARGUMENT OPTIONAL
+-VARIABLE_NAME THREAD_POOL_EXACT_STATS
+-VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BOOLEAN
+-VARIABLE_COMMENT If set to 1, provides better statistics in information_schema threadpool tables
+-NUMERIC_MIN_VALUE NULL
+-NUMERIC_MAX_VALUE NULL
+-NUMERIC_BLOCK_SIZE NULL
+-ENUM_VALUE_LIST OFF,ON
+-READ_ONLY NO
+-COMMAND_LINE_ARGUMENT OPTIONAL
+-VARIABLE_NAME THREAD_POOL_IDLE_TIMEOUT
+-VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE INT UNSIGNED
+-VARIABLE_COMMENT Timeout in seconds for an idle thread in the thread pool.Worker thread will be shut down after timeout
+-NUMERIC_MIN_VALUE 1
+-NUMERIC_MAX_VALUE 4294967295
+-NUMERIC_BLOCK_SIZE 1
+-ENUM_VALUE_LIST NULL
+-READ_ONLY NO
+-COMMAND_LINE_ARGUMENT REQUIRED
+-VARIABLE_NAME THREAD_POOL_MAX_THREADS
+-VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE INT UNSIGNED
+-VARIABLE_COMMENT Maximum allowed number of worker threads in the thread pool
+-NUMERIC_MIN_VALUE 1
+-NUMERIC_MAX_VALUE 65536
+-NUMERIC_BLOCK_SIZE 1
+-ENUM_VALUE_LIST NULL
+-READ_ONLY NO
+-COMMAND_LINE_ARGUMENT REQUIRED
+-VARIABLE_NAME THREAD_POOL_OVERSUBSCRIBE
+-VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE INT UNSIGNED
+-VARIABLE_COMMENT How many additional active worker threads in a group are allowed.
+-NUMERIC_MIN_VALUE 1
+-NUMERIC_MAX_VALUE 1000
+-NUMERIC_BLOCK_SIZE 1
+-ENUM_VALUE_LIST NULL
+-READ_ONLY NO
+-COMMAND_LINE_ARGUMENT REQUIRED
+-VARIABLE_NAME THREAD_POOL_PRIORITY
+-VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE ENUM
+-VARIABLE_COMMENT Threadpool priority. High priority connections usually start executing earlier than low priority.If priority set to 'auto', the the actual priority(low or high) is determined based on whether or not connection is inside transaction.
+-NUMERIC_MIN_VALUE NULL
+-NUMERIC_MAX_VALUE NULL
+-NUMERIC_BLOCK_SIZE NULL
+-ENUM_VALUE_LIST high,low,auto
+-READ_ONLY NO
+-COMMAND_LINE_ARGUMENT REQUIRED
+-VARIABLE_NAME THREAD_POOL_PRIO_KICKUP_TIMER
+-VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE INT UNSIGNED
+-VARIABLE_COMMENT The number of milliseconds before a dequeued low-priority statement is moved to the high-priority queue
+-NUMERIC_MIN_VALUE 0
+-NUMERIC_MAX_VALUE 4294967295
+-NUMERIC_BLOCK_SIZE 1
+-ENUM_VALUE_LIST NULL
+-READ_ONLY NO
+-COMMAND_LINE_ARGUMENT REQUIRED
+-VARIABLE_NAME THREAD_POOL_SIZE
+-VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE INT UNSIGNED
+-VARIABLE_COMMENT Number of thread groups in the pool. This parameter is roughly equivalent to maximum number of concurrently executing threads (threads in a waiting state do not count as executing).
+-NUMERIC_MIN_VALUE 1
+-NUMERIC_MAX_VALUE 100000
+-NUMERIC_BLOCK_SIZE 1
+-ENUM_VALUE_LIST NULL
+-READ_ONLY NO
+-COMMAND_LINE_ARGUMENT REQUIRED
+-VARIABLE_NAME THREAD_POOL_STALL_LIMIT
+-VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE INT UNSIGNED
+-VARIABLE_COMMENT Maximum query execution time in milliseconds,before an executing non-yielding thread is considered stalled.If a worker thread is stalled, additional worker thread may be created to handle remaining clients.
+-NUMERIC_MIN_VALUE 1
+-NUMERIC_MAX_VALUE 4294967295
+-NUMERIC_BLOCK_SIZE 1
+-ENUM_VALUE_LIST NULL
+-READ_ONLY NO
+-COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME THREAD_STACK
+ VARIABLE_SCOPE GLOBAL
+ VARIABLE_TYPE BIGINT UNSIGNED
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 66baff2efc1..24ad0bd4676 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -10508,7 +10508,12 @@ do_continue:;
DBUG_PRINT("info", ("is_table_renamed: %d engine_changed: %d",
alter_ctx.is_table_renamed(), engine_changed));
- if (!alter_ctx.is_table_renamed())
+ /*
+ InnoDB cannot use the rename optimization when foreign key
+ constraint is involved because InnoDB fails to drop the
+ parent table due to foreign key constraint
+ */
+ if (!alter_ctx.is_table_renamed() || alter_ctx.fk_error_if_delete_row)
{
/*
Rename the old table to temporary name to have a backup in case
@@ -10560,7 +10565,7 @@ do_continue:;
(void) quick_rm_table(thd, new_db_type, &alter_ctx.new_db,
&alter_ctx.tmp_name, FN_IS_TMP);
- if (!alter_ctx.is_table_renamed())
+ if (!alter_ctx.is_table_renamed() || alter_ctx.fk_error_if_delete_row)
{
// Restore the backup of the original table to the old name.
(void) mysql_rename_table(old_db_type, &alter_ctx.db, &backup_name,
diff --git a/tpool/aio_simulated.cc b/tpool/aio_simulated.cc
index 4811797a75e..93b2ae134b2 100644
--- a/tpool/aio_simulated.cc
+++ b/tpool/aio_simulated.cc
@@ -159,7 +159,9 @@ public:
#endif
cb->m_ret_len = ret_len;
cb->m_err = err;
- cb->m_callback(cb);
+ cb->m_internal_task.m_func= cb->m_callback;
+ thread_pool *pool= (thread_pool *)cb->m_internal;
+ pool->submit_task(&cb->m_internal_task);
}
virtual int submit_io(aiocb *aiocb) override
@@ -167,6 +169,7 @@ public:
aiocb->m_internal_task.m_func = simulated_aio_callback;
aiocb->m_internal_task.m_arg = aiocb;
aiocb->m_internal_task.m_group = aiocb->m_group;
+ aiocb->m_internal = m_pool;
m_pool->submit_task(&aiocb->m_internal_task);
return 0;
}