summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-06-21 18:21:07 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2022-06-21 18:21:07 +0300
commit707f2aa214ba92751ed06b48f83c2d5e86b6316e (patch)
treec4dd6f72b4891de2fdbec901cf76923d2526bc83
parent3aabda7e1806d9661ec17727b93e7561216c9dea (diff)
parent54ac356deab14d6b9433af00da8fe82f9aaaccb8 (diff)
downloadmariadb-git-707f2aa214ba92751ed06b48f83c2d5e86b6316e.tar.gz
Merge 10.8 into 10.9
-rw-r--r--cmake/os/WindowsCache.cmake2
-rw-r--r--config.h.cmake2
-rw-r--r--configure.cmake2
-rw-r--r--include/aligned.h34
-rw-r--r--include/my_global.h2
-rw-r--r--mysql-test/main/bootstrap.result6
-rw-r--r--mysql-test/main/bootstrap.test26
-rw-r--r--mysql-test/main/mysql_tzinfo_to_sql_symlink.result40
-rw-r--r--mysql-test/main/mysql_tzinfo_to_sql_symlink.test17
-rw-r--r--mysql-test/suite/innodb/r/innodb-wl5980-debug.result27
-rw-r--r--mysql-test/suite/innodb/t/innodb-wl5980-debug.test52
-rw-r--r--mysql-test/suite/innodb/t/innodb_page_compressed.combinations5
-rw-r--r--mysys/my_lockmem.c6
-rw-r--r--sql/table_cache.cc11
-rw-r--r--sql/tztime.cc8
-rw-r--r--storage/innobase/buf/buf0buf.cc8
-rw-r--r--storage/innobase/fil/fil0fil.cc225
-rw-r--r--storage/innobase/include/buf0buf.h21
-rw-r--r--storage/innobase/include/mtr0mtr.h6
-rw-r--r--storage/innobase/include/univ.i1
-rw-r--r--storage/innobase/include/ut0pool.h9
-rw-r--r--storage/innobase/lock/lock0lock.cc14
-rw-r--r--storage/innobase/mtr/mtr0mtr.cc106
-rw-r--r--storage/perfschema/pfs_digest.cc3
-rw-r--r--storage/perfschema/pfs_events_stages.h3
-rw-r--r--storage/perfschema/pfs_events_statements.h3
-rw-r--r--storage/perfschema/pfs_events_waits.h4
-rw-r--r--storage/perfschema/pfs_global.cc56
-rw-r--r--storage/perfschema/pfs_global.h23
-rw-r--r--storage/perfschema/pfs_host.cc3
-rw-r--r--storage/perfschema/pfs_instr.cc3
-rw-r--r--storage/perfschema/unittest/stub_pfs_global.h16
-rw-r--r--storage/spider/mysql-test/spider/r/variable_deprecation.result2
-rw-r--r--storage/spider/spd_param.cc136
-rw-r--r--tpool/tpool_generic.cc19
35 files changed, 405 insertions, 496 deletions
diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake
index 9b855dbb42b..316b42af796 100644
--- a/cmake/os/WindowsCache.cmake
+++ b/cmake/os/WindowsCache.cmake
@@ -23,6 +23,7 @@ IF(MSVC)
SET(BFD_H_EXISTS 0 CACHE INTERNAL "")
SET(HAVE_ACCESS 1 CACHE INTERNAL "")
SET(HAVE_ALARM CACHE INTERNAL "")
+SET(HAVE_ALIGNED_ALLOC CACHE INTERNAL "")
SET(HAVE_ALLOCA_H CACHE INTERNAL "")
SET(HAVE_ARPA_INET_H CACHE INTERNAL "")
SET(HAVE_BACKTRACE CACHE INTERNAL "")
@@ -93,7 +94,6 @@ SET(HAVE_MALLINFO CACHE INTERNAL "")
SET(HAVE_MALLINFO2 CACHE INTERNAL "")
SET(HAVE_MALLOC_H 1 CACHE INTERNAL "")
SET(HAVE_MALLOC_ZONE CACHE INTERNAL "")
-SET(HAVE_MEMALIGN CACHE INTERNAL "")
SET(HAVE_MEMCPY 1 CACHE INTERNAL "")
SET(HAVE_MEMMOVE 1 CACHE INTERNAL "")
SET(HAVE_MEMORY_H 1 CACHE INTERNAL "")
diff --git a/config.h.cmake b/config.h.cmake
index 99acaf71bee..46d7b209246 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -19,6 +19,7 @@
/* Headers we may want to use. */
#cmakedefine STDC_HEADERS 1
#cmakedefine _GNU_SOURCE 1
+#cmakedefine HAVE_ALIGNED_ALLOC 1
#cmakedefine HAVE_ALLOCA_H 1
#cmakedefine HAVE_ARPA_INET_H 1
#cmakedefine HAVE_ASM_TERMBITS_H 1
@@ -163,7 +164,6 @@
#cmakedefine HAVE_LRAND48 1
#cmakedefine HAVE_LOCALTIME_R 1
#cmakedefine HAVE_LSTAT 1
-#cmakedefine HAVE_MEMALIGN 1
/* #cmakedefine HAVE_MLOCK 1 see Bug#54662 */
#cmakedefine HAVE_NL_LANGINFO 1
#cmakedefine HAVE_MADVISE 1
diff --git a/configure.cmake b/configure.cmake
index 2e0d7ed089e..6db53ba6e8f 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -324,6 +324,7 @@ ENDIF()
CHECK_FUNCTION_EXISTS (accept4 HAVE_ACCEPT4)
CHECK_FUNCTION_EXISTS (access HAVE_ACCESS)
CHECK_FUNCTION_EXISTS (alarm HAVE_ALARM)
+CHECK_FUNCTION_EXISTS (aligned_alloc HAVE_ALIGNED_ALLOC)
SET(HAVE_ALLOCA 1)
CHECK_FUNCTION_EXISTS (backtrace HAVE_BACKTRACE)
CHECK_FUNCTION_EXISTS (backtrace_symbols HAVE_BACKTRACE_SYMBOLS)
@@ -421,7 +422,6 @@ CHECK_FUNCTION_EXISTS (thr_setconcurrency HAVE_THR_SETCONCURRENCY)
CHECK_FUNCTION_EXISTS (thr_yield HAVE_THR_YIELD)
CHECK_FUNCTION_EXISTS (vasprintf HAVE_VASPRINTF)
CHECK_FUNCTION_EXISTS (vsnprintf HAVE_VSNPRINTF)
-CHECK_FUNCTION_EXISTS (memalign HAVE_MEMALIGN)
CHECK_FUNCTION_EXISTS (nl_langinfo HAVE_NL_LANGINFO)
IF(HAVE_SYS_EVENT_H)
diff --git a/include/aligned.h b/include/aligned.h
new file mode 100644
index 00000000000..ad2c7532b26
--- /dev/null
+++ b/include/aligned.h
@@ -0,0 +1,34 @@
+/*
+ Copyright (c) 2022, 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 Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
+
+inline void *aligned_malloc(size_t size, size_t alignment)
+{
+#ifdef _WIN32
+ return _aligned_malloc(size, alignment);
+#elif defined HAVE_ALIGNED_ALLOC
+ return aligned_alloc(alignment, size);
+#else
+ void *result;
+ if (posix_memalign(&result, alignment, size))
+ result= NULL;
+ return result;
+#endif
+}
+
+inline void aligned_free(void *ptr)
+{
+ IF_WIN(_aligned_free,free)(ptr);
+}
diff --git a/include/my_global.h b/include/my_global.h
index 27df0da1454..22968900b0a 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -1,6 +1,6 @@
/*
Copyright (c) 2001, 2013, Oracle and/or its affiliates.
- Copyright (c) 2009, 2021, MariaDB Corporation.
+ Copyright (c) 2009, 2022, 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
diff --git a/mysql-test/main/bootstrap.result b/mysql-test/main/bootstrap.result
index 96aec014093..f77ff0bc194 100644
--- a/mysql-test/main/bootstrap.result
+++ b/mysql-test/main/bootstrap.result
@@ -34,4 +34,10 @@ name dl
EXAMPLE ha_example.so
truncate table mysql.plugin;
# Kill the server
+#
+# MDEV-28782 mariadb-tzinfo-to-sql to work in bootstrap mode
+#
+#
+# End of 10.6 tests
+#
# restart
diff --git a/mysql-test/main/bootstrap.test b/mysql-test/main/bootstrap.test
index d75d3154064..e2f882f1d19 100644
--- a/mysql-test/main/bootstrap.test
+++ b/mysql-test/main/bootstrap.test
@@ -133,4 +133,30 @@ EOF
--exec $MYSQLD_BOOTSTRAP_CMD --default-time-zone=Europe/Moscow < $MYSQLTEST_VARDIR/tmp/bootstrap_9969.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
--remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_9969.sql
+--echo #
+--echo # MDEV-28782 mariadb-tzinfo-to-sql to work in bootstrap mode
+--echo #
+
+--write_file $MYSQLTEST_VARDIR/tmp/tz.sql
+use test;
+
+create table time_zone like mysql.time_zone;
+create table time_zone_leap_second like mysql.time_zone_leap_second;
+create table time_zone_name like mysql.time_zone_name;
+create table time_zone_transition like mysql.time_zone_transition;
+create table time_zone_transition_type like mysql.time_zone_transition_type;
+
+EOF
+--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog std_data/zoneinfo/GMT GMT 2>/dev/null >> $MYSQLTEST_VARDIR/tmp/tz.sql
+--append_file $MYSQLTEST_VARDIR/tmp/tz.sql
+DROP TABLE time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type;
+EOF
+--exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/tz.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
+--remove_file $MYSQLTEST_VARDIR/tmp/tz.sql
+
+--echo #
+--echo # End of 10.6 tests
+--echo #
+
+# restore
--source include/start_mysqld.inc
diff --git a/mysql-test/main/mysql_tzinfo_to_sql_symlink.result b/mysql-test/main/mysql_tzinfo_to_sql_symlink.result
index c87aedcc247..a6be207434f 100644
--- a/mysql-test/main/mysql_tzinfo_to_sql_symlink.result
+++ b/mysql-test/main/mysql_tzinfo_to_sql_symlink.result
@@ -7,9 +7,9 @@ CREATE TABLE time_zone_leap_second LIKE mysql.time_zone_leap_second;
# MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
#
# Verbose run
-set @wsrep_is_on=(select sum(VARIABLE_NAME='wsrep_on' AND SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES);
+set @wsrep_is_on=(select sum(SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on');
SELECT concat('%', GROUP_CONCAT(OPTION), '%') INTO @replicate_opt FROM (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('time_zone', 'time_zone_name', 'time_zone_transition', 'time_zone_transition_type', 'time_zone_leap_second') AND ENGINE in ('MyISAM', 'Aria')) AS o ORDER BY OPTION DESC;
-set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(VARIABLE_NAME='wsrep_mode' and GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES);
+set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode');
execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone'", 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone ENGINE=InnoDB', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_name_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_name'", 'do 0');
@@ -56,9 +56,9 @@ execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_t
# MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases
#
# Run on zoneinfo directory
-set @wsrep_is_on=(select sum(VARIABLE_NAME='wsrep_on' AND SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES);
+set @wsrep_is_on=(select sum(SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on');
SELECT concat('%', GROUP_CONCAT(OPTION), '%') INTO @replicate_opt FROM (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('time_zone', 'time_zone_name', 'time_zone_transition', 'time_zone_transition_type', 'time_zone_leap_second') AND ENGINE in ('MyISAM', 'Aria')) AS o ORDER BY OPTION DESC;
-set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(VARIABLE_NAME='wsrep_mode' and GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES);
+set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode');
execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone'", 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone ENGINE=InnoDB', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_name_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_name'", 'do 0');
@@ -116,9 +116,9 @@ COUNT(*)
#
# Run on zoneinfo directory --skip-write-binlog
#
-set @wsrep_is_on=(select sum(VARIABLE_NAME='wsrep_on' AND SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES);
+set @wsrep_is_on=(select sum(SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on');
SELECT concat('%', GROUP_CONCAT(OPTION), '%') INTO @replicate_opt FROM (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('time_zone', 'time_zone_name', 'time_zone_transition', 'time_zone_transition_type', 'time_zone_leap_second') AND ENGINE in ('MyISAM', 'Aria')) AS o ORDER BY OPTION DESC;
-set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(VARIABLE_NAME='wsrep_mode' and GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES);
+set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode');
execute immediate if(@wsrep_is_on, 'SET @save_wsrep_on=@@WSREP_ON, WSREP_ON=OFF', 'do 0');
SET @save_sql_log_bin=@@SQL_LOG_BIN;
SET SESSION SQL_LOG_BIN=0;
@@ -188,9 +188,9 @@ TRUNCATE TABLE time_zone_leap_second;
#
# Testing with explicit timezonefile
#
-set @wsrep_is_on=(select sum(VARIABLE_NAME='wsrep_on' AND SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES);
+set @wsrep_is_on=(select sum(SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on');
SELECT concat('%', GROUP_CONCAT(OPTION), '%') INTO @replicate_opt FROM (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('time_zone', 'time_zone_name', 'time_zone_transition', 'time_zone_transition_type', 'time_zone_leap_second') AND ENGINE in ('MyISAM', 'Aria')) AS o ORDER BY OPTION DESC;
-set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(VARIABLE_NAME='wsrep_mode' and GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES);
+set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode');
execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone'", 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone ENGINE=InnoDB', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_name_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_name'", 'do 0');
@@ -252,9 +252,9 @@ TRUNCATE TABLE time_zone_leap_second;
#
# Testing with explicit timezonefile --skip-write-binlog
#
-set @wsrep_is_on=(select sum(VARIABLE_NAME='wsrep_on' AND SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES);
+set @wsrep_is_on=(select sum(SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on');
SELECT concat('%', GROUP_CONCAT(OPTION), '%') INTO @replicate_opt FROM (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('time_zone', 'time_zone_name', 'time_zone_transition', 'time_zone_transition_type', 'time_zone_leap_second') AND ENGINE in ('MyISAM', 'Aria')) AS o ORDER BY OPTION DESC;
-set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(VARIABLE_NAME='wsrep_mode' and GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES);
+set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode');
execute immediate if(@wsrep_is_on, 'SET @save_wsrep_on=@@WSREP_ON, WSREP_ON=OFF', 'do 0');
SET @save_sql_log_bin=@@SQL_LOG_BIN;
SET SESSION SQL_LOG_BIN=0;
@@ -310,9 +310,9 @@ TRUNCATE TABLE time_zone_leap_second;
#
# Testing --leap
#
-set @wsrep_is_on=(select sum(VARIABLE_NAME='wsrep_on' AND SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES);
+set @wsrep_is_on=(select sum(SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on');
SELECT concat('%', GROUP_CONCAT(OPTION), '%') INTO @replicate_opt FROM (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('time_zone', 'time_zone_name', 'time_zone_transition', 'time_zone_transition_type', 'time_zone_leap_second') AND ENGINE in ('MyISAM', 'Aria')) AS o ORDER BY OPTION DESC;
-set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(VARIABLE_NAME='wsrep_mode' and GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES);
+set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode');
execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone'", 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone ENGINE=InnoDB', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_name_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_name'", 'do 0');
@@ -373,9 +373,9 @@ TRUNCATE TABLE time_zone_leap_second;
#
# Testing --skip-write-binlog --leap
#
-set @wsrep_is_on=(select sum(VARIABLE_NAME='wsrep_on' AND SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES);
+set @wsrep_is_on=(select sum(SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on');
SELECT concat('%', GROUP_CONCAT(OPTION), '%') INTO @replicate_opt FROM (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('time_zone', 'time_zone_name', 'time_zone_transition', 'time_zone_transition_type', 'time_zone_leap_second') AND ENGINE in ('MyISAM', 'Aria')) AS o ORDER BY OPTION DESC;
-set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(VARIABLE_NAME='wsrep_mode' and GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES);
+set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode');
execute immediate if(@wsrep_is_on, 'SET @save_wsrep_on=@@WSREP_ON, WSREP_ON=OFF', 'do 0');
SET @save_sql_log_bin=@@SQL_LOG_BIN;
SET SESSION SQL_LOG_BIN=0;
@@ -425,9 +425,9 @@ COM_TRUNCATE 1
#
# Testing --skip-write-binlog
#
-set @wsrep_is_on=(select sum(VARIABLE_NAME='wsrep_on' AND SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES);
+set @wsrep_is_on=(select sum(SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on');
SELECT concat('%', GROUP_CONCAT(OPTION), '%') INTO @replicate_opt FROM (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('time_zone', 'time_zone_name', 'time_zone_transition', 'time_zone_transition_type', 'time_zone_leap_second') AND ENGINE in ('MyISAM', 'Aria')) AS o ORDER BY OPTION DESC;
-set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(VARIABLE_NAME='wsrep_mode' and GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES);
+set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode');
execute immediate if(@wsrep_is_on, 'SET @save_wsrep_on=@@WSREP_ON, WSREP_ON=OFF', 'do 0');
SET @save_sql_log_bin=@@SQL_LOG_BIN;
SET SESSION SQL_LOG_BIN=0;
@@ -447,9 +447,9 @@ UNLOCK TABLES;
COMMIT;
SET SESSION SQL_LOG_BIN=@save_sql_log_bin;
execute immediate if(@wsrep_is_on, 'SET SESSION WSREP_ON=@save_wsrep_on', 'do 0');
-set @wsrep_is_on=(select sum(VARIABLE_NAME='wsrep_on' AND SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES);
+set @wsrep_is_on=(select sum(SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on');
SELECT concat('%', GROUP_CONCAT(OPTION), '%') INTO @replicate_opt FROM (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('time_zone', 'time_zone_name', 'time_zone_transition', 'time_zone_transition_type', 'time_zone_leap_second') AND ENGINE in ('MyISAM', 'Aria')) AS o ORDER BY OPTION DESC;
-set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(VARIABLE_NAME='wsrep_mode' and GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES);
+set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode');
execute immediate if(@wsrep_is_on, 'SET @save_wsrep_on=@@WSREP_ON, WSREP_ON=OFF', 'do 0');
SET @save_sql_log_bin=@@SQL_LOG_BIN;
SET SESSION SQL_LOG_BIN=0;
@@ -471,9 +471,9 @@ execute immediate if(@wsrep_is_on, 'SET SESSION WSREP_ON=@save_wsrep_on', 'do 0'
#
# MDEV-6236 - [PATCH] mysql_tzinfo_to_sql may produce invalid SQL
#
-set @wsrep_is_on=(select sum(VARIABLE_NAME='wsrep_on' AND SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES);
+set @wsrep_is_on=(select sum(SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on');
SELECT concat('%', GROUP_CONCAT(OPTION), '%') INTO @replicate_opt FROM (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('time_zone', 'time_zone_name', 'time_zone_transition', 'time_zone_transition_type', 'time_zone_leap_second') AND ENGINE in ('MyISAM', 'Aria')) AS o ORDER BY OPTION DESC;
-set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(VARIABLE_NAME='wsrep_mode' and GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES);
+set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode');
execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone'", 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone ENGINE=InnoDB', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_name_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_name'", 'do 0');
diff --git a/mysql-test/main/mysql_tzinfo_to_sql_symlink.test b/mysql-test/main/mysql_tzinfo_to_sql_symlink.test
index 34df1281c38..857f24e610f 100644
--- a/mysql-test/main/mysql_tzinfo_to_sql_symlink.test
+++ b/mysql-test/main/mysql_tzinfo_to_sql_symlink.test
@@ -3,6 +3,8 @@
--source include/not_windows.inc
--source include/no_protocol.inc
+let $is_embedded=`select version() like '%embedded%'`;
+
CREATE TABLE time_zone LIKE mysql.time_zone;
CREATE TABLE time_zone_name LIKE mysql.time_zone_name;
CREATE TABLE time_zone_transition LIKE mysql.time_zone_transition;
@@ -61,6 +63,9 @@ SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second;
+if ($is_embedded) {
+--replace_column 1 0 2 0
+}
SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@SQL_LOG_BIN;
SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff
FROM information_schema.global_status g
@@ -95,6 +100,9 @@ SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second;
+if ($is_embedded) {
+--replace_column 1 0 2 0
+}
SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@SQL_LOG_BIN;
SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff
FROM information_schema.global_status g
@@ -127,6 +135,9 @@ SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second;
+if ($is_embedded) {
+--replace_column 1 0 2 0
+}
SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@SQL_LOG_BIN;
SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff
FROM information_schema.global_status g
@@ -159,6 +170,9 @@ SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second;
+if ($is_embedded) {
+--replace_column 1 0 2 0
+}
SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@SQL_LOG_BIN;
SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff
FROM information_schema.global_status g
@@ -191,6 +205,9 @@ SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second;
+if ($is_embedded) {
+--replace_column 1 0 2 0
+}
SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@SQL_LOG_BIN;
SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff
FROM information_schema.global_status g
diff --git a/mysql-test/suite/innodb/r/innodb-wl5980-debug.result b/mysql-test/suite/innodb/r/innodb-wl5980-debug.result
deleted file mode 100644
index 51cff4393aa..00000000000
--- a/mysql-test/suite/innodb/r/innodb-wl5980-debug.result
+++ /dev/null
@@ -1,27 +0,0 @@
-call mtr.add_suppression("Cannot find space id [0-9]+ in the tablespace memory cache");
-call mtr.add_suppression("Cannot rename table 'test/t1' to 'test/t2' since the dictionary cache already contains 'test/t2'.");
-#
-# WL5980 Remote tablespace debug error injection tests.
-#
-CREATE TABLE t1 (a int KEY, b text) ENGINE=Innodb DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir' ;
-INSERT INTO t1 VALUES (1, 'tablespace');
-SELECT * FROM t1;
-a b
-1 tablespace
-#
-# Test the second injection point in fil_rename_tablespace().
-# Make sure the table is useable after this failure.
-#
-SET @save_dbug=@@debug_dbug;
-SET debug_dbug="+d,fil_rename_tablespace_failure_2";
-RENAME TABLE t1 TO t2;
-SET debug_dbug=@save_dbug;
-INSERT INTO t1 VALUES (2, 'tablespace');
-SELECT * FROM t1;
-a b
-1 tablespace
-2 tablespace
-#
-# Cleanup
-#
-DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb-wl5980-debug.test b/mysql-test/suite/innodb/t/innodb-wl5980-debug.test
deleted file mode 100644
index dbb8ad33676..00000000000
--- a/mysql-test/suite/innodb/t/innodb-wl5980-debug.test
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-# This testcase is to check the various debug injection points
-# to make sure error conditions react corectly and acheive
-# better code coverage.
-#
-
-# Not supported in embedded
---source include/not_embedded.inc
---source include/have_debug.inc
---source include/have_innodb.inc
---source include/have_symlink.inc
-
-# These messages are expected in the log
-call mtr.add_suppression("Cannot find space id [0-9]+ in the tablespace memory cache");
-call mtr.add_suppression("Cannot rename table 'test/t1' to 'test/t2' since the dictionary cache already contains 'test/t2'.");
-
-# Set up some variables
-LET $MYSQL_DATA_DIR = `select @@datadir`;
-LET $data_directory_clause = DATA DIRECTORY='$MYSQL_TMP_DIR/alt_dir';
---enable_query_log
-
---echo #
---echo # WL5980 Remote tablespace debug error injection tests.
---echo #
-
---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
-eval CREATE TABLE t1 (a int KEY, b text) ENGINE=Innodb $data_directory_clause ;
-INSERT INTO t1 VALUES (1, 'tablespace');
-SELECT * FROM t1;
-
---echo #
---echo # Test the second injection point in fil_rename_tablespace().
---echo # Make sure the table is useable after this failure.
---echo #
-SET @save_dbug=@@debug_dbug;
-SET debug_dbug="+d,fil_rename_tablespace_failure_2";
---disable_result_log
---error ER_ERROR_ON_RENAME
-RENAME TABLE t1 TO t2;
---enable_result_log
-SET debug_dbug=@save_dbug;
-INSERT INTO t1 VALUES (2, 'tablespace');
-SELECT * FROM t1;
-
---echo #
---echo # Cleanup
---echo #
-
-DROP TABLE t1;
-
---rmdir $MYSQL_TMP_DIR/alt_dir/test
---rmdir $MYSQL_TMP_DIR/alt_dir
diff --git a/mysql-test/suite/innodb/t/innodb_page_compressed.combinations b/mysql-test/suite/innodb/t/innodb_page_compressed.combinations
index f3caab14af3..498c85ee65c 100644
--- a/mysql-test/suite/innodb/t/innodb_page_compressed.combinations
+++ b/mysql-test/suite/innodb/t/innodb_page_compressed.combinations
@@ -1,6 +1,11 @@
[bzip2]
+plugin-load-add=$PROVIDER_BZIP2_SO
[lz4]
+plugin-load-add=$PROVIDER_LZ4_SO
[lzma]
+plugin-load-add=$PROVIDER_LZMA_SO
[lzo]
+plugin-load-add=$PROVIDER_LZO_SO
[snappy]
+plugin-load-add=$PROVIDER_SNAPPY_SO
[zlib]
diff --git a/mysys/my_lockmem.c b/mysys/my_lockmem.c
index a3ad7a5b76c..1b6b68816f8 100644
--- a/mysys/my_lockmem.c
+++ b/mysys/my_lockmem.c
@@ -1,4 +1,5 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2022, 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,6 +18,7 @@
#include "mysys_priv.h"
#include "mysys_err.h"
+#include "aligned.h"
#include <my_list.h>
#ifdef HAVE_MLOCK
@@ -39,7 +41,7 @@ uchar *my_malloc_lock(uint size,myf MyFlags)
DBUG_ENTER("my_malloc_lock");
size=((size-1) & ~(pagesize-1))+pagesize;
- if (!(ptr=memalign(pagesize,size)))
+ if (!(ptr=aligned_malloc(size,pagesize)))
{
if (MyFlags & (MY_FAE+MY_WME))
my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_FATAL), size);
@@ -91,7 +93,7 @@ void my_free_lock(uchar *ptr)
}
mysql_mutex_unlock(&THR_LOCK_malloc);
my_free(element);
- free(ptr); /* Free even if not locked */
+ aligned_free(ptr); /* Free even if not locked */
}
#endif /* HAVE_MLOCK */
diff --git a/sql/table_cache.cc b/sql/table_cache.cc
index 2e9fb34c17e..8fb3a559d86 100644
--- a/sql/table_cache.cc
+++ b/sql/table_cache.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2010, 2011 Monty Program Ab
+ Copyright (c) 2010, 2022, MariaDB Corporation.
Copyright (C) 2013 Sergey Vojtovich and MariaDB Foundation
This program is free software; you can redistribute it and/or modify
@@ -50,6 +50,7 @@
#include "lf.h"
#include "table.h"
#include "sql_base.h"
+#include "aligned.h"
/** Configuration. */
@@ -122,6 +123,7 @@ struct Table_cache_instance
records, Share_free_tables::List (TABLE::prev and TABLE::next),
TABLE::in_use.
*/
+ alignas(CPU_LEVEL1_DCACHE_LINESIZE)
mysql_mutex_t LOCK_table_cache;
I_P_List <TABLE, I_P_List_adapter<TABLE, &TABLE::global_free_next,
&TABLE::global_free_prev>,
@@ -130,11 +132,10 @@ struct Table_cache_instance
ulong records;
uint mutex_waits;
uint mutex_nowaits;
- /** Avoid false sharing between instances */
- char pad[CPU_LEVEL1_DCACHE_LINESIZE];
Table_cache_instance(): records(0), mutex_waits(0), mutex_nowaits(0)
{
+ static_assert(!(sizeof(*this) % CPU_LEVEL1_DCACHE_LINESIZE), "alignment");
mysql_mutex_init(key_LOCK_table_cache, &LOCK_table_cache,
MY_MUTEX_INIT_FAST);
}
@@ -146,6 +147,10 @@ struct Table_cache_instance
DBUG_ASSERT(records == 0);
}
+ static void *operator new[](size_t size)
+ { return aligned_malloc(size, CPU_LEVEL1_DCACHE_LINESIZE); }
+ static void operator delete[](void *ptr) { aligned_free(ptr); }
+
/**
Lock table cache mutex and check contention.
diff --git a/sql/tztime.cc b/sql/tztime.cc
index ae71a0e91c9..5dc3826f0d6 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -2730,11 +2730,11 @@ static const char *trunc_tables_const=
"TRUNCATE TABLE time_zone_transition;\n"
"TRUNCATE TABLE time_zone_transition_type;\n";
static const char *wsrep_is_on=
- "select sum(VARIABLE_NAME='wsrep_on' AND SESSION_VALUE='ON')"
- " from information_schema.SYSTEM_VARIABLES";
+ "select sum(SESSION_VALUE='ON')"
+ " from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on'";
static const char *wsrep_cannot_replicate_tz=
- "select sum(VARIABLE_NAME='wsrep_mode' and GLOBAL_VALUE NOT LIKE @replicate_opt)"
- " from information_schema.SYSTEM_VARIABLES";
+ "select sum(GLOBAL_VALUE NOT LIKE @replicate_opt)"
+ " from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode'";
int
main(int argc, char **argv)
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index b8c1de88db3..dae7959ad15 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -1075,9 +1075,10 @@ inline const buf_block_t *buf_pool_t::chunk_t::not_freed() const
void buf_pool_t::page_hash_table::create(ulint n)
{
n_cells= ut_find_prime(n);
- const size_t size= pad(n_cells) * sizeof *array;
- void* v= aligned_malloc(size, CPU_LEVEL1_DCACHE_LINESIZE);
- memset(v, 0, size);
+ const size_t size= MY_ALIGN(pad(n_cells) * sizeof *array,
+ CPU_LEVEL1_DCACHE_LINESIZE);
+ void *v= aligned_malloc(size, CPU_LEVEL1_DCACHE_LINESIZE);
+ memset_aligned<CPU_LEVEL1_DCACHE_LINESIZE>(v, 0, size);
array= static_cast<hash_chain*>(v);
}
@@ -3224,6 +3225,7 @@ retry:
if (UNIV_UNLIKELY(id != page_id))
{
ut_ad(id.is_corrupted());
+ bpage->lock.x_unlock();
goto retry;
}
mysql_mutex_lock(&buf_pool.mutex);
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index a8299b8afc4..08aad0df1cb 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -125,16 +125,6 @@ bool fil_space_t::try_to_close(bool print_info)
return false;
}
-/** Rename a single-table tablespace.
-The tablespace must exist in the memory cache.
-@param[in] id tablespace identifier
-@param[in] old_path old file name
-@param[in] new_path_in new file name,
-or NULL if it is located in the normal data directory
-@return true if success */
-static bool fil_rename_tablespace(uint32_t id, const char *old_path,
- const char *new_path_in);
-
/*
IMPLEMENTATION OF THE TABLESPACE MEMORY CACHE
=============================================
@@ -1475,40 +1465,6 @@ inline void mtr_t::log_file_op(mfile_type_t type, uint32_t space_id,
m_log.push(reinterpret_cast<const byte*>(path), uint32_t(len));
}
-/** Write redo log for renaming a file.
-@param[in] space_id tablespace id
-@param[in] old_name tablespace file name
-@param[in] new_name tablespace file name after renaming
-@param[in,out] mtr mini-transaction */
-static void fil_name_write_rename_low(uint32_t space_id, const char *old_name,
- const char *new_name, mtr_t *mtr)
-{
- ut_ad(!is_predefined_tablespace(space_id));
- mtr->log_file_op(FILE_RENAME, space_id, old_name, new_name);
-}
-
-static void fil_name_commit_durable(mtr_t *mtr)
-{
- log_sys.latch.wr_lock(SRW_LOCK_CALL);
- auto lsn= mtr->commit_files();
- log_sys.latch.wr_unlock();
- mtr->flag_wr_unlock();
- log_write_up_to(lsn, true);
-}
-
-/** Write redo log for renaming a file.
-@param[in] space_id tablespace id
-@param[in] old_name tablespace file name
-@param[in] new_name tablespace file name after renaming */
-static void fil_name_write_rename(uint32_t space_id,
- const char *old_name, const char* new_name)
-{
- mtr_t mtr;
- mtr.start();
- fil_name_write_rename_low(space_id, old_name, new_name, &mtr);
- fil_name_commit_durable(&mtr);
-}
-
/** Write FILE_MODIFY for a file.
@param[in] space_id tablespace id
@param[in] name tablespace file name
@@ -1636,40 +1592,8 @@ pfs_os_file_t fil_delete_tablespace(uint32_t id)
mtr_t mtr;
mtr.start();
mtr.log_file_op(FILE_DELETE, id, space->chain.start->name);
- fil_name_commit_durable(&mtr);
-
- /* Remove any additional files. */
- if (char *cfg_name= fil_make_filepath(space->chain.start->name,
- fil_space_t::name_type{}, CFG,
- false))
- {
- os_file_delete_if_exists(innodb_data_file_key, cfg_name, nullptr);
- ut_free(cfg_name);
- }
- if (FSP_FLAGS_HAS_DATA_DIR(space->flags))
- RemoteDatafile::delete_link_file(space->name());
-
- /* Remove the directory entry. The file will actually be deleted
- when our caller closes the handle. */
- os_file_delete(innodb_data_file_key, space->chain.start->name);
-
- mysql_mutex_lock(&fil_system.mutex);
- /* Sanity checks after reacquiring fil_system.mutex */
- ut_ad(space == fil_space_get_by_id(id));
- ut_ad(!space->referenced());
- ut_ad(space->is_stopping());
- ut_ad(UT_LIST_GET_LEN(space->chain) == 1);
- /* Detach the file handle. */
- handle= fil_system.detach(space, true);
- mysql_mutex_unlock(&fil_system.mutex);
-
- log_sys.latch.wr_lock(SRW_LOCK_CALL);
- if (space->max_lsn)
- {
- ut_d(space->max_lsn = 0);
- fil_system.named_spaces.remove(*space);
- }
- log_sys.latch.wr_unlock();
+ handle= space->chain.start->handle;
+ mtr.commit_file(*space, nullptr);
fil_space_free_low(space);
}
@@ -1794,120 +1718,55 @@ char *fil_make_filepath(const char* path, const table_name_t name,
dberr_t fil_space_t::rename(const char *path, bool log, bool replace)
{
ut_ad(UT_LIST_GET_LEN(chain) == 1);
- ut_ad(!is_system_tablespace(id));
+ ut_ad(!is_predefined_tablespace(id));
const char *old_path= chain.start->name;
+ ut_ad(strchr(old_path, '/'));
+ ut_ad(strchr(path, '/'));
+
if (!strcmp(path, old_path))
return DB_SUCCESS;
- if (log)
+ if (!log)
{
- bool exists= false;
- os_file_type_t ftype;
-
- if (os_file_status(old_path, &exists, &ftype) && !exists)
- {
- ib::error() << "Cannot rename '" << old_path << "' to '" << path
- << "' because the source file does not exist.";
- return DB_TABLESPACE_NOT_FOUND;
- }
-
- exists= false;
- if (replace);
- else if (!os_file_status(path, &exists, &ftype) || exists)
- {
- ib::error() << "Cannot rename '" << old_path << "' to '" << path
- << "' because the target file exists.";
- return DB_TABLESPACE_EXISTS;
- }
-
- fil_name_write_rename(id, old_path, path);
+ if (!os_file_rename(innodb_data_file_key, old_path, path))
+ return DB_ERROR;
+ mysql_mutex_lock(&fil_system.mutex);
+ ut_free(chain.start->name);
+ chain.start->name= mem_strdup(path);
+ mysql_mutex_unlock(&fil_system.mutex);
+ return DB_SUCCESS;
}
- return fil_rename_tablespace(id, old_path, path) ? DB_SUCCESS : DB_ERROR;
-}
-
-/** Rename a single-table tablespace.
-The tablespace must exist in the memory cache.
-@param[in] id tablespace identifier
-@param[in] old_path old file name
-@param[in] new_path_in new file name,
-or NULL if it is located in the normal data directory
-@return true if success */
-static bool fil_rename_tablespace(uint32_t id, const char *old_path,
- const char *new_path_in)
-{
- fil_space_t* space;
- fil_node_t* node;
- ut_a(id != 0);
-
- mysql_mutex_lock(&fil_system.mutex);
-
- space = fil_space_get_by_id(id);
-
- if (space == NULL) {
- ib::error() << "Cannot find space id " << id
- << " in the tablespace memory cache, though the file '"
- << old_path
- << "' in a rename operation should have that id.";
- mysql_mutex_unlock(&fil_system.mutex);
- return(false);
- }
-
- /* The following code must change when InnoDB supports
- multiple datafiles per tablespace. */
- ut_a(UT_LIST_GET_LEN(space->chain) == 1);
- node = UT_LIST_GET_FIRST(space->chain);
- space->reacquire();
+ bool exists= false;
+ os_file_type_t ftype;
- mysql_mutex_unlock(&fil_system.mutex);
-
- char* new_file_name = mem_strdup(new_path_in);
- char* old_file_name = node->name;
-
- ut_ad(strchr(old_file_name, '/'));
- ut_ad(strchr(new_file_name, '/'));
-
- if (!recv_recovery_is_on()) {
- log_sys.latch.wr_lock(SRW_LOCK_CALL);
- }
-
- /* log_sys.latch is above fil_system.mutex in the latching order */
-#ifndef SUX_LOCK_GENERIC
- ut_ad(log_sys.latch.is_write_locked() ||
- srv_operation == SRV_OPERATION_RESTORE_DELTA);
-#endif
- mysql_mutex_lock(&fil_system.mutex);
- space->release();
- ut_ad(node->name == old_file_name);
- bool success;
- DBUG_EXECUTE_IF("fil_rename_tablespace_failure_2",
- goto skip_second_rename; );
- success = os_file_rename(innodb_data_file_key,
- old_file_name,
- new_file_name);
- DBUG_EXECUTE_IF("fil_rename_tablespace_failure_2",
-skip_second_rename:
- success = false; );
-
- ut_ad(node->name == old_file_name);
-
- if (success) {
- node->name = new_file_name;
- } else {
- old_file_name = new_file_name;
- }
-
- if (!recv_recovery_is_on()) {
- log_sys.latch.wr_unlock();
- }
-
- mysql_mutex_unlock(&fil_system.mutex);
+ /* Check upfront if the rename operation might succeed, because we
+ must durably write redo log before actually attempting to execute
+ the rename in the file system. */
+ if (os_file_status(old_path, &exists, &ftype) && !exists)
+ {
+ sql_print_error("InnoDB: Cannot rename '%s' to '%s'"
+ " because the source file does not exist.",
+ old_path, path);
+ return DB_TABLESPACE_NOT_FOUND;
+ }
- ut_free(old_file_name);
+ exists= false;
+ if (replace);
+ else if (!os_file_status(path, &exists, &ftype) || exists)
+ {
+ sql_print_error("InnoDB: Cannot rename '%s' to '%s'"
+ " because the target file exists.",
+ old_path, path);
+ return DB_TABLESPACE_EXISTS;
+ }
- return(success);
+ mtr_t mtr;
+ mtr.start();
+ mtr.log_file_op(FILE_RENAME, id, old_path, path);
+ return mtr.commit_file(*this, path) ? DB_SUCCESS : DB_ERROR;
}
/** Create a tablespace file.
@@ -1953,7 +1812,11 @@ fil_ibd_create(
mtr.start();
mtr.log_file_op(FILE_CREATE, space_id, path);
- fil_name_commit_durable(&mtr);
+ log_sys.latch.wr_lock(SRW_LOCK_CALL);
+ auto lsn= mtr.commit_files();
+ log_sys.latch.wr_unlock();
+ mtr.flag_wr_unlock();
+ log_write_up_to(lsn, true);
ulint type;
static_assert(((UNIV_ZIP_SIZE_MIN >> 1) << 3) == 4096,
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index 24a092ed5b5..24571483d05 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -329,27 +329,6 @@ bool buf_page_is_corrupted(bool check_lsn, const byte *read_buf,
uint32_t fsp_flags)
MY_ATTRIBUTE((warn_unused_result));
-inline void *aligned_malloc(size_t size, size_t align)
-{
-#ifdef _MSC_VER
- return _aligned_malloc(size, align);
-#else
- void *result;
- if (posix_memalign(&result, align, size))
- result= NULL;
- return result;
-#endif
-}
-
-inline void aligned_free(void *ptr)
-{
-#ifdef _MSC_VER
- _aligned_free(ptr);
-#else
- free(ptr);
-#endif
-}
-
/** Read the key version from the page. In full crc32 format,
key version is stored at {0-3th} bytes. In other format, it is
stored in 26th position.
diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h
index f068467f70c..e426b6c61a7 100644
--- a/storage/innobase/include/mtr0mtr.h
+++ b/storage/innobase/include/mtr0mtr.h
@@ -102,6 +102,12 @@ struct mtr_t {
@param space tablespace that is being shrunk */
ATTRIBUTE_COLD void commit_shrink(fil_space_t &space);
+ /** Commit a mini-transaction that is deleting or renaming a file.
+ @param space tablespace that is being renamed or deleted
+ @param name new file name (nullptr=the file will be deleted)
+ @return whether the operation succeeded */
+ ATTRIBUTE_COLD bool commit_file(fil_space_t &space, const char *name);
+
/** Commit a mini-transaction that did not modify any pages,
but generated some redo log on a higher level, such as
FILE_MODIFY records and an optional FILE_CHECKPOINT marker.
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index 6dc1d8b7341..ab421203cd4 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -67,6 +67,7 @@ support cross-platform development and expose comonly used SQL names. */
#include <my_global.h>
#include "my_counter.h"
+#include "aligned.h"
#include <m_string.h>
#include <mysqld_error.h>
diff --git a/storage/innobase/include/ut0pool.h b/storage/innobase/include/ut0pool.h
index bce443a51b2..aa0cfb9e060 100644
--- a/storage/innobase/include/ut0pool.h
+++ b/storage/innobase/include/ut0pool.h
@@ -64,15 +64,8 @@ struct Pool {
ut_a(m_start == 0);
-#ifdef _MSC_VER
m_start = static_cast<Element*>(
- _aligned_malloc(m_size, CPU_LEVEL1_DCACHE_LINESIZE));
-#else
- void* start;
- ut_a(!posix_memalign(&start, CPU_LEVEL1_DCACHE_LINESIZE,
- m_size));
- m_start = static_cast<Element*>(start);
-#endif
+ aligned_malloc(m_size, CPU_LEVEL1_DCACHE_LINESIZE));
memset_aligned<CPU_LEVEL1_DCACHE_LINESIZE>(
m_start, 0, m_size);
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index 91791fb8a3a..9323117eff5 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -75,9 +75,10 @@ struct TableLockGetNode
void lock_sys_t::hash_table::create(ulint n)
{
n_cells= ut_find_prime(n);
- const size_t size= pad(n_cells) * sizeof *array;
- void* v= aligned_malloc(size, CPU_LEVEL1_DCACHE_LINESIZE);
- memset(v, 0, size);
+ const size_t size= MY_ALIGN(pad(n_cells) * sizeof *array,
+ CPU_LEVEL1_DCACHE_LINESIZE);
+ void *v= aligned_malloc(size, CPU_LEVEL1_DCACHE_LINESIZE);
+ memset_aligned<CPU_LEVEL1_DCACHE_LINESIZE>(v, 0, size);
array= static_cast<hash_cell_t*>(v);
}
@@ -87,9 +88,10 @@ void lock_sys_t::hash_table::resize(ulint n)
{
ut_ad(lock_sys.is_writer());
ulint new_n_cells= ut_find_prime(n);
- const size_t size= pad(new_n_cells) * sizeof *array;
- void* v= aligned_malloc(size, CPU_LEVEL1_DCACHE_LINESIZE);
- memset(v, 0, size);
+ const size_t size= MY_ALIGN(pad(new_n_cells) * sizeof *array,
+ CPU_LEVEL1_DCACHE_LINESIZE);
+ void *v= aligned_malloc(size, CPU_LEVEL1_DCACHE_LINESIZE);
+ memset_aligned<CPU_LEVEL1_DCACHE_LINESIZE>(v, 0, size);
hash_cell_t *new_array= static_cast<hash_cell_t*>(v);
for (auto i= pad(n_cells); i--; )
diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc
index ae784fe7482..7c38748c115 100644
--- a/storage/innobase/mtr/mtr0mtr.cc
+++ b/storage/innobase/mtr/mtr0mtr.cc
@@ -888,6 +888,112 @@ void mtr_t::commit_shrink(fil_space_t &space)
release_resources();
}
+/** Commit a mini-transaction that is deleting or renaming a file.
+@param space tablespace that is being renamed or deleted
+@param name new file name (nullptr=the file will be deleted)
+@return whether the operation succeeded */
+bool mtr_t::commit_file(fil_space_t &space, const char *name)
+{
+ ut_ad(is_active());
+ ut_ad(!is_inside_ibuf());
+ ut_ad(!high_level_read_only);
+ ut_ad(m_modifications);
+ ut_ad(!m_made_dirty);
+ ut_ad(!recv_recovery_is_on());
+ ut_ad(m_log_mode == MTR_LOG_ALL);
+ ut_ad(UT_LIST_GET_LEN(space.chain) == 1);
+ ut_ad(!m_latch_ex);
+
+ m_latch_ex= true;
+
+ log_write_and_flush_prepare();
+
+ log_sys.latch.wr_lock(SRW_LOCK_CALL);
+
+ size_t size= m_log.size() + 5;
+
+ if (log_sys.is_encrypted())
+ {
+ /* We will not encrypt any FILE_ records, but we will reserve
+ a nonce at the end. */
+ size+= 8;
+ m_commit_lsn= log_sys.get_lsn();
+ }
+ else
+ m_commit_lsn= 0;
+
+ m_crc= 0;
+ m_log.for_each_block([this](const mtr_buf_t::block_t *b)
+ { m_crc= my_crc32c(m_crc, b->begin(), b->used()); return true; });
+ finish_write(size);
+
+ if (!name && space.max_lsn)
+ {
+ ut_d(space.max_lsn= 0);
+ fil_system.named_spaces.remove(space);
+ }
+
+ /* Block log_checkpoint(). */
+ mysql_mutex_lock(&buf_pool.flush_list_mutex);
+
+ /* Durably write the log for the file system operation. */
+ log_write_and_flush();
+
+ log_sys.latch.wr_unlock();
+ m_latch_ex= false;
+
+ char *old_name= space.chain.start->name;
+ bool success;
+
+ if (name)
+ {
+ success= os_file_rename(innodb_data_file_key, old_name, name);
+
+ if (success)
+ {
+ mysql_mutex_lock(&fil_system.mutex);
+ space.chain.start->name= mem_strdup(name);
+ mysql_mutex_unlock(&fil_system.mutex);
+ ut_free(old_name);
+ }
+ }
+ else
+ {
+ /* Remove any additional files. */
+ if (char *cfg_name= fil_make_filepath(old_name,
+ fil_space_t::name_type{}, CFG,
+ false))
+ {
+ os_file_delete_if_exists(innodb_data_file_key, cfg_name, nullptr);
+ ut_free(cfg_name);
+ }
+
+ if (FSP_FLAGS_HAS_DATA_DIR(space.flags))
+ RemoteDatafile::delete_link_file(space.name());
+
+ /* Remove the directory entry. The file will actually be deleted
+ when our caller closes the handle. */
+ os_file_delete(innodb_data_file_key, old_name);
+
+ mysql_mutex_lock(&fil_system.mutex);
+ /* Sanity checks after reacquiring fil_system.mutex */
+ ut_ad(&space == fil_space_get_by_id(space.id));
+ ut_ad(!space.referenced());
+ ut_ad(space.is_stopping());
+
+ fil_system.detach(&space, true);
+ mysql_mutex_unlock(&fil_system.mutex);
+
+ success= true;
+ }
+
+ mysql_mutex_unlock(&buf_pool.flush_list_mutex);
+ ut_d(m_log.erase());
+ release_resources();
+
+ return success;
+}
+
/** Commit a mini-transaction that did not modify any pages,
but generated some redo log on a higher level, such as
FILE_MODIFY records and an optional FILE_CHECKPOINT marker.
diff --git a/storage/perfschema/pfs_digest.cc b/storage/perfschema/pfs_digest.cc
index 43375c753dd..0dff583fa6d 100644
--- a/storage/perfschema/pfs_digest.cc
+++ b/storage/perfschema/pfs_digest.cc
@@ -1,4 +1,5 @@
/* Copyright (c) 2008, 2021, Oracle and/or its affiliates.
+ Copyright (c) 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
@@ -56,7 +57,7 @@ bool flag_statements_digest= true;
Current index in Stat array where new record is to be inserted.
index 0 is reserved for "all else" case when entire array is full.
*/
-static PFS_ALIGNED PFS_cacheline_uint32 digest_monotonic_index;
+PFS_ALIGNED static PFS_cacheline_uint32 digest_monotonic_index;
bool digest_full= false;
diff --git a/storage/perfschema/pfs_events_stages.h b/storage/perfschema/pfs_events_stages.h
index eeae350ddf4..0fa7bc8de51 100644
--- a/storage/perfschema/pfs_events_stages.h
+++ b/storage/perfschema/pfs_events_stages.h
@@ -1,4 +1,5 @@
/* Copyright (c) 2010, 2021, Oracle and/or its affiliates.
+ Copyright (c) 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
@@ -49,7 +50,7 @@ extern bool flag_events_stages_history;
extern bool flag_events_stages_history_long;
extern bool events_stages_history_long_full;
-extern PFS_ALIGNED PFS_cacheline_uint32 events_stages_history_long_index;
+PFS_ALIGNED extern PFS_cacheline_uint32 events_stages_history_long_index;
extern PFS_events_stages *events_stages_history_long_array;
extern ulong events_stages_history_long_size;
diff --git a/storage/perfschema/pfs_events_statements.h b/storage/perfschema/pfs_events_statements.h
index 2b2426ef7d1..b03afb8a768 100644
--- a/storage/perfschema/pfs_events_statements.h
+++ b/storage/perfschema/pfs_events_statements.h
@@ -1,4 +1,5 @@
/* Copyright (c) 2010, 2021, Oracle and/or its affiliates.
+ Copyright (c) 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
@@ -132,7 +133,7 @@ extern bool flag_events_statements_history;
extern bool flag_events_statements_history_long;
extern bool events_statements_history_long_full;
-extern PFS_ALIGNED PFS_cacheline_uint32 events_statements_history_long_index;
+PFS_ALIGNED extern PFS_cacheline_uint32 events_statements_history_long_index;
extern PFS_events_statements *events_statements_history_long_array;
extern size_t events_statements_history_long_size;
diff --git a/storage/perfschema/pfs_events_waits.h b/storage/perfschema/pfs_events_waits.h
index 8a7355f2d32..ad992b4b0bd 100644
--- a/storage/perfschema/pfs_events_waits.h
+++ b/storage/perfschema/pfs_events_waits.h
@@ -1,5 +1,5 @@
/* Copyright (c) 2008, 2021, Oracle and/or its affiliates..
- Copyright (c) 2017, 2019, MariaDB Corporation.
+ Copyright (c) 2017, 2012, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
@@ -127,7 +127,7 @@ extern bool flag_global_instrumentation;
extern bool flag_thread_instrumentation;
extern bool events_waits_history_long_full;
-extern PFS_ALIGNED PFS_cacheline_uint32 events_waits_history_long_index;
+PFS_ALIGNED extern PFS_cacheline_uint32 events_waits_history_long_index;
extern PFS_events_waits *events_waits_history_long_array;
extern ulong events_waits_history_long_size;
diff --git a/storage/perfschema/pfs_global.cc b/storage/perfschema/pfs_global.cc
index 1f9d24eea4e..e87941448a6 100644
--- a/storage/perfschema/pfs_global.cc
+++ b/storage/perfschema/pfs_global.cc
@@ -1,5 +1,6 @@
/* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights
reserved.
+ Copyright (c) 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
@@ -30,6 +31,8 @@
#include "pfs_global.h"
#include "pfs_builtin_memory.h"
#include "log.h"
+#include "aligned.h"
+#include "assume_aligned.h"
#include <stdlib.h>
#include <string.h>
@@ -46,9 +49,6 @@
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
bool pfs_initialized= false;
@@ -62,41 +62,16 @@ void *pfs_malloc(PFS_builtin_memory_class *klass, size_t size, myf flags)
assert(klass != NULL);
assert(size > 0);
- void *ptr= NULL;
+ const size_t aligned_size= MY_ALIGN(size, CPU_LEVEL1_DCACHE_LINESIZE);
-#ifdef PFS_ALIGNEMENT
-#ifdef HAVE_POSIX_MEMALIGN
- /* Linux */
- if (unlikely(posix_memalign(& ptr, PFS_ALIGNEMENT, size)))
- return NULL;
-#else
-#ifdef HAVE_MEMALIGN
- /* Solaris */
- ptr= memalign(PFS_ALIGNEMENT, size);
- if (unlikely(ptr == NULL))
- return NULL;
-#else
-#ifdef HAVE_ALIGNED_MALLOC
- /* Windows */
- ptr= _aligned_malloc(size, PFS_ALIGNEMENT);
+ void *ptr= aligned_malloc(aligned_size, CPU_LEVEL1_DCACHE_LINESIZE);
if (unlikely(ptr == NULL))
return NULL;
-#else
-#error "Missing implementation for PFS_ALIGNENT"
-#endif /* HAVE_ALIGNED_MALLOC */
-#endif /* HAVE_MEMALIGN */
-#endif /* HAVE_POSIX_MEMALIGN */
-#else /* PFS_ALIGNMENT */
- /* Everything else */
- ptr= malloc(size);
- if (unlikely(ptr == NULL))
- return NULL;
-#endif
klass->count_alloc(size);
if (flags & MY_ZEROFILL)
- memset(ptr, 0, size);
+ memset_aligned<CPU_LEVEL1_DCACHE_LINESIZE>(ptr, 0, aligned_size);
return ptr;
}
@@ -105,24 +80,7 @@ void pfs_free(PFS_builtin_memory_class *klass, size_t size, void *ptr)
if (ptr == NULL)
return;
-#ifdef HAVE_POSIX_MEMALIGN
- /* Allocated with posix_memalign() */
- free(ptr);
-#else
-#ifdef HAVE_MEMALIGN
- /* Allocated with memalign() */
- free(ptr);
-#else
-#ifdef HAVE_ALIGNED_MALLOC
- /* Allocated with _aligned_malloc() */
- _aligned_free(ptr);
-#else
- /* Allocated with malloc() */
- free(ptr);
-#endif /* HAVE_ALIGNED_MALLOC */
-#endif /* HAVE_MEMALIGN */
-#endif /* HAVE_POSIX_MEMALIGN */
-
+ aligned_free(ptr);
klass->count_free(size);
}
diff --git a/storage/perfschema/pfs_global.h b/storage/perfschema/pfs_global.h
index 48a5587839e..6bce7c347cf 100644
--- a/storage/perfschema/pfs_global.h
+++ b/storage/perfschema/pfs_global.h
@@ -1,4 +1,5 @@
/* Copyright (c) 2008, 2021, Oracle and/or its affiliates.
+ Copyright (c) 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
@@ -35,23 +36,7 @@ extern bool pfs_initialized;
/** Total memory allocated by the performance schema, in bytes. */
extern size_t pfs_allocated_memory;
-#if defined(HAVE_POSIX_MEMALIGN) || defined(HAVE_MEMALIGN) || defined(HAVE_ALIGNED_MALLOC)
-#define PFS_ALIGNEMENT CPU_LEVEL1_DCACHE_LINESIZE
-#define PFS_ALIGNED MY_ALIGNED(PFS_ALIGNEMENT)
-#else
-/*
- Known platforms that do not provide aligned memory:
- - MacOSX Darwin (osx10.5)
- For these platforms, compile without the alignment optimization.
-*/
-#define PFS_ALIGNED
-#endif /* HAVE_POSIX_MEMALIGN || HAVE_MEMALIGN || HAVE_ALIGNED_MALLOC */
-
-#ifdef CPU_LEVEL1_DCACHE_LINESIZE
-#define PFS_CACHE_LINE_SIZE CPU_LEVEL1_DCACHE_LINESIZE
-#else
-#define PFS_CACHE_LINE_SIZE 128
-#endif
+#define PFS_ALIGNED alignas(CPU_LEVEL1_DCACHE_LINESIZE)
/**
A uint32 variable, guaranteed to be alone in a CPU cache line.
@@ -60,7 +45,7 @@ extern size_t pfs_allocated_memory;
struct PFS_cacheline_uint32
{
uint32 m_u32;
- char m_full_cache_line[PFS_CACHE_LINE_SIZE - sizeof(uint32)];
+ char m_full_cache_line[CPU_LEVEL1_DCACHE_LINESIZE - sizeof(uint32)];
PFS_cacheline_uint32()
: m_u32(0)
@@ -74,7 +59,7 @@ struct PFS_cacheline_uint32
struct PFS_cacheline_uint64
{
uint64 m_u64;
- char m_full_cache_line[PFS_CACHE_LINE_SIZE - sizeof(uint64)];
+ char m_full_cache_line[CPU_LEVEL1_DCACHE_LINESIZE - sizeof(uint64)];
PFS_cacheline_uint64()
: m_u64(0)
diff --git a/storage/perfschema/pfs_host.cc b/storage/perfschema/pfs_host.cc
index 7d7af7700c2..cbd97e69041 100644
--- a/storage/perfschema/pfs_host.cc
+++ b/storage/perfschema/pfs_host.cc
@@ -1,4 +1,5 @@
/* Copyright (c) 2010, 2021, Oracle and/or its affiliates.
+ Copyright (c) 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
@@ -135,7 +136,7 @@ static void set_host_key(PFS_host_key *key,
PFS_host *find_or_create_host(PFS_thread *thread,
const char *hostname, uint hostname_length)
{
- static PFS_ALIGNED PFS_cacheline_uint32 monotonic;
+ PFS_ALIGNED static PFS_cacheline_uint32 monotonic;
LF_PINS *pins= get_host_hash_pins(thread);
if (unlikely(pins == NULL))
diff --git a/storage/perfschema/pfs_instr.cc b/storage/perfschema/pfs_instr.cc
index 41b1b24295a..a2fcaa9222c 100644
--- a/storage/perfschema/pfs_instr.cc
+++ b/storage/perfschema/pfs_instr.cc
@@ -1,4 +1,5 @@
/* Copyright (c) 2008, 2021, Oracle and/or its affiliates.
+ Copyright (c) 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
@@ -88,7 +89,7 @@ PFS_stage_stat *global_instr_class_stages_array= NULL;
PFS_statement_stat *global_instr_class_statements_array= NULL;
PFS_memory_stat *global_instr_class_memory_array= NULL;
-static PFS_ALIGNED PFS_cacheline_uint64 thread_internal_id_counter;
+PFS_ALIGNED static PFS_cacheline_uint64 thread_internal_id_counter;
/** Hash table for instrumented files. */
LF_HASH pfs_filename_hash;
diff --git a/storage/perfschema/unittest/stub_pfs_global.h b/storage/perfschema/unittest/stub_pfs_global.h
index 6d10e29161d..3a3aedb537e 100644
--- a/storage/perfschema/unittest/stub_pfs_global.h
+++ b/storage/perfschema/unittest/stub_pfs_global.h
@@ -25,9 +25,7 @@
#include <my_sys.h>
#include <pfs_global.h>
#include <string.h>
-#ifdef HAVE_MEMALIGN
-# include <malloc.h>
-#endif
+#include "aligned.h"
bool pfs_initialized= false;
size_t pfs_allocated_memory_size= 0;
@@ -49,17 +47,7 @@ void *pfs_malloc(PFS_builtin_memory_class *klass, size_t size, myf)
if (--stub_alloc_fails_after_count <= 0)
return NULL;
-#ifndef PFS_ALIGNEMENT
- void *ptr= malloc(size);
-#elif defined HAVE_MEMALIGN
- void *ptr= memalign(PFS_ALIGNEMENT, size);
-#elif defined HAVE_ALIGNED_MALLOC
- void *ptr= _aligned_malloc(size, PFS_ALIGNEMENT);
-#else
- void *ptr;
- if (posix_memalign(&ptr, PFS_ALIGNEMENT, size))
- ptr= NULL;
-#endif
+ void *ptr= aligned_malloc(size, CPU_LEVEL1_DCACHE_LINESIZE);
if (ptr != NULL)
memset(ptr, 0, size);
return ptr;
diff --git a/storage/spider/mysql-test/spider/r/variable_deprecation.result b/storage/spider/mysql-test/spider/r/variable_deprecation.result
index 8840f1da892..ddd32bf5e4b 100644
--- a/storage/spider/mysql-test/spider/r/variable_deprecation.result
+++ b/storage/spider/mysql-test/spider/r/variable_deprecation.result
@@ -80,7 +80,7 @@ Warnings:
Warning 1287 '@@spider_internal_limit' is deprecated and will be removed in a future release
SHOW VARIABLES LIKE "spider_internal_limit";
Variable_name Value
-spider_internal_limit 9223372032559808513
+spider_internal_limit 1
CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='ilm "1"';
Warnings:
Warning 1287 The table parameter 'ilm' is deprecated and will be removed in a future release
diff --git a/storage/spider/spd_param.cc b/storage/spider/spd_param.cc
index a21ee246409..22c41184cca 100644
--- a/storage/spider/spd_param.cc
+++ b/storage/spider/spd_param.cc
@@ -138,8 +138,8 @@ static MYSQL_SYSVAR_BOOL(
TRUE
);
-static void spider_use_table_value_deprecated(THD *thd, st_mysql_sys_var *,
- void *var_ptr, const void *save)
+static void spider_var_deprecated_int(THD *thd, st_mysql_sys_var *,
+ void *var_ptr, const void *save)
{
int val= *static_cast<const int *>(save);
*static_cast<int *>(var_ptr)= val;
@@ -152,6 +152,20 @@ static void spider_use_table_value_deprecated(THD *thd, st_mysql_sys_var *,
}
}
+static void spider_var_deprecated_longlong(THD *thd, st_mysql_sys_var *,
+ void *var_ptr, const void *save)
+{
+ longlong val= *static_cast<const longlong *>(save);
+ *static_cast<longlong *>(var_ptr)= val;
+ if (val == -1)
+ {
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ HA_ERR_UNSUPPORTED,
+ "The option value -1 (use table value) is deprecated "
+ "and will be removed in a future release");
+ }
+}
+
my_bool spider_param_support_xa()
{
DBUG_ENTER("spider_param_support_xa");
@@ -233,7 +247,7 @@ static MYSQL_SYSVAR_INT(
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Use table charset for remote access",
NULL,
- spider_use_table_value_deprecated,
+ spider_var_deprecated_int,
1,
-1,
1,
@@ -436,7 +450,7 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Internal offset", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_longlong, /* update */
0, /* def */
-1, /* min */
9223372036854775807LL, /* max */
@@ -461,7 +475,7 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Internal limit", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_longlong, /* update */
9223372036854775807LL, /* def */
-1, /* min */
9223372036854775807LL, /* max */
@@ -486,7 +500,7 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Number of rows at a select", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_longlong, /* update */
9223372036854775807LL, /* def */
-1, /* min */
9223372036854775807LL, /* max */
@@ -512,7 +526,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Use offset and limit parameter in SQL for split_read parameter.", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
2, /* def */
-1, /* min */
2147483647, /* max */
@@ -537,7 +551,7 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"The limit value for semi_split_read", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_longlong, /* update */
9223372036854775807LL, /* def */
-1, /* min */
9223372036854775807LL, /* max */
@@ -563,7 +577,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Initial sql string alloc size", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
1024, /* def */
-1, /* min */
2147483647, /* max */
@@ -589,7 +603,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Reset sql string alloc after execute", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
1, /* def */
-1, /* min */
1, /* max */
@@ -615,7 +629,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Sprit read mode for multi range", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
100, /* def */
-1, /* min */
2147483647, /* max */
@@ -640,7 +654,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Max columns for order by", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
32767, /* def */
-1, /* min */
32767, /* max */
@@ -786,7 +800,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Use different connection if semi_table_lock is enabled", /* comment */
&spider_param_semi_table_lock_connection_check, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
1, /* def */
-1, /* min */
1, /* max */
@@ -835,7 +849,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Lock for select with update", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
1, /* def */
-1, /* min */
2, /* max */
@@ -924,7 +938,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Bulk insert size", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
16000, /* def */
-1, /* min */
2147483647, /* max */
@@ -953,7 +967,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"The mode of bulk updating and deleting", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
0, /* def */
-1, /* min */
2, /* max */
@@ -978,7 +992,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Bulk update size", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
16000, /* def */
-1, /* min */
2147483647, /* max */
@@ -1003,7 +1017,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Buffer size", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
16000, /* def */
-1, /* min */
2147483647, /* max */
@@ -1029,7 +1043,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Execute optimize to remote server", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
0, /* def */
-1, /* min */
1, /* max */
@@ -1055,7 +1069,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Execute optimize to remote server with local", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
0, /* def */
-1, /* min */
1, /* max */
@@ -1204,7 +1218,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Wait timeout of connecting to remote server", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
6, /* def */
-1, /* min */
2147483647, /* max */
@@ -1231,7 +1245,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Wait timeout of receiving data from remote server", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
600, /* def */
-1, /* min */
2147483647, /* max */
@@ -1258,7 +1272,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Wait timeout of sending data to remote server", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
600, /* def */
-1, /* min */
2147483647, /* max */
@@ -1289,7 +1303,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"The retrieval result from a remote server is acquired by acquisition one by one", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
3, /* def */
-1, /* min */
3, /* max */
@@ -1314,7 +1328,7 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Number of records in a page when acquisition one by one", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
1024, /* def */
-1, /* min */
9223372036854775807LL, /* max */
@@ -1339,7 +1353,7 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"The limitation of memory size in a page when acquisition one by one", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
10485760, /* def */
-1, /* min */
9223372036854775807LL, /* max */
@@ -1365,7 +1379,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Use low memory mode when SQL(SELECT) internally issued to a remote server is executed and get a result list", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
1, /* def */
-1, /* min */
1, /* max */
@@ -1392,7 +1406,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"The mode of using columns at select clause", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
1, /* def */
-1, /* min */
1, /* max */
@@ -1420,7 +1434,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Mode of background search", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
0, /* def */
-1, /* min */
3, /* max */
@@ -1446,7 +1460,7 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Number of first read records when background search is used", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
2, /* def */
-1, /* min */
9223372036854775807LL, /* max */
@@ -1472,7 +1486,7 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Number of second read records when background search is used", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
100, /* def */
-1, /* min */
9223372036854775807LL, /* max */
@@ -1498,7 +1512,7 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Number of first read records", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
0, /* def */
-1, /* min */
9223372036854775807LL, /* max */
@@ -1524,7 +1538,7 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Number of second read records", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
0, /* def */
-1, /* min */
9223372036854775807LL, /* max */
@@ -1550,7 +1564,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Interval of cardinality confirmation.(second)", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
51, /* def */
-1, /* min */
2147483647, /* max */
@@ -1578,7 +1592,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Mode of cardinality confirmation.", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
1, /* def */
-1, /* min */
3, /* max */
@@ -1606,7 +1620,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Cardinality synchronization in partitioned table.", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
0, /* def */
-1, /* min */
2, /* max */
@@ -1633,7 +1647,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Type of cardinality calculation.", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
2, /* def */
-1, /* min */
2, /* max */
@@ -1658,7 +1672,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Weight coefficient to calculate effectiveness of index from cardinality of column.", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
2, /* def */
-1, /* min */
2147483647, /* max */
@@ -1685,7 +1699,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Mode of cardinality confirmation at background.", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
2, /* def */
-1, /* min */
2, /* max */
@@ -1711,7 +1725,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Interval of table state confirmation.(second)", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
10, /* def */
-1, /* min */
2147483647, /* max */
@@ -1738,7 +1752,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Mode of table state confirmation.", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
1, /* def */
-1, /* min */
2, /* max */
@@ -1766,7 +1780,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Table state synchronization in partitioned table.", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
0, /* def */
-1, /* min */
2, /* max */
@@ -1793,7 +1807,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Mode of table state confirmation at background.", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
2, /* def */
-1, /* min */
2, /* max */
@@ -1843,7 +1857,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Mode of auto increment.", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
0, /* def */
-1, /* min */
3, /* max */
@@ -1936,7 +1950,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Execute \"REPLACE\" and \"INSERT IGNORE\" on remote server and avoid duplicate check on local server", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
0, /* def */
-1, /* min */
1, /* max */
@@ -2265,7 +2279,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Mode of BKA for Spider", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
1, /* def */
-1, /* min */
2, /* max */
@@ -2343,7 +2357,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Use handler for reading", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
0, /* def */
-1, /* min */
3, /* max */
@@ -2369,7 +2383,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Read error mode if error", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
0, /* def */
-1, /* min */
1, /* max */
@@ -2395,7 +2409,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Write error mode if error", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
0, /* def */
-1, /* min */
1, /* max */
@@ -2421,7 +2435,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Skip generating internal default condition", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
0, /* def */
-1, /* min */
1, /* max */
@@ -2449,7 +2463,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Skip parallel search by specific conditions", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
0, /* def */
-1, /* min */
3, /* max */
@@ -2475,7 +2489,7 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Send 'ORDER BY' and 'LIMIT' to remote server directly", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
9223372036854775807LL, /* def */
-1, /* min */
9223372036854775807LL, /* max */
@@ -2501,7 +2515,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Read only", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
0, /* def */
-1, /* min */
1, /* max */
@@ -2708,7 +2722,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Read casually if it is possible", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
0, /* def */
-1, /* min */
63, /* max */
@@ -2751,7 +2765,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"The type of delete_all_rows", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
1, /* def */
-1, /* min */
1, /* max */
@@ -2777,7 +2791,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"The type of temporary table name for bka", /* comment */
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
0, /* def */
-1, /* min */
1, /* max */
@@ -2829,7 +2843,7 @@ static MYSQL_SYSVAR_INT(
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED,
"Store last sts result into system table",
NULL,
- spider_use_table_value_deprecated,
+ spider_var_deprecated_int,
1,
-1,
1,
@@ -2856,7 +2870,7 @@ static MYSQL_SYSVAR_INT(
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED,
"Store last crd result into system table",
NULL,
- spider_use_table_value_deprecated,
+ spider_var_deprecated_int,
1,
-1,
1,
@@ -2883,7 +2897,7 @@ static MYSQL_SYSVAR_INT(
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED,
"Load sts from system table at startup",
NULL,
- spider_use_table_value_deprecated,
+ spider_var_deprecated_int,
1,
-1,
1,
@@ -2910,7 +2924,7 @@ static MYSQL_SYSVAR_INT(
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED,
"Load crd from system table at startup",
NULL,
- spider_use_table_value_deprecated,
+ spider_var_deprecated_int,
1,
-1,
1,
@@ -3078,7 +3092,7 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Use columns in select clause strictly for group by clause",
NULL, /* check */
- spider_use_table_value_deprecated, /* update */
+ spider_var_deprecated_int, /* update */
1, /* def */
-1, /* min */
1, /* max */
diff --git a/tpool/tpool_generic.cc b/tpool/tpool_generic.cc
index 22d29d6400b..dfd780e7ea3 100644
--- a/tpool/tpool_generic.cc
+++ b/tpool/tpool_generic.cc
@@ -33,6 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 - 1301 USA*/
#include <my_dbug.h>
#include <thr_timer.h>
#include <stdlib.h>
+#include "aligned.h"
namespace tpool
{
@@ -180,23 +181,13 @@ struct alignas(CPU_LEVEL1_DCACHE_LINESIZE) worker_data
{}
/*Define custom new/delete because of overaligned structure. */
- void* operator new(size_t size)
+ static void *operator new(size_t size)
{
-#ifdef _WIN32
- return _aligned_malloc(size, CPU_LEVEL1_DCACHE_LINESIZE);
-#else
- void* ptr;
- int ret = posix_memalign(&ptr, CPU_LEVEL1_DCACHE_LINESIZE, size);
- return ret ? 0 : ptr;
-#endif
+ return aligned_malloc(size, CPU_LEVEL1_DCACHE_LINESIZE);
}
- void operator delete(void* p)
+ static void operator delete(void* p)
{
-#ifdef _WIN32
- _aligned_free(p);
-#else
- free(p);
-#endif
+ aligned_free(p);
}
};