21 Feb '19
revision-id: 5b4d6595d26aaaf0bf8bb3c9171cf1da96306a7c (mariadb-10.3.6-163-g5b4d6595d26)
parent(s): 33b9f80595d3dad74bd16e8ac430a93aecf8eddf
author: Oleksandr Byelkin
committer: Oleksandr Byelkin
timestamp: 2019-02-21 18:29:17 +0100
message:
fix test to pass on embedded serever
---
mysql-test/suite/innodb/r/full_crc32_import.result | 4 ----
mysql-test/suite/innodb/t/full_crc32_import.test | 4 ++++
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/mysql-test/suite/innodb/r/full_crc32_import.result b/mysql-test/suite/innodb/r/full_crc32_import.result
index 6c68af64c7b..693ad22bab6 100644
--- a/mysql-test/suite/innodb/r/full_crc32_import.result
+++ b/mysql-test/suite/innodb/r/full_crc32_import.result
@@ -34,8 +34,6 @@ db.opt
t1.frm
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
-Warnings:
-Warning 1810 IO Read error: (2, No such file or directory) Error opening './test/t1.cfg', will attempt to import without schema verification
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -110,8 +108,6 @@ ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
ALTER TABLE t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
-Warnings:
-Warning 1810 IO Read error: (2, No such file or directory) Error opening './test/t1.cfg', will attempt to import without schema verification
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/suite/innodb/t/full_crc32_import.test b/mysql-test/suite/innodb/t/full_crc32_import.test
index 71e38ddbafb..f62c68ec543 100644
--- a/mysql-test/suite/innodb/t/full_crc32_import.test
+++ b/mysql-test/suite/innodb/t/full_crc32_import.test
@@ -49,7 +49,9 @@ ib_restore_tablespaces("test", "t1");
EOF
--remove_file $MYSQLD_DATADIR/test/t1.cfg
+--disable_warnings
ALTER TABLE t1 IMPORT TABLESPACE;
+--enable_warnings
SHOW CREATE TABLE t1;
UPDATE t1 set b = repeat("de", 100) where b = repeat("cd", 200);
--replace_column 9 #
@@ -123,7 +125,9 @@ ib_restore_tablespaces("test", "t1");
EOF
--remove_file $MYSQLD_DATADIR/test/t1.cfg
+--disable_warnings
ALTER TABLE t1 IMPORT TABLESPACE;
+--enable_warnings
SHOW CREATE TABLE t1;
UPDATE t1 SET C2 = ST_GeomFromText('POINT(0 0)');
SELECT COUNT(*) FROM t1;
1
0
revision-id: 93ac7ae70ff000353538f732899b421a3f2ea7ce (mariadb-10.3.6-140-g93ac7ae70ff)
parent(s): 4932aba921755cfbc351b92c67068a5c48d3922b a40de1bdeb218d66d5cc737758a4bab1b06f255d
author: Oleksandr Byelkin
committer: Oleksandr Byelkin
timestamp: 2019-02-21 14:40:52 +0100
message:
Merge branch '10.3' into 10.4
CMakeLists.txt | 12 +-
client/mysqlbinlog.cc | 23 +-
client/mysqltest.cc | 66 +-
cmake/aws_sdk.cmake | 4 +
cmake/build_configurations/mysql_release.cmake | 1 -
cmake/readline.cmake | 2 +-
cmake/submodules.cmake | 12 +-
config.h.cmake | 6 +-
configure.cmake | 2 +-
debian/autobake-deb.sh | 27 -
extra/mariabackup/backup_copy.cc | 13 +
extra/mariabackup/xtrabackup.cc | 44 +-
include/my_sys.h | 5 +-
include/my_valgrind.h | 4 +-
include/mysql.h | 2 +-
include/mysql.h.pp | 2 +-
libmariadb | 2 +-
mysql-test/include/check-testcase.test | 1 -
mysql-test/include/mtr_check.sql | 1 -
mysql-test/main/alter_table.result | 49 +
mysql-test/main/alter_table.test | 17 +
mysql-test/main/alter_table_errors.result | 6 +
mysql-test/main/alter_table_errors.test | 10 +
mysql-test/main/check.result | 7 +
mysql-test/main/check.test | 9 +
mysql-test/main/check_constraint.result | 2 +-
mysql-test/main/check_constraint.test | 1 -
mysql-test/main/check_constraint_innodb.result | 9 +
mysql-test/main/check_constraint_innodb.test | 14 +
mysql-test/main/disabled.def | 1 +
mysql-test/main/error_simulation.result | 5 +-
mysql-test/main/error_simulation.test | 7 +-
mysql-test/main/func_misc.result | 8 +
mysql-test/main/func_misc.test | 8 +
mysql-test/main/gis.test | 1 -
mysql-test/main/gis2.result | 2 +-
mysql-test/main/mysql.result | 26 +
mysql-test/main/mysql.test | 22 +
mysql-test/main/mysqlbinlog_row_minimal.result | 122 +-
mysql-test/main/mysqlbinlog_row_minimal.test | 41 +
mysql-test/main/row-checksum-old.result | 16 +
mysql-test/main/row-checksum.result | 16 +
mysql-test/main/row-checksum.test | 17 +
mysql-test/main/subselect2.result | 22 +
mysql-test/main/subselect2.test | 20 +
mysql-test/main/subselect_mat.result | 16 +
mysql-test/main/subselect_mat.test | 13 +
mysql-test/main/subselect_sj2_mat.result | 4 +
mysql-test/main/subselect_sj2_mat.test | 2 +
mysql-test/suite/archive/partition_archive.result | 4 +-
mysql-test/suite/archive/partition_archive.test | 3 +-
.../suite/binlog/r/binlog_base64_flag.result | 19 +
.../binlog/r/binlog_mysqlbinlog_row_frag.result | 24 +
mysql-test/suite/binlog/t/binlog_base64_flag.test | 22 +
.../binlog/t/binlog_mysqlbinlog_row_frag.test | 46 +
.../encryption/r/innodb-encryption-alter.result | 4 +-
.../encryption/t/innodb-encryption-alter.test | 2 -
.../suite/encryption/t/innodb-spatial-index.test | 2 -
.../suite/funcs_1/r/is_routines_embedded.result | 6 +-
mysql-test/suite/galera/r/galera_defaults.result | 3 +-
mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf | 1 +
mysql-test/suite/galera_3nodes/galera_3nodes.cnf | 1 +
.../galera_3nodes/include/have_mariabackup.inc | 4 -
.../suite/galera_3nodes/r/galera_garbd.result | 4 +-
.../galera_3nodes/r/galera_var_dirty_reads2.result | 4 +
mysql-test/suite/galera_3nodes/suite.pm | 9 +-
mysql-test/suite/galera_3nodes/t/galera_garbd.test | 16 +-
.../galera_3nodes/t/galera_ipv6_mariabackup.test | 2 +-
.../galera_3nodes/t/galera_var_dirty_reads2.test | 14 +
.../suite/gcol/inc/gcol_column_def_options.inc | 1 -
mysql-test/suite/gcol/inc/gcol_keys.inc | 1 -
mysql-test/suite/gcol/r/gcol_keys_innodb.result | 2 +-
mysql-test/suite/gcol/r/innodb_virtual_fk.result | 4 +-
mysql-test/suite/gcol/t/innodb_virtual_fk.test | 2 -
mysql-test/suite/innodb/r/add_constraint.result | 2 +-
.../suite/innodb/r/alter_foreign_crash.result | 2 +-
.../suite/innodb/r/alter_varchar_change.result | 9 +
mysql-test/suite/innodb/r/foreign_key.result | 57 +-
.../suite/innodb/r/innodb-fk-warnings.result | 24 +-
mysql-test/suite/innodb/r/innodb-fk.result | 6 +-
.../suite/innodb/r/innodb-index-online.result | 2 +-
mysql-test/suite/innodb/r/innodb-index.result | 10 +-
.../suite/innodb/r/innodb_force_recovery.result | 8 +-
.../suite/innodb/r/instant_varchar_enlarge.result | 9 -
.../suite/innodb/r/undo_truncate_recover.result | 1 +
mysql-test/suite/innodb/t/add_constraint.test | 1 -
.../suite/innodb/t/alter_varchar_change.test | 7 +
mysql-test/suite/innodb/t/foreign_key.test | 52 +-
mysql-test/suite/innodb/t/innodb-fk-warnings.test | 18 -
mysql-test/suite/innodb/t/innodb-fk.test | 2 -
mysql-test/suite/innodb/t/innodb-index-online.test | 1 -
mysql-test/suite/innodb/t/innodb-index.test | 5 -
.../innodb/t/innodb-page_compression_tables.test | 4 -
.../suite/innodb/t/innodb_force_recovery.test | 4 -
.../suite/innodb/t/instant_varchar_enlarge.test | 8 -
.../suite/innodb/t/undo_truncate_recover.test | 6 +-
.../suite/innodb_gis/r/alter_spatial_index.result | 2 +-
mysql-test/suite/innodb_gis/r/point_basic.result | 14 +-
mysql-test/suite/innodb_gis/t/point_basic.test | 6 -
.../mariabackup/encrypted_page_compressed.test | 2 +-
.../mariabackup/encrypted_page_corruption.test | 2 +-
.../suite/mariabackup/incremental_rocksdb.opt | 1 +
.../suite/mariabackup/incremental_rocksdb.result | 19 +
.../suite/mariabackup/incremental_rocksdb.test | 38 +
.../suite/mariabackup/log_checksum_mismatch.test | 2 +-
.../mariabackup/unencrypted_page_compressed.test | 2 +-
.../perfschema/r/dml_setup_instruments.result | 4 +-
.../suite/perfschema/t/dml_setup_instruments.test | 5 +-
mysql-test/suite/plugins/t/audit_null.test | 2 +-
mysql-test/suite/rpl/r/rpl_set_statement.test | 0
mysql-test/suite/sys_vars/r/all_vars.result | 1 +
.../r/sysvars_innodb,32bit,xtradb.rdiff-disabled | 1236 +++++++++++
.../r/sysvars_innodb,xtradb.rdiff-disabled | 697 ++++++
mysql-test/suite/sys_vars/r/sysvars_wsrep.result | 14 +
.../sys_vars/r/tmp_disk_table_size_func.result | 2 +-
.../suite/sys_vars/t/tmp_disk_table_size_func.test | 1 -
mysql-test/suite/vcol/inc/vcol_keys.inc | 1 -
mysql-test/suite/vcol/r/vcol_keys_innodb.result | 2 +-
mysys/mf_iocache2.c | 61 +-
mysys/my_delete.c | 61 +
mysys/my_file.c | 7 +-
mysys/my_malloc.c | 1 +
plugin/aws_key_management/CMakeLists.txt | 2 +-
plugin/wsrep_info/mysql-test/wsrep_info/suite.pm | 2 +
scripts/mysql_install_db.sh | 24 +-
scripts/wsrep_sst_mariabackup.sh | 6 +-
scripts/wsrep_sst_rsync.sh | 2 +-
sql-common/client.c | 30 +-
sql/field.cc | 4 +-
sql/item.cc | 18 +-
sql/item_func.cc | 2 +-
sql/item_func.h | 4 +
sql/log.cc | 6 +-
sql/log_event.cc | 386 +++-
sql/log_event.h | 24 +-
sql/log_event_old.cc | 17 +-
sql/partition_info.cc | 2 +-
sql/rpl_tblmap.cc | 20 +-
sql/rpl_tblmap.h | 10 +-
sql/sql_binlog.cc | 91 +-
sql/sql_class.cc | 23 +-
sql/sql_class.h | 2 +-
sql/sql_lex.cc | 3 +-
sql/sql_lex.h | 4 +
sql/sql_repl.cc | 6 +-
sql/sql_select.cc | 21 +-
sql/sql_table.cc | 150 +-
sql/sql_yacc.yy | 19 +-
sql/sql_yacc_ora.yy | 19 +-
sql/sys_vars.cc | 13 +
sql/table.cc | 2 +-
sql/table.h | 12 +-
sql/wsrep_mysqld.cc | 1 +
sql/wsrep_mysqld.h | 1 +
sql/wsrep_mysqld_c.h | 30 +
storage/connect/ha_connect.cc | 45 +-
storage/connect/jsonudf.cpp | 48 +-
storage/connect/jsonudf.h | 5 +
.../mysql-test/connect/r/jdbc_postgresql.result | 2 +-
.../connect/mysql-test/connect/r/part_table.result | 4 +-
.../connect/mysql-test/connect/t/part_table.test | 2 +-
storage/connect/tabext.cpp | 43 +-
storage/connect/tabext.h | 5 +-
storage/connect/tabjdbc.cpp | 89 +-
storage/connect/tabjson.cpp | 46 +-
storage/connect/tabjson.h | 2 +-
storage/connect/tabxml.cpp | 279 +--
storage/connect/tabxml.h | 1 +
storage/innobase/dict/dict0dict.cc | 49 +-
storage/innobase/handler/handler0alter.cc | 107 +-
storage/innobase/handler/i_s.cc | 87 +-
storage/innobase/include/trx0rseg.h | 4 +-
storage/innobase/log/log0recv.cc | 2 +-
storage/innobase/row/row0mysql.cc | 3 -
storage/innobase/row/row0sel.cc | 43 +-
storage/innobase/srv/srv0start.cc | 6 +-
storage/maria/ma_delete.c | 2 -
storage/maria/ma_write.c | 3 +-
storage/maria/maria_def.h | 4 +-
storage/tokudb/PerconaFT/COPYING.APACHEv2 | 174 ++
storage/tokudb/PerconaFT/README.md | 5 +-
storage/tokudb/PerconaFT/ft/txn/txn_manager.h | 4 +-
.../tokudb/PerconaFT/locktree/concurrent_tree.cc | 14 +
.../tokudb/PerconaFT/locktree/concurrent_tree.h | 14 +
storage/tokudb/PerconaFT/locktree/keyrange.cc | 13 +
storage/tokudb/PerconaFT/locktree/keyrange.h | 13 +
storage/tokudb/PerconaFT/locktree/lock_request.cc | 13 +
storage/tokudb/PerconaFT/locktree/lock_request.h | 13 +
storage/tokudb/PerconaFT/locktree/locktree.cc | 13 +
storage/tokudb/PerconaFT/locktree/locktree.h | 13 +
storage/tokudb/PerconaFT/locktree/manager.cc | 13 +
storage/tokudb/PerconaFT/locktree/range_buffer.cc | 13 +
storage/tokudb/PerconaFT/locktree/range_buffer.h | 13 +
storage/tokudb/PerconaFT/locktree/treenode.cc | 13 +
storage/tokudb/PerconaFT/locktree/treenode.h | 13 +
storage/tokudb/PerconaFT/locktree/txnid_set.cc | 13 +
storage/tokudb/PerconaFT/locktree/txnid_set.h | 13 +
storage/tokudb/PerconaFT/locktree/wfg.cc | 13 +
storage/tokudb/PerconaFT/locktree/wfg.h | 13 +
.../PerconaFT/portability/toku_instr_mysql.cc | 12 +-
.../PerconaFT/portability/toku_instr_mysql.h | 11 +-
.../tokudb/PerconaFT/portability/toku_pthread.h | 78 +-
storage/tokudb/PerconaFT/util/growable_array.h | 13 +
storage/tokudb/PerconaFT/util/omt.cc | 2261 +++++++++++---------
storage/tokudb/PerconaFT/util/omt.h | 13 +
storage/tokudb/ha_tokudb.cc | 10 +
storage/tokudb/hatoku_hton.cc | 4 +-
storage/tokudb/hatoku_hton.h | 1 -
.../tokudb/mysql-test/tokudb_bugs/r/PS-4979.result | 2 +
.../tokudb/mysql-test/tokudb_bugs/t/PS-4979.test | 13 +
storage/tokudb/tokudb_background.cc | 4 +-
storage/tokudb/tokudb_sysvars.cc | 14 +-
storage/tokudb/tokudb_sysvars.h | 4 +-
support-files/mysql.server.sh | 6 +-
unittest/mysys/thr_template.c | 4 +-
unittest/sql/mf_iocache-t.cc | 70 +-
win/packaging/heidisql.cmake | 2 +-
217 files changed, 6122 insertions(+), 1986 deletions(-)
diff --cc cmake/aws_sdk.cmake
index 975a3fa6888,00000000000..92e1e78ad3f
mode 100644,000000..100644
--- a/cmake/aws_sdk.cmake
+++ b/cmake/aws_sdk.cmake
@@@ -1,91 -1,0 +1,95 @@@
+MACRO (SKIP_AWS_SDK MSG)
+ SET(${RETVAL} OFF PARENT_SCOPE)
+ SET(${REASON} ${MSG} PARENT_SCOPE)
+ RETURN()
+ENDMACRO()
+
+FUNCTION (CHECK_AWS_SDK RETVAL REASON)
+ # AWS_SDK_EXTERNAL_PROJECT must be ON
+ IF(NOT AWS_SDK_EXTERNAL_PROJECT)
+ SKIP_AWS_SDK("AWS_SDK_EXTERNAL_PROJECT is not ON")
+ ENDIF()
++ IF(NOT NOT_FOR_DISTRIBUTION)
++ SKIP_AWS_SDK("AWS SDK has Apache 2.0 License which is not complatible with GPLv2. Set -DNOT_FOR_DISTRIBUTION=ON if you need it")
++ ENDIF()
+ # Check compiler support
+ IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+ EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
+ IF (GCC_VERSION VERSION_LESS 4.8)
+ SKIP_AWS_SDK("GCC VERSION too old (${GCC_VERSION}, required is 4.8 or later")
+ ENDIF()
+ ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ IF ((CMAKE_CXX_COMPILER_VERSION AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.3) OR
+ (CLANG_VERSION_STRING AND CLANG_VERSION_STRING VERSION_LESS 3.3))
+ SKIP_AWS_SDK("Clang version too old, required is 3.3 or later")
+ ENDIF()
+ ELSEIF(MSVC)
+ IF (MSVC_VERSION LESS 1800)
+ SKIP_AWS_SDK("MSVC version too old, required is VS2015 or later")
+ ENDIF()
+ ELSE()
+ SKIP_AWS_SDK("Unsupported compiler")
+ ENDIF()
+
+ # Check OS support
+ IF (NOT(WIN32 OR APPLE OR (CMAKE_SYSTEM_NAME MATCHES "Linux")))
+ SKIP_AWS_SDK("OS unsupported by AWS SDK")
+ ENDIF()
+
+ # Build from source, using ExternalProject_Add
+ # AWS C++ SDK requires cmake 2.8.12
+ IF(CMAKE_VERSION VERSION_LESS "2.8.12")
+ SKIP_AWS_SDK("CMake is too old")
+ ENDIF()
+
+ IF(UNIX)
+ # Check librairies required for building SDK
+ FIND_PACKAGE(CURL)
+ IF(NOT CURL_FOUND)
+ SKIP_AWS_SDK("AWS C++ SDK requires libcurl development package")
+ ENDIF()
+ FIND_PATH(UUID_INCLUDE_DIR uuid/uuid.h)
+ IF(NOT UUID_INCLUDE_DIR)
+ SKIP_AWS_SDK("AWS C++ SDK requires uuid development package")
+ ENDIF()
+ IF(NOT APPLE)
+ FIND_LIBRARY(UUID_LIBRARIES uuid)
+ IF(NOT UUID_LIBRARIES)
+ SKIP_AWS_SDK("AWS C++ SDK requires uuid development package")
+ ENDIF()
+ FIND_PACKAGE(OpenSSL)
+ IF(NOT OPENSSL_FOUND)
+ SKIP_AWS_SDK("AWS C++ SDK requires openssl development package")
+ ENDIF()
+ ENDIF()
+ ENDIF()
+ SET(${RETVAL} ON PARENT_SCOPE)
+ENDFUNCTION()
+
+
+# USE_AWS_SDK_LIBS(target sdk_component1 ... sdk_component_N)
+# Example usage
+# USE_AWS_SDK_LIBS(aws_key_management kms s3)
+FUNCTION(USE_AWS_SDK_LIBS)
+ SET(SDK_COMPONENTS ${ARGN})
+ LIST(GET SDK_COMPONENTS 0 target)
+ IF(NOT TARGET ${target})
+ MESSAGE(FATAL_ERROR "${target} is not a valid target")
+ ENDIF()
++ SET(NON_DISTRIBUTABLE_WARNING "Apache 2.0" CACHE INTERNAL "")
+ LIST(REMOVE_AT SDK_COMPONENTS 0)
+ FOREACH(comp ${SDK_COMPONENTS})
+ SET_PROPERTY(GLOBAL PROPERTY AWS_SDK_LIBS ${comp} APPEND)
+ TARGET_LINK_LIBRARIES(${target} aws-cpp-sdk-${comp})
+ ENDFOREACH()
+ TARGET_LINK_LIBRARIES(${target} aws-cpp-sdk-core)
+ TARGET_INCLUDE_DIRECTORIES(${target} PRIVATE ${PROJECT_BINARY_DIR}/aws_sdk/aws_sdk_cpp/include)
+ # Link OS libraries that AWS SDK depends on
+ IF(WIN32)
+ TARGET_LINK_LIBRARIES(${target} bcrypt winhttp wininet userenv version)
+ ELSE()
+ FIND_PACKAGE(CURL REQUIRED)
+ FIND_PACKAGE(OpenSSL REQUIRED)
+ TARGET_LINK_LIBRARIES(${target} ${OPENSSL_LIBRARIES} ${CURL_LIBRARIES} ${UUID_LIBRARIES})
+ ENDIF()
+ENDFUNCTION()
diff --cc cmake/readline.cmake
index 12a8980b6a9,f1c6f62e311..f7a5291135c
--- a/cmake/readline.cmake
+++ b/cmake/readline.cmake
@@@ -134,7 -134,7 +134,7 @@@ MACRO (MYSQL_FIND_SYSTEM_READLINE
SET(USE_NEW_READLINE_INTERFACE 1)
ELSE()
IF(NOT_FOR_DISTRIBUTION)
- SET(NON_DISTRIBUTABLE_WARNING 1)
- SET(NON_DISTRIBUTABLE_WARNING "GPLv3")
++ SET(NON_DISTRIBUTABLE_WARNING "GPLv3" CACHE INTERNAL "")
SET(USE_NEW_READLINE_INTERFACE 1)
ELSE()
SET(USE_NEW_READLINE_INTERFACE 0)
diff --cc cmake/submodules.cmake
index 9f04c26e8d6,34d1f37c956..c8f7b3cc400
--- a/cmake/submodules.cmake
+++ b/cmake/submodules.cmake
@@@ -31,7 -36,6 +36,6 @@@ ENDIF(
IF(update_result OR NOT EXISTS ${CMAKE_SOURCE_DIR}/libmariadb/CMakeLists.txt)
MESSAGE(FATAL_ERROR "No MariaDB Connector/C! Run
- git submodule update --init --recursive
- Then restart the build.
- ")
- ${GIT_EXECUTABLE} submodule update --init
++ ${GIT_EXECUTABLE} submodule update --init --recursive
+ Then restart the build.${SUBMODULE_UPDATE_CONFIG_MESSAGE}")
ENDIF()
diff --cc configure.cmake
index 08eac106e6a,3cfc4b31d4e..947689d0f86
--- a/configure.cmake
+++ b/configure.cmake
@@@ -260,7 -260,7 +260,7 @@@ SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_
CHECK_INCLUDE_FILES (bfd.h BFD_H_EXISTS)
IF(BFD_H_EXISTS)
IF(NOT_FOR_DISTRIBUTION)
- SET(NON_DISTRIBUTABLE_WARNING 1)
- SET(NON_DISTRIBUTABLE_WARNING "GPLv3")
++ SET(NON_DISTRIBUTABLE_WARNING "GPLv3" CACHE INTERNAL "")
SET(HAVE_BFD_H 1)
ENDIF()
ENDIF()
diff --cc debian/autobake-deb.sh
index 3442afbf376,5ca59e0305d..6ef0cb33553
--- a/debian/autobake-deb.sh
+++ b/debian/autobake-deb.sh
@@@ -94,36 -94,9 +94,9 @@@ f
# x86 32 bit.
if [[ $GCCVERSION -lt 40800 ]] || [[ $(arch) =~ i[346]86 ]] || [[ $TRAVIS ]]
then
- sed '/Package: mariadb-plugin-rocksdb/,+14d' -i debian/control
+ sed '/Package: mariadb-plugin-rocksdb/,/^$/d' -i debian/control
fi
- # AWS SDK requires c++11 -capable compiler.
- # Minimal supported versions are g++ 4.8 and clang 3.3.
- # AWS SDK also requires the build machine to have network access and git, so
- # it cannot be part of the base version included in Linux distros, but a pure
- # custom built plugin.
- if [[ $GCCVERSION -gt 40800 ]] && [[ ! $TRAVIS ]] && [[ -x "$(command -v git)" ]] && timeout 3s bash -c 'sed -n q </dev/tcp/github.com/22'
- then
- cat <<EOF >> debian/control
-
- Package: mariadb-plugin-aws-key-management
- Architecture: any
- Breaks: mariadb-aws-key-management-10.1,
- mariadb-aws-key-management-10.2
- Replaces: mariadb-aws-key-management-10.1,
- mariadb-aws-key-management-10.2
- Depends: mariadb-server-10.4,
- \${misc:Depends},
- \${shlibs:Depends}
- Description: Amazon Web Service Key Management Service Plugin for MariaDB
- This encryption key management plugin gives an interface to the Amazon Web
- Services Key Management Service for managing encryption keys used for MariaDB
- data-at-rest encryption.
- EOF
-
- sed -i -e "/-DPLUGIN_AWS_KEY_MANAGEMENT=NO/d" debian/rules
- fi
-
# Don't build cassandra package if thrift is not installed
if [[ ! -f /usr/local/include/thrift/Thrift.h && ! -f /usr/include/thrift/Thrift.h ]]
then
diff --cc mysql-test/main/disabled.def
index eecee845a35,b6991cc1d37..c1cfd229a9b
--- a/mysql-test/main/disabled.def
+++ b/mysql-test/main/disabled.def
@@@ -18,6 -21,4 +18,7 @@@ innodb-wl5522-debug-zip : broken upstr
innodb_bug12902967 : broken upstream
file_contents : MDEV-6526 these files are not installed anymore
max_statement_time : cannot possibly work, depends on timing
+ partition_open_files_limit : open_files_limit check broken by MDEV-18360
+mysqlcheck : special tables like proxy , host specific to a system are shown
+flush_read_lock : special tables like proxy , host specific to a system are shown
+join_cache : enable after MDEV-17752 is fixed
diff --cc mysql-test/main/subselect2.result
index 21bf9aad122,cae0f2286c1..0e71f22e52e
--- a/mysql-test/main/subselect2.result
+++ b/mysql-test/main/subselect2.result
@@@ -394,3 -394,25 +394,25 @@@ select null in (select a from t1 where
(select a from t3) +1 < out3.a+1) from t3 out3;
ERROR 21000: Subquery returns more than 1 row
drop table t1, t2, t3;
+ CREATE TABLE t1(
+ q11 int, q12 int, q13 int, q14 int, q15 int, q16 int, q17 int, q18 int, q19 int,
+ q21 int, q22 int, q23 int, q24 int, q25 int, q26 int, q27 int, q28 int, q29 int,
+ f1 int
+ );
+ CREATE TABLE t2(f2 int, f21 int, f3 timestamp, f4 int, f5 int, f6 int);
+ INSERT INTO t1 (f1) VALUES (1),(1),(2),(2);
+ INSERT INTO t2 VALUES (1,1,"2004-02-29 11:11:11",0,0,0), (2,2,"2004-02-29 11:11:11",0,0,0);
+ SELECT f1,
+ (SELECT t.f21 from t2 t where max(
+ q11+q12+q13+q14+q15+q16+q17+q18+q19+
+ q21+q22+q23+q24+q25+q26+q27+q28+q29) = t.f2 UNION
+ SELECT t.f3 FROM t2 AS t WHERE t1.f1=t.f2 AND t.f3=MAX(t1.f1) UNION
+ SELECT 1 LIMIT 1) AS test
+ FROM t1 GROUP BY f1;
+ f1 test
+ 1 1
+ 2 1
+ Warnings:
-Warning 1292 Incorrect datetime value: '1'
-Warning 1292 Incorrect datetime value: '2'
++Warning 1292 Truncated incorrect datetime value: '1'
++Warning 1292 Truncated incorrect datetime value: '2'
+ DROP TABLE t1,t2;
diff --cc mysql-test/main/subselect_sj2_mat.result
index e4583cf6348,884451d7dff..73f682755da
--- a/mysql-test/main/subselect_sj2_mat.result
+++ b/mysql-test/main/subselect_sj2_mat.result
@@@ -1734,6 -1692,6 +1734,10 @@@ insert into t1(`id`,`local_name`) valu
(11,'Rollover - Internet Payday'),
(12,'AL Monthly Installment'),
(13,'AL Semi-Monthly Installment');
++ANALYZE TABLE t1;
++Table Op Msg_type Msg_text
++test.t1 analyze status Engine-independent statistics collected
++test.t1 analyze status OK
explain
SELECT SQL_NO_CACHE t.id
FROM t1 t
diff --cc mysql-test/main/subselect_sj2_mat.test
index 91057f0b201,6ae687aa99a..6eeaceb82b0
--- a/mysql-test/main/subselect_sj2_mat.test
+++ b/mysql-test/main/subselect_sj2_mat.test
@@@ -335,6 -329,6 +335,8 @@@ insert into t1(`id`,`local_name`) valu
(12,'AL Monthly Installment'),
(13,'AL Semi-Monthly Installment');
++ANALYZE TABLE t1;
++
explain
SELECT SQL_NO_CACHE t.id
FROM t1 t
diff --cc mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_frag.result
index 00000000000,04846efc274..5f685dfa785
mode 000000,100644..100644
--- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_frag.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_frag.result
@@@ -1,0 -1,24 +1,24 @@@
+ CREATE TABLE t (a TEXT);
+ RESET MASTER;
+ INSERT INTO t SET a=repeat('a', 1024);
-SELECT a from t into @a;
++SELECT a into @a from t;
+ FLUSH LOGS;
+ DELETE FROM t;
+ FOUND 1 /BINLOG @binlog_fragment_0, @binlog_fragment_1/ in mysqlbinlog.sql
+ SELECT a LIKE @a as 'true' FROM t;
+ true
+ 1
+ BINLOG number-of-fragments must be exactly two
+ BINLOG @binlog_fragment;
+ ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
+ BINLOG @binlog_fragment, @binlog_fragment, @binlog_fragment;
+ ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' @binlog_fragment' at line 1
+ SET @binlog_fragment_0='012345';
+ SET @binlog_fragment_1='012345';
+ BINLOG @binlog_fragment_0, @binlog_fragment_1;
+ ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use
+ SET @binlog_fragment_0='012345';
+ BINLOG @binlog_fragment_0, @binlog_fragment_not_exist;
+ ERROR 42000: Incorrect argument type to variable 'binlog_fragment_not_exist'
+ # Cleanup
+ DROP TABLE t;
diff --cc mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test
index 00000000000,2d55aa79d48..6765b26f3da
mode 000000,100644..100644
--- a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test
@@@ -1,0 -1,46 +1,46 @@@
+ --source include/have_debug.inc
+ --source include/have_binlog_format_row.inc
+
+ --let $MYSQLD_DATADIR= `select @@datadir`
+
+ CREATE TABLE t (a TEXT);
+ # events of interest are guaranteed to stay in 000001 log
+ RESET MASTER;
+ --eval INSERT INTO t SET a=repeat('a', 1024)
-SELECT a from t into @a;
++SELECT a into @a from t;
+ FLUSH LOGS;
+ DELETE FROM t;
+
+ # Todo: MDEV-10362 to test multi-row Rows_log_event:s in verbose mode
+ --exec $MYSQL_BINLOG -vv --debug-binlog-row-event-max-encoded-size=256 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
+
+ --let SEARCH_PATTERN= BINLOG @binlog_fragment_0, @binlog_fragment_1
+ --let SEARCH_FILE= $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
+ --source include/search_pattern_in_file.inc
+
+ --exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
+
+ SELECT a LIKE @a as 'true' FROM t;
+
+ # improper syntax error
+ --echo BINLOG number-of-fragments must be exactly two
+ --error ER_PARSE_ERROR
+ BINLOG @binlog_fragment;
+ --error ER_PARSE_ERROR
+ BINLOG @binlog_fragment, @binlog_fragment, @binlog_fragment;
+
+ # corrupted fragments error check (to the expected error code notice,
+ # the same error code occurs in a similar unfragmented case)
+ SET @binlog_fragment_0='012345';
+ SET @binlog_fragment_1='012345';
+ --error ER_SYNTAX_ERROR
+ BINLOG @binlog_fragment_0, @binlog_fragment_1;
+
+ # Not existing fragment is not allowed
+ SET @binlog_fragment_0='012345';
+ --error ER_WRONG_TYPE_FOR_VAR
+ BINLOG @binlog_fragment_0, @binlog_fragment_not_exist;
+
+ --echo # Cleanup
+ --remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
+ DROP TABLE t;
diff --cc mysql-test/suite/encryption/t/innodb-spatial-index.test
index a50ef306351,2bf56817740..0465225cd4f
--- a/mysql-test/suite/encryption/t/innodb-spatial-index.test
+++ b/mysql-test/suite/encryption/t/innodb-spatial-index.test
@@@ -7,21 -6,10 +7,20 @@@
#
#
-# (1) Do not allow creating table with ENCRYPTED=YES
#
#
---error ER_CANT_CREATE_TABLE
+let $checksum_algorithm = `SELECT @@innodb_checksum_algorithm`;
+let $error_code = ER_CANT_CREATE_TABLE, ER_ILLEGAL_HA_CREATE_OPTION;
+if ($checksum_algorithm == "full_crc32")
+{
+ let $error_code = 0;
+}
+if ($checksum_algorithm == "strict_full_crc32")
+{
+ let $error_code = 0;
+}
+
- --replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
+--error $error_code
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT,
c VARCHAR(256), coordinate POINT NOT NULL, SPATIAL index(coordinate)) ENGINE=INNODB
ENCRYPTED=YES;
@@@ -49,15 -30,14 +48,14 @@@ CREATE TABLE t1 (pk INT PRIMARY KEY AUT
c VARCHAR(256), coordinate POINT NOT NULL) ENCRYPTED=YES ENGINE=INNODB;
# FIXME: MDEV-13851 Encrypted table refuses some form of ALGORITHM=COPY,
# but allows rebuild by FORCE
- --replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
---error ER_CANT_CREATE_TABLE
-ALTER TABLE t1 ADD SPATIAL INDEX b(coordinate), ALGORITHM=COPY;
---error ER_ILLEGAL_HA_CREATE_OPTION
-ALTER TABLE t1 ADD SPATIAL INDEX b(coordinate), FORCE, ALGORITHM=INPLACE;
---error ER_ILLEGAL_HA_CREATE_OPTION
+--error $error_code
+ALTER TABLE t1 ADD SPATIAL INDEX b1(coordinate), ALGORITHM=COPY;
+--error $error_code
+ALTER TABLE t1 ADD SPATIAL INDEX b2(coordinate), FORCE, ALGORITHM=INPLACE;
+--error $error_code
ALTER TABLE t1 ADD SPATIAL INDEX(coordinate);
---error ER_ILLEGAL_HA_CREATE_OPTION
-CREATE SPATIAL INDEX b on t1(coordinate);
+--error $error_code
+CREATE SPATIAL INDEX b3 on t1(coordinate);
DROP TABLE t1;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT,
diff --cc mysql-test/suite/funcs_1/r/is_routines_embedded.result
index 02d2867b657,1739a0c15c8..ec375e9c5f6
--- a/mysql-test/suite/funcs_1/r/is_routines_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_routines_embedded.result
@@@ -197,7 -197,7 +197,7 @@@ sp_6_408002_2 def db_datadict_2 sp_6_40
SELECT * FROM db_datadict_2.res_6_408002_2;
END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
add_suppression def mtr add_suppression PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN INSERT INTO test_suppressions (pattern) VALUES (pattern); FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
- check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' AND variable_name != 'AUTO_INCREMENT_INCREMENT' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA
.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping,
mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
-check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDE
R BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.host, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zon
e, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.user; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
++check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDE
R BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.tim
e_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
connect testuser2, localhost, testuser2, , db_datadict;
SELECT * FROM information_schema.routines;
@@@ -209,7 -209,7 +209,7 @@@ sp_6_408002_2 def db_datadict_2 sp_6_40
SELECT * FROM db_datadict_2.res_6_408002_2;
END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
add_suppression def mtr add_suppression PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN INSERT INTO test_suppressions (pattern) VALUES (pattern); FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
- check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' AND variable_name != 'AUTO_INCREMENT_INCREMENT' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA
.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping,
mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
-check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDE
R BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.host, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zon
e, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.user; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
++check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDE
R BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.tim
e_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
connect testuser3, localhost, testuser3, , test;
SELECT * FROM information_schema.routines;
@@@ -221,7 -221,7 +221,7 @@@ sp_6_408002_2 def db_datadict_2 sp_6_40
SELECT * FROM db_datadict_2.res_6_408002_2;
END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
add_suppression def mtr add_suppression PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN INSERT INTO test_suppressions (pattern) VALUES (pattern); FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
- check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' AND variable_name != 'AUTO_INCREMENT_INCREMENT' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA
.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping,
mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
-check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDE
R BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.host, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zon
e, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.user; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
++check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDE
R BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.tim
e_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
connection default;
disconnect testuser1;
diff --cc mysql-test/suite/galera/r/galera_defaults.result
index d0eb22ffcbc,e7a2508c0f3..6dd5258ff6d
--- a/mysql-test/suite/galera/r/galera_defaults.result
+++ b/mysql-test/suite/galera/r/galera_defaults.result
@@@ -1,8 -1,6 +1,8 @@@
-SELECT COUNT(*) = 43 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%';
-COUNT(*) = 43
-0
+connection node_2;
+connection node_1;
+SELECT COUNT(*) `expect 48` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%';
+expect 48
- 48
++49
SELECT VARIABLE_NAME, VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME LIKE 'wsrep_%'
diff --cc mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf
index 7aac1662edd,477789175fb..a0c7e64af91
--- a/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf
+++ b/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf
@@@ -9,7 -9,9 +9,8 @@@ innodb-autoinc-lock-mode=
default-storage-engine=innodb
wsrep_gtid_mode=1
gtid_ignore_duplicates
+ auto_increment_increment=3
-wsrep-on=1
wsrep-provider=(a)ENV.WSREP_PROVIDER
wsrep_node_address=127.0.0.1
# enforce read-committed characteristics across the cluster
diff --cc mysql-test/suite/galera_3nodes/galera_3nodes.cnf
index ab7493e313b,e5aa81b8742..d33ed0caddf
--- a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf
+++ b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf
@@@ -5,7 -5,9 +5,8 @@@
binlog-format=row
innodb-autoinc-lock-mode=2
default-storage-engine=innodb
+ auto_increment_increment=3
-wsrep-on=1
wsrep-provider=(a)ENV.WSREP_PROVIDER
wsrep_node_address=127.0.0.1
# enforce read-committed characteristics across the cluster
diff --cc mysql-test/suite/galera_3nodes/r/galera_garbd.result
index 88bb3ca2ff9,fb7e729dc77..ebc5fdf33f4
--- a/mysql-test/suite/galera_3nodes/r/galera_garbd.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_garbd.result
@@@ -1,10 -1,8 +1,12 @@@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
- connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+ connection node_1;
+ connection node_2;
connection node_3;
Killing node #3 to free ports for garbd ...
+ connection node_3;
connection node_1;
Starting garbd ...
CREATE TABLE t1 (f1 INTEGER);
diff --cc mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result
index 8e6d27823f6,77991a6d468..cb327107e2a
--- a/mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result
@@@ -1,5 -1,7 +1,9 @@@
+connection node_2;
+connection node_1;
+ connection node_1;
+ connection node_2;
+ connection node_3;
+ connection node_1;
CREATE TABLE t1 (f1 INTEGER);
INSERT INTO t1 VALUES (1);
connection node_2;
diff --cc mysql-test/suite/galera_3nodes/t/galera_garbd.test
index 68e288c06c7,2d03e8897b9..aaa9ecc8083
--- a/mysql-test/suite/galera_3nodes/t/galera_garbd.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_garbd.test
@@@ -7,21 -7,20 +7,31 @@@
--source include/have_innodb.inc
--source include/big_test.inc
+# Save galera ports
+--connection node_1
+--source suite/galera/include/galera_base_port.inc
+--let $NODE_GALERAPORT_1 = $_NODE_GALERAPORT
+
+--connection node_2
+--source suite/galera/include/galera_base_port.inc
+--let $NODE_GALERAPORT_2 = $_NODE_GALERAPORT
+
- --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+ --let $galera_connection_name = node_3
+ --let $galera_server_number = 3
+ --source include/galera_connect.inc
+--source suite/galera/include/galera_base_port.inc
+--let $NODE_GALERAPORT_3 = $_NODE_GALERAPORT
- --connection node_3
+ # Save original auto_increment_offset values.
+ --let $node_1=node_1
+ --let $node_2=node_2
+ --let $node_3=node_3
+ --source ../galera/include/auto_increment_offset_save.inc
+
--echo Killing node #3 to free ports for garbd ...
+ --connection node_3
+ --let $gp3 = `SELECT SUBSTR(@@wsrep_provider_options, LOCATE('base_port =', @@wsrep_provider_options) + LENGTH('base_port = '))`
+ --let $galera_port_3 = `SELECT SUBSTR('$gp3', 1, LOCATE(';', '$gp3') - 1)`
--source include/shutdown_mysqld.inc
--connection node_1
diff --cc mysql-test/suite/galera_3nodes/t/galera_var_dirty_reads2.test
index 2ceda1ed352,e3f94a012b8..9f9d6da17b9
--- a/mysql-test/suite/galera_3nodes/t/galera_var_dirty_reads2.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_var_dirty_reads2.test
@@@ -106,8 -117,10 +117,11 @@@ SET GLOBAL wsrep_provider_options='gmca
--source include/wait_condition.inc
--connection node_2
---let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
+--source include/galera_wait_ready.inc
DROP TABLE t1;
+
+ # Restore original auto_increment_offset values.
+ --source ../galera/include/auto_increment_offset_restore.inc
diff --cc mysql-test/suite/innodb/r/undo_truncate_recover.result
index 018ac65537a,bcfc136e8c0..8ab41331950
--- a/mysql-test/suite/innodb/r/undo_truncate_recover.result
+++ b/mysql-test/suite/innodb/r/undo_truncate_recover.result
@@@ -9,6 -9,8 +9,7 @@@ update t1 set c = 'MariaDB'
update t1 set c = 'InnoDB';
set global debug_dbug = '+d,ib_undo_trunc';
commit;
+ call mtr.add_suppression("InnoDB: innodb_undo_tablespaces=0 disables dedicated undo log tablespaces");
-call mtr.add_suppression("InnoDB: The redo log transaction size ");
SET GLOBAL innodb_fast_shutdown=0;
FOUND 1 /ib_undo_trunc/ in mysqld.1.err
drop table t1;
diff --cc mysql-test/suite/innodb/t/undo_truncate_recover.test
index 5d680525c5b,c3fa698ff13..1da64497550
--- a/mysql-test/suite/innodb/t/undo_truncate_recover.test
+++ b/mysql-test/suite/innodb/t/undo_truncate_recover.test
@@@ -39,18 -38,14 +39,20 @@@ update t1 set c = 'MariaDB'
update t1 set c = 'InnoDB';
eval set global debug_dbug = '+d,$SEARCH_PATTERN';
commit;
+ call mtr.add_suppression("InnoDB: innodb_undo_tablespaces=0 disables dedicated undo log tablespaces");
-# FIXME: remove this work-around, and generate less log!
-call mtr.add_suppression("InnoDB: The redo log transaction size ");
SET GLOBAL innodb_fast_shutdown=0;
--source include/shutdown_mysqld.inc
--source include/search_pattern_in_file.inc
-# FIXME: remove this work-around, and generate less log!
---let $restart_parameters= --innodb-buffer-pool-size=16m --innodb-undo-tablespaces=1
++--let $restart_parameters= --innodb-undo-tablespaces=1
+if ($checksum_algorithm == "strict_full_crc32")
+{
- let $restart_parameters= --innodb_checksum_algorithm=strict_crc32;
++ let $restart_parameters= $restart_parameters --innodb_checksum_algorithm=strict_crc32;
+}
+
+if ($checksum_algorithm == "strict_crc32")
+{
- let $restart_parameters= --innodb_checksum_algorithm=strict_full_crc32;
++ let $restart_parameters= $restart_parameters --innodb_checksum_algorithm=strict_full_crc32;
+}
--source include/start_mysqld.inc
drop table t1;
diff --cc mysql-test/suite/perfschema/r/dml_setup_instruments.result
index e43841c80ac,a5184782af8..a972cf02285
--- a/mysql-test/suite/perfschema/r/dml_setup_instruments.result
+++ b/mysql-test/suite/perfschema/r/dml_setup_instruments.result
@@@ -16,10 -16,11 +16,12 @@@ wait/synch/mutex/sql/LOCK_after_binlog_
wait/synch/mutex/sql/LOCK_audit_mask YES YES
select * from performance_schema.setup_instruments
where name like 'Wait/Synch/Rwlock/sql/%'
- and name not in ('wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock')
+ and name not in (
+ 'wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock',
+ 'wait/synch/rwlock/sql/LOCK_named_pipe_full_access_group')
order by name limit 10;
NAME ENABLED TIMED
+wait/synch/rwlock/sql/LOCK_all_status_vars YES YES
wait/synch/rwlock/sql/LOCK_dboptions YES YES
wait/synch/rwlock/sql/LOCK_grant YES YES
wait/synch/rwlock/sql/LOCK_SEQUENCE YES YES
diff --cc plugin/aws_key_management/CMakeLists.txt
index b6f48cd18a0,e9e1b49d5f2..248d56e8d76
--- a/plugin/aws_key_management/CMakeLists.txt
+++ b/plugin/aws_key_management/CMakeLists.txt
@@@ -1,14 -1,174 +1,14 @@@
-# We build parts of AWS C++ SDK as CMake external project
-# The restrictions of the SDK (https://github.com/awslabs/aws-sdk-cpp/blob/master/README.md)
-# are
-
-# - OS : Windows,Linux or OSX
-# - C++11 compiler : VS2013+, gcc 4.8+, clang 3.3+
-# - libcurl development package needs to be present on Unixes
-#
-# If we build SDK outselves, we'll need require GIT to be present on the build machine
-
-
-# Give message why the building this plugin is skipped (only if -DVERBOSE is defined)
-# or if plugin is explicitly requested to build. Then bail out.
-MACRO(SKIP_AWS_PLUGIN msg)
- MESSAGE_ONCE(SKIP_AWS_PLUGIN "Skip aws_key_management - ${msg}")
+INCLUDE(aws_sdk)
+CHECK_AWS_SDK(HAVE_AWS_SDK REASON)
+IF(NOT HAVE_AWS_SDK)
+ MESSAGE_ONCE(AWS_KEY_MANAGEMENT_NO_AWS_SDK "Can't build aws_key_management - AWS SDK not available (${REASON})")
RETURN()
-ENDMACRO()
-SET(CMAKE_CXX_STANDARD 11)
-
-IF(NOT NOT_FOR_DISTRIBUTION)
- SKIP_AWS_PLUGIN("AWS SDK has Apache 2.0 License which is not complatible with GPLv2. Set -DNOT_FOR_DISTRIBUTION=ON if you need this plugin")
-ENDIF()
-
-# This plugin needs recent C++ compilers (AWS C++ SDK header files are using C++11 features)
-SET(CXX11_FLAGS)
-SET(OLD_COMPILER_MSG "AWS SDK requires c++11 -capable compiler (minimal supported versions are g++ 4.8, clang 3.3, VS2103)")
-
-IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
- EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
- IF (GCC_VERSION VERSION_LESS 4.8)
- SKIP_AWS_PLUGIN("${OLD_COMPILER_MSG}")
- ENDIF()
- SET(CXX11_FLAGS "-std=c++11")
-ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
- IF ((CMAKE_CXX_COMPILER_VERSION AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.3) OR
- (CLANG_VERSION_STRING AND CLANG_VERSION_STRING VERSION_LESS 3.3))
- SKIP_AWS_PLUGIN("${OLD_COMPILER_MSG}")
- ENDIF()
- SET(CXX11_FLAGS "-stdlib=libc++")
-ELSEIF(MSVC)
- IF (MSVC_VERSION LESS 1800)
- SKIP_AWS_PLUGIN("${OLD_COMPILER_MSG}")
- ENDIF()
-ELSE()
- SKIP_AWS_PLUGIN("Compiler not supported by AWS C++ SDK")
-ENDIF()
-
-IF (NOT(WIN32 OR APPLE OR (CMAKE_SYSTEM_NAME MATCHES "Linux")))
- SKIP_AWS_PLUGIN("OS unsupported by AWS SDK")
ENDIF()
+MYSQL_ADD_PLUGIN(aws_key_management
+ aws_key_management_plugin.cc
+ COMPONENT aws-key-management)
-
-FIND_LIBRARY(AWS_CPP_SDK_CORE NAMES aws-cpp-sdk-core PATH_SUFFIXES "${SDK_INSTALL_BINARY_PREFIX}")
-FIND_LIBRARY(AWS_CPP_SDK_KMS NAMES aws-cpp-sdk-kms PATH_SUFFIXES "${SDK_INSTALL_BINARY_PREFIX}")
-FIND_PATH(AWS_CPP_SDK_INCLUDE_DIR NAMES aws/kms/KMSClient.h)
-
-IF(AWS_CPP_SDK_CORE AND AWS_CPP_SDK_KMS AND AWS_CPP_SDK_INCLUDE_DIR)
- # AWS C++ SDK installed
- INCLUDE_DIRECTORIES(${AWS_CPP_SDK_INCLUDE_DIR})
- SET(AWS_SDK_LIBS ${AWS_CPP_SDK_CORE} ${AWS_CPP_SDK_KMS})
-ELSE()
- OPTION(AWS_SDK_EXTERNAL_PROJECT "Allow download and build AWS C++ SDK" OFF)
- IF(NOT AWS_SDK_EXTERNAL_PROJECT)
- SKIP_AWS_PLUGIN("AWS_SDK_EXTERNAL_PROJECT is not set")
- ENDIF()
- # Build from source, using ExternalProject_Add
- # AWS C++ SDK requires cmake 2.8.12
- IF(CMAKE_VERSION VERSION_LESS "2.8.12")
- SKIP_AWS_PLUGIN("CMake is too old")
- ENDIF()
- FIND_PACKAGE(Git)
- IF(NOT GIT_FOUND)
- SKIP_AWS_PLUGIN("no GIT")
- ENDIF()
- INCLUDE(ExternalProject)
- IF(UNIX)
- FIND_PACKAGE(CURL)
- IF(NOT CURL_FOUND)
- SKIP_AWS_PLUGIN("AWS C++ SDK requires libcurl development package")
- ENDIF()
- SET(PIC_FLAG -fPIC)
- FIND_PATH(UUID_INCLUDE_DIR uuid/uuid.h)
- IF(NOT UUID_INCLUDE_DIR)
- SKIP_AWS_PLUGIN("AWS C++ SDK requires uuid development package")
- ENDIF()
- IF(NOT APPLE)
- FIND_LIBRARY(UUID_LIBRARIES uuid)
- IF(NOT UUID_LIBRARIES)
- SKIP_AWS_PLUGIN("AWS C++ SDK requires uuid development package")
- ENDIF()
- FIND_PACKAGE(OpenSSL)
- IF(NOT OPENSSL_FOUND)
- SKIP_AWS_PLUGIN("AWS C++ SDK requires openssl development package")
- ENDIF()
- ENDIF()
- ENDIF()
- IF(MSVC)
- SET(EXTRA_SDK_CMAKE_FLAGS -DCMAKE_CXX_FLAGS_DEBUGOPT="" -DCMAKE_EXE_LINKER_FLAGS_DEBUGOPT="" "-DCMAKE_CXX_FLAGS=/wd4530 /wd4577 /WX-")
- ENDIF()
- IF(CMAKE_CXX_COMPILER)
- SET(EXTRA_SDK_CMAKE_FLAGS ${EXTRA_SDK_CMAKE_FLAGS} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER})
- ENDIF()
-
- SET(byproducts )
- # We do not need to build the whole SDK , just 2 of its libs
- set(AWS_SDK_LIBS aws-cpp-sdk-core aws-cpp-sdk-kms)
- FOREACH(lib ${AWS_SDK_LIBS})
- ADD_LIBRARY(${lib} STATIC IMPORTED GLOBAL)
- ADD_DEPENDENCIES(${lib} aws_sdk_cpp)
- SET(loc "${CMAKE_CURRENT_BINARY_DIR}/aws_sdk_cpp/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}")
- IF(CMAKE_VERSION VERSION_GREATER "3.1")
- SET(byproducts ${byproducts} BUILD_BYPRODUCTS ${loc})
- ENDIF()
- SET_TARGET_PROPERTIES(${lib} PROPERTIES IMPORTED_LOCATION ${loc})
- ENDFOREACH()
-
- # To be compatible with older cmake, we use older version of the SDK
- IF(CMAKE_VERSION LESS "3.0")
- SET(GIT_TAG "1.0.8")
- ELSE()
- SET(GIT_TAG "1.2.11")
- ENDIF()
-
- SET(AWS_SDK_PATCH_COMMAND )
- ExternalProject_Add(
- aws_sdk_cpp
- GIT_REPOSITORY "https://github.com/awslabs/aws-sdk-cpp.git"
- GIT_TAG ${GIT_TAG}
- UPDATE_COMMAND ""
- SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/aws-sdk-cpp"
- ${byproducts}
- CMAKE_ARGS
- -DBUILD_ONLY=kms
- -DBUILD_SHARED_LIBS=OFF
- -DFORCE_SHARED_CRT=OFF
- -DENABLE_TESTING=OFF
- "-DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG} ${PIC_FLAG}"
- "-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${PIC_FLAG}"
- "-DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE} ${PIC_FLAG}"
- "-DCMAKE_CXX_FLAGS_MINSIZEREL=${CMAKE_CXX_FLAGS_MINSIZEREL} ${PIC_FLAG}"
- ${EXTRA_SDK_CMAKE_FLAGS}
- -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/aws_sdk_cpp
- -DCMAKE_INSTALL_LIBDIR=lib
- TEST_COMMAND ""
- )
- SET_TARGET_PROPERTIES(aws_sdk_cpp PROPERTIES EXCLUDE_FROM_ALL TRUE)
-
- IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
- # Need whole-archive , otherwise static libraries are not linked
- SET(AWS_SDK_LIBS -Wl,--whole-archive ${AWS_SDK_LIBS} -Wl,--no-whole-archive)
- ENDIF()
- SET_TARGET_PROPERTIES(aws_sdk_cpp PROPERTIES EXCLUDE_FROM_ALL TRUE)
- INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/aws_sdk_cpp/include)
-ENDIF()
-
-ADD_DEFINITIONS(${SSL_DEFINES}) # Need to know whether openssl should be initialized
-IF(CMAKE_VERSION GREATER "3.0")
- SET(CMAKE_CXX_STANDARD 11)
-ELSE()
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_FLAGS}")
-ENDIF()
-IF(WIN32)
- SET(AWS_CPP_SDK_DEPENDENCIES bcrypt winhttp wininet userenv version)
-ELSE()
- SET(AWS_CPP_SDK_DEPENDENCIES ${OPENSSL_LIBRARIES} ${CURL_LIBRARIES} ${UUID_LIBRARIES})
-ENDIF()
-MYSQL_ADD_PLUGIN(aws_key_management aws_key_management_plugin.cc
- LINK_LIBRARIES ${AWS_SDK_LIBS} ${AWS_CPP_SDK_DEPENDENCIES}
- COMPONENT aws-key-management)
-
-IF (TARGET aws_key_management)
- SET(NON_DISTRIBUTABLE_WARNING "Apache 2.0" PARENT_SCOPE)
+IF(TARGET aws_key_management)
+ USE_AWS_SDK_LIBS(aws_key_management kms)
- ENDIF()
+ ENDIF()
diff --cc scripts/mysql_install_db.sh
index 54b5bed4546,52107405525..4ab486186f4
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@@ -37,10 -37,13 +37,13 @@@ force=
in_rpm=0
ip_only=0
cross_bootstrap=0
-auth_root_authentication_method=normal
-auth_root_socket_user='root'
+auth_root_authentication_method=socket
+auth_root_socket_user=""
skip_test_db=0
+ dirname0=`dirname $0 2>/dev/null`
+ dirname0=`dirname $dirname0 2>/dev/null`
+
usage()
{
cat <<EOF
@@@ -343,7 -345,16 +346,18 @@@ the
exit 1
fi
plugindir=`find_in_dirs --dir auth_socket.so $basedir/lib*/plugin $basedir/lib*/mysql/plugin`
+ pamtooldir=$plugindir
+ # relative from where the script was run for a relocatable install
+ elif test -n "$dirname0" -a -x "$rel_mysqld" -a ! "$rel_mysqld" -ef "@sbindir@/mysqld"
+ then
+ basedir="$dirname0"
+ bindir="$basedir/@INSTALL_BINDIR@"
+ resolveip="$bindir/resolveip"
+ mysqld="$rel_mysqld"
+ srcpkgdatadir="$basedir/@INSTALL_MYSQLSHAREDIR@"
+ buildpkgdatadir="$basedir/@INSTALL_MYSQLSHAREDIR@"
+ plugindir="$basedir/@INSTALL_PLUGINDIR@"
++ pamtooldir=$plugindir
else
basedir="@prefix@"
bindir="@bindir@"
diff --cc sql-common/client.c
index 69404e43613,160a85fd7b5..c66cb1a749d
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@@ -1375,10 -1634,16 +1381,12 @@@ mysql_init(MYSQL *mysql
--enable-local-infile
*/
- #if defined(ENABLED_LOCAL_INFILE) && !defined(MYSQL_SERVER)
+ #if ENABLED_LOCAL_INFILE && !defined(MYSQL_SERVER)
mysql->options.client_flag|= CLIENT_LOCAL_FILES;
+ mysql->auto_local_infile= ENABLED_LOCAL_INFILE == LOCAL_INFILE_MODE_AUTO
+ ? WAIT_FOR_QUERY : ALWAYS_ACCEPT;
#endif
-#ifdef HAVE_SMEM
- mysql->options.shared_memory_base_name= (char*) def_shared_memory_base_name;
-#endif
-
mysql->options.methods_to_use= MYSQL_OPT_GUESS_CONNECTION;
mysql->options.report_data_truncation= TRUE; /* default */
diff --cc sql/item.cc
index a6b4402b6ba,ada79fcb9df..47e10ba4004
--- a/sql/item.cc
+++ b/sql/item.cc
@@@ -1950,9 -2195,34 +1950,14 @@@ bool Item_name_const::is_null(
Item_name_const::Item_name_const(THD *thd, Item *name_arg, Item *val):
- Item(thd), value_item(val), name_item(name_arg)
+ Item_fixed_hybrid(thd), value_item(val), name_item(name_arg)
{
+ StringBuffer<128> name_buffer;
+ String *name_str;
Item::maybe_null= TRUE;
- valid_args= true;
- if (!name_item->basic_const_item() ||
- !(name_str= name_item->val_str(&name_buffer))) // Can't have a NULL name
- goto err;
- set_name(thd, name_str->ptr(), name_str->length(), name_str->charset());
-
- if (value_item->basic_const_item())
- return; // ok
-
- if (value_item->type() == FUNC_ITEM)
- {
- Item_func *value_func= (Item_func *) value_item;
- if (value_func->functype() != Item_func::COLLATE_FUNC &&
- value_func->functype() != Item_func::NEG_FUNC)
- goto err;
-
- if (value_func->key_item()->basic_const_item())
- return; // ok
- }
-
-err:
- valid_args= false;
- my_error(ER_WRONG_ARGUMENTS, MYF(0), "NAME_CONST");
++ if (name_item->basic_const_item() &&
++ (name_str= name_item->val_str(&name_buffer))) // Can't have a NULL name
++ set_name(thd, name_str->ptr(), name_str->length(), name_str->charset());
}
@@@ -1988,16 -2266,12 +1993,10 @@@ Item::Type Item_name_const::type() cons
bool Item_name_const::fix_fields(THD *thd, Item **ref)
{
- char buf[128];
- String *item_name;
- String s(buf, sizeof(buf), &my_charset_bin);
- s.length(0);
-
- if ((!value_item->fixed &&
- value_item->fix_fields(thd, &value_item)) ||
- (!name_item->fixed &&
- name_item->fix_fields(thd, &name_item)) ||
+ if (value_item->fix_fields_if_needed(thd, &value_item) ||
+ name_item->fix_fields_if_needed(thd, &name_item) ||
!value_item->const_item() ||
- !name_item->const_item() ||
- !(item_name= name_item->val_str(&s))) // Can't have a NULL name
+ !name_item->const_item())
{
my_error(ER_RESERVED_SYNTAX, MYF(0), "NAME_CONST");
return TRUE;
diff --cc sql/sql_binlog.cc
index 1fa3cca7c27,60de2923a8f..97b8e2e4f91
--- a/sql/sql_binlog.cc
+++ b/sql/sql_binlog.cc
@@@ -109,6 -109,64 +109,64 @@@ static int check_event_type(int type, R
}
}
+ /**
+ Copy fragments into the standard placeholder thd->lex->comment.str.
+
+ Compute the size of the (still) encoded total,
+ allocate and then copy fragments one after another.
+ The size can exceed max(max_allowed_packet) which is not a
+ problem as no String instance is created off this char array.
+
+ @param thd THD handle
+ @return
+ 0 at success,
+ -1 otherwise.
+ */
+ int binlog_defragment(THD *thd)
+ {
+ user_var_entry *entry[2];
+ LEX_CSTRING name[2]= { thd->lex->comment, thd->lex->ident };
+
+ /* compute the total size */
+ thd->lex->comment.str= NULL;
+ thd->lex->comment.length= 0;
+ for (uint k= 0; k < 2; k++)
+ {
+ entry[k]=
+ (user_var_entry*) my_hash_search(&thd->user_vars, (uchar*) name[k].str,
+ name[k].length);
+ if (!entry[k] || entry[k]->type != STRING_RESULT)
+ {
+ my_error(ER_WRONG_TYPE_FOR_VAR, MYF(0), name[k].str);
+ return -1;
+ }
+ thd->lex->comment.length += entry[k]->length;
+ }
+
+ thd->lex->comment.str= // to be freed by the caller
+ (char *) my_malloc(thd->lex->comment.length, MYF(MY_WME));
+ if (!thd->lex->comment.str)
+ {
- my_error(ER_OUTOFMEMORY, MYF(ME_FATALERROR), 1);
++ my_error(ER_OUTOFMEMORY, MYF(ME_FATAL), 1);
+ return -1;
+ }
+
+ /* fragments are merged into allocated buf while the user var:s get reset */
+ size_t gathered_length= 0;
+ for (uint k=0; k < 2; k++)
+ {
+ memcpy(const_cast<char*>(thd->lex->comment.str) + gathered_length, entry[k]->value,
+ entry[k]->length);
+ gathered_length += entry[k]->length;
+ update_hash(entry[k], true, NULL, 0, STRING_RESULT, &my_charset_bin, 0);
+ }
+
+ DBUG_ASSERT(gathered_length == thd->lex->comment.length);
+
+ return 0;
+ }
+
+
/**
Execute a BINLOG statement.
@@@ -171,14 -223,31 +223,31 @@@ void mysql_client_binlog_statement(THD
/*
Out of memory check
*/
- if (!(rli && buf))
+ if (!(rli))
{
- my_error(ER_OUTOFMEMORY, MYF(ME_FATALERROR), 1); /* needed 1 bytes */
+ my_error(ER_OUTOFMEMORY, MYF(ME_FATAL), 1); /* needed 1 bytes */
goto end;
}
DBUG_ASSERT(rli->belongs_to_client());
+ if (unlikely(is_fragmented= thd->lex->comment.str && thd->lex->ident.str))
+ if (binlog_defragment(thd))
+ goto end;
+
+ if (!(coded_len= thd->lex->comment.length))
+ {
+ my_error(ER_SYNTAX_ERROR, MYF(0));
+ goto end;
+ }
+
+ decoded_len= my_base64_needed_decoded_length((int)coded_len);
+ if (!(buf= (char *) my_malloc(decoded_len, MYF(MY_WME))))
+ {
- my_error(ER_OUTOFMEMORY, MYF(ME_FATALERROR), 1);
++ my_error(ER_OUTOFMEMORY, MYF(ME_FATAL), 1);
+ goto end;
+ }
+
for (char const *strptr= thd->lex->comment.str ;
strptr < thd->lex->comment.str + thd->lex->comment.length ; )
{
diff --cc sql/sql_class.h
index 88494f8c169,b1fc89db7f2..361340ee235
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@@ -4420,80 -4375,6 +4420,80 @@@ private
return raised;
}
+private:
+ void push_warning_truncated_priv(Sql_condition::enum_warning_level level,
+ uint sql_errno,
+ const char *type_str, const char *val)
+ {
+ DBUG_ASSERT(sql_errno == ER_TRUNCATED_WRONG_VALUE ||
+ sql_errno == ER_WRONG_VALUE);
+ char buff[MYSQL_ERRMSG_SIZE];
+ CHARSET_INFO *cs= &my_charset_latin1;
+ cs->cset->snprintf(cs, buff, sizeof(buff),
+ ER_THD(this, sql_errno), type_str, val);
+ /*
+ Note: the format string can vary between ER_TRUNCATED_WRONG_VALUE
+ and ER_WRONG_VALUE, but the code passed to push_warning() is
+ always ER_TRUNCATED_WRONG_VALUE. This is intentional.
+ */
+ push_warning(this, level, ER_TRUNCATED_WRONG_VALUE, buff);
+ }
+public:
+ void push_warning_truncated_wrong_value(Sql_condition::enum_warning_level level,
+ const char *type_str, const char *val)
+ {
+ return push_warning_truncated_priv(level, ER_TRUNCATED_WRONG_VALUE,
+ type_str, val);
+ }
+ void push_warning_wrong_value(Sql_condition::enum_warning_level level,
+ const char *type_str, const char *val)
+ {
+ return push_warning_truncated_priv(level, ER_WRONG_VALUE, type_str, val);
+ }
+ void push_warning_truncated_wrong_value(const char *type_str, const char *val)
+ {
+ return push_warning_truncated_wrong_value(Sql_condition::WARN_LEVEL_WARN,
+ type_str, val);
+ }
+ void push_warning_truncated_value_for_field(Sql_condition::enum_warning_level
+ level, const char *type_str,
+ const char *val,
+ const TABLE_SHARE *s,
+ const char *name)
+ {
+ DBUG_ASSERT(name);
+ char buff[MYSQL_ERRMSG_SIZE];
+ CHARSET_INFO *cs= &my_charset_latin1;
+ const char *db_name= s ? s->db.str : NULL;
- const char *table_name= s ? s->error_table_name() : NULL;
++ const char *table_name= s ? s->table_name.str : NULL;
+
+ if (!db_name)
+ db_name= "";
+ if (!table_name)
+ table_name= "";
+ cs->cset->snprintf(cs, buff, sizeof(buff),
+ ER_THD(this, ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
+ type_str, val, db_name, table_name, name,
+ (ulong) get_stmt_da()->current_row_for_warning());
+ push_warning(this, level, ER_TRUNCATED_WRONG_VALUE, buff);
+
+ }
+ void push_warning_wrong_or_truncated_value(Sql_condition::enum_warning_level level,
+ bool totally_useless_value,
+ const char *type_str,
+ const char *val,
+ const TABLE_SHARE *s,
+ const char *field_name)
+ {
+ if (field_name)
+ push_warning_truncated_value_for_field(level, type_str, val,
+ s, field_name);
+ else if (totally_useless_value)
+ push_warning_wrong_value(level, type_str, val);
+ else
+ push_warning_truncated_wrong_value(level, type_str, val);
+ }
+
public:
/** Overloaded to guard query/query_length fields */
virtual void set_statement(Statement *stmt);
diff --cc sql/sql_repl.cc
index 59f6a45a52f,fdca609f5af..7fc3bb5926d
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@@ -547,19 -556,29 +547,19 @@@ static my_bool adjust_callback(THD *thd
}
-bool log_in_use(const char* log_name)
+void adjust_linfo_offsets(my_off_t purge_offset)
{
- size_t log_name_len = strlen(log_name) + 1;
- THD *tmp;
- bool result = 0;
+ server_threads.iterate(adjust_callback, &purge_offset);
+}
- mysql_mutex_lock(&LOCK_thread_count);
- I_List_iterator<THD> it(threads);
- while ((tmp=it++))
- {
- LOG_INFO* linfo;
- if ((linfo = tmp->current_linfo))
- {
- mysql_mutex_lock(&linfo->lock);
- result = !strncmp(log_name, linfo->log_file_name, log_name_len);
- mysql_mutex_unlock(&linfo->lock);
- if (result)
- break;
- }
- }
-
- mysql_mutex_unlock(&LOCK_thread_count);
+static my_bool log_in_use_callback(THD *thd, const char *log_name)
+{
+ my_bool result= 0;
+ mysql_mutex_lock(&thd->LOCK_thd_data);
+ if (auto linfo= thd->current_linfo)
- result= !memcmp(log_name, linfo->log_file_name, strlen(log_name) + 1);
++ result= !strcmp(log_name, linfo->log_file_name);
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
return result;
}
diff --cc sql/sql_table.cc
index 4dd9d43a7b9,7f2003b765b..a3f1f616edd
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@@ -9762,12 -9818,11 +9786,12 @@@ do_continue:
/* Mark that we have created table in storage engine. */
no_ha_table= false;
+ /* Open the table since we need to copy the data. */
- new_table= thd->create_and_open_tmp_table(new_db_type, &frm,
- alter_ctx.get_tmp_path(),
- alter_ctx.new_db.str,
- alter_ctx.tmp_name.str,
- true, true);
+ new_table=
+ thd->create_and_open_tmp_table(new_db_type, &frm, alter_ctx.get_tmp_path(),
+ alter_ctx.new_db.str,
+ alter_ctx.new_name.str,
+ true, true);
if (!new_table)
goto err_new_table_cleanup;
@@@ -10687,9 -10732,12 +10710,12 @@@ bool mysql_checksum_table(THD *thd, TAB
{
/* calculating table's checksum */
ha_checksum crc= 0;
- uchar null_mask=256 - (1 << t->s->last_null_bit_pos);
+ DBUG_ASSERT(t->s->last_null_bit_pos < 8);
+ uchar null_mask= (t->s->last_null_bit_pos ?
+ (256 - (1 << t->s->last_null_bit_pos)):
+ 0);
- t->use_all_columns();
+ t->use_all_stored_columns();
if (t->file->ha_rnd_init(1))
protocol->store_null();
diff --cc sql/table.cc
index 7682119c241,10543a1b4f0..75f5a464186
--- a/sql/table.cc
+++ b/sql/table.cc
@@@ -5449,8 -5292,8 +5449,8 @@@ int TABLE::verify_constraints(bool igno
}
field_error.append((*chk)->name.str);
my_error(ER_CONSTRAINT_FAILED,
- MYF(ignore_failure ? ME_JUST_WARNING : 0), field_error.c_ptr(),
+ MYF(ignore_failure ? ME_WARNING : 0), field_error.c_ptr(),
- s->db.str, s->error_table_name());
+ s->db.str, s->table_name.str);
return ignore_failure ? VIEW_CHECK_SKIP : VIEW_CHECK_ERROR;
}
}
diff --cc sql/wsrep_mysqld.h
index dc2793c384d,cca66922a24..d12cc835136
--- a/sql/wsrep_mysqld.h
+++ b/sql/wsrep_mysqld.h
@@@ -20,25 -23,15 +20,26 @@@
#ifdef WITH_WSREP
+#include <mysql/plugin.h>
+#include "mysql/service_wsrep.h"
+
+#include <my_global.h>
+#include <my_pthread.h>
+#include "log.h"
+#include "mysqld.h"
+
typedef struct st_mysql_show_var SHOW_VAR;
#include <sql_priv.h>
-//#include "rpl_gtid.h"
-#include "../wsrep/wsrep_api.h"
#include "mdl.h"
-#include "mysqld.h"
#include "sql_table.h"
+ #include "wsrep_mysqld_c.h"
+#include "wsrep/provider.hpp"
+#include "wsrep/streaming_context.hpp"
+#include "wsrep_api.h"
+#include <vector>
+#include "wsrep_server_state.h"
+
#define WSREP_UNDEFINED_TRX_ID ULONGLONG_MAX
class set_var;
diff --cc storage/innobase/handler/handler0alter.cc
index 307374ec700,d3907f2d05e..b1dc295206a
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@@ -10176,12 -9087,12 +10191,13 @@@ commit_try_norebuild
after a successful commit_try_norebuild() call.
@param ha_alter_info algorithm=inplace context
@param ctx In-place ALTER TABLE context for the current partition
+@param altered_table the TABLE after the ALTER
@param table the TABLE before the ALTER
@param trx Data dictionary transaction
- (will be started and committed, for DROP INDEX) */
+ (will be started and committed, for DROP INDEX)
+ @return whether all replacements were found for dropped indexes */
inline MY_ATTRIBUTE((nonnull))
- void
+ bool
commit_cache_norebuild(
/*===================*/
Alter_inplace_info* ha_alter_info,
@@@ -11009,12 -9869,20 +11015,21 @@@ foreign_fail
m_user_thd,
Sql_condition::WARN_LEVEL_WARN,
ER_ALTER_INFO,
- "InnoDB: Could not add foreign"
- " key constraints.");
- } else {
- commit_cache_norebuild(ha_alter_info, ctx,
- altered_table,
- table, trx);
+ "failed to load FOREIGN KEY"
+ " constraints");
+ }
+ } else {
+ bool fk_fail = innobase_update_foreign_cache(
+ ctx, m_user_thd) != DB_SUCCESS;
+
- if (!commit_cache_norebuild(ha_alter_info, ctx, table,
++ if (!commit_cache_norebuild(ha_alter_info, ctx,
++ altered_table, table,
+ trx)) {
+ fk_fail = true;
+ }
+
+ if (fk_fail && m_prebuilt->trx->check_foreigns) {
+ goto foreign_fail;
}
}
1
0
[Commits] af2ebf62cb3: MDEV-18601: Can't create table with ENCRYPTED=DEFAULT when innodb_default_encryption_key_id!=1
by jan 21 Feb '19
by jan 21 Feb '19
21 Feb '19
revision-id: af2ebf62cb332205282d4f34d79850f80b0eedb4 (mariadb-10.1.38-6-gaf2ebf62cb3)
parent(s): 98e185ee373310291825fe6ac87f45afe6a3ccf7
author: Jan Lindström
committer: Jan Lindström
timestamp: 2019-02-21 14:47:53 +0200
message:
MDEV-18601: Can't create table with ENCRYPTED=DEFAULT when innodb_default_encryption_key_id!=1
innodb_check_default_encryption_key_id
Add a new function to check that provided innodb_default_encryption_key_id
is found from key file if it is not same as system default. We need to
accept system default here as it is used e.g. when no encryption configuration
is set.
ha_innobase::check_table_options
Used encryption key_id must be found from key file even
when encryption is disabled by table options or default
encryption is used and encryption is disabled. This is
because encryption can be enabled later and it is possible
only if all existing tables use key_id that is found
from key file. Again we need to accept system default
as it is used on default table creation.
innodb_var_default_encryption_key_id
New test to test variable innodb_default_encryption_key_id
---
.../encryption/r/innodb-encryption-alter.result | 69 +++++-----
.../encryption/r/innodb-page_encryption.result | 2 +-
.../r/innodb_var_default_encryption_key_id.result | 144 +++++++++++++++++++++
.../encryption/t/innodb-encryption-alter.test | 29 +++--
.../t/innodb_var_default_encryption_key_id.test | 101 +++++++++++++++
storage/innobase/handler/ha_innodb.cc | 95 ++++++++++----
storage/xtradb/handler/ha_innodb.cc | 97 ++++++++++----
7 files changed, 438 insertions(+), 99 deletions(-)
diff --git a/mysql-test/suite/encryption/r/innodb-encryption-alter.result b/mysql-test/suite/encryption/r/innodb-encryption-alter.result
index 5245d1da7d0..038e2a2fd47 100644
--- a/mysql-test/suite/encryption/r/innodb-encryption-alter.result
+++ b/mysql-test/suite/encryption/r/innodb-encryption-alter.result
@@ -3,24 +3,18 @@ SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_encrypt_tables = ON;
SET GLOBAL innodb_encryption_threads = 4;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=NO ENCRYPTION_KEY_ID=4;
-Warnings:
-Warning 140 InnoDB: Ignored ENCRYPTION_KEY_ID 4 when encryption is disabled
DROP TABLE t1;
set innodb_default_encryption_key_id = 99;
+Warnings:
+Warning 1210 InnoDB: Ignored innodb_default_encryption_key_id=99 as it is not available in the key file. Using default=1.
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB;
-ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
-Warning 140 InnoDB: ENCRYPTION_KEY_ID 99 not available
-Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
-Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
+DROP TABLE t1;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=YES;
-ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
-Warning 140 InnoDB: ENCRYPTION_KEY_ID 99 not available
-Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
-Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
+DROP TABLE t1;
set innodb_default_encryption_key_id = 4;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=YES;
SHOW CREATE TABLE t1;
@@ -40,50 +34,57 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`pk`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `ENCRYPTION_KEY_ID`=4
CREATE TABLE t2 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=NO ENCRYPTION_KEY_ID=1;
-Warnings:
-Warning 140 InnoDB: Ignored ENCRYPTION_KEY_ID 1 when encryption is disabled
ALTER TABLE t1 ENCRYPTION_KEY_ID=99;
ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID'
SHOW WARNINGS;
Level Code Message
-Warning 140 InnoDB: ENCRYPTION_KEY_ID 99 not available
+Warning 140 InnoDB: ENCRYPTION_KEY_ID=99 not available
Error 1478 Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID'
set innodb_default_encryption_key_id = 1;
drop table t1,t2;
+set innodb_default_encryption_key_id = 10;
SET GLOBAL innodb_encrypt_tables=OFF;
CREATE TABLE t1 (a int not null primary key) engine=innodb;
ALTER TABLE t1 ENCRYPTION_KEY_ID=4;
-ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID'
-SHOW WARNINGS;
-Level Code Message
-Warning 140 InnoDB: innodb_encrypt_tables=OFF only allows ENCRYPTION_KEY_ID=1
-Error 1478 Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID'
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `ENCRYPTION_KEY_ID`=4
DROP TABLE t1;
-CREATE TABLE t2 (a int not null primary key) engine=innodb;
-ALTER TABLE t2 ENCRYPTION_KEY_ID=4, ALGORITHM=COPY;
-ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
+CREATE TABLE t1 (a int not null primary key) engine=innodb ENCRYPTION_KEY_ID=4;
SHOW WARNINGS;
Level Code Message
-Warning 140 InnoDB: innodb_encrypt_tables=OFF only allows ENCRYPTION_KEY_ID=1
-Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
-Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
-SHOW CREATE TABLE t2;
+SHOW CREATE TABLE t1;
Table Create Table
-t2 CREATE TABLE `t2` (
+t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-DROP TABLE t2;
-CREATE TABLE t3 (a int not null primary key) engine=innodb ENCRYPTION_KEY_ID=4;
-ERROR HY000: Can't create table `test`.`t3` (errno: 140 "Wrong create options")
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `ENCRYPTION_KEY_ID`=4
+ALTER TABLE t1 ENCRYPTION_KEY_ID=10;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `ENCRYPTION_KEY_ID`=10
+DROP TABLE t1;
+CREATE TABLE t1 (a int not null primary key) engine=innodb ENCRYPTED=NO ENCRYPTION_KEY_ID=10;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `ENCRYPTED`=NO `ENCRYPTION_KEY_ID`=10
SHOW WARNINGS;
Level Code Message
-Warning 140 InnoDB: innodb_encrypt_tables=OFF only allows ENCRYPTION_KEY_ID=1
-Error 1005 Can't create table `test`.`t3` (errno: 140 "Wrong create options")
-Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
+ALTER TABLE t1 ENCRYPTION_KEY_ID=1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `ENCRYPTED`=NO `ENCRYPTION_KEY_ID`=1
+DROP TABLE t1;
+set innodb_default_encryption_key_id = 1;
diff --git a/mysql-test/suite/encryption/r/innodb-page_encryption.result b/mysql-test/suite/encryption/r/innodb-page_encryption.result
index c4814983af4..37c4d6caab1 100644
--- a/mysql-test/suite/encryption/r/innodb-page_encryption.result
+++ b/mysql-test/suite/encryption/r/innodb-page_encryption.result
@@ -13,7 +13,7 @@ create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_f
ERROR HY000: Can't create table `test`.`innodb_dynamic` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
-Warning 140 InnoDB: ENCRYPTION_KEY_ID 3 not available
+Warning 140 InnoDB: ENCRYPTION_KEY_ID=3 not available
Error 1005 Can't create table `test`.`innodb_dynamic` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=33;
diff --git a/mysql-test/suite/encryption/r/innodb_var_default_encryption_key_id.result b/mysql-test/suite/encryption/r/innodb_var_default_encryption_key_id.result
new file mode 100644
index 00000000000..f2af1b86b75
--- /dev/null
+++ b/mysql-test/suite/encryption/r/innodb_var_default_encryption_key_id.result
@@ -0,0 +1,144 @@
+SET @global_start_value = @@global.innodb_default_encryption_key_id;
+SELECT @global_start_value;
+@global_start_value
+1
+SET @@global.innodb_default_encryption_key_id = DEFAULT;
+SELECT @@global.innodb_default_encryption_key_id;
+@@global.innodb_default_encryption_key_id
+1
+SELECT @@innodb_default_encryption_key_id;
+@@innodb_default_encryption_key_id
+1
+SET @@global.innodb_default_encryption_key_id = 4;
+SELECT @@global.innodb_default_encryption_key_id;
+@@global.innodb_default_encryption_key_id
+4
+SET @@global.innodb_default_encryption_key_id = 0;
+ERROR 42000: Variable 'innodb_default_encryption_key_id' can't be set to the value of '0'
+SET @@global.innodb_default_encryption_key_id = -1;
+ERROR 42000: Variable 'innodb_default_encryption_key_id' can't be set to the value of '-1'
+SET @@global.innodb_default_encryption_key_id = 4294967296;
+ERROR 42000: Variable 'innodb_default_encryption_key_id' can't be set to the value of '4294967296'
+SET @@global.innodb_default_encryption_key_id = "t";
+ERROR 42000: Incorrect argument type to variable 'innodb_default_encryption_key_id'
+SET @@global.innodb_default_encryption_key_id = NULL;
+ERROR 42000: Incorrect argument type to variable 'innodb_default_encryption_key_id'
+SET @@global.innodb_default_encryption_key_id = 99;
+Warnings:
+Warning 1210 InnoDB: Ignored innodb_default_encryption_key_id=99 as it is not available in the key file. Using default=1.
+SELECT @@global.innodb_default_encryption_key_id;
+@@global.innodb_default_encryption_key_id
+1
+SET @@global.innodb_default_encryption_key_id = 4294967295;
+Warnings:
+Warning 1210 InnoDB: Ignored innodb_default_encryption_key_id=4294967295 as it is not available in the key file. Using default=1.
+SELECT @@global.innodb_default_encryption_key_id;
+@@global.innodb_default_encryption_key_id
+1
+SELECT @@global.innodb_default_encryption_key_id =
+VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_default_encryption_key_id';
+@@global.innodb_default_encryption_key_id =
+VARIABLE_VALUE
+1
+SELECT @@global.innodb_default_encryption_key_id;
+@@global.innodb_default_encryption_key_id
+1
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_default_encryption_key_id';
+VARIABLE_VALUE
+1
+SET @@global.innodb_default_encryption_key_id = @global_start_value;
+SELECT @@global.innodb_default_encryption_key_id;
+@@global.innodb_default_encryption_key_id
+1
+select @@global.innodb_default_encryption_key_id;
+@@global.innodb_default_encryption_key_id
+1
+select @@session.innodb_default_encryption_key_id;
+@@session.innodb_default_encryption_key_id
+1
+create table t1(a int not null primary key) engine=innodb encrypted=yes;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes
+create table t2(a int not null primary key) engine=innodb encrypted=no;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=no
+create table t3(a int not null primary key) engine=innodb;
+show create table t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+set session innodb_default_encryption_key_id = 2;
+select @@global.innodb_default_encryption_key_id;
+@@global.innodb_default_encryption_key_id
+1
+select @@session.innodb_default_encryption_key_id;
+@@session.innodb_default_encryption_key_id
+2
+create table t11(a int not null primary key) engine=innodb encrypted=yes;
+show create table t11;
+Table Create Table
+t11 CREATE TABLE `t11` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes `ENCRYPTION_KEY_ID`=2
+create table t12(a int not null primary key) engine=innodb encrypted=no;
+show create table t12;
+Table Create Table
+t12 CREATE TABLE `t12` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=no `ENCRYPTION_KEY_ID`=2
+create table t13(a int not null primary key) engine=innodb;
+show create table t13;
+Table Create Table
+t13 CREATE TABLE `t13` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `ENCRYPTION_KEY_ID`=2
+set session innodb_default_encryption_key_id = 4;
+select @@global.innodb_default_encryption_key_id;
+@@global.innodb_default_encryption_key_id
+1
+select @@session.innodb_default_encryption_key_id;
+@@session.innodb_default_encryption_key_id
+4
+create table t21(a int not null primary key) engine=innodb encrypted=yes;
+show create table t21;
+Table Create Table
+t21 CREATE TABLE `t21` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes `ENCRYPTION_KEY_ID`=4
+create table t22(a int not null primary key) engine=innodb encrypted=no;
+show create table t22;
+Table Create Table
+t22 CREATE TABLE `t22` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=no `ENCRYPTION_KEY_ID`=4
+create table t23(a int not null primary key) engine=innodb;
+show create table t23;
+Table Create Table
+t23 CREATE TABLE `t23` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `ENCRYPTION_KEY_ID`=4
+select @@global.innodb_default_encryption_key_id;
+@@global.innodb_default_encryption_key_id
+1
+select @@session.innodb_default_encryption_key_id;
+@@session.innodb_default_encryption_key_id
+1
+drop table t1,t2,t3,t11,t12,t13,t21,t22,t23;
diff --git a/mysql-test/suite/encryption/t/innodb-encryption-alter.test b/mysql-test/suite/encryption/t/innodb-encryption-alter.test
index 9465226dd96..d1a856a0011 100644
--- a/mysql-test/suite/encryption/t/innodb-encryption-alter.test
+++ b/mysql-test/suite/encryption/t/innodb-encryption-alter.test
@@ -20,12 +20,12 @@ SET GLOBAL innodb_encryption_threads = 4;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=NO ENCRYPTION_KEY_ID=4;
DROP TABLE t1;
set innodb_default_encryption_key_id = 99;
---error 1005
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB;
SHOW WARNINGS;
---error 1005
+DROP TABLE t1;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=YES;
SHOW WARNINGS;
+DROP TABLE t1;
set innodb_default_encryption_key_id = 4;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=YES;
SHOW CREATE TABLE t1;
@@ -89,27 +89,30 @@ drop table t1,t2;
#
# MDEV-17230: encryption_key_id from alter is ignored by encryption threads
+# MDEV-18601: Can't create table with ENCRYPTED=DEFAULT when innodb_default_encryption_key_id!=1
#
+set innodb_default_encryption_key_id = 10;
SET GLOBAL innodb_encrypt_tables=OFF;
CREATE TABLE t1 (a int not null primary key) engine=innodb;
---error ER_ILLEGAL_HA_CREATE_OPTION
ALTER TABLE t1 ENCRYPTION_KEY_ID=4;
-SHOW WARNINGS;
SHOW CREATE TABLE t1;
DROP TABLE t1;
-CREATE TABLE t2 (a int not null primary key) engine=innodb;
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
---error ER_CANT_CREATE_TABLE
-ALTER TABLE t2 ENCRYPTION_KEY_ID=4, ALGORITHM=COPY;
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
+CREATE TABLE t1 (a int not null primary key) engine=innodb ENCRYPTION_KEY_ID=4;
SHOW WARNINGS;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 ENCRYPTION_KEY_ID=10;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
---error ER_CANT_CREATE_TABLE
-CREATE TABLE t3 (a int not null primary key) engine=innodb ENCRYPTION_KEY_ID=4;
+CREATE TABLE t1 (a int not null primary key) engine=innodb ENCRYPTED=NO ENCRYPTION_KEY_ID=10;
+SHOW CREATE TABLE t1;
SHOW WARNINGS;
+ALTER TABLE t1 ENCRYPTION_KEY_ID=1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+set innodb_default_encryption_key_id = 1;
# reset system
--disable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb_var_default_encryption_key_id.test b/mysql-test/suite/encryption/t/innodb_var_default_encryption_key_id.test
new file mode 100644
index 00000000000..779bcc5300b
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb_var_default_encryption_key_id.test
@@ -0,0 +1,101 @@
+-- source include/have_innodb.inc
+-- source include/have_file_key_management_plugin.inc
+
+--disable_query_log
+SET @global_file_format = @@global.innodb_file_format;
+SET @global_file_per_table = @@global.innodb_file_per_table;
+--enable_query_log
+
+--disable_query_log
+--disable_warnings
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+--enable_warnings
+--enable_query_log
+
+SET @global_start_value = @@global.innodb_default_encryption_key_id;
+SELECT @global_start_value;
+
+SET @@global.innodb_default_encryption_key_id = DEFAULT;
+SELECT @@global.innodb_default_encryption_key_id;
+SELECT @@innodb_default_encryption_key_id;
+
+SET @@global.innodb_default_encryption_key_id = 4;
+SELECT @@global.innodb_default_encryption_key_id;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.innodb_default_encryption_key_id = 0;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.innodb_default_encryption_key_id = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.innodb_default_encryption_key_id = 4294967296;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_default_encryption_key_id = "t";
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_default_encryption_key_id = NULL;
+
+SET @@global.innodb_default_encryption_key_id = 99;
+SELECT @@global.innodb_default_encryption_key_id;
+
+SET @@global.innodb_default_encryption_key_id = 4294967295;
+SELECT @@global.innodb_default_encryption_key_id;
+
+SELECT @@global.innodb_default_encryption_key_id =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_default_encryption_key_id';
+SELECT @@global.innodb_default_encryption_key_id;
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_default_encryption_key_id';
+
+SET @@global.innodb_default_encryption_key_id = @global_start_value;
+SELECT @@global.innodb_default_encryption_key_id;
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+
+--connection default
+select @@global.innodb_default_encryption_key_id;
+select @@session.innodb_default_encryption_key_id;
+create table t1(a int not null primary key) engine=innodb encrypted=yes;
+show create table t1;
+create table t2(a int not null primary key) engine=innodb encrypted=no;
+show create table t2;
+create table t3(a int not null primary key) engine=innodb;
+show create table t3;
+
+--connection con1
+set session innodb_default_encryption_key_id = 2;
+select @@global.innodb_default_encryption_key_id;
+select @@session.innodb_default_encryption_key_id;
+create table t11(a int not null primary key) engine=innodb encrypted=yes;
+show create table t11;
+create table t12(a int not null primary key) engine=innodb encrypted=no;
+show create table t12;
+create table t13(a int not null primary key) engine=innodb;
+show create table t13;
+
+--connection con2
+set session innodb_default_encryption_key_id = 4;
+select @@global.innodb_default_encryption_key_id;
+select @@session.innodb_default_encryption_key_id;
+create table t21(a int not null primary key) engine=innodb encrypted=yes;
+show create table t21;
+create table t22(a int not null primary key) engine=innodb encrypted=no;
+show create table t22;
+create table t23(a int not null primary key) engine=innodb;
+show create table t23;
+
+--connection default
+select @@global.innodb_default_encryption_key_id;
+select @@session.innodb_default_encryption_key_id;
+--disconnect con1
+--disconnect con2
+drop table t1,t2,t3,t11,t12,t13,t21,t22,t23;
+
+--disable_query_log
+--disable_warnings
+SET @@global.innodb_file_format = @global_file_format;
+SET @@global.innodb_file_per_table = @global_file_per_table;
+SET @@global.innodb_default_encryption_key_id = @global_start_value;
+--disable_warnings
+--enable_warnings
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 472fb86288f..326b4136861 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -686,9 +686,58 @@ static int mysql_tmpfile_path(const char *path, const char *prefix)
static void innodb_remember_check_sysvar_funcs();
mysql_var_check_func check_sysvar_enum;
+/*************************************************************//**
+Check whether provided innodb_default_encryption_key_id is
+found from key file if it is not same as system default.
+This function is registered as a callback with MySQL.
+@return 0 for valid key_id */
+static int innodb_check_default_encryption_key_id(
+ THD* thd, /*!< in: thread handle */
+ struct st_mysql_sys_var* var, /*!< in: pointer to system
+ variable */
+ void* save, /*!< out: immediate result
+ for update function */
+ struct st_mysql_value* value) /*!< in: incoming value */
+{
+ long long intbuf;
+ uint key_id;
+
+ if (value->val_int(value, &intbuf)) {
+ /* The value is NULL. That is invalid. */
+ return(1);
+ }
+
+ if (intbuf < 1 || intbuf > UINT_MAX32) {
+ /* Invalid value */
+ return(1);
+ }
+
+ key_id = static_cast<uint>(intbuf);
+
+ if (key_id != FIL_DEFAULT_ENCRYPTION_KEY) {
+ /* If user has requested key_id that is not same as
+ system default check that key is found from key file.
+ If it is not found fall back to default. */
+ if (!encryption_key_id_exists(key_id)) {
+ push_warning_printf(
+ thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WRONG_ARGUMENTS,
+ "InnoDB: Ignored innodb_default_encryption_key_id=%u as "
+ "it is not available in the key file. Using default=1.",
+ key_id
+ );
+
+ key_id = FIL_DEFAULT_ENCRYPTION_KEY;
+ }
+ }
+
+ *reinterpret_cast<ulint*>(save) = key_id;
+ return (0);
+}
+
static MYSQL_THDVAR_UINT(default_encryption_key_id, PLUGIN_VAR_RQCMDARG,
"Default encryption key id used for table encryption.",
- NULL, NULL,
+ innodb_check_default_encryption_key_id, NULL,
FIL_DEFAULT_ENCRYPTION_KEY, 1, UINT_MAX32, 0);
/**
@@ -11944,41 +11993,37 @@ ha_innobase::check_table_options(
/* If encryption is set up make sure that used key_id is found */
if (encrypt == FIL_ENCRYPTION_ON ||
(encrypt == FIL_ENCRYPTION_DEFAULT && srv_encrypt_tables)) {
- if (!encryption_key_id_exists((unsigned int)options->encryption_key_id)) {
+ if (!encryption_key_id_exists(options->encryption_key_id)) {
push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN,
HA_WRONG_CREATE_OPTION,
- "InnoDB: ENCRYPTION_KEY_ID %u not available",
- (uint)options->encryption_key_id
+ "InnoDB: ENCRYPTION_KEY_ID=%u not available",
+ options->encryption_key_id
);
return "ENCRYPTION_KEY_ID";
}
}
- /* Ignore nondefault key_id if encryption is set off */
- if (encrypt == FIL_ENCRYPTION_OFF &&
- options->encryption_key_id != THDVAR(thd, default_encryption_key_id)) {
- push_warning_printf(
- thd, Sql_condition::WARN_LEVEL_WARN,
- HA_WRONG_CREATE_OPTION,
- "InnoDB: Ignored ENCRYPTION_KEY_ID %u when encryption is disabled",
- (uint)options->encryption_key_id
- );
- options->encryption_key_id = FIL_DEFAULT_ENCRYPTION_KEY;
- }
-
- /* If default encryption is used and encryption is disabled, you may
- not use nondefault encryption_key_id as it is not stored anywhere. */
- if (encrypt == FIL_ENCRYPTION_DEFAULT
- && !srv_encrypt_tables
+ /* Used encryption key_id must be found from key file even
+ when encryption is disabled by table options or default
+ encryption is used and encryption is disabled. This is
+ because encryption can be enabled later and it is possible
+ only if all existing tables use key_id that is found
+ from key file. */
+ if ((encrypt == FIL_ENCRYPTION_OFF
+ || (encrypt == FIL_ENCRYPTION_DEFAULT && !srv_encrypt_tables))
&& options->encryption_key_id != FIL_DEFAULT_ENCRYPTION_KEY) {
compile_time_assert(FIL_DEFAULT_ENCRYPTION_KEY == 1);
- push_warning_printf(
- thd, Sql_condition::WARN_LEVEL_WARN,
- HA_WRONG_CREATE_OPTION,
- "InnoDB: innodb_encrypt_tables=OFF only allows ENCRYPTION_KEY_ID=1"
+ if (!encryption_key_id_exists(options->encryption_key_id)) {
+
+ push_warning_printf(
+ thd, Sql_condition::WARN_LEVEL_WARN,
+ HA_WRONG_CREATE_OPTION,
+ "InnoDB: ENCRYPTION_KEY_ID=%u not available",
+ options->encryption_key_id
);
- return "ENCRYPTION_KEY_ID";
+ return "ENCRYPTION_KEY_ID";
+ }
}
/* Check atomic writes requirements */
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index c9db941b4bf..66ad3544030 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -5,7 +5,7 @@ Copyright (c) 2013, 2018, MariaDB Corporation.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2018, MariaDB Corporation.
+Copyright (c) 2013, 2019, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -687,9 +687,58 @@ ib_cb_t innodb_api_cb[] = {
static void innodb_remember_check_sysvar_funcs();
mysql_var_check_func check_sysvar_enum;
+/*************************************************************//**
+Check whether provided innodb_default_encryption_key_id is
+found from key file if it is not same as system default.
+This function is registered as a callback with MySQL.
+@return 0 for valid key_id */
+static int innodb_check_default_encryption_key_id(
+ THD* thd, /*!< in: thread handle */
+ struct st_mysql_sys_var* var, /*!< in: pointer to system
+ variable */
+ void* save, /*!< out: immediate result
+ for update function */
+ struct st_mysql_value* value) /*!< in: incoming value */
+{
+ long long intbuf;
+ uint key_id;
+
+ if (value->val_int(value, &intbuf)) {
+ /* The value is NULL. That is invalid. */
+ return(1);
+ }
+
+ if (intbuf < 1 || intbuf > UINT_MAX32) {
+ /* Invalid value */
+ return(1);
+ }
+
+ key_id = static_cast<uint>(intbuf);
+
+ if (key_id != FIL_DEFAULT_ENCRYPTION_KEY) {
+ /* If user has requested key_id that is not same as
+ system default check that key is found from key file.
+ If it is not found fall back to default. */
+ if (!encryption_key_id_exists(key_id)) {
+ push_warning_printf(
+ thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WRONG_ARGUMENTS,
+ "InnoDB: Ignored innodb_default_encryption_key_id=%u as "
+ "it is not available in the key file. Using default=1.",
+ key_id
+ );
+
+ key_id = FIL_DEFAULT_ENCRYPTION_KEY;
+ }
+ }
+
+ *reinterpret_cast<ulint*>(save) = key_id;
+ return (0);
+}
+
static MYSQL_THDVAR_UINT(default_encryption_key_id, PLUGIN_VAR_RQCMDARG,
"Default encryption key id used for table encryption.",
- NULL, NULL,
+ innodb_check_default_encryption_key_id, NULL,
FIL_DEFAULT_ENCRYPTION_KEY, 1, UINT_MAX32, 0);
/**
@@ -12510,42 +12559,38 @@ ha_innobase::check_table_options(
/* If encryption is set up make sure that used key_id is found */
if (encrypt == FIL_ENCRYPTION_ON ||
(encrypt == FIL_ENCRYPTION_DEFAULT && srv_encrypt_tables)) {
- if (!encryption_key_id_exists((unsigned int)options->encryption_key_id)) {
+ if (!encryption_key_id_exists(options->encryption_key_id)) {
push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN,
HA_WRONG_CREATE_OPTION,
- "InnoDB: ENCRYPTION_KEY_ID %u not available",
- (uint)options->encryption_key_id
+ "InnoDB: ENCRYPTION_KEY_ID=%u not available",
+ options->encryption_key_id
);
return "ENCRYPTION_KEY_ID";
}
}
- /* Ignore nondefault key_id if encryption is set off */
- if (encrypt == FIL_ENCRYPTION_OFF &&
- options->encryption_key_id != THDVAR(thd, default_encryption_key_id)) {
- push_warning_printf(
- thd, Sql_condition::WARN_LEVEL_WARN,
- HA_WRONG_CREATE_OPTION,
- "InnoDB: Ignored ENCRYPTION_KEY_ID %u when encryption is disabled",
- (uint)options->encryption_key_id
- );
- options->encryption_key_id = FIL_DEFAULT_ENCRYPTION_KEY;
- }
-
- /* If default encryption is used and encryption is disabled, you may
- not use nondefault encryption_key_id as it is not stored anywhere. */
- if (encrypt == FIL_ENCRYPTION_DEFAULT
- && !srv_encrypt_tables
+ /* Used encryption key_id must be found from key file even
+ when encryption is disabled by table options or default
+ encryption is used and encryption is disabled. This is
+ because encryption can be enabled later and it is possible
+ only if all existing tables use key_id that is found
+ from key file. */
+ if ((encrypt == FIL_ENCRYPTION_OFF
+ || (encrypt == FIL_ENCRYPTION_DEFAULT && !srv_encrypt_tables))
&& options->encryption_key_id != FIL_DEFAULT_ENCRYPTION_KEY) {
compile_time_assert(FIL_DEFAULT_ENCRYPTION_KEY == 1);
- push_warning_printf(
- thd, Sql_condition::WARN_LEVEL_WARN,
- HA_WRONG_CREATE_OPTION,
- "InnoDB: innodb_encrypt_tables=OFF only allows ENCRYPTION_KEY_ID=1"
+ if (!encryption_key_id_exists(options->encryption_key_id)) {
+
+ push_warning_printf(
+ thd, Sql_condition::WARN_LEVEL_WARN,
+ HA_WRONG_CREATE_OPTION,
+ "InnoDB: ENCRYPTION_KEY_ID=%u not available",
+ options->encryption_key_id
);
- return "ENCRYPTION_KEY_ID";
+ return "ENCRYPTION_KEY_ID";
+ }
}
/* Check atomic writes requirements */
1
0
[Commits] facf250: MDEV-7974 backport fix for mysql bug#12161 (XA and binlog).
by holyfootï¼ askmonty.org 21 Feb '19
by holyfootï¼ askmonty.org 21 Feb '19
21 Feb '19
revision-id: facf2504fa8006b8ee577da1a235beef6db750bb (mariadb-10.4.1-103-gfacf250)
parent(s): 8aae31cf494678b6253031c627566e50bc666920
committer: Alexey Botchkov
timestamp: 2019-02-21 12:44:53 +0400
message:
MDEV-7974 backport fix for mysql bug#12161 (XA and binlog).
XA transactions now are kept persistent after prepare.
XA_prepare_log_event implamented, and XA tranasctions are logged
as XA transactions.
---
mysql-test/suite/rpl/r/rpl_xa.result | 31 +++
mysql-test/suite/rpl/t/rpl_xa.test | 46 ++++
sql/handler.cc | 9 +
sql/handler.h | 25 ++
sql/log.cc | 115 +++++++--
sql/log.h | 10 +
sql/log_event.cc | 449 +++++++++++++++++++++++++++-------
sql/log_event.h | 116 ++++++++-
sql/sql_class.cc | 18 +-
sql/sql_class.h | 45 +++-
sql/sql_connect.cc | 1 +
sql/transaction.cc | 201 ++++++++++++++-
sql/transaction.h | 2 +
storage/innobase/handler/ha_innodb.cc | 45 +++-
14 files changed, 987 insertions(+), 126 deletions(-)
diff --git a/mysql-test/suite/rpl/r/rpl_xa.result b/mysql-test/suite/rpl/r/rpl_xa.result
new file mode 100644
index 0000000..58c1b09
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_xa.result
@@ -0,0 +1,31 @@
+include/master-slave.inc
+[connection master]
+create table t1 (a int, b int) engine=InnoDB;
+xa start 't';
+insert into t1 values(1, 2);
+xa end 't';
+xa prepare 't';
+xa commit 't';
+select * from t1;
+a b
+1 2
+connection slave;
+select * from t1;
+a b
+1 2
+connection master;
+xa start 't';
+insert into t1 values(3, 4);
+xa end 't';
+xa prepare 't';
+xa rollback 't';
+select * from t1;
+a b
+1 2
+connection slave;
+select * from t1;
+a b
+1 2
+connection master;
+drop table t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_xa.test b/mysql-test/suite/rpl/t/rpl_xa.test
new file mode 100644
index 0000000..c28a205
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_xa.test
@@ -0,0 +1,46 @@
+source include/have_innodb.inc;
+source include/master-slave.inc;
+
+create table t1 (a int, b int) engine=InnoDB;
+xa start 't';
+insert into t1 values(1, 2);
+xa end 't';
+xa prepare 't';
+xa commit 't';
+select * from t1;
+sync_slave_with_master;
+select * from t1;
+connection master;
+
+xa start 't';
+insert into t1 values(3, 4);
+xa end 't';
+xa prepare 't';
+xa rollback 't';
+select * from t1;
+sync_slave_with_master;
+select * from t1;
+
+connection master;
+SET pseudo_slave_mode=1;
+create table t2 (a int) engine=InnoDB;
+xa start 't';
+insert into t1 values (5, 6);
+xa end 't';
+xa prepare 't';
+xa start 's';
+insert into t2 values (0);
+xa end 's';
+xa prepare 's';
+xa commit 't';
+xa commit 's';
+select * from t1;
+select * from t2;
+sync_slave_with_master;
+select * from t1;
+select * from t2;
+
+connection master;
+SET pseudo_slave_mode=0;
+drop table t1, t2;
+source include/rpl_end.inc;
diff --git a/sql/handler.cc b/sql/handler.cc
index 001055c..3b2a3e0 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -1214,6 +1214,9 @@ static int prepare_or_error(handlerton *ht, THD *thd, bool all)
}
+/*static inline */int
+binlog_commit_flush_xid_caches(THD *thd, binlog_cache_mngr *cache_mngr,
+ bool all, my_xid xid);
/**
@retval
0 ok
@@ -1225,6 +1228,7 @@ int ha_prepare(THD *thd)
int error=0, all=1;
THD_TRANS *trans=all ? &thd->transaction.all : &thd->transaction.stmt;
Ha_trx_info *ha_info= trans->ha_list;
+
DBUG_ENTER("ha_prepare");
if (ha_info)
@@ -1250,6 +1254,11 @@ int ha_prepare(THD *thd)
}
}
+ if (unlikely(tc_log->log_prepare(thd, all)))
+ {
+ ha_rollback_trans(thd, all);
+ error=1;
+ }
}
DBUG_RETURN(error);
diff --git a/sql/handler.h b/sql/handler.h
index fc6246c..0c65842 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -810,6 +810,16 @@ struct xid_t {
long gtrid_length;
long bqual_length;
char data[XIDDATASIZE]; // not \0-terminated !
+ /*
+ The size of the string containing serialized Xid representation
+ is computed as a sum of
+ eight as the number of formatting symbols (X'',X'',)
+ plus 2 x XIDDATASIZE (2 due to hex format),
+ plus space for decimal digits of XID::formatID,
+ plus one for 0x0.
+ */
+ static const uint ser_buf_size=
+ 8 + 2 * XIDDATASIZE + 4 * sizeof(long) + 1;
xid_t() {} /* Remove gcc warning */
bool eq(struct xid_t *xid)
@@ -1626,6 +1636,21 @@ struct handlerton
/* backup */
void (*prepare_for_backup)(void);
void (*end_backup)(void);
+ /**
+ @param[in,out] thd pointer to THD
+ @param[in] new_trx_arg pointer to replacement transaction
+ @param[out] ptr_trx_arg double pointer to being replaced transaction
+
+ Associated with THD engine's native transaction is replaced
+ with @c new_trx_arg. The old value is returned through a buffer if non-null
+ pointer is provided with @c ptr_trx_arg.
+ The method is adapted by XA start and XA prepare handlers to
+ handle XA transaction that is logged as two parts by slave applier.
+
+ This interface concerns engines that are aware of XA transaction.
+ */
+ void (*replace_native_transaction_in_thd)(THD *thd, void *new_trx_arg,
+ void **ptr_trx_arg);
};
diff --git a/sql/log.cc b/sql/log.cc
index a56117a..316b871 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -87,6 +87,9 @@ static bool binlog_savepoint_rollback_can_release_mdl(handlerton *hton,
static int binlog_commit(handlerton *hton, THD *thd, bool all);
static int binlog_rollback(handlerton *hton, THD *thd, bool all);
static int binlog_prepare(handlerton *hton, THD *thd, bool all);
+static int binlog_xa_recover(handlerton *hton, XID *xid_list, uint len);
+static int binlog_commit_by_xid(handlerton *hton, XID *xid);
+static int binlog_rollback_by_xid(handlerton *hton, XID *xid);
static int binlog_start_consistent_snapshot(handlerton *hton, THD *thd);
static const LEX_CSTRING write_error_msg=
@@ -1688,6 +1691,9 @@ int binlog_init(void *p)
binlog_hton->commit= binlog_commit;
binlog_hton->rollback= binlog_rollback;
binlog_hton->prepare= binlog_prepare;
+ binlog_hton->recover= binlog_xa_recover;
+ binlog_hton->commit_by_xid = binlog_commit_by_xid;
+ binlog_hton->rollback_by_xid = binlog_rollback_by_xid;
binlog_hton->start_consistent_snapshot= binlog_start_consistent_snapshot;
binlog_hton->flags= HTON_NOT_USER_SELECTABLE | HTON_HIDDEN;
return 0;
@@ -1883,23 +1889,16 @@ static inline int
binlog_commit_flush_xid_caches(THD *thd, binlog_cache_mngr *cache_mngr,
bool all, my_xid xid)
{
- if (xid)
- {
- Xid_log_event end_evt(thd, xid, TRUE);
- return (binlog_flush_cache(thd, cache_mngr, &end_evt, all, TRUE, TRUE));
- }
- else
+ /* Mask XA COMMIT ... ONE PHASE as plain BEGIN ... COMMIT */
+ if (!xid)
{
- /*
- Empty xid occurs in XA COMMIT ... ONE PHASE.
- In this case, we do not have a MySQL xid for the transaction, and the
- external XA transaction coordinator will have to handle recovery if
- needed. So we end the transaction with a plain COMMIT query event.
- */
- Query_log_event end_evt(thd, STRING_WITH_LEN("COMMIT"),
- TRUE, TRUE, TRUE, 0);
- return (binlog_flush_cache(thd, cache_mngr, &end_evt, all, TRUE, TRUE));
+ DBUG_ASSERT(thd->transaction.xid_state.xa_state == XA_IDLE &&
+ thd->lex->xa_opt == XA_ONE_PHASE);
+ xid= thd->query_id;
}
+
+ Xid_log_event end_evt(thd, xid, TRUE);
+ return (binlog_flush_cache(thd, cache_mngr, &end_evt, all, TRUE, TRUE));
}
/**
@@ -1961,11 +1960,77 @@ static int binlog_prepare(handlerton *hton, THD *thd, bool all)
do nothing.
just pretend we can do 2pc, so that MySQL won't
switch to 1pc.
- real work will be done in MYSQL_BIN_LOG::log_and_order()
+ real work is done in MYSQL_BIN_LOG::log_and_order()
*/
return 0;
}
+
+static int serialize_xid(XID *xid, char *buf)
+{
+ size_t size;
+ buf[0]= '\'';
+ memcpy(buf+1, xid->data, xid->gtrid_length);
+ size= xid->gtrid_length + 2;
+ buf[size-1]= '\'';
+ if (xid->bqual_length == 0 && xid->formatID == 1)
+ return size;
+
+ memcpy(buf+size, ", '", 3);
+ memcpy(buf+size+3, xid->data+xid->gtrid_length, xid->bqual_length);
+ size+= 3 + xid->bqual_length;
+ buf[size]= '\'';
+ size++;
+ if (xid->formatID != 1)
+ size+= sprintf(buf+size, ", %ld", xid->formatID);
+ return size;
+}
+
+
+static int binlog_xa_recover(handlerton *hton __attribute__((unused)),
+ XID *xid_list __attribute__((unused)),
+ uint len __attribute__((unused)))
+{
+ /* Does nothing. */
+ return 0;
+}
+
+
+static int binlog_commit_by_xid(handlerton *hton, XID *xid)
+{
+ THD *thd= current_thd;
+ const size_t xc_len= sizeof("XA COMMIT ") - 1; // do not count trailing 0
+ char buf[xc_len + xid_t::ser_buf_size];
+ size_t buflen;
+ binlog_cache_mngr *const cache_mngr= thd->binlog_setup_trx_data();
+
+ DBUG_ASSERT(thd->lex->sql_command == SQLCOM_XA_COMMIT);
+
+ if (!cache_mngr)
+ return 1;
+
+ memcpy(buf, "XA COMMIT ", xc_len);
+ buflen= xc_len + serialize_xid(xid, buf+xc_len);
+ Query_log_event qe(thd, buf, buflen, TRUE, FALSE, FALSE, 0);
+ return binlog_flush_cache(thd, cache_mngr, &qe, TRUE, TRUE, TRUE);
+}
+
+
+static int binlog_rollback_by_xid(handlerton *hton, XID *xid)
+{
+ THD *thd= current_thd;
+ const size_t xr_len= sizeof("XA ROLLBACK ") - 1; // do not count trailing 0
+ char buf[xr_len + xid_t::ser_buf_size];
+ size_t buflen;
+
+ DBUG_ASSERT(thd->lex->sql_command == SQLCOM_XA_ROLLBACK);
+ memcpy(buf, "XA ROLLBACK ", xr_len);
+ buflen= xr_len + serialize_xid(xid, buf+xr_len);
+ Query_log_event qe(thd, buf, buflen, FALSE, TRUE, TRUE, 0);
+ return mysql_bin_log.write_event(&qe);
+}
+
+
/*
We flush the cache wrapped in a beging/rollback if:
. aborting a single or multi-statement transaction and;
@@ -9809,6 +9874,24 @@ int TC_LOG_BINLOG::unlog(ulong cookie, my_xid xid)
DBUG_RETURN(BINLOG_COOKIE_GET_ERROR_FLAG(cookie));
}
+
+int TC_LOG_BINLOG::log_prepare(THD *thd, bool all)
+{
+ XID *xid= &thd->transaction.xid_state.xid;
+ XA_prepare_log_event end_evt(thd, xid, FALSE);
+ binlog_cache_mngr *cache_mngr= thd->binlog_setup_trx_data();
+
+ if (!cache_mngr)
+ {
+ WSREP_DEBUG("Skipping empty log_xid: %s", thd->query());
+ return 0;
+ }
+
+ cache_mngr->using_xa= FALSE;
+ return (binlog_flush_cache(thd, cache_mngr, &end_evt, all, TRUE, TRUE));
+}
+
+
void
TC_LOG_BINLOG::commit_checkpoint_notify(void *cookie)
{
diff --git a/sql/log.h b/sql/log.h
index 7dfdb36..92fdf95 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -61,6 +61,7 @@ class TC_LOG
bool need_prepare_ordered,
bool need_commit_ordered) = 0;
virtual int unlog(ulong cookie, my_xid xid)=0;
+ virtual int log_prepare(THD *thd, bool all)= 0;
virtual void commit_checkpoint_notify(void *cookie)= 0;
protected:
@@ -115,6 +116,10 @@ class TC_LOG_DUMMY: public TC_LOG // use it to disable the logging
return 1;
}
int unlog(ulong cookie, my_xid xid) { return 0; }
+ int log_prepare(THD *thd, bool all)
+ {
+ return 0;
+ }
void commit_checkpoint_notify(void *cookie) { DBUG_ASSERT(0); };
};
@@ -198,6 +203,10 @@ class TC_LOG_MMAP: public TC_LOG
int log_and_order(THD *thd, my_xid xid, bool all,
bool need_prepare_ordered, bool need_commit_ordered);
int unlog(ulong cookie, my_xid xid);
+ int log_prepare(THD *thd, bool all)
+ {
+ return 0;
+ }
void commit_checkpoint_notify(void *cookie);
int recover();
@@ -698,6 +707,7 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
int log_and_order(THD *thd, my_xid xid, bool all,
bool need_prepare_ordered, bool need_commit_ordered);
int unlog(ulong cookie, my_xid xid);
+ int log_prepare(THD *thd, bool all);
void commit_checkpoint_notify(void *cookie);
int recover(LOG_INFO *linfo, const char *last_log_name, IO_CACHE *first_log,
Format_description_log_event *fdle, bool do_xa);
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 7a0d0be..6465f0c 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -2139,6 +2139,9 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len,
case XID_EVENT:
ev = new Xid_log_event(buf, fdle);
break;
+ case XA_PREPARE_LOG_EVENT:
+ ev = new XA_prepare_log_event(buf, fdle);
+ break;
case RAND_EVENT:
ev = new Rand_log_event(buf, fdle);
break;
@@ -2190,7 +2193,6 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len,
case PREVIOUS_GTIDS_LOG_EVENT:
case TRANSACTION_CONTEXT_EVENT:
case VIEW_CHANGE_EVENT:
- case XA_PREPARE_LOG_EVENT:
ev= new Ignorable_log_event(buf, fdle,
get_type_str((Log_event_type) event_type));
break;
@@ -4418,6 +4420,7 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, size_t que
case SQLCOM_RELEASE_SAVEPOINT:
case SQLCOM_ROLLBACK_TO_SAVEPOINT:
case SQLCOM_SAVEPOINT:
+ case SQLCOM_XA_END:
use_cache= trx_cache= TRUE;
break;
default:
@@ -6222,6 +6225,7 @@ Format_description_log_event(uint8 binlog_ver, const char* server_ver)
post_header_len[USER_VAR_EVENT-1]= USER_VAR_HEADER_LEN;
post_header_len[FORMAT_DESCRIPTION_EVENT-1]= FORMAT_DESCRIPTION_HEADER_LEN;
post_header_len[XID_EVENT-1]= XID_HEADER_LEN;
+ post_header_len[XA_PREPARE_LOG_EVENT-1]= XA_PREPARE_HEADER_LEN;
post_header_len[BEGIN_LOAD_QUERY_EVENT-1]= BEGIN_LOAD_QUERY_HEADER_LEN;
post_header_len[EXECUTE_LOAD_QUERY_EVENT-1]= EXECUTE_LOAD_QUERY_HEADER_LEN;
/*
@@ -7874,7 +7878,7 @@ Gtid_log_event::Gtid_log_event(const char *buf, uint event_len,
buf+= 8;
domain_id= uint4korr(buf);
buf+= 4;
- flags2= *buf;
+ flags2= *(buf++);
if (flags2 & FL_GROUP_COMMIT_ID)
{
if (event_len < (uint)header_size + GTID_HEADER_LEN + 2)
@@ -7882,8 +7886,22 @@ Gtid_log_event::Gtid_log_event(const char *buf, uint event_len,
seq_no= 0; // So is_valid() returns false
return;
}
- ++buf;
commit_id= uint8korr(buf);
+ buf+= 8;
+ }
+ if (flags2 & FL_XA_TRANSACTION)
+ {
+ xid.formatID= (long) buf[0];
+ xid.gtrid_length= (long) buf[1];
+ xid.bqual_length= (long) buf[2];
+
+ buf+= 3;
+ if (xid.formatID >= 0)
+ {
+ long data_length= xid.bqual_length + xid.gtrid_length;
+ memcpy(xid.data, buf, data_length);
+ buf+= data_length;
+ }
}
}
@@ -7914,6 +7932,12 @@ Gtid_log_event::Gtid_log_event(THD *thd_arg, uint64 seq_no_arg,
/* Preserve any DDL or WAITED flag in the slave's binlog. */
if (thd_arg->rgi_slave)
flags2|= (thd_arg->rgi_slave->gtid_ev_flags2 & (FL_DDL|FL_WAITED));
+ if (thd->transaction.xid_state.xa_state == XA_IDLE &&
+ thd->lex->xa_opt != XA_ONE_PHASE)
+ {
+ flags2|= FL_XA_TRANSACTION;
+ xid= thd->transaction.xid_state.xid;
+ }
}
@@ -7956,7 +7980,7 @@ Gtid_log_event::peek(const char *event_start, size_t event_len,
bool
Gtid_log_event::write()
{
- uchar buf[GTID_HEADER_LEN+2];
+ uchar buf[GTID_HEADER_LEN+2+sizeof(XID)];
size_t write_len;
int8store(buf, seq_no);
@@ -7968,8 +7992,25 @@ Gtid_log_event::write()
write_len= GTID_HEADER_LEN + 2;
}
else
+ write_len= 13;
+
+ if (flags2 & FL_XA_TRANSACTION)
{
- bzero(buf+13, GTID_HEADER_LEN-13);
+ buf[write_len]= (uchar) ((char) xid.formatID);
+ buf[write_len+1]= (uchar) xid.gtrid_length;
+ buf[write_len+2]= (uchar) xid.bqual_length;
+ write_len+= 3;
+ if (xid.formatID >= 0)
+ {
+ long data_length= xid.bqual_length + xid.gtrid_length;
+ memcpy(buf+write_len, xid.data, data_length);
+ write_len+= data_length;
+ }
+ }
+
+ if (write_len < GTID_HEADER_LEN)
+ {
+ bzero(buf+write_len, GTID_HEADER_LEN-write_len);
write_len= GTID_HEADER_LEN;
}
return write_header(write_len) ||
@@ -8012,7 +8053,7 @@ Gtid_log_event::make_compatible_event(String *packet, bool *need_dummy_event,
void
Gtid_log_event::pack_info(Protocol *protocol)
{
- char buf[6+5+10+1+10+1+20+1+4+20+1];
+ char buf[6+5+10+1+10+1+20+1+4+20+1+5+128];
char *p;
p = strmov(buf, (flags2 & FL_STANDALONE ? "GTID " : "BEGIN GTID "));
p= longlong10_to_str(domain_id, p, 10);
@@ -8026,6 +8067,12 @@ Gtid_log_event::pack_info(Protocol *protocol)
p= longlong10_to_str(commit_id, p, 10);
}
+ if (flags2 & FL_XA_TRANSACTION)
+ {
+ p= strmov(p, " XID :");
+ p= strnmov(p, xid.data, xid.bqual_length + xid.gtrid_length);
+ }
+
protocol->store(buf, p-buf, &my_charset_bin);
}
@@ -8079,11 +8126,25 @@ Gtid_log_event::do_apply_event(rpl_group_info *rgi)
thd->lex->sql_command= SQLCOM_BEGIN;
thd->is_slave_error= 0;
status_var_increment(thd->status_var.com_stat[thd->lex->sql_command]);
- if (trans_begin(thd, 0))
+ if (flags2 & FL_XA_TRANSACTION)
{
- DBUG_PRINT("error", ("trans_begin() failed"));
- thd->is_slave_error= 1;
+ thd->lex->xid= &xid;
+ thd->lex->xa_opt= XA_NONE;
+ if (trans_xa_start(thd))
+ {
+ DBUG_PRINT("error", ("trans_xa_start() failed"));
+ thd->is_slave_error= 1;
+ }
}
+ else
+ {
+ if (trans_begin(thd, 0))
+ {
+ DBUG_PRINT("error", ("trans_begin() failed"));
+ thd->is_slave_error= 1;
+ }
+ }
+
thd->update_stats();
if (likely(!thd->is_slave_error))
@@ -8202,9 +8263,29 @@ Gtid_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info)
buf, print_event_info->delimiter))
goto err;
}
- if (!(flags2 & FL_STANDALONE))
- if (my_b_printf(&cache, is_flashback ? "COMMIT\n%s\n" : "BEGIN\n%s\n", print_event_info->delimiter))
+ if ((flags2 & FL_XA_TRANSACTION) && !is_flashback)
+ {
+ my_b_write_string(&cache, "XA START '");
+ my_b_write(&cache, (uchar *) xid.data, xid.gtrid_length);
+ my_b_write_string(&cache, "'");
+ if (xid.bqual_length > 0 || xid.formatID != 1)
+ {
+ my_b_write_string(&cache, ", '");
+ my_b_write(&cache, (uchar *) xid.data+xid.gtrid_length, xid.bqual_length);
+ my_b_write_string(&cache, "'");
+ if (xid.formatID != 1)
+ if (my_b_printf(&cache, ", %d", xid.formatID))
+ goto err;
+ }
+ if (my_b_printf(&cache, "%s\n", print_event_info->delimiter))
goto err;
+ }
+ else if (!(flags2 & FL_STANDALONE))
+ {
+ if (my_b_printf(&cache, is_flashback ? "COMMIT\n%s\n" : "BEGIN\n%s\n",
+ print_event_info->delimiter))
+ goto err;
+ }
return cache.flush_data();
err:
@@ -8825,80 +8906,20 @@ bool slave_execute_deferred_events(THD *thd)
/**************************************************************************
- Xid_log_event methods
+ Xid_apply_log_event methods
**************************************************************************/
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-void Xid_log_event::pack_info(Protocol *protocol)
-{
- char buf[128], *pos;
- pos= strmov(buf, "COMMIT /* xid=");
- pos= longlong10_to_str(xid, pos, 10);
- pos= strmov(pos, " */");
- protocol->store(buf, (uint) (pos-buf), &my_charset_bin);
-}
-#endif
-
-/**
- @note
- It's ok not to use int8store here,
- as long as xid_t::set(ulonglong) and
- xid_t::get_my_xid doesn't do it either.
- We don't care about actual values of xids as long as
- identical numbers compare identically
-*/
-Xid_log_event::
-Xid_log_event(const char* buf,
- const Format_description_log_event *description_event)
- :Log_event(buf, description_event)
+int Xid_apply_log_event::record_gtid(const rpl_gtid *gtid, uint64 sub_id,
+ void **out_hton)
{
- /* The Post-Header is empty. The Variable Data part begins immediately. */
- buf+= description_event->common_header_len +
- description_event->post_header_len[XID_EVENT-1];
- memcpy((char*) &xid, buf, sizeof(xid));
+ return rpl_global_gtid_slave_state->record_gtid(thd, gtid, sub_id, true,
+ false, out_hton);
}
-#ifndef MYSQL_CLIENT
-bool Xid_log_event::write()
-{
- DBUG_EXECUTE_IF("do_not_write_xid", return 0;);
- return write_header(sizeof(xid)) ||
- write_data((uchar*)&xid, sizeof(xid)) ||
- write_footer();
-}
-#endif
-
-
-#ifdef MYSQL_CLIENT
-bool Xid_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
-{
- Write_on_release_cache cache(&print_event_info->head_cache, file,
- Write_on_release_cache::FLUSH_F, this);
-
- if (!print_event_info->short_form)
- {
- char buf[64];
- longlong10_to_str(xid, buf, 10);
-
- if (print_header(&cache, print_event_info, FALSE) ||
- my_b_printf(&cache, "\tXid = %s\n", buf))
- goto err;
- }
- if (my_b_printf(&cache, is_flashback ? "BEGIN%s\n" : "COMMIT%s\n",
- print_event_info->delimiter))
- goto err;
-
- return cache.flush_data();
-err:
- return 1;
-}
-#endif /* MYSQL_CLIENT */
-
-
-#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-int Xid_log_event::do_apply_event(rpl_group_info *rgi)
+int Xid_apply_log_event::do_apply_event(rpl_group_info *rgi)
{
bool res;
int err;
@@ -8929,8 +8950,7 @@ int Xid_log_event::do_apply_event(rpl_group_info *rgi)
rgi->gtid_pending= false;
gtid= rgi->current_gtid;
- err= rpl_global_gtid_slave_state->record_gtid(thd, >id, sub_id, true,
- false, &hton);
+ err= record_gtid(>id, sub_id, &hton);
if (unlikely(err))
{
int ec= thd->get_stmt_da()->sql_errno();
@@ -8959,8 +8979,7 @@ int Xid_log_event::do_apply_event(rpl_group_info *rgi)
general_log_print(thd, COM_QUERY,
"COMMIT /* implicit, from Xid_log_event */");
thd->variables.option_bits&= ~OPTION_GTID_BEGIN;
- res= trans_commit(thd); /* Automatically rolls back on error. */
- thd->mdl_context.release_transactional_locks();
+ res= do_commit();
if (likely(!res) && sub_id)
rpl_global_gtid_slave_state->update_state_hash(sub_id, >id, hton, rgi);
@@ -8973,10 +8992,11 @@ int Xid_log_event::do_apply_event(rpl_group_info *rgi)
return res;
}
+
Log_event::enum_skip_reason
-Xid_log_event::do_shall_skip(rpl_group_info *rgi)
+Xid_apply_log_event::do_shall_skip(rpl_group_info *rgi)
{
- DBUG_ENTER("Xid_log_event::do_shall_skip");
+ DBUG_ENTER("Xid_apply_log_event::do_shall_skip");
if (rgi->rli->slave_skip_counter > 0)
{
DBUG_ASSERT(!rgi->rli->get_flag(Relay_log_info::IN_TRANSACTION));
@@ -9000,6 +9020,268 @@ Xid_log_event::do_shall_skip(rpl_group_info *rgi)
#endif
DBUG_RETURN(Log_event::do_shall_skip(rgi));
}
+
+#endif /*MYSQL_SERVER*/
+
+
+/**************************************************************************
+ Xid_log_event methods
+**************************************************************************/
+
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
+void Xid_log_event::pack_info(Protocol *protocol)
+{
+ char buf[128], *pos;
+ pos= strmov(buf, "COMMIT /* xid=");
+ pos= longlong10_to_str(xid, pos, 10);
+ pos= strmov(pos, " */");
+ protocol->store(buf, (uint) (pos-buf), &my_charset_bin);
+}
+#endif
+
+/**
+ @note
+ It's ok not to use int8store here,
+ as long as xid_t::set(ulonglong) and
+ xid_t::get_my_xid doesn't do it either.
+ We don't care about actual values of xids as long as
+ identical numbers compare identically
+*/
+
+Xid_log_event::
+Xid_log_event(const char* buf,
+ const Format_description_log_event *description_event)
+ :Xid_apply_log_event(buf, description_event)
+{
+ /* The Post-Header is empty. The Variable Data part begins immediately. */
+ buf+= description_event->common_header_len +
+ description_event->post_header_len[XID_EVENT-1];
+ memcpy((char*) &xid, buf, sizeof(xid));
+}
+
+
+#ifndef MYSQL_CLIENT
+bool Xid_log_event::write()
+{
+ DBUG_EXECUTE_IF("do_not_write_xid", return 0;);
+ return write_header(sizeof(xid)) ||
+ write_data((uchar*)&xid, sizeof(xid)) ||
+ write_footer();
+}
+#endif
+
+
+#ifdef MYSQL_CLIENT
+bool Xid_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
+{
+ Write_on_release_cache cache(&print_event_info->head_cache, file,
+ Write_on_release_cache::FLUSH_F, this);
+
+ if (!print_event_info->short_form)
+ {
+ char buf[64];
+ longlong10_to_str(xid, buf, 10);
+
+ if (print_header(&cache, print_event_info, FALSE) ||
+ my_b_printf(&cache, "\tXid = %s\n", buf))
+ goto err;
+ }
+ if (my_b_printf(&cache, is_flashback ? "BEGIN%s\n" : "COMMIT%s\n",
+ print_event_info->delimiter))
+ goto err;
+
+ return cache.flush_data();
+err:
+ return 1;
+}
+#endif /* MYSQL_CLIENT */
+
+
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
+int Xid_log_event::do_commit()
+{
+ bool res;
+ res= trans_commit(thd); /* Automatically rolls back on error. */
+ thd->mdl_context.release_transactional_locks();
+ return res;
+}
+#endif /* !MYSQL_CLIENT */
+
+
+char *XA_prepare_log_event::event_xid_t::serialize(char *buf) const
+{
+ char *c= buf;
+
+ c[0]= '\'';
+ memcpy(c+1, data, gtrid_length);
+ c[gtrid_length+1]= '\'';
+ c+= gtrid_length + 2;
+
+ if (bqual_length)
+ {
+ c[0]= ',';
+ c[1]= '\'';
+ memcpy(c+2, data+gtrid_length, bqual_length);
+ c[bqual_length+2]= '\'';
+ c+= bqual_length+3;
+ }
+
+ if (formatID != 1)
+ sprintf(c, ",%lu", formatID);
+ else
+ c[0]=0;
+
+ return buf;
+}
+
+
+/**************************************************************************
+ XA_prepare_log_event methods
+**************************************************************************/
+/**
+ @note
+ It's ok not to use int8store here,
+ as long as xid_t::set(ulonglong) and
+ xid_t::get_n_xid doesn't do it either.
+ We don't care about actual values of xids as long as
+ identical numbers compare identically
+*/
+
+XA_prepare_log_event::
+XA_prepare_log_event(const char* buf,
+ const Format_description_log_event *description_event)
+ :Xid_apply_log_event(buf, description_event)
+{
+ uint32 temp= 0;
+ uint8 temp_byte;
+
+ buf+= description_event->common_header_len +
+ description_event->post_header_len[XA_PREPARE_LOG_EVENT-1];
+ memcpy(&temp_byte, buf, 1);
+ one_phase= (bool) temp_byte;
+ buf += sizeof(temp_byte);
+ memcpy(&temp, buf, sizeof(temp));
+ m_xid.formatID= le32toh(temp);
+ buf += sizeof(temp);
+ memcpy(&temp, buf, sizeof(temp));
+ m_xid.gtrid_length= le32toh(temp);
+ buf += sizeof(temp);
+ memcpy(&temp, buf, sizeof(temp));
+ m_xid.bqual_length= le32toh(temp);
+ buf += sizeof(temp);
+ memcpy(m_xid.data, buf, m_xid.gtrid_length + m_xid.bqual_length);
+
+ xid= NULL;
+}
+
+
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
+void XA_prepare_log_event::pack_info(Protocol *protocol)
+{
+ char buf[ser_buf_size];
+ char query[sizeof("XA COMMIT ONE PHASE") + 1 + sizeof(buf)];
+
+ /* RHS of the following assert is unknown to client sources */
+ compile_time_assert(ser_buf_size == XID::ser_buf_size);
+ m_xid.serialize(buf);
+ sprintf(query,
+ (one_phase ? "XA COMMIT %s ONE PHASE" : "XA PREPARE %s"),
+ buf);
+
+ protocol->store(query, strlen(query), &my_charset_bin);
+}
+#endif
+
+
+#ifndef MYSQL_CLIENT
+bool XA_prepare_log_event::write()
+{
+ uchar data[1 + 4 + 4 + 4];
+ uint8 one_phase_byte= one_phase;
+
+ data[0]= one_phase;
+ int4store(data+1, static_cast<XID*>(xid)->formatID);
+ int4store(data+(1+4), static_cast<XID*>(xid)->gtrid_length);
+ int4store(data+(1+4+4), static_cast<XID*>(xid)->bqual_length);
+
+ DBUG_ASSERT(xid_bufs_size == sizeof(data) - 1);
+
+ return write_header(sizeof(one_phase_byte) + xid_bufs_size +
+ static_cast<XID*>(xid)->gtrid_length +
+ static_cast<XID*>(xid)->bqual_length) ||
+ write_data(data, sizeof(data)) ||
+ write_data((uchar*) static_cast<XID*>(xid)->data,
+ static_cast<XID*>(xid)->gtrid_length +
+ static_cast<XID*>(xid)->bqual_length) ||
+ write_footer();
+}
+#endif
+
+
+#ifdef MYSQL_CLIENT
+bool XA_prepare_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
+{
+ Write_on_release_cache cache(&print_event_info->head_cache, file,
+ Write_on_release_cache::FLUSH_F, this);
+ char buf[ser_buf_size];
+
+ m_xid.serialize(buf);
+
+ if (!print_event_info->short_form)
+ {
+ print_header(&cache, print_event_info, FALSE);
+ if (my_b_printf(&cache, "\tXID = %s\n", buf))
+ goto error;
+ }
+
+ if (my_b_printf(&cache, "XA PREPARE %s\n%s\n",
+ buf, print_event_info->delimiter))
+ goto error;
+
+ return cache.flush_data();
+error:
+ return TRUE;
+}
+#endif /* MYSQL_CLIENT */
+
+
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
+int XA_prepare_log_event::record_gtid(const rpl_gtid *gtid, uint64 sub_id,
+ void **out_hton)
+{
+ int err;
+ xa_states c_state= thd->transaction.xid_state.xa_state;
+ thd->transaction.xid_state.xa_state= XA_ACTIVE;
+ err= rpl_global_gtid_slave_state->record_gtid(thd, gtid, sub_id, true,
+ false, out_hton);
+ thd->transaction.xid_state.xa_state= c_state;
+ return err;
+}
+
+
+int XA_prepare_log_event::do_commit()
+{
+ int res;
+ xid_t xid;
+ xid.set(m_xid.formatID,
+ m_xid.data, m_xid.gtrid_length,
+ m_xid.data + m_xid.gtrid_length, m_xid.bqual_length);
+
+ thd->lex->xid= &xid;
+ if (!one_phase)
+ {
+ thd->lex->sql_command= SQLCOM_XA_PREPARE;
+ if ((res= trans_xa_prepare(thd)) == 0)
+ res= applier_reset_xa_trans(thd);
+ }
+ else
+ {
+ res= trans_xa_commit(thd);
+ thd->mdl_context.release_transactional_locks();
+ }
+
+ return res;
+}
#endif /* !MYSQL_CLIENT */
@@ -14789,7 +15071,6 @@ bool event_that_should_be_ignored(const char *buf)
event_type == PREVIOUS_GTIDS_LOG_EVENT ||
event_type == TRANSACTION_CONTEXT_EVENT ||
event_type == VIEW_CHANGE_EVENT ||
- event_type == XA_PREPARE_LOG_EVENT ||
(uint2korr(buf + FLAGS_OFFSET) & LOG_EVENT_IGNORABLE_F))
return 1;
return 0;
diff --git a/sql/log_event.h b/sql/log_event.h
index 38a40c9..f2f784b 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -217,6 +217,7 @@ class String;
#define GTID_HEADER_LEN 19
#define GTID_LIST_HEADER_LEN 4
#define START_ENCRYPTION_HEADER_LEN 0
+#define XA_PREPARE_HEADER_LEN 0
/*
Max number of possible extra bytes in a replication event compared to a
@@ -3016,6 +3017,30 @@ class Rand_log_event: public Log_event
#endif
};
+
+class Xid_apply_log_event: public Log_event
+{
+public:
+#ifdef MYSQL_SERVER
+ Xid_apply_log_event(THD* thd_arg):
+ Log_event(thd_arg, 0, TRUE) {}
+#endif
+ Xid_apply_log_event(const char* buf,
+ const Format_description_log_event *description_event):
+ Log_event(buf, description_event) {}
+
+ ~Xid_apply_log_event() {}
+ bool is_valid() const { return 1; }
+private:
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
+ virtual int do_commit()= 0;
+ virtual int record_gtid(const rpl_gtid *gtid, uint64 sub_id, void **out_hton);
+ virtual int do_apply_event(rpl_group_info *rgi);
+ enum_skip_reason do_shall_skip(rpl_group_info *rgi);
+#endif
+};
+
+
/**
@class Xid_log_event
@@ -3028,14 +3053,14 @@ class Rand_log_event: public Log_event
typedef ulonglong my_xid; // this line is the same as in handler.h
#endif
-class Xid_log_event: public Log_event
+class Xid_log_event: public Xid_apply_log_event
{
- public:
- my_xid xid;
+public:
+ my_xid xid;
#ifdef MYSQL_SERVER
Xid_log_event(THD* thd_arg, my_xid x, bool direct):
- Log_event(thd_arg, 0, TRUE), xid(x)
+ Xid_apply_log_event(thd_arg)
{
if (direct)
cache_type= Log_event::EVENT_NO_CACHE;
@@ -3055,15 +3080,85 @@ class Xid_log_event: public Log_event
#ifdef MYSQL_SERVER
bool write();
#endif
- bool is_valid() const { return 1; }
private:
#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
- virtual int do_apply_event(rpl_group_info *rgi);
- enum_skip_reason do_shall_skip(rpl_group_info *rgi);
+ int do_commit();
#endif
};
+
+/**
+ @class XA_prepare_log_event
+
+ Similar to Xid_log_event except that
+ - it is specific to XA transaction
+ - it carries out the prepare logics rather than the final committing
+ when @c one_phase member is off.
+ From the groupping perspective the event finalizes the current "prepare" group
+ started with XA START Query-log-event.
+ When @c one_phase is false Commit of Rollback for XA transaction are
+ logged separately to the prepare-group events so being a groups of
+ their own.
+*/
+
+class XA_prepare_log_event: public Xid_apply_log_event
+{
+protected:
+ /* The event_xid_t members were copied from handler.h */
+ struct event_xid_t
+ {
+ long formatID;
+ long gtrid_length;
+ long bqual_length;
+ char data[MYSQL_XIDDATASIZE]; // not \0-terminated !
+ char *serialize(char *buf) const;
+ };
+
+ /* size of serialization buffer is explained in $MYSQL/sql/xa.h. */
+ static const uint ser_buf_size=
+ 8 + 2 * MYSQL_XIDDATASIZE + 4 * sizeof(long) + 1;
+
+ /* Total size of buffers to hold serialized members of XID struct */
+ static const int xid_bufs_size= 12;
+ event_xid_t m_xid;
+ void *xid;
+ bool one_phase;
+
+public:
+#ifdef MYSQL_SERVER
+ XA_prepare_log_event(THD* thd_arg, XID *xid_arg, bool one_phase_arg):
+ Xid_apply_log_event(thd_arg), xid(xid_arg), one_phase(one_phase_arg)
+ {
+ cache_type= Log_event::EVENT_NO_CACHE;
+ }
+#ifdef HAVE_REPLICATION
+ void pack_info(Protocol* protocol);
+#endif /* HAVE_REPLICATION */
+#else
+ bool print(FILE* file, PRINT_EVENT_INFO* print_event_info);
+#endif
+ XA_prepare_log_event(const char* buf,
+ const Format_description_log_event *description_event);
+ ~XA_prepare_log_event() {}
+ Log_event_type get_type_code() { return XA_PREPARE_LOG_EVENT; }
+ int get_data_size()
+ {
+ return xid_bufs_size + m_xid.gtrid_length + m_xid.bqual_length;
+ }
+
+#ifdef MYSQL_SERVER
+ bool write();
+#endif
+
+private:
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
+ int record_gtid(const rpl_gtid *gtid, uint64 sub_id, void **out_hton);
+ int do_commit();
+#endif
+};
+
+
/**
@class User_var_log_event
@@ -3376,6 +3471,11 @@ class Gtid_log_event: public Log_event
uint64 seq_no;
uint64 commit_id;
uint32 domain_id;
+#ifdef MYSQL_SERVER
+ XID xid;
+#else
+ struct st_mysql_xid xid;
+#endif
uchar flags2;
/* Flags2. */
@@ -3404,6 +3504,8 @@ class Gtid_log_event: public Log_event
static const uchar FL_WAITED= 16;
/* FL_DDL is set for event group containing DDL. */
static const uchar FL_DDL= 32;
+ /* FL_XA_TRANSACTION is set for XA transaction. */
+ static const uchar FL_XA_TRANSACTION= 64;
#ifdef MYSQL_SERVER
Gtid_log_event(THD *thd_arg, uint64 seq_no, uint32 domain_id, bool standalone,
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index fa2f866..88bbc9a 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -1461,12 +1461,19 @@ void THD::cleanup(void)
DBUG_ASSERT(cleanup_done == 0);
set_killed(KILL_CONNECTION);
-#ifdef ENABLE_WHEN_BINLOG_WILL_BE_ABLE_TO_PREPARE
if (transaction.xid_state.xa_state == XA_PREPARED)
{
-#error xid_state in the cache should be replaced by the allocated value
+ trans_xa_detach(this);
+ transaction.xid_state.xa_state= XA_NOTR;
+ transaction.xid_state.rm_error= 0;
+ }
+ else
+ {
+ transaction.xid_state.xa_state= XA_NOTR;
+ transaction.xid_state.rm_error= 0;
+ trans_rollback(this);
+ xid_cache_delete(this, &transaction.xid_state);
}
-#endif
mysql_ha_cleanup(this);
locked_tables_list.unlock_locked_tables(this);
@@ -1474,11 +1481,6 @@ void THD::cleanup(void)
delete_dynamic(&user_var_events);
close_temporary_tables();
- transaction.xid_state.xa_state= XA_NOTR;
- transaction.xid_state.rm_error= 0;
- trans_rollback(this);
- xid_cache_delete(this, &transaction.xid_state);
-
DBUG_ASSERT(open_tables == NULL);
/*
If the thread was in the middle of an ongoing transaction (rolled
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 69fabee..d13a3a4 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1255,6 +1255,18 @@ typedef struct st_xid_state {
/* Error reported by the Resource Manager (RM) to the Transaction Manager. */
uint rm_error;
XID_cache_element *xid_cache_element;
+ /*
+ Binary logging status.
+ It is set to TRUE at XA PREPARE if the transaction was written
+ to the binlog.
+ Naturally FALSE means the transaction was not written to
+ the binlog. Happens if the trnasaction did not modify anything
+ or binlogging was turned off. In that case we shouldn't binlog
+ the consequent XA COMMIT/ROLLBACK.
+ The recovered transaction after server restart sets it to TRUE always.
+ That can cause inconsistencies (shoud be fixed?).
+ */
+ bool is_binlogged;
/**
Check that XA transaction has an uncommitted work. Report an error
@@ -1278,6 +1290,12 @@ typedef struct st_xid_state {
}
return false;
}
+
+ void reset()
+ {
+ xid.null();
+ is_binlogged= FALSE;
+ }
} XID_STATE;
void xid_cache_init(void);
@@ -1917,6 +1935,17 @@ struct Ha_data
*/
void *ha_ptr;
/**
+ A memorizer to engine specific "native" transaction object to provide
+ storage engine detach-re-attach facility.
+ The server level transaction object can dissociate from storage engine
+ transactions. The released "native" transaction reference
+ can be hold in the member until it is reconciled later.
+ Lifetime: Depends on caller of @c hton::replace_native_transaction_in_thd.
+ For instance in the case of slave server applier handling XA transaction
+ it is from XA START to XA PREPARE.
+ */
+ void *ha_ptr_backup;
+ /**
0: Life time: one statement within a transaction. If @@autocommit is
on, also represents the entire transaction.
@sa trans_register_ha()
@@ -1932,7 +1961,7 @@ struct Ha_data
non-NULL: engine is bound to this thread, engine shutdown forbidden
*/
plugin_ref lock;
- Ha_data() :ha_ptr(NULL) {}
+ Ha_data() :ha_ptr(NULL), ha_ptr_backup(NULL) {}
};
/**
@@ -2603,7 +2632,7 @@ class THD :public Statement,
then.
*/
if (!xid_state.rm_error)
- xid_state.xid.null();
+ xid_state.reset();
free_root(&mem_root,MYF(MY_KEEP_PREALLOC));
DBUG_VOID_RETURN;
}
@@ -6456,6 +6485,18 @@ inline bool add_group_to_list(THD *thd, Item *item, bool asc)
return thd->lex->current_select->add_group_to_list(thd, item, asc);
}
+/**
+ @param THD thread context
+ @param hton pointer to handlerton
+ @return address of the placeholder of handlerton's specific transaction
+ object (data)
+*/
+
+inline void **thd_ha_data_backup(const THD *thd, const struct handlerton *hton)
+{
+ return (void **) &thd->ha_data[hton->slot].ha_ptr_backup;
+}
+
inline Item *and_conds(THD *thd, Item *a, Item *b)
{
if (!b) return a;
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index b48070b..3e4a067 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -1414,6 +1414,7 @@ void do_handle_one_connection(CONNECT *connect)
#endif
end_thread:
close_connection(thd);
+ thd->get_stmt_da()->reset_diagnostics_area();
if (thd->userstat_running)
update_global_user_stats(thd, create_user, time(NULL));
diff --git a/sql/transaction.cc b/sql/transaction.cc
index 13614d3..c9b85d8 100644
--- a/sql/transaction.cc
+++ b/sql/transaction.cc
@@ -790,6 +790,135 @@ bool trans_release_savepoint(THD *thd, LEX_CSTRING name)
/**
+ Detach the current XA transaction;
+
+ @param thd Current thread
+
+ @retval FALSE Success
+ @retval TRUE Failure
+*/
+
+bool trans_xa_detach(THD *thd)
+{
+ XID_STATE *xid_s= &thd->transaction.xid_state;
+ Ha_trx_info *ha_info, *ha_info_next;
+
+ DBUG_ENTER("trans_xa_detach");
+
+// DBUG_ASSERT(xid_s->xa_state == XA_PREPARED &&
+// xid_cache_search(thd, &xid_s->xid));
+
+ xid_cache_delete(thd, xid_s);
+ if (xid_cache_insert(&xid_s->xid, XA_PREPARED))
+ DBUG_RETURN(TRUE);
+
+ for (ha_info= thd->transaction.all.ha_list;
+ ha_info;
+ ha_info= ha_info_next)
+ {
+ ha_info_next= ha_info->next();
+ ha_info->reset(); /* keep it conveniently zero-filled */
+ }
+
+ thd->transaction.all.ha_list= 0;
+ thd->transaction.all.no_2pc= 0;
+
+ DBUG_RETURN(FALSE);
+}
+
+
+void attach_native_trx(THD *thd);
+/**
+ This is a specific to "slave" applier collection of standard cleanup
+ actions to reset XA transaction states at the end of XA prepare rather than
+ to do it at the transaction commit, see @c ha_commit_one_phase.
+ THD of the slave applier is dissociated from a transaction object in engine
+ that continues to exist there.
+
+ @param THD current thread
+ @return the value of is_error()
+*/
+
+bool applier_reset_xa_trans(THD *thd)
+{
+ XID_STATE *xid_s= &thd->transaction.xid_state;
+
+ thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
+ thd->server_status&=
+ ~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY);
+ DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS"));
+ xid_cache_delete(thd, xid_s);
+ if (xid_cache_insert(&xid_s->xid, XA_PREPARED))
+ return true;
+
+ attach_native_trx(thd);
+ thd->transaction.cleanup();
+ thd->transaction.xid_state.xa_state= XA_NOTR;
+ thd->mdl_context.release_transactional_locks();
+
+ return thd->is_error();
+}
+
+
+/**
+ The function detaches existing storage engines transaction
+ context from thd. Backup area to save it is provided to low level
+ storage engine function.
+
+ is invoked by plugin_foreach() after
+ trans_xa_start() for each storage engine.
+
+ @param[in,out] thd Thread context
+ @param plugin Reference to handlerton
+
+ @return FALSE on success, TRUE otherwise.
+*/
+
+my_bool detach_native_trx(THD *thd, plugin_ref plugin, void *unused)
+{
+ handlerton *hton= plugin_hton(plugin);
+ if (hton->replace_native_transaction_in_thd)
+ hton->replace_native_transaction_in_thd(thd, NULL,
+ thd_ha_data_backup(thd, hton));
+
+ return FALSE;
+
+}
+
+/**
+ The function restores previously saved storage engine transaction context.
+
+ @param thd Thread context
+*/
+void attach_native_trx(THD *thd)
+{
+ Ha_trx_info *ha_info= thd->transaction.all.ha_list;
+ Ha_trx_info *ha_info_next;
+
+ if (ha_info)
+ {
+ for (; ha_info; ha_info= ha_info_next)
+ {
+ handlerton *hton= ha_info->ht();
+ if (hton->replace_native_transaction_in_thd)
+ {
+ /* restore the saved original engine transaction's link with thd */
+ void **trx_backup= thd_ha_data_backup(thd, hton);
+
+ hton->
+ replace_native_transaction_in_thd(thd, *trx_backup, NULL);
+ *trx_backup= NULL;
+ }
+ ha_info_next= ha_info->next();
+ ha_info->reset();
+ }
+ }
+ thd->transaction.all.ha_list= 0;
+ thd->transaction.all.no_2pc= 0;
+}
+
+
+/**
Starts an XA transaction with the given xid value.
@param thd Current thread
@@ -833,6 +962,17 @@ bool trans_xa_start(THD *thd)
trans_rollback(thd);
DBUG_RETURN(true);
}
+
+ if (thd->variables.pseudo_slave_mode || thd->slave_thread)
+ {
+ /*
+ In case of slave thread applier or processing binlog by client,
+ detach the "native" thd's trx in favor of dynamically created.
+ */
+ plugin_foreach(thd, detach_native_trx,
+ MYSQL_STORAGE_ENGINE_PLUGIN, NULL);
+ }
+
DBUG_RETURN(FALSE);
}
@@ -862,7 +1002,15 @@ bool trans_xa_end(THD *thd)
else if (!thd->transaction.xid_state.xid.eq(thd->lex->xid))
my_error(ER_XAER_NOTA, MYF(0));
else if (!xa_trans_rolled_back(&thd->transaction.xid_state))
- thd->transaction.xid_state.xa_state= XA_IDLE;
+ {
+ if ((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) &&
+ thd->binlog_query(THD::STMT_QUERY_TYPE,
+ thd->query(), thd->query_length(),
+ TRUE, FALSE, FALSE, 0))
+ my_error(ER_XAER_RMERR, MYF(0));
+ else
+ thd->transaction.xid_state.xa_state= XA_IDLE;
+ }
DBUG_RETURN(thd->is_error() ||
thd->transaction.xid_state.xa_state != XA_IDLE);
@@ -880,6 +1028,8 @@ bool trans_xa_end(THD *thd)
bool trans_xa_prepare(THD *thd)
{
+ int res= 1;
+
DBUG_ENTER("trans_xa_prepare");
if (thd->transaction.xid_state.xa_state != XA_IDLE)
@@ -894,10 +1044,14 @@ bool trans_xa_prepare(THD *thd)
my_error(ER_XA_RBROLLBACK, MYF(0));
}
else
+ {
+ res= 0;
thd->transaction.xid_state.xa_state= XA_PREPARED;
+ if (thd->variables.pseudo_slave_mode)
+ res= applier_reset_xa_trans(thd);
+ }
- DBUG_RETURN(thd->is_error() ||
- thd->transaction.xid_state.xa_state != XA_PREPARED);
+ DBUG_RETURN(res);
}
@@ -928,6 +1082,12 @@ bool trans_xa_commit(THD *thd)
res= !xs;
if (res)
my_error(ER_XAER_NOTA, MYF(0));
+ else if (thd->in_multi_stmt_transaction_mode())
+ {
+ my_error(ER_XAER_RMFAIL, MYF(0),
+ xa_state_names[thd->transaction.xid_state.xa_state]);
+ res= TRUE;
+ }
else
{
res= xa_trans_rolled_back(xs);
@@ -978,8 +1138,16 @@ bool trans_xa_commit(THD *thd)
{
DEBUG_SYNC(thd, "trans_xa_commit_after_acquire_commit_lock");
- res= MY_TEST(ha_commit_one_phase(thd, 1));
- if (res)
+ if(WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())
+ {
+ res= thd->binlog_query(THD::THD::STMT_QUERY_TYPE,
+ thd->query(), thd->query_length(),
+ FALSE, FALSE, FALSE, 0);
+ }
+ else
+ res= 0;
+
+ if (res || (res= MY_TEST(ha_commit_one_phase(thd, 1))))
my_error(ER_XAER_RMERR, MYF(0));
}
}
@@ -1032,19 +1200,36 @@ bool trans_xa_rollback(THD *thd)
else
{
xa_trans_rolled_back(xs);
- ha_commit_or_rollback_by_xid(thd->lex->xid, 0);
+ if (ha_commit_or_rollback_by_xid(thd->lex->xid, 0) == 0 &&
+ (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()))
+ thd->binlog_query(THD::THD::STMT_QUERY_TYPE,
+ thd->query(), thd->query_length(),
+ FALSE, FALSE, FALSE, 0);
xid_cache_delete(thd, xs);
}
DBUG_RETURN(thd->get_stmt_da()->is_error());
}
- if (xa_state != XA_IDLE && xa_state != XA_PREPARED && xa_state != XA_ROLLBACK_ONLY)
+ if (xa_state != XA_IDLE && xa_state != XA_PREPARED &&
+ xa_state != XA_ROLLBACK_ONLY)
{
my_error(ER_XAER_RMFAIL, MYF(0), xa_state_names[xa_state]);
DBUG_RETURN(TRUE);
}
- res= xa_trans_force_rollback(thd);
+ if(xa_state == XA_PREPARED &&
+ (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()))
+ {
+ res= thd->binlog_query(THD::THD::STMT_QUERY_TYPE,
+ thd->query(), thd->query_length(),
+ FALSE, FALSE, FALSE, 0);
+ }
+ else
+ res= 0;
+
+ res= res || xa_trans_force_rollback(thd);
+ if (res || (res= MY_TEST(xa_trans_force_rollback(thd))))
+ my_error(ER_XAER_RMERR, MYF(0));
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
thd->transaction.all.reset();
diff --git a/sql/transaction.h b/sql/transaction.h
index 7e34693..1109a61 100644
--- a/sql/transaction.h
+++ b/sql/transaction.h
@@ -42,6 +42,8 @@ bool trans_xa_end(THD *thd);
bool trans_xa_prepare(THD *thd);
bool trans_xa_commit(THD *thd);
bool trans_xa_rollback(THD *thd);
+bool trans_xa_detach(THD *thd);
+bool applier_reset_xa_trans(THD *thd);
void trans_reset_one_shot_chistics(THD *thd);
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 35c8b7f..b9e75f4 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -1827,7 +1827,7 @@ thd_innodb_tmpdir(
/** Obtain the InnoDB transaction of a MySQL thread.
@param[in,out] thd thread handle
@return reference to transaction pointer */
-static trx_t* thd_to_trx(THD* thd)
+static trx_t*& thd_to_trx(THD* thd)
{
return *reinterpret_cast<trx_t**>(thd_ha_data(thd, innodb_hton_ptr));
}
@@ -3625,6 +3625,46 @@ static ulonglong innodb_prepare_commit_versioned(THD* thd, ulonglong *trx_id)
return 0;
}
+/** InnoDB transaction object that is currently associated with THD is
+replaced with that of the 2nd argument. The previous value is
+returned through the 3rd argument's buffer, unless it's NULL. When
+the buffer is not provided (value NULL) that should mean the caller
+restores previously saved association so the current trx has to be
+additionally freed from all association with MYSQL.
+
+@param[in,out] thd MySQL thread handle
+@param[in] new_trx_arg replacement trx_t
+@param[in,out] ptr_trx_arg pointer to a buffer to store old trx_t */
+static
+void
+innodb_replace_trx_in_thd(
+ THD* thd,
+ void* new_trx_arg,
+ void** ptr_trx_arg)
+{
+ trx_t*& trx = thd_to_trx(thd);
+
+ ut_ad(new_trx_arg == NULL
+ || (((trx_t*) new_trx_arg)->mysql_thd == thd
+ && !((trx_t*) new_trx_arg)->is_recovered));
+
+ if (ptr_trx_arg) {
+ *ptr_trx_arg = trx;
+
+ ut_ad(trx == NULL
+ || (trx->mysql_thd == thd && !trx->is_recovered));
+
+ } else if (trx->state == TRX_STATE_NOT_STARTED) {
+ ut_ad(thd == trx->mysql_thd);
+ trx->read_view.close();
+ } else {
+ ut_ad(thd == trx->mysql_thd);
+ ut_ad(trx_state_eq(trx, TRX_STATE_PREPARED));
+ trx_disconnect_prepared(trx);
+ }
+ trx = static_cast<trx_t*>(new_trx_arg);
+}
+
/** Initialize and normalize innodb_buffer_pool_size. */
static void innodb_buffer_pool_size_init()
{
@@ -4177,6 +4217,9 @@ static int innodb_init(void* p)
innobase_hton->prepare_commit_versioned
= innodb_prepare_commit_versioned;
+ innobase_hton->replace_native_transaction_in_thd =
+ innodb_replace_trx_in_thd;
+
innodb_remember_check_sysvar_funcs();
compile_time_assert(DATA_MYSQL_TRUE_VARCHAR == MYSQL_TYPE_VARCHAR);
1
0
[Commits] b88a803459c: MDEV-17428: Update wsrep_max_ws_rows and wsrep_max_ws_size values in wsrep.cnf.sh
by jan 21 Feb '19
by jan 21 Feb '19
21 Feb '19
revision-id: b88a803459c479f41bbff0a2bfe4c8d90cd1c446 (mariadb-10.1.38-11-gb88a803459c)
parent(s): d9f7b6be5aa8d0eea18d1f122338b6058c03fdc3
author: Jan Lindström
committer: Jan Lindström
timestamp: 2019-02-21 09:19:18 +0200
message:
MDEV-17428: Update wsrep_max_ws_rows and wsrep_max_ws_size values in wsrep.cnf.sh
Since MariaDB 10.1.17 the new default values for wsrep_max_ws_rows and wsrep_max_ws_size were set:
wsrep_max_ws_rows
Default Value:
0 (>= MariaDB Galera 10.0.27, MariaDB 10.1.17)
131072 (<= MariaDB Galera 10.0.26, MariaDB 10.1.16)
wsrep_max_ws_size
Default Value:
2147483647 (2GB, >= MariaDB Galera 10.0.27, MariaDB 10.1.17)
1073741824 (1GB, <= MariaDB Galera 10.0.26, MariaDB 10.1.16)
---
support-files/wsrep.cnf.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/support-files/wsrep.cnf.sh b/support-files/wsrep.cnf.sh
index 51ce3dca2dd..7242fff9f7a 100644
--- a/support-files/wsrep.cnf.sh
+++ b/support-files/wsrep.cnf.sh
@@ -67,10 +67,10 @@ wsrep_slave_threads=1
wsrep_certify_nonPK=1
# Maximum number of rows in write set
-wsrep_max_ws_rows=131072
+wsrep_max_ws_rows=0
# Maximum size of write set
-wsrep_max_ws_size=1073741824
+wsrep_max_ws_size=2147483647
# to enable debug level logging, set this to 1
wsrep_debug=0
1
0
revision-id: 80c17fb3a842fa68df0d69e10e16da853de3a872 (mariadb-10.3.6-142-g80c17fb3a84)
parent(s): 0e186837c6b67214174d8f3ed98ef2e2f2f86ddb a40de1bdeb218d66d5cc737758a4bab1b06f255d
author: Oleksandr Byelkin
committer: Oleksandr Byelkin
timestamp: 2019-02-20 17:25:11 +0100
message:
Merge branch '10.3' into 10.4
debian/autobake-deb.sh | 27 ----------------------
.../mariabackup/encrypted_page_compressed.test | 2 +-
.../mariabackup/encrypted_page_corruption.test | 2 +-
.../suite/mariabackup/log_checksum_mismatch.test | 2 +-
.../mariabackup/unencrypted_page_compressed.test | 2 +-
5 files changed, 4 insertions(+), 31 deletions(-)
diff --cc debian/autobake-deb.sh
index 3442afbf376,5ca59e0305d..6ef0cb33553
--- a/debian/autobake-deb.sh
+++ b/debian/autobake-deb.sh
@@@ -94,36 -94,9 +94,9 @@@ f
# x86 32 bit.
if [[ $GCCVERSION -lt 40800 ]] || [[ $(arch) =~ i[346]86 ]] || [[ $TRAVIS ]]
then
- sed '/Package: mariadb-plugin-rocksdb/,+14d' -i debian/control
+ sed '/Package: mariadb-plugin-rocksdb/,/^$/d' -i debian/control
fi
- # AWS SDK requires c++11 -capable compiler.
- # Minimal supported versions are g++ 4.8 and clang 3.3.
- # AWS SDK also requires the build machine to have network access and git, so
- # it cannot be part of the base version included in Linux distros, but a pure
- # custom built plugin.
- if [[ $GCCVERSION -gt 40800 ]] && [[ ! $TRAVIS ]] && [[ -x "$(command -v git)" ]] && timeout 3s bash -c 'sed -n q </dev/tcp/github.com/22'
- then
- cat <<EOF >> debian/control
-
- Package: mariadb-plugin-aws-key-management
- Architecture: any
- Breaks: mariadb-aws-key-management-10.1,
- mariadb-aws-key-management-10.2
- Replaces: mariadb-aws-key-management-10.1,
- mariadb-aws-key-management-10.2
- Depends: mariadb-server-10.4,
- \${misc:Depends},
- \${shlibs:Depends}
- Description: Amazon Web Service Key Management Service Plugin for MariaDB
- This encryption key management plugin gives an interface to the Amazon Web
- Services Key Management Service for managing encryption keys used for MariaDB
- data-at-rest encryption.
- EOF
-
- sed -i -e "/-DPLUGIN_AWS_KEY_MANAGEMENT=NO/d" debian/rules
- fi
-
# Don't build cassandra package if thrift is not installed
if [[ ! -f /usr/local/include/thrift/Thrift.h && ! -f /usr/include/thrift/Thrift.h ]]
then
1
0
[Commits] 5e7d0af0293: MDEV-18659: Fix gcc-8 compiler warnings produced by -Wstringop-truncation and -Wstringop-overflow for InnoDB
by jan 20 Feb '19
by jan 20 Feb '19
20 Feb '19
revision-id: 5e7d0af0293ec0e8713efba6cf311e595f96e310 (mariadb-10.1.38-7-g5e7d0af0293)
parent(s): 346e46089621e6951e076c82ed5690aa23dcb5fe
author: Jan Lindström
committer: Jan Lindström
timestamp: 2019-02-20 15:26:27 +0200
message:
MDEV-18659: Fix gcc-8 compiler warnings produced by -Wstringop-truncation and -Wstringop-overflow for InnoDB
dict_table_rename_in_cache
dict/dict0dict.cc:1870:11: warning: ‘char* strncpy(char*, const char*, size_t)’ output may be truncated copying 320 bytes from a string of length 654 [-Wstringop-truncation]
Use memcpy instead as it is safe to read and copy MAX_TABLE_NAME_LEN
characters as both old_name_cs_filename and old_name
have allocated more space.
fts_write_node
Make sure than inserted word is not NULL. Note that there
is similar assertions before we search stopwords or insert
data.
fts_fetch_index_words
fts/fts0opt.cc:681:16: warning: ‘int __builtin_memcmp_eq(const void*, const void*, long unsigned int)’ specified size 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
dfield_get_len returns a ulint as it can return UNIV_SQL_NULL
(ULINT32_UNDEFINED) and storing return value to short can
cause overflow. However, NULL-values are not actually stored
"word"-column in FTS-index.
dict_create_add_foreign_id
include/dict0crea.ic:71:11: warning: ‘char* strncpy(char*, const char*, size_t)’ specified bound 340 equals destination size [-Wstringop-truncation]
Add extra space for string constant to avoid this.
row_rename_table_for_mysql
row/row0mysql.cc:5190:10: warning: ‘char* strncpy(char*, const char*, size_t)’ specified bound 320 equals destination size [-Wstringop-truncation]
Add extra space for string constant to avoid this.
log_online_setup_bitmap_file_range
log/log0online.cc:1455:11: warning: ‘char* strncpy(char*, const char*, size_t)’ output may be truncated copying 512 bytes from a string of length 3999 [-Wstringop-truncation]
Copy only FN_REFLEN - 1 characters as we will add string end marker there anyway.
---
storage/innobase/dict/dict0dict.cc | 4 ++--
storage/innobase/fts/fts0fts.cc | 1 +
storage/innobase/fts/fts0opt.cc | 10 +++++-----
storage/innobase/include/dict0crea.ic | 2 +-
storage/innobase/row/row0mysql.cc | 4 ++--
storage/xtradb/dict/dict0dict.cc | 6 +++---
storage/xtradb/fts/fts0fts.cc | 1 +
storage/xtradb/fts/fts0opt.cc | 10 +++++-----
storage/xtradb/include/dict0crea.ic | 2 +-
storage/xtradb/log/log0online.cc | 2 +-
storage/xtradb/row/row0mysql.cc | 4 ++--
11 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 06c6c3effab..d14a2320795 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -1861,7 +1861,7 @@ dict_table_rename_in_cache(
/* The old table name in my_charset_filename is stored
in old_name_cs_filename */
- strncpy(old_name_cs_filename, old_name,
+ memcpy(old_name_cs_filename, old_name,
MAX_TABLE_NAME_LEN);
if (strstr(old_name, TEMP_TABLE_PATH_PREFIX) == NULL) {
@@ -1883,7 +1883,7 @@ dict_table_rename_in_cache(
} else {
/* Old name already in
my_charset_filename */
- strncpy(old_name_cs_filename, old_name,
+ memcpy(old_name_cs_filename, old_name,
MAX_TABLE_NAME_LEN);
}
}
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index 75258bb8610..14ef9960cee 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -3830,6 +3830,7 @@ fts_write_node(
info = pars_info_create();
}
+ ut_ad(word->f_len != UNIV_SQL_NULL);
pars_info_bind_varchar_literal(info, "token", word->f_str, word->f_len);
/* Convert to "storage" byte order. */
diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc
index 77293bc867a..2a97f0fa527 100644
--- a/storage/innobase/fts/fts0opt.cc
+++ b/storage/innobase/fts/fts0opt.cc
@@ -673,18 +673,18 @@ fts_fetch_index_words(
fts_zip_t* zip = static_cast<fts_zip_t*>(user_arg);
que_node_t* exp = sel_node->select_list;
dfield_t* dfield = que_node_get_val(exp);
- short len = static_cast<short>(dfield_get_len(dfield));
+ ulint len = dfield_get_len(dfield);
void* data = dfield_get_data(dfield);
+ ut_a(len <= FTS_MAX_WORD_LEN);
+
/* Skip the duplicate words. */
- if (zip->word.f_len == static_cast<ulint>(len)
+ if (zip->word.f_len == len
&& !memcmp(zip->word.f_str, data, len)) {
return(TRUE);
}
- ut_a(len <= FTS_MAX_WORD_LEN);
-
memcpy(zip->word.f_str, data, len);
zip->word.f_len = len;
@@ -693,7 +693,7 @@ fts_fetch_index_words(
/* The string is prefixed by len. */
zip->zp->next_in = reinterpret_cast<byte*>(&len);
- zip->zp->avail_in = sizeof(len);
+ zip->zp->avail_in = sizeof(static_cast<short>(len));
/* Compress the word, create output blocks as necessary. */
while (zip->zp->avail_in > 0) {
diff --git a/storage/innobase/include/dict0crea.ic b/storage/innobase/include/dict0crea.ic
index 1cbaa47032b..88919fbd24c 100644
--- a/storage/innobase/include/dict0crea.ic
+++ b/storage/innobase/include/dict0crea.ic
@@ -65,7 +65,7 @@ dict_create_add_foreign_id(
sprintf(id, "%s_ibfk_%lu", name,
(ulong) (*id_nr)++);
} else {
- char table_name[MAX_TABLE_NAME_LEN + 20] = "";
+ char table_name[MAX_TABLE_NAME_LEN + 21] = "";
uint errors = 0;
strncpy(table_name, name,
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index 2a9ade1da2c..84f30e226dd 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -5173,8 +5173,8 @@ row_rename_table_for_mysql(
if (!new_is_tmp) {
/* Rename all constraints. */
- char new_table_name[MAX_TABLE_NAME_LEN] = "";
- char old_table_utf8[MAX_TABLE_NAME_LEN] = "";
+ char new_table_name[MAX_TABLE_NAME_LEN+1] = "";
+ char old_table_utf8[MAX_TABLE_NAME_LEN+1] = "";
uint errors = 0;
strncpy(old_table_utf8, old_name, MAX_TABLE_NAME_LEN);
diff --git a/storage/xtradb/dict/dict0dict.cc b/storage/xtradb/dict/dict0dict.cc
index 1c489d13f1a..3961e0c4639 100644
--- a/storage/xtradb/dict/dict0dict.cc
+++ b/storage/xtradb/dict/dict0dict.cc
@@ -1867,7 +1867,7 @@ dict_table_rename_in_cache(
/* The old table name in my_charset_filename is stored
in old_name_cs_filename */
- strncpy(old_name_cs_filename, old_name,
+ memcpy(old_name_cs_filename, old_name,
MAX_TABLE_NAME_LEN);
if (strstr(old_name, TEMP_TABLE_PATH_PREFIX) == NULL) {
@@ -1889,7 +1889,7 @@ dict_table_rename_in_cache(
} else {
/* Old name already in
my_charset_filename */
- strncpy(old_name_cs_filename, old_name,
+ memcpy(old_name_cs_filename, old_name,
MAX_TABLE_NAME_LEN);
}
}
@@ -1916,7 +1916,7 @@ dict_table_rename_in_cache(
/* This is a generated >= 4.0.18 format id */
- char table_name[MAX_TABLE_NAME_LEN] = "";
+ char table_name[MAX_TABLE_NAME_LEN+1] = "";
uint errors = 0;
if (strlen(table->name) > strlen(old_name)) {
diff --git a/storage/xtradb/fts/fts0fts.cc b/storage/xtradb/fts/fts0fts.cc
index 02d81551e75..e6549e40232 100644
--- a/storage/xtradb/fts/fts0fts.cc
+++ b/storage/xtradb/fts/fts0fts.cc
@@ -3829,6 +3829,7 @@ fts_write_node(
info = pars_info_create();
}
+ ut_ad(word->f_len != UNIV_SQL_NULL);
pars_info_bind_varchar_literal(info, "token", word->f_str, word->f_len);
/* Convert to "storage" byte order. */
diff --git a/storage/xtradb/fts/fts0opt.cc b/storage/xtradb/fts/fts0opt.cc
index 77293bc867a..2a97f0fa527 100644
--- a/storage/xtradb/fts/fts0opt.cc
+++ b/storage/xtradb/fts/fts0opt.cc
@@ -673,18 +673,18 @@ fts_fetch_index_words(
fts_zip_t* zip = static_cast<fts_zip_t*>(user_arg);
que_node_t* exp = sel_node->select_list;
dfield_t* dfield = que_node_get_val(exp);
- short len = static_cast<short>(dfield_get_len(dfield));
+ ulint len = dfield_get_len(dfield);
void* data = dfield_get_data(dfield);
+ ut_a(len <= FTS_MAX_WORD_LEN);
+
/* Skip the duplicate words. */
- if (zip->word.f_len == static_cast<ulint>(len)
+ if (zip->word.f_len == len
&& !memcmp(zip->word.f_str, data, len)) {
return(TRUE);
}
- ut_a(len <= FTS_MAX_WORD_LEN);
-
memcpy(zip->word.f_str, data, len);
zip->word.f_len = len;
@@ -693,7 +693,7 @@ fts_fetch_index_words(
/* The string is prefixed by len. */
zip->zp->next_in = reinterpret_cast<byte*>(&len);
- zip->zp->avail_in = sizeof(len);
+ zip->zp->avail_in = sizeof(static_cast<short>(len));
/* Compress the word, create output blocks as necessary. */
while (zip->zp->avail_in > 0) {
diff --git a/storage/xtradb/include/dict0crea.ic b/storage/xtradb/include/dict0crea.ic
index 1cbaa47032b..88919fbd24c 100644
--- a/storage/xtradb/include/dict0crea.ic
+++ b/storage/xtradb/include/dict0crea.ic
@@ -65,7 +65,7 @@ dict_create_add_foreign_id(
sprintf(id, "%s_ibfk_%lu", name,
(ulong) (*id_nr)++);
} else {
- char table_name[MAX_TABLE_NAME_LEN + 20] = "";
+ char table_name[MAX_TABLE_NAME_LEN + 21] = "";
uint errors = 0;
strncpy(table_name, name,
diff --git a/storage/xtradb/log/log0online.cc b/storage/xtradb/log/log0online.cc
index bc1667e1c20..43ed68cbd57 100644
--- a/storage/xtradb/log/log0online.cc
+++ b/storage/xtradb/log/log0online.cc
@@ -1453,7 +1453,7 @@ log_online_setup_bitmap_file_range(
bitmap_files->files[array_pos].seq_num = file_seq_num;
strncpy(bitmap_files->files[array_pos].name,
- bitmap_dir_file_info.name, FN_REFLEN);
+ bitmap_dir_file_info.name, FN_REFLEN - 1);
bitmap_files->files[array_pos].name[FN_REFLEN - 1]
= '\0';
bitmap_files->files[array_pos].start_lsn
diff --git a/storage/xtradb/row/row0mysql.cc b/storage/xtradb/row/row0mysql.cc
index 93a4db98e7b..0ea2ae1b6d4 100644
--- a/storage/xtradb/row/row0mysql.cc
+++ b/storage/xtradb/row/row0mysql.cc
@@ -5183,8 +5183,8 @@ row_rename_table_for_mysql(
if (!new_is_tmp) {
/* Rename all constraints. */
- char new_table_name[MAX_TABLE_NAME_LEN] = "";
- char old_table_utf8[MAX_TABLE_NAME_LEN] = "";
+ char new_table_name[MAX_TABLE_NAME_LEN+1] = "";
+ char old_table_utf8[MAX_TABLE_NAME_LEN+1] = "";
uint errors = 0;
strncpy(old_table_utf8, old_name, MAX_TABLE_NAME_LEN);
1
0
[Commits] 56a0da6b1d9: MDEV-18659: Fix gcc-8 compiler warnings produced by -Wstringop-truncation and -Wstringop-overflow for InnoDB
by jan 20 Feb '19
by jan 20 Feb '19
20 Feb '19
revision-id: 56a0da6b1d99e305572826ee82868b1ea373b8e2 (mariadb-10.1.38-7-g56a0da6b1d9)
parent(s): 346e46089621e6951e076c82ed5690aa23dcb5fe
author: Jan Lindström
committer: Jan Lindström
timestamp: 2019-02-20 14:52:11 +0200
message:
MDEV-18659: Fix gcc-8 compiler warnings produced by -Wstringop-truncation and -Wstringop-overflow for InnoDB
dict_table_rename_in_cache
dict/dict0dict.cc:1870:11: warning: ‘char* strncpy(char*, const char*, size_t)’ output may be truncated copying 320 bytes from a string of length 654 [-Wstringop-truncation]
Use memcpy instead as it is safe to read and copy MAX_TABLE_NAME_LEN
characters as both old_name_cs_filename and old_name
have allocated more space.
fts_write_node
Make sure than inserted word is not NULL. Note that there
is similar assertions before we search stopwords or insert
data to FTS-index.
fts_fetch_index_words
fts/fts0opt.cc:681:16: warning: ‘int __builtin_memcmp_eq(const void*, const void*, long unsigned int)’ specified size 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
dfield_get_len returns a ulint as it can return UNIV_SQL_NULL
(ULINT32_UNDEFINED) and storing return value to short can
cause overflow. However, NULL-values are not actually stored
"word"-column in FTS-index.
dict_create_add_foreign_id
include/dict0crea.ic:71:11: warning: ‘char* strncpy(char*, const char*, size_t)’ specified bound 340 equals destination size [-Wstringop-truncation]
Add extra space for string constant to avoid this.
row_rename_table_for_mysql
row/row0mysql.cc:5190:10: warning: ‘char* strncpy(char*, const char*, size_t)’ specified bound 320 equals destination size [-Wstringop-truncation]
Add extra space for string constant to avoid this.
---
storage/innobase/dict/dict0dict.cc | 4 ++--
storage/innobase/fts/fts0fts.cc | 1 +
storage/innobase/fts/fts0opt.cc | 10 +++++-----
storage/innobase/include/dict0crea.ic | 2 +-
storage/innobase/row/row0mysql.cc | 4 ++--
storage/xtradb/dict/dict0dict.cc | 6 +++---
storage/xtradb/fts/fts0fts.cc | 1 +
storage/xtradb/fts/fts0opt.cc | 10 +++++-----
storage/xtradb/include/dict0crea.ic | 2 +-
storage/xtradb/row/row0mysql.cc | 4 ++--
10 files changed, 23 insertions(+), 21 deletions(-)
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 06c6c3effab..d14a2320795 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -1861,7 +1861,7 @@ dict_table_rename_in_cache(
/* The old table name in my_charset_filename is stored
in old_name_cs_filename */
- strncpy(old_name_cs_filename, old_name,
+ memcpy(old_name_cs_filename, old_name,
MAX_TABLE_NAME_LEN);
if (strstr(old_name, TEMP_TABLE_PATH_PREFIX) == NULL) {
@@ -1883,7 +1883,7 @@ dict_table_rename_in_cache(
} else {
/* Old name already in
my_charset_filename */
- strncpy(old_name_cs_filename, old_name,
+ memcpy(old_name_cs_filename, old_name,
MAX_TABLE_NAME_LEN);
}
}
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index 75258bb8610..14ef9960cee 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -3830,6 +3830,7 @@ fts_write_node(
info = pars_info_create();
}
+ ut_ad(word->f_len != UNIV_SQL_NULL);
pars_info_bind_varchar_literal(info, "token", word->f_str, word->f_len);
/* Convert to "storage" byte order. */
diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc
index 77293bc867a..2a97f0fa527 100644
--- a/storage/innobase/fts/fts0opt.cc
+++ b/storage/innobase/fts/fts0opt.cc
@@ -673,18 +673,18 @@ fts_fetch_index_words(
fts_zip_t* zip = static_cast<fts_zip_t*>(user_arg);
que_node_t* exp = sel_node->select_list;
dfield_t* dfield = que_node_get_val(exp);
- short len = static_cast<short>(dfield_get_len(dfield));
+ ulint len = dfield_get_len(dfield);
void* data = dfield_get_data(dfield);
+ ut_a(len <= FTS_MAX_WORD_LEN);
+
/* Skip the duplicate words. */
- if (zip->word.f_len == static_cast<ulint>(len)
+ if (zip->word.f_len == len
&& !memcmp(zip->word.f_str, data, len)) {
return(TRUE);
}
- ut_a(len <= FTS_MAX_WORD_LEN);
-
memcpy(zip->word.f_str, data, len);
zip->word.f_len = len;
@@ -693,7 +693,7 @@ fts_fetch_index_words(
/* The string is prefixed by len. */
zip->zp->next_in = reinterpret_cast<byte*>(&len);
- zip->zp->avail_in = sizeof(len);
+ zip->zp->avail_in = sizeof(static_cast<short>(len));
/* Compress the word, create output blocks as necessary. */
while (zip->zp->avail_in > 0) {
diff --git a/storage/innobase/include/dict0crea.ic b/storage/innobase/include/dict0crea.ic
index 1cbaa47032b..88919fbd24c 100644
--- a/storage/innobase/include/dict0crea.ic
+++ b/storage/innobase/include/dict0crea.ic
@@ -65,7 +65,7 @@ dict_create_add_foreign_id(
sprintf(id, "%s_ibfk_%lu", name,
(ulong) (*id_nr)++);
} else {
- char table_name[MAX_TABLE_NAME_LEN + 20] = "";
+ char table_name[MAX_TABLE_NAME_LEN + 21] = "";
uint errors = 0;
strncpy(table_name, name,
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index 2a9ade1da2c..84f30e226dd 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -5173,8 +5173,8 @@ row_rename_table_for_mysql(
if (!new_is_tmp) {
/* Rename all constraints. */
- char new_table_name[MAX_TABLE_NAME_LEN] = "";
- char old_table_utf8[MAX_TABLE_NAME_LEN] = "";
+ char new_table_name[MAX_TABLE_NAME_LEN+1] = "";
+ char old_table_utf8[MAX_TABLE_NAME_LEN+1] = "";
uint errors = 0;
strncpy(old_table_utf8, old_name, MAX_TABLE_NAME_LEN);
diff --git a/storage/xtradb/dict/dict0dict.cc b/storage/xtradb/dict/dict0dict.cc
index 1c489d13f1a..3961e0c4639 100644
--- a/storage/xtradb/dict/dict0dict.cc
+++ b/storage/xtradb/dict/dict0dict.cc
@@ -1867,7 +1867,7 @@ dict_table_rename_in_cache(
/* The old table name in my_charset_filename is stored
in old_name_cs_filename */
- strncpy(old_name_cs_filename, old_name,
+ memcpy(old_name_cs_filename, old_name,
MAX_TABLE_NAME_LEN);
if (strstr(old_name, TEMP_TABLE_PATH_PREFIX) == NULL) {
@@ -1889,7 +1889,7 @@ dict_table_rename_in_cache(
} else {
/* Old name already in
my_charset_filename */
- strncpy(old_name_cs_filename, old_name,
+ memcpy(old_name_cs_filename, old_name,
MAX_TABLE_NAME_LEN);
}
}
@@ -1916,7 +1916,7 @@ dict_table_rename_in_cache(
/* This is a generated >= 4.0.18 format id */
- char table_name[MAX_TABLE_NAME_LEN] = "";
+ char table_name[MAX_TABLE_NAME_LEN+1] = "";
uint errors = 0;
if (strlen(table->name) > strlen(old_name)) {
diff --git a/storage/xtradb/fts/fts0fts.cc b/storage/xtradb/fts/fts0fts.cc
index 02d81551e75..e6549e40232 100644
--- a/storage/xtradb/fts/fts0fts.cc
+++ b/storage/xtradb/fts/fts0fts.cc
@@ -3829,6 +3829,7 @@ fts_write_node(
info = pars_info_create();
}
+ ut_ad(word->f_len != UNIV_SQL_NULL);
pars_info_bind_varchar_literal(info, "token", word->f_str, word->f_len);
/* Convert to "storage" byte order. */
diff --git a/storage/xtradb/fts/fts0opt.cc b/storage/xtradb/fts/fts0opt.cc
index 77293bc867a..2a97f0fa527 100644
--- a/storage/xtradb/fts/fts0opt.cc
+++ b/storage/xtradb/fts/fts0opt.cc
@@ -673,18 +673,18 @@ fts_fetch_index_words(
fts_zip_t* zip = static_cast<fts_zip_t*>(user_arg);
que_node_t* exp = sel_node->select_list;
dfield_t* dfield = que_node_get_val(exp);
- short len = static_cast<short>(dfield_get_len(dfield));
+ ulint len = dfield_get_len(dfield);
void* data = dfield_get_data(dfield);
+ ut_a(len <= FTS_MAX_WORD_LEN);
+
/* Skip the duplicate words. */
- if (zip->word.f_len == static_cast<ulint>(len)
+ if (zip->word.f_len == len
&& !memcmp(zip->word.f_str, data, len)) {
return(TRUE);
}
- ut_a(len <= FTS_MAX_WORD_LEN);
-
memcpy(zip->word.f_str, data, len);
zip->word.f_len = len;
@@ -693,7 +693,7 @@ fts_fetch_index_words(
/* The string is prefixed by len. */
zip->zp->next_in = reinterpret_cast<byte*>(&len);
- zip->zp->avail_in = sizeof(len);
+ zip->zp->avail_in = sizeof(static_cast<short>(len));
/* Compress the word, create output blocks as necessary. */
while (zip->zp->avail_in > 0) {
diff --git a/storage/xtradb/include/dict0crea.ic b/storage/xtradb/include/dict0crea.ic
index 1cbaa47032b..88919fbd24c 100644
--- a/storage/xtradb/include/dict0crea.ic
+++ b/storage/xtradb/include/dict0crea.ic
@@ -65,7 +65,7 @@ dict_create_add_foreign_id(
sprintf(id, "%s_ibfk_%lu", name,
(ulong) (*id_nr)++);
} else {
- char table_name[MAX_TABLE_NAME_LEN + 20] = "";
+ char table_name[MAX_TABLE_NAME_LEN + 21] = "";
uint errors = 0;
strncpy(table_name, name,
diff --git a/storage/xtradb/row/row0mysql.cc b/storage/xtradb/row/row0mysql.cc
index 93a4db98e7b..0ea2ae1b6d4 100644
--- a/storage/xtradb/row/row0mysql.cc
+++ b/storage/xtradb/row/row0mysql.cc
@@ -5183,8 +5183,8 @@ row_rename_table_for_mysql(
if (!new_is_tmp) {
/* Rename all constraints. */
- char new_table_name[MAX_TABLE_NAME_LEN] = "";
- char old_table_utf8[MAX_TABLE_NAME_LEN] = "";
+ char new_table_name[MAX_TABLE_NAME_LEN+1] = "";
+ char old_table_utf8[MAX_TABLE_NAME_LEN+1] = "";
uint errors = 0;
strncpy(old_table_utf8, old_name, MAX_TABLE_NAME_LEN);
1
0
revision-id: e5a4f316f5af8e21e73bcdee6e2b1ad95ebb206d (mariadb-10.3.6-139-ge5a4f316f5a)
parent(s): 539a165b7a470baad1f3fcda7dde1ed6a81b1c2e 1005376e588dd99846c86f33d86ffdec9de6c213
author: Marko Mäkelä
committer: Oleksandr Byelkin
timestamp: 2019-02-20 12:02:52 +0100
message:
WIP merge 10.3 into 10.4
Unresolved conflicts:
both modified: mysql-test/suite/galera_3nodes/r/galera_garbd.result
both modified: mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result
both modified: mysql-test/suite/galera_3nodes/t/galera_garbd.test
both modified: scripts/mysql_install_db.sh
both modified: sql/item.cc
both modified: sql/sql_table.cc
both modified: sql/sql_time.cc
both modified: sql/sql_yacc.yy
both modified: sql/sql_yacc_ora.yy
both modified: sql/table.cc
CMakeLists.txt | 12 +-
client/mysqlbinlog.cc | 23 +-
client/mysqltest.cc | 66 +-
cmake/build_configurations/mysql_release.cmake | 1 -
cmake/readline.cmake | 2 +-
cmake/submodules.cmake | 12 +-
config.h.cmake | 6 +-
configure.cmake | 2 +-
extra/mariabackup/backup_copy.cc | 13 +
extra/mariabackup/xtrabackup.cc | 44 +-
include/my_sys.h | 5 +-
include/my_valgrind.h | 4 +-
include/mysql.h | 2 +-
include/mysql.h.pp | 2 +-
libmariadb | 2 +-
mysql-test/include/check-testcase.test | 1 -
mysql-test/include/mtr_check.sql | 1 -
mysql-test/main/alter_table.result | 49 +
mysql-test/main/alter_table.test | 17 +
mysql-test/main/alter_table_errors.result | 6 +
mysql-test/main/alter_table_errors.test | 10 +
mysql-test/main/check.result | 7 +
mysql-test/main/check.test | 9 +
mysql-test/main/check_constraint.result | 2 +-
mysql-test/main/check_constraint.test | 1 -
mysql-test/main/check_constraint_innodb.result | 9 +
mysql-test/main/check_constraint_innodb.test | 14 +
mysql-test/main/disabled.def | 1 +
mysql-test/main/error_simulation.result | 5 +-
mysql-test/main/error_simulation.test | 7 +-
mysql-test/main/func_misc.result | 8 +
mysql-test/main/func_misc.test | 8 +
mysql-test/main/gis.test | 1 -
mysql-test/main/gis2.result | 2 +-
mysql-test/main/mysql.result | 26 +
mysql-test/main/mysql.test | 22 +
mysql-test/main/mysqlbinlog_row_minimal.result | 122 +-
mysql-test/main/mysqlbinlog_row_minimal.test | 41 +
mysql-test/main/row-checksum-old.result | 16 +
mysql-test/main/row-checksum.result | 16 +
mysql-test/main/row-checksum.test | 17 +
mysql-test/main/subselect2.result | 22 +
mysql-test/main/subselect2.test | 20 +
mysql-test/main/subselect_mat.result | 16 +
mysql-test/main/subselect_mat.test | 13 +
mysql-test/main/subselect_sj2_mat.result | 4 +-
mysql-test/suite/archive/partition_archive.result | 4 +-
mysql-test/suite/archive/partition_archive.test | 3 +-
.../suite/binlog/r/binlog_base64_flag.result | 19 +
.../binlog/r/binlog_mysqlbinlog_row_frag.result | 24 +
mysql-test/suite/binlog/t/binlog_base64_flag.test | 22 +
.../binlog/t/binlog_mysqlbinlog_row_frag.test | 46 +
.../encryption/r/innodb-encryption-alter.result | 4 +-
.../encryption/t/innodb-encryption-alter.test | 2 -
.../suite/encryption/t/innodb-spatial-index.test | 2 -
mysql-test/suite/galera/r/galera_defaults.result | 1 +
mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf | 1 +
mysql-test/suite/galera_3nodes/galera_3nodes.cnf | 1 +
.../galera_3nodes/include/have_mariabackup.inc | 4 -
.../suite/galera_3nodes/r/galera_garbd.result | 8 +
.../galera_3nodes/r/galera_var_dirty_reads2.result | 8 +
mysql-test/suite/galera_3nodes/suite.pm | 9 +-
mysql-test/suite/galera_3nodes/t/galera_garbd.test | 26 +
.../galera_3nodes/t/galera_ipv6_mariabackup.test | 2 +-
.../galera_3nodes/t/galera_var_dirty_reads2.test | 14 +
.../suite/gcol/inc/gcol_column_def_options.inc | 1 -
mysql-test/suite/gcol/inc/gcol_keys.inc | 1 -
mysql-test/suite/gcol/r/gcol_keys_innodb.result | 2 +-
mysql-test/suite/gcol/r/innodb_virtual_fk.result | 4 +-
mysql-test/suite/gcol/t/innodb_virtual_fk.test | 2 -
mysql-test/suite/innodb/r/add_constraint.result | 2 +-
.../suite/innodb/r/alter_foreign_crash.result | 2 +-
.../suite/innodb/r/alter_varchar_change.result | 9 +
mysql-test/suite/innodb/r/foreign_key.result | 57 +-
.../suite/innodb/r/innodb-fk-warnings.result | 24 +-
mysql-test/suite/innodb/r/innodb-fk.result | 6 +-
.../suite/innodb/r/innodb-index-online.result | 2 +-
mysql-test/suite/innodb/r/innodb-index.result | 10 +-
.../suite/innodb/r/innodb_force_recovery.result | 8 +-
.../suite/innodb/r/instant_varchar_enlarge.result | 9 -
.../suite/innodb/r/undo_truncate_recover.result | 1 +
mysql-test/suite/innodb/t/add_constraint.test | 1 -
.../suite/innodb/t/alter_varchar_change.test | 7 +
mysql-test/suite/innodb/t/foreign_key.test | 52 +-
mysql-test/suite/innodb/t/innodb-fk-warnings.test | 18 -
mysql-test/suite/innodb/t/innodb-fk.test | 2 -
mysql-test/suite/innodb/t/innodb-index-online.test | 1 -
mysql-test/suite/innodb/t/innodb-index.test | 5 -
.../innodb/t/innodb-page_compression_tables.test | 4 -
.../suite/innodb/t/innodb_force_recovery.test | 4 -
.../suite/innodb/t/instant_varchar_enlarge.test | 8 -
.../suite/innodb/t/undo_truncate_recover.test | 6 +-
.../suite/innodb_gis/r/alter_spatial_index.result | 2 +-
mysql-test/suite/innodb_gis/r/point_basic.result | 14 +-
mysql-test/suite/innodb_gis/t/point_basic.test | 6 -
.../suite/mariabackup/incremental_rocksdb.opt | 1 +
.../suite/mariabackup/incremental_rocksdb.result | 19 +
.../suite/mariabackup/incremental_rocksdb.test | 38 +
.../perfschema/r/dml_setup_instruments.result | 4 +-
.../suite/perfschema/t/dml_setup_instruments.test | 5 +-
mysql-test/suite/plugins/t/audit_null.test | 2 +-
mysql-test/suite/rpl/r/rpl_set_statement.test | 0
mysql-test/suite/sys_vars/r/all_vars.result | 1 +
.../r/sysvars_innodb,32bit,xtradb.rdiff-disabled | 1236 +++++++++++
.../r/sysvars_innodb,xtradb.rdiff-disabled | 697 ++++++
mysql-test/suite/sys_vars/r/sysvars_wsrep.result | 14 +
.../sys_vars/r/tmp_disk_table_size_func.result | 2 +-
.../suite/sys_vars/t/tmp_disk_table_size_func.test | 1 -
mysql-test/suite/vcol/inc/vcol_keys.inc | 1 -
mysql-test/suite/vcol/r/vcol_keys_innodb.result | 2 +-
mysys/mf_iocache2.c | 61 +-
mysys/my_delete.c | 61 +
mysys/my_file.c | 7 +-
mysys/my_malloc.c | 1 +
plugin/aws_key_management/CMakeLists.txt | 6 +-
plugin/wsrep_info/mysql-test/wsrep_info/suite.pm | 2 +
scripts/mysql_install_db.sh | 26 +-
scripts/wsrep_sst_mariabackup.sh | 6 +-
scripts/wsrep_sst_rsync.sh | 2 +-
sql-common/client.c | 30 +-
sql/field.cc | 4 +-
sql/item.cc | 18 +-
sql/item_func.cc | 2 +-
sql/item_func.h | 4 +
sql/log.cc | 6 +-
sql/log_event.cc | 386 +++-
sql/log_event.h | 24 +-
sql/log_event_old.cc | 17 +-
sql/partition_info.cc | 2 +-
sql/rpl_tblmap.cc | 20 +-
sql/rpl_tblmap.h | 10 +-
sql/sql_binlog.cc | 91 +-
sql/sql_class.cc | 23 +-
sql/sql_class.h | 2 +-
sql/sql_lex.cc | 3 +-
sql/sql_lex.h | 4 +
sql/sql_repl.cc | 6 +-
sql/sql_select.cc | 21 +-
sql/sql_table.cc | 142 +-
sql/sql_yacc.yy | 19 +-
sql/sql_yacc_ora.yy | 19 +-
sql/sys_vars.cc | 13 +
sql/table.cc | 2 +-
sql/table.h | 12 +-
sql/wsrep_mysqld.cc | 1 +
sql/wsrep_mysqld.h | 1 +
sql/wsrep_mysqld_c.h | 30 +
storage/connect/ha_connect.cc | 45 +-
storage/connect/jsonudf.cpp | 48 +-
storage/connect/jsonudf.h | 5 +
.../mysql-test/connect/r/jdbc_postgresql.result | 2 +-
.../connect/mysql-test/connect/r/part_table.result | 4 +-
.../connect/mysql-test/connect/t/part_table.test | 2 +-
storage/connect/tabext.cpp | 43 +-
storage/connect/tabext.h | 5 +-
storage/connect/tabjdbc.cpp | 89 +-
storage/connect/tabjson.cpp | 46 +-
storage/connect/tabjson.h | 2 +-
storage/connect/tabxml.cpp | 279 +--
storage/connect/tabxml.h | 1 +
storage/innobase/dict/dict0dict.cc | 49 +-
storage/innobase/handler/handler0alter.cc | 107 +-
storage/innobase/handler/i_s.cc | 87 +-
storage/innobase/include/trx0rseg.h | 4 +-
storage/innobase/log/log0recv.cc | 2 +-
storage/innobase/row/row0mysql.cc | 3 -
storage/innobase/row/row0sel.cc | 43 +-
storage/innobase/srv/srv0start.cc | 6 +-
storage/maria/ma_delete.c | 2 -
storage/maria/ma_write.c | 3 +-
storage/maria/maria_def.h | 4 +-
storage/tokudb/PerconaFT/COPYING.APACHEv2 | 174 ++
storage/tokudb/PerconaFT/README.md | 5 +-
storage/tokudb/PerconaFT/ft/txn/txn_manager.h | 4 +-
.../tokudb/PerconaFT/locktree/concurrent_tree.cc | 14 +
.../tokudb/PerconaFT/locktree/concurrent_tree.h | 14 +
storage/tokudb/PerconaFT/locktree/keyrange.cc | 13 +
storage/tokudb/PerconaFT/locktree/keyrange.h | 13 +
storage/tokudb/PerconaFT/locktree/lock_request.cc | 13 +
storage/tokudb/PerconaFT/locktree/lock_request.h | 13 +
storage/tokudb/PerconaFT/locktree/locktree.cc | 13 +
storage/tokudb/PerconaFT/locktree/locktree.h | 13 +
storage/tokudb/PerconaFT/locktree/manager.cc | 13 +
storage/tokudb/PerconaFT/locktree/range_buffer.cc | 13 +
storage/tokudb/PerconaFT/locktree/range_buffer.h | 13 +
storage/tokudb/PerconaFT/locktree/treenode.cc | 13 +
storage/tokudb/PerconaFT/locktree/treenode.h | 13 +
storage/tokudb/PerconaFT/locktree/txnid_set.cc | 13 +
storage/tokudb/PerconaFT/locktree/txnid_set.h | 13 +
storage/tokudb/PerconaFT/locktree/wfg.cc | 13 +
storage/tokudb/PerconaFT/locktree/wfg.h | 13 +
.../PerconaFT/portability/toku_instr_mysql.cc | 12 +-
.../PerconaFT/portability/toku_instr_mysql.h | 11 +-
.../tokudb/PerconaFT/portability/toku_pthread.h | 78 +-
storage/tokudb/PerconaFT/util/growable_array.h | 13 +
storage/tokudb/PerconaFT/util/omt.cc | 2261 +++++++++++---------
storage/tokudb/PerconaFT/util/omt.h | 13 +
storage/tokudb/ha_tokudb.cc | 10 +
storage/tokudb/hatoku_hton.cc | 4 +-
storage/tokudb/hatoku_hton.h | 1 -
.../tokudb/mysql-test/tokudb_bugs/r/PS-4979.result | 2 +
.../tokudb/mysql-test/tokudb_bugs/t/PS-4979.test | 13 +
storage/tokudb/tokudb_background.cc | 4 +-
storage/tokudb/tokudb_sysvars.cc | 14 +-
storage/tokudb/tokudb_sysvars.h | 4 +-
support-files/mysql.server.sh | 6 +-
unittest/mysys/thr_template.c | 4 +-
unittest/sql/mf_iocache-t.cc | 70 +-
win/packaging/heidisql.cmake | 2 +-
209 files changed, 6128 insertions(+), 1947 deletions(-)
diff --cc cmake/submodules.cmake
index 9f04c26e8d6,34d1f37c956..c8f7b3cc400
--- a/cmake/submodules.cmake
+++ b/cmake/submodules.cmake
@@@ -31,7 -36,6 +36,6 @@@ ENDIF(
IF(update_result OR NOT EXISTS ${CMAKE_SOURCE_DIR}/libmariadb/CMakeLists.txt)
MESSAGE(FATAL_ERROR "No MariaDB Connector/C! Run
- git submodule update --init --recursive
- Then restart the build.
- ")
- ${GIT_EXECUTABLE} submodule update --init
++ ${GIT_EXECUTABLE} submodule update --init --recursive
+ Then restart the build.${SUBMODULE_UPDATE_CONFIG_MESSAGE}")
ENDIF()
diff --cc libmariadb
index beb9d5ea899,2c5aebb3bc7..4aad20db15d
--- a/libmariadb
+++ b/libmariadb
@@@ -1,1 -1,1 +1,1 @@@
- Subproject commit beb9d5ea8994bb90361c4b9f3d926eee24055178
-Subproject commit 2c5aebb3bc724c1663c481ba2fedde00ab494fa4
++Subproject commit 4aad20db15d137009422416d53b2e0de5b819808
diff --cc mysql-test/main/disabled.def
index eecee845a35,b6991cc1d37..c1cfd229a9b
--- a/mysql-test/main/disabled.def
+++ b/mysql-test/main/disabled.def
@@@ -18,6 -21,4 +18,7 @@@ innodb-wl5522-debug-zip : broken upstr
innodb_bug12902967 : broken upstream
file_contents : MDEV-6526 these files are not installed anymore
max_statement_time : cannot possibly work, depends on timing
+ partition_open_files_limit : open_files_limit check broken by MDEV-18360
+mysqlcheck : special tables like proxy , host specific to a system are shown
+flush_read_lock : special tables like proxy , host specific to a system are shown
+join_cache : enable after MDEV-17752 is fixed
diff --cc mysql-test/main/subselect2.result
index 21bf9aad122,cae0f2286c1..0e71f22e52e
--- a/mysql-test/main/subselect2.result
+++ b/mysql-test/main/subselect2.result
@@@ -394,3 -394,25 +394,25 @@@ select null in (select a from t1 where
(select a from t3) +1 < out3.a+1) from t3 out3;
ERROR 21000: Subquery returns more than 1 row
drop table t1, t2, t3;
+ CREATE TABLE t1(
+ q11 int, q12 int, q13 int, q14 int, q15 int, q16 int, q17 int, q18 int, q19 int,
+ q21 int, q22 int, q23 int, q24 int, q25 int, q26 int, q27 int, q28 int, q29 int,
+ f1 int
+ );
+ CREATE TABLE t2(f2 int, f21 int, f3 timestamp, f4 int, f5 int, f6 int);
+ INSERT INTO t1 (f1) VALUES (1),(1),(2),(2);
+ INSERT INTO t2 VALUES (1,1,"2004-02-29 11:11:11",0,0,0), (2,2,"2004-02-29 11:11:11",0,0,0);
+ SELECT f1,
+ (SELECT t.f21 from t2 t where max(
+ q11+q12+q13+q14+q15+q16+q17+q18+q19+
+ q21+q22+q23+q24+q25+q26+q27+q28+q29) = t.f2 UNION
+ SELECT t.f3 FROM t2 AS t WHERE t1.f1=t.f2 AND t.f3=MAX(t1.f1) UNION
+ SELECT 1 LIMIT 1) AS test
+ FROM t1 GROUP BY f1;
+ f1 test
+ 1 1
+ 2 1
+ Warnings:
-Warning 1292 Incorrect datetime value: '1'
-Warning 1292 Incorrect datetime value: '2'
++Warning 1292 Truncated incorrect datetime value: '1'
++Warning 1292 Truncated incorrect datetime value: '2'
+ DROP TABLE t1,t2;
diff --cc mysql-test/main/subselect_sj2_mat.result
index e4583cf6348,884451d7dff..f42b5ce1542
--- a/mysql-test/main/subselect_sj2_mat.result
+++ b/mysql-test/main/subselect_sj2_mat.result
@@@ -1743,10 -1701,10 +1743,10 @@@ O
(t.id IN (0,4,12,13,1,10,3,11))
);
id select_type table type possible_keys key key_len ref rows Extra
--1 PRIMARY t index PRIMARY PRIMARY 4 NULL 13 Using where; Using index
++1 PRIMARY t index PRIMARY PRIMARY 4 NULL 14 Using where; Using index
2 MATERIALIZED <subquery3> ALL distinct_key NULL NULL NULL 8
--2 MATERIALIZED A ALL PRIMARY NULL NULL NULL 13 Using where; Using join buffer (flat, BNL join)
-3 MATERIALIZED B ALL PRIMARY NULL NULL NULL 13 Using where
++2 MATERIALIZED A ALL PRIMARY NULL NULL NULL 14 Using where; Using join buffer (flat, BNL join)
+3 MATERIALIZED B range PRIMARY PRIMARY 4 NULL 8 Using where
SELECT SQL_NO_CACHE t.id
FROM t1 t
WHERE (
diff --cc mysql-test/suite/encryption/t/innodb-spatial-index.test
index a50ef306351,2bf56817740..0465225cd4f
--- a/mysql-test/suite/encryption/t/innodb-spatial-index.test
+++ b/mysql-test/suite/encryption/t/innodb-spatial-index.test
@@@ -7,21 -6,10 +7,20 @@@
#
#
-# (1) Do not allow creating table with ENCRYPTED=YES
#
#
---error ER_CANT_CREATE_TABLE
+let $checksum_algorithm = `SELECT @@innodb_checksum_algorithm`;
+let $error_code = ER_CANT_CREATE_TABLE, ER_ILLEGAL_HA_CREATE_OPTION;
+if ($checksum_algorithm == "full_crc32")
+{
+ let $error_code = 0;
+}
+if ($checksum_algorithm == "strict_full_crc32")
+{
+ let $error_code = 0;
+}
+
- --replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
+--error $error_code
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT,
c VARCHAR(256), coordinate POINT NOT NULL, SPATIAL index(coordinate)) ENGINE=INNODB
ENCRYPTED=YES;
@@@ -49,15 -30,14 +48,14 @@@ CREATE TABLE t1 (pk INT PRIMARY KEY AUT
c VARCHAR(256), coordinate POINT NOT NULL) ENCRYPTED=YES ENGINE=INNODB;
# FIXME: MDEV-13851 Encrypted table refuses some form of ALGORITHM=COPY,
# but allows rebuild by FORCE
- --replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
---error ER_CANT_CREATE_TABLE
-ALTER TABLE t1 ADD SPATIAL INDEX b(coordinate), ALGORITHM=COPY;
---error ER_ILLEGAL_HA_CREATE_OPTION
-ALTER TABLE t1 ADD SPATIAL INDEX b(coordinate), FORCE, ALGORITHM=INPLACE;
---error ER_ILLEGAL_HA_CREATE_OPTION
+--error $error_code
+ALTER TABLE t1 ADD SPATIAL INDEX b1(coordinate), ALGORITHM=COPY;
+--error $error_code
+ALTER TABLE t1 ADD SPATIAL INDEX b2(coordinate), FORCE, ALGORITHM=INPLACE;
+--error $error_code
ALTER TABLE t1 ADD SPATIAL INDEX(coordinate);
---error ER_ILLEGAL_HA_CREATE_OPTION
-CREATE SPATIAL INDEX b on t1(coordinate);
+--error $error_code
+CREATE SPATIAL INDEX b3 on t1(coordinate);
DROP TABLE t1;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT,
diff --cc mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf
index 7aac1662edd,477789175fb..a0c7e64af91
--- a/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf
+++ b/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf
@@@ -9,7 -9,9 +9,8 @@@ innodb-autoinc-lock-mode=
default-storage-engine=innodb
wsrep_gtid_mode=1
gtid_ignore_duplicates
+ auto_increment_increment=3
-wsrep-on=1
wsrep-provider=(a)ENV.WSREP_PROVIDER
wsrep_node_address=127.0.0.1
# enforce read-committed characteristics across the cluster
diff --cc mysql-test/suite/galera_3nodes/galera_3nodes.cnf
index ab7493e313b,e5aa81b8742..d33ed0caddf
--- a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf
+++ b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf
@@@ -5,7 -5,9 +5,8 @@@
binlog-format=row
innodb-autoinc-lock-mode=2
default-storage-engine=innodb
+ auto_increment_increment=3
-wsrep-on=1
wsrep-provider=(a)ENV.WSREP_PROVIDER
wsrep_node_address=127.0.0.1
# enforce read-committed characteristics across the cluster
diff --cc mysql-test/suite/galera_3nodes/r/galera_garbd.result
index 88bb3ca2ff9,fb7e729dc77..1396179b871
--- a/mysql-test/suite/galera_3nodes/r/galera_garbd.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_garbd.result
@@@ -1,10 -1,8 +1,18 @@@
++<<<<<<< HEAD
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_3;
++||||||| merged common ancestors
++=======
+ connection node_1;
+ connection node_2;
+ connection node_3;
++>>>>>>> 10.3
Killing node #3 to free ports for garbd ...
+ connection node_3;
connection node_1;
Starting garbd ...
CREATE TABLE t1 (f1 INTEGER);
diff --cc mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result
index 8e6d27823f6,77991a6d468..b0b5c8d26bd
--- a/mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result
@@@ -1,5 -1,7 +1,13 @@@
++<<<<<<< HEAD
+connection node_2;
+connection node_1;
++||||||| merged common ancestors
++=======
+ connection node_1;
+ connection node_2;
+ connection node_3;
+ connection node_1;
++>>>>>>> 10.3
CREATE TABLE t1 (f1 INTEGER);
INSERT INTO t1 VALUES (1);
connection node_2;
diff --cc mysql-test/suite/galera_3nodes/t/galera_garbd.test
index 68e288c06c7,2d03e8897b9..cd401a5376a
--- a/mysql-test/suite/galera_3nodes/t/galera_garbd.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_garbd.test
@@@ -7,21 -7,20 +7,45 @@@
--source include/have_innodb.inc
--source include/big_test.inc
++<<<<<<< HEAD
+# Save galera ports
+--connection node_1
+--source suite/galera/include/galera_base_port.inc
+--let $NODE_GALERAPORT_1 = $_NODE_GALERAPORT
+
+--connection node_2
+--source suite/galera/include/galera_base_port.inc
+--let $NODE_GALERAPORT_2 = $_NODE_GALERAPORT
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--source suite/galera/include/galera_base_port.inc
+--let $NODE_GALERAPORT_3 = $_NODE_GALERAPORT
+
+--connection node_3
+--echo Killing node #3 to free ports for garbd ...
++||||||| merged common ancestors
++--echo Killing node #3 to free ports for garbd ...
++--let $galera_connection_name = node_3
++--let $galera_server_number = 3
++--source include/galera_connect.inc
++--let $gp3 = `SELECT SUBSTR(@@wsrep_provider_options, LOCATE('base_port =', @@wsrep_provider_options) + LENGTH('base_port = '))`
++--let $galera_port_3 = `SELECT SUBSTR('$gp3', 1, LOCATE(';', '$gp3') - 1)`
++=======
+ --let $galera_connection_name = node_3
+ --let $galera_server_number = 3
+ --source include/galera_connect.inc
+
+ # Save original auto_increment_offset values.
+ --let $node_1=node_1
+ --let $node_2=node_2
+ --let $node_3=node_3
+ --source ../galera/include/auto_increment_offset_save.inc
+
+ --echo Killing node #3 to free ports for garbd ...
+ --connection node_3
+ --let $gp3 = `SELECT SUBSTR(@@wsrep_provider_options, LOCATE('base_port =', @@wsrep_provider_options) + LENGTH('base_port = '))`
+ --let $galera_port_3 = `SELECT SUBSTR('$gp3', 1, LOCATE(';', '$gp3') - 1)`
++>>>>>>> 10.3
--source include/shutdown_mysqld.inc
--connection node_1
diff --cc mysql-test/suite/galera_3nodes/t/galera_var_dirty_reads2.test
index 2ceda1ed352,e3f94a012b8..9f9d6da17b9
--- a/mysql-test/suite/galera_3nodes/t/galera_var_dirty_reads2.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_var_dirty_reads2.test
@@@ -106,8 -117,10 +117,11 @@@ SET GLOBAL wsrep_provider_options='gmca
--source include/wait_condition.inc
--connection node_2
---let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
+--source include/galera_wait_ready.inc
DROP TABLE t1;
+
+ # Restore original auto_increment_offset values.
+ --source ../galera/include/auto_increment_offset_restore.inc
diff --cc mysql-test/suite/innodb/r/undo_truncate_recover.result
index 018ac65537a,bcfc136e8c0..8ab41331950
--- a/mysql-test/suite/innodb/r/undo_truncate_recover.result
+++ b/mysql-test/suite/innodb/r/undo_truncate_recover.result
@@@ -9,6 -9,8 +9,7 @@@ update t1 set c = 'MariaDB'
update t1 set c = 'InnoDB';
set global debug_dbug = '+d,ib_undo_trunc';
commit;
+ call mtr.add_suppression("InnoDB: innodb_undo_tablespaces=0 disables dedicated undo log tablespaces");
-call mtr.add_suppression("InnoDB: The redo log transaction size ");
SET GLOBAL innodb_fast_shutdown=0;
FOUND 1 /ib_undo_trunc/ in mysqld.1.err
drop table t1;
diff --cc mysql-test/suite/innodb/t/undo_truncate_recover.test
index 5d680525c5b,c3fa698ff13..1da64497550
--- a/mysql-test/suite/innodb/t/undo_truncate_recover.test
+++ b/mysql-test/suite/innodb/t/undo_truncate_recover.test
@@@ -39,18 -38,14 +39,20 @@@ update t1 set c = 'MariaDB'
update t1 set c = 'InnoDB';
eval set global debug_dbug = '+d,$SEARCH_PATTERN';
commit;
+ call mtr.add_suppression("InnoDB: innodb_undo_tablespaces=0 disables dedicated undo log tablespaces");
-# FIXME: remove this work-around, and generate less log!
-call mtr.add_suppression("InnoDB: The redo log transaction size ");
SET GLOBAL innodb_fast_shutdown=0;
--source include/shutdown_mysqld.inc
--source include/search_pattern_in_file.inc
-# FIXME: remove this work-around, and generate less log!
---let $restart_parameters= --innodb-buffer-pool-size=16m --innodb-undo-tablespaces=1
++--let $restart_parameters= --innodb-undo-tablespaces=1
+if ($checksum_algorithm == "strict_full_crc32")
+{
- let $restart_parameters= --innodb_checksum_algorithm=strict_crc32;
++ let $restart_parameters= $restart_parameters --innodb_checksum_algorithm=strict_crc32;
+}
+
+if ($checksum_algorithm == "strict_crc32")
+{
- let $restart_parameters= --innodb_checksum_algorithm=strict_full_crc32;
++ let $restart_parameters= $restart_parameters --innodb_checksum_algorithm=strict_full_crc32;
+}
--source include/start_mysqld.inc
drop table t1;
diff --cc mysql-test/suite/perfschema/r/dml_setup_instruments.result
index e43841c80ac,a5184782af8..a972cf02285
--- a/mysql-test/suite/perfschema/r/dml_setup_instruments.result
+++ b/mysql-test/suite/perfschema/r/dml_setup_instruments.result
@@@ -16,10 -16,11 +16,12 @@@ wait/synch/mutex/sql/LOCK_after_binlog_
wait/synch/mutex/sql/LOCK_audit_mask YES YES
select * from performance_schema.setup_instruments
where name like 'Wait/Synch/Rwlock/sql/%'
- and name not in ('wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock')
+ and name not in (
+ 'wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock',
+ 'wait/synch/rwlock/sql/LOCK_named_pipe_full_access_group')
order by name limit 10;
NAME ENABLED TIMED
+wait/synch/rwlock/sql/LOCK_all_status_vars YES YES
wait/synch/rwlock/sql/LOCK_dboptions YES YES
wait/synch/rwlock/sql/LOCK_grant YES YES
wait/synch/rwlock/sql/LOCK_SEQUENCE YES YES
diff --cc plugin/aws_key_management/CMakeLists.txt
index b6f48cd18a0,e9e1b49d5f2..90170746eb5
--- a/plugin/aws_key_management/CMakeLists.txt
+++ b/plugin/aws_key_management/CMakeLists.txt
@@@ -1,14 -1,174 +1,18 @@@
-# We build parts of AWS C++ SDK as CMake external project
-# The restrictions of the SDK (https://github.com/awslabs/aws-sdk-cpp/blob/master/README.md)
-# are
-
-# - OS : Windows,Linux or OSX
-# - C++11 compiler : VS2013+, gcc 4.8+, clang 3.3+
-# - libcurl development package needs to be present on Unixes
-#
-# If we build SDK outselves, we'll need require GIT to be present on the build machine
-
-
-# Give message why the building this plugin is skipped (only if -DVERBOSE is defined)
-# or if plugin is explicitly requested to build. Then bail out.
-MACRO(SKIP_AWS_PLUGIN msg)
- MESSAGE_ONCE(SKIP_AWS_PLUGIN "Skip aws_key_management - ${msg}")
+INCLUDE(aws_sdk)
+CHECK_AWS_SDK(HAVE_AWS_SDK REASON)
+IF(NOT HAVE_AWS_SDK)
+ MESSAGE_ONCE(AWS_KEY_MANAGEMENT_NO_AWS_SDK "Can't build aws_key_management - AWS SDK not available (${REASON})")
RETURN()
-ENDMACRO()
-SET(CMAKE_CXX_STANDARD 11)
-
+ENDIF()
+ IF(NOT NOT_FOR_DISTRIBUTION)
+ SKIP_AWS_PLUGIN("AWS SDK has Apache 2.0 License which is not complatible with GPLv2. Set -DNOT_FOR_DISTRIBUTION=ON if you need this plugin")
+ ENDIF()
-# This plugin needs recent C++ compilers (AWS C++ SDK header files are using C++11 features)
-SET(CXX11_FLAGS)
-SET(OLD_COMPILER_MSG "AWS SDK requires c++11 -capable compiler (minimal supported versions are g++ 4.8, clang 3.3, VS2103)")
-
-IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
- EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
- IF (GCC_VERSION VERSION_LESS 4.8)
- SKIP_AWS_PLUGIN("${OLD_COMPILER_MSG}")
- ENDIF()
- SET(CXX11_FLAGS "-std=c++11")
-ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
- IF ((CMAKE_CXX_COMPILER_VERSION AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.3) OR
- (CLANG_VERSION_STRING AND CLANG_VERSION_STRING VERSION_LESS 3.3))
- SKIP_AWS_PLUGIN("${OLD_COMPILER_MSG}")
- ENDIF()
- SET(CXX11_FLAGS "-stdlib=libc++")
-ELSEIF(MSVC)
- IF (MSVC_VERSION LESS 1800)
- SKIP_AWS_PLUGIN("${OLD_COMPILER_MSG}")
- ENDIF()
-ELSE()
- SKIP_AWS_PLUGIN("Compiler not supported by AWS C++ SDK")
-ENDIF()
-
-IF (NOT(WIN32 OR APPLE OR (CMAKE_SYSTEM_NAME MATCHES "Linux")))
- SKIP_AWS_PLUGIN("OS unsupported by AWS SDK")
-ENDIF()
-
-
-
-FIND_LIBRARY(AWS_CPP_SDK_CORE NAMES aws-cpp-sdk-core PATH_SUFFIXES "${SDK_INSTALL_BINARY_PREFIX}")
-FIND_LIBRARY(AWS_CPP_SDK_KMS NAMES aws-cpp-sdk-kms PATH_SUFFIXES "${SDK_INSTALL_BINARY_PREFIX}")
-FIND_PATH(AWS_CPP_SDK_INCLUDE_DIR NAMES aws/kms/KMSClient.h)
-
-IF(AWS_CPP_SDK_CORE AND AWS_CPP_SDK_KMS AND AWS_CPP_SDK_INCLUDE_DIR)
- # AWS C++ SDK installed
- INCLUDE_DIRECTORIES(${AWS_CPP_SDK_INCLUDE_DIR})
- SET(AWS_SDK_LIBS ${AWS_CPP_SDK_CORE} ${AWS_CPP_SDK_KMS})
-ELSE()
- OPTION(AWS_SDK_EXTERNAL_PROJECT "Allow download and build AWS C++ SDK" OFF)
- IF(NOT AWS_SDK_EXTERNAL_PROJECT)
- SKIP_AWS_PLUGIN("AWS_SDK_EXTERNAL_PROJECT is not set")
- ENDIF()
- # Build from source, using ExternalProject_Add
- # AWS C++ SDK requires cmake 2.8.12
- IF(CMAKE_VERSION VERSION_LESS "2.8.12")
- SKIP_AWS_PLUGIN("CMake is too old")
- ENDIF()
- FIND_PACKAGE(Git)
- IF(NOT GIT_FOUND)
- SKIP_AWS_PLUGIN("no GIT")
- ENDIF()
- INCLUDE(ExternalProject)
- IF(UNIX)
- FIND_PACKAGE(CURL)
- IF(NOT CURL_FOUND)
- SKIP_AWS_PLUGIN("AWS C++ SDK requires libcurl development package")
- ENDIF()
- SET(PIC_FLAG -fPIC)
- FIND_PATH(UUID_INCLUDE_DIR uuid/uuid.h)
- IF(NOT UUID_INCLUDE_DIR)
- SKIP_AWS_PLUGIN("AWS C++ SDK requires uuid development package")
- ENDIF()
- IF(NOT APPLE)
- FIND_LIBRARY(UUID_LIBRARIES uuid)
- IF(NOT UUID_LIBRARIES)
- SKIP_AWS_PLUGIN("AWS C++ SDK requires uuid development package")
- ENDIF()
- FIND_PACKAGE(OpenSSL)
- IF(NOT OPENSSL_FOUND)
- SKIP_AWS_PLUGIN("AWS C++ SDK requires openssl development package")
- ENDIF()
- ENDIF()
- ENDIF()
- IF(MSVC)
- SET(EXTRA_SDK_CMAKE_FLAGS -DCMAKE_CXX_FLAGS_DEBUGOPT="" -DCMAKE_EXE_LINKER_FLAGS_DEBUGOPT="" "-DCMAKE_CXX_FLAGS=/wd4530 /wd4577 /WX-")
- ENDIF()
- IF(CMAKE_CXX_COMPILER)
- SET(EXTRA_SDK_CMAKE_FLAGS ${EXTRA_SDK_CMAKE_FLAGS} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER})
- ENDIF()
-
- SET(byproducts )
- # We do not need to build the whole SDK , just 2 of its libs
- set(AWS_SDK_LIBS aws-cpp-sdk-core aws-cpp-sdk-kms)
- FOREACH(lib ${AWS_SDK_LIBS})
- ADD_LIBRARY(${lib} STATIC IMPORTED GLOBAL)
- ADD_DEPENDENCIES(${lib} aws_sdk_cpp)
- SET(loc "${CMAKE_CURRENT_BINARY_DIR}/aws_sdk_cpp/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}")
- IF(CMAKE_VERSION VERSION_GREATER "3.1")
- SET(byproducts ${byproducts} BUILD_BYPRODUCTS ${loc})
- ENDIF()
- SET_TARGET_PROPERTIES(${lib} PROPERTIES IMPORTED_LOCATION ${loc})
- ENDFOREACH()
-
- # To be compatible with older cmake, we use older version of the SDK
- IF(CMAKE_VERSION LESS "3.0")
- SET(GIT_TAG "1.0.8")
- ELSE()
- SET(GIT_TAG "1.2.11")
- ENDIF()
-
- SET(AWS_SDK_PATCH_COMMAND )
- ExternalProject_Add(
- aws_sdk_cpp
- GIT_REPOSITORY "https://github.com/awslabs/aws-sdk-cpp.git"
- GIT_TAG ${GIT_TAG}
- UPDATE_COMMAND ""
- SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/aws-sdk-cpp"
- ${byproducts}
- CMAKE_ARGS
- -DBUILD_ONLY=kms
- -DBUILD_SHARED_LIBS=OFF
- -DFORCE_SHARED_CRT=OFF
- -DENABLE_TESTING=OFF
- "-DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG} ${PIC_FLAG}"
- "-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${PIC_FLAG}"
- "-DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE} ${PIC_FLAG}"
- "-DCMAKE_CXX_FLAGS_MINSIZEREL=${CMAKE_CXX_FLAGS_MINSIZEREL} ${PIC_FLAG}"
- ${EXTRA_SDK_CMAKE_FLAGS}
- -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/aws_sdk_cpp
- -DCMAKE_INSTALL_LIBDIR=lib
- TEST_COMMAND ""
- )
- SET_TARGET_PROPERTIES(aws_sdk_cpp PROPERTIES EXCLUDE_FROM_ALL TRUE)
-
- IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
- # Need whole-archive , otherwise static libraries are not linked
- SET(AWS_SDK_LIBS -Wl,--whole-archive ${AWS_SDK_LIBS} -Wl,--no-whole-archive)
- ENDIF()
- SET_TARGET_PROPERTIES(aws_sdk_cpp PROPERTIES EXCLUDE_FROM_ALL TRUE)
- INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/aws_sdk_cpp/include)
-ENDIF()
-
-ADD_DEFINITIONS(${SSL_DEFINES}) # Need to know whether openssl should be initialized
-IF(CMAKE_VERSION GREATER "3.0")
- SET(CMAKE_CXX_STANDARD 11)
-ELSE()
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_FLAGS}")
-ENDIF()
-IF(WIN32)
- SET(AWS_CPP_SDK_DEPENDENCIES bcrypt winhttp wininet userenv version)
-ELSE()
- SET(AWS_CPP_SDK_DEPENDENCIES ${OPENSSL_LIBRARIES} ${CURL_LIBRARIES} ${UUID_LIBRARIES})
-ENDIF()
-MYSQL_ADD_PLUGIN(aws_key_management aws_key_management_plugin.cc
- LINK_LIBRARIES ${AWS_SDK_LIBS} ${AWS_CPP_SDK_DEPENDENCIES}
- COMPONENT aws-key-management)
+MYSQL_ADD_PLUGIN(aws_key_management
+ aws_key_management_plugin.cc
+ COMPONENT aws-key-management)
-IF (TARGET aws_key_management)
- SET(NON_DISTRIBUTABLE_WARNING "Apache 2.0" PARENT_SCOPE)
+IF(TARGET aws_key_management)
++ SET(NON_DISTRIBUTABLE_WARNING "Apache 2.0" PARENT_SCOPE)
+ USE_AWS_SDK_LIBS(aws_key_management kms)
- ENDIF()
+ ENDIF()
diff --cc scripts/mysql_install_db.sh
index 54b5bed4546,52107405525..06c03dfcb40
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@@ -37,10 -37,13 +37,13 @@@ force=
in_rpm=0
ip_only=0
cross_bootstrap=0
-auth_root_authentication_method=normal
-auth_root_socket_user='root'
+auth_root_authentication_method=socket
+auth_root_socket_user=""
skip_test_db=0
+ dirname0=`dirname $0 2>/dev/null`
+ dirname0=`dirname $dirname0 2>/dev/null`
+
usage()
{
cat <<EOF
@@@ -343,7 -345,16 +346,18 @@@ the
exit 1
fi
plugindir=`find_in_dirs --dir auth_socket.so $basedir/lib*/plugin $basedir/lib*/mysql/plugin`
+ pamtooldir=$plugindir
+ # relative from where the script was run for a relocatable install
+ elif test -n "$dirname0" -a -x "$rel_mysqld" -a ! "$rel_mysqld" -ef "@sbindir@/mysqld"
+ then
+ basedir="$dirname0"
+ bindir="$basedir/@INSTALL_BINDIR@"
+ resolveip="$bindir/resolveip"
+ mysqld="$rel_mysqld"
+ srcpkgdatadir="$basedir/@INSTALL_MYSQLSHAREDIR@"
+ buildpkgdatadir="$basedir/@INSTALL_MYSQLSHAREDIR@"
+ plugindir="$basedir/@INSTALL_PLUGINDIR@"
++ pamtooldir=$plugindir
else
basedir="@prefix@"
bindir="@bindir@"
@@@ -352,7 -363,6 +366,7 @@@
srcpkgdatadir="@pkgdatadir@"
buildpkgdatadir="@pkgdatadir@"
plugindir="@pkgplugindir@"
- pamtooldir="@pkgplugindir@"
++ pamtooldir=$plugindir
fi
# Set up paths to SQL scripts required for bootstrap
diff --cc sql-common/client.c
index 69404e43613,160a85fd7b5..c66cb1a749d
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@@ -1375,10 -1634,16 +1381,12 @@@ mysql_init(MYSQL *mysql
--enable-local-infile
*/
- #if defined(ENABLED_LOCAL_INFILE) && !defined(MYSQL_SERVER)
+ #if ENABLED_LOCAL_INFILE && !defined(MYSQL_SERVER)
mysql->options.client_flag|= CLIENT_LOCAL_FILES;
+ mysql->auto_local_infile= ENABLED_LOCAL_INFILE == LOCAL_INFILE_MODE_AUTO
+ ? WAIT_FOR_QUERY : ALWAYS_ACCEPT;
#endif
-#ifdef HAVE_SMEM
- mysql->options.shared_memory_base_name= (char*) def_shared_memory_base_name;
-#endif
-
mysql->options.methods_to_use= MYSQL_OPT_GUESS_CONNECTION;
mysql->options.report_data_truncation= TRUE; /* default */
diff --cc sql/item.cc
index a6b4402b6ba,ada79fcb9df..47e10ba4004
--- a/sql/item.cc
+++ b/sql/item.cc
@@@ -1950,9 -2195,34 +1950,14 @@@ bool Item_name_const::is_null(
Item_name_const::Item_name_const(THD *thd, Item *name_arg, Item *val):
- Item(thd), value_item(val), name_item(name_arg)
+ Item_fixed_hybrid(thd), value_item(val), name_item(name_arg)
{
+ StringBuffer<128> name_buffer;
+ String *name_str;
Item::maybe_null= TRUE;
- valid_args= true;
- if (!name_item->basic_const_item() ||
- !(name_str= name_item->val_str(&name_buffer))) // Can't have a NULL name
- goto err;
- set_name(thd, name_str->ptr(), name_str->length(), name_str->charset());
-
- if (value_item->basic_const_item())
- return; // ok
-
- if (value_item->type() == FUNC_ITEM)
- {
- Item_func *value_func= (Item_func *) value_item;
- if (value_func->functype() != Item_func::COLLATE_FUNC &&
- value_func->functype() != Item_func::NEG_FUNC)
- goto err;
-
- if (value_func->key_item()->basic_const_item())
- return; // ok
- }
-
-err:
- valid_args= false;
- my_error(ER_WRONG_ARGUMENTS, MYF(0), "NAME_CONST");
++ if (name_item->basic_const_item() &&
++ (name_str= name_item->val_str(&name_buffer))) // Can't have a NULL name
++ set_name(thd, name_str->ptr(), name_str->length(), name_str->charset());
}
@@@ -1988,16 -2266,12 +1993,10 @@@ Item::Type Item_name_const::type() cons
bool Item_name_const::fix_fields(THD *thd, Item **ref)
{
- char buf[128];
- String *item_name;
- String s(buf, sizeof(buf), &my_charset_bin);
- s.length(0);
-
- if ((!value_item->fixed &&
- value_item->fix_fields(thd, &value_item)) ||
- (!name_item->fixed &&
- name_item->fix_fields(thd, &name_item)) ||
+ if (value_item->fix_fields_if_needed(thd, &value_item) ||
+ name_item->fix_fields_if_needed(thd, &name_item) ||
!value_item->const_item() ||
- !name_item->const_item() ||
- !(item_name= name_item->val_str(&s))) // Can't have a NULL name
+ !name_item->const_item())
{
my_error(ER_RESERVED_SYNTAX, MYF(0), "NAME_CONST");
return TRUE;
diff --cc sql/sql_binlog.cc
index 1fa3cca7c27,60de2923a8f..97b8e2e4f91
--- a/sql/sql_binlog.cc
+++ b/sql/sql_binlog.cc
@@@ -109,6 -109,64 +109,64 @@@ static int check_event_type(int type, R
}
}
+ /**
+ Copy fragments into the standard placeholder thd->lex->comment.str.
+
+ Compute the size of the (still) encoded total,
+ allocate and then copy fragments one after another.
+ The size can exceed max(max_allowed_packet) which is not a
+ problem as no String instance is created off this char array.
+
+ @param thd THD handle
+ @return
+ 0 at success,
+ -1 otherwise.
+ */
+ int binlog_defragment(THD *thd)
+ {
+ user_var_entry *entry[2];
+ LEX_CSTRING name[2]= { thd->lex->comment, thd->lex->ident };
+
+ /* compute the total size */
+ thd->lex->comment.str= NULL;
+ thd->lex->comment.length= 0;
+ for (uint k= 0; k < 2; k++)
+ {
+ entry[k]=
+ (user_var_entry*) my_hash_search(&thd->user_vars, (uchar*) name[k].str,
+ name[k].length);
+ if (!entry[k] || entry[k]->type != STRING_RESULT)
+ {
+ my_error(ER_WRONG_TYPE_FOR_VAR, MYF(0), name[k].str);
+ return -1;
+ }
+ thd->lex->comment.length += entry[k]->length;
+ }
+
+ thd->lex->comment.str= // to be freed by the caller
+ (char *) my_malloc(thd->lex->comment.length, MYF(MY_WME));
+ if (!thd->lex->comment.str)
+ {
- my_error(ER_OUTOFMEMORY, MYF(ME_FATALERROR), 1);
++ my_error(ER_OUTOFMEMORY, MYF(ME_FATAL), 1);
+ return -1;
+ }
+
+ /* fragments are merged into allocated buf while the user var:s get reset */
+ size_t gathered_length= 0;
+ for (uint k=0; k < 2; k++)
+ {
+ memcpy(const_cast<char*>(thd->lex->comment.str) + gathered_length, entry[k]->value,
+ entry[k]->length);
+ gathered_length += entry[k]->length;
+ update_hash(entry[k], true, NULL, 0, STRING_RESULT, &my_charset_bin, 0);
+ }
+
+ DBUG_ASSERT(gathered_length == thd->lex->comment.length);
+
+ return 0;
+ }
+
+
/**
Execute a BINLOG statement.
@@@ -171,14 -223,31 +223,31 @@@ void mysql_client_binlog_statement(THD
/*
Out of memory check
*/
- if (!(rli && buf))
+ if (!(rli))
{
- my_error(ER_OUTOFMEMORY, MYF(ME_FATALERROR), 1); /* needed 1 bytes */
+ my_error(ER_OUTOFMEMORY, MYF(ME_FATAL), 1); /* needed 1 bytes */
goto end;
}
DBUG_ASSERT(rli->belongs_to_client());
+ if (unlikely(is_fragmented= thd->lex->comment.str && thd->lex->ident.str))
+ if (binlog_defragment(thd))
+ goto end;
+
+ if (!(coded_len= thd->lex->comment.length))
+ {
+ my_error(ER_SYNTAX_ERROR, MYF(0));
+ goto end;
+ }
+
+ decoded_len= my_base64_needed_decoded_length((int)coded_len);
+ if (!(buf= (char *) my_malloc(decoded_len, MYF(MY_WME))))
+ {
- my_error(ER_OUTOFMEMORY, MYF(ME_FATALERROR), 1);
++ my_error(ER_OUTOFMEMORY, MYF(ME_FATAL), 1);
+ goto end;
+ }
+
for (char const *strptr= thd->lex->comment.str ;
strptr < thd->lex->comment.str + thd->lex->comment.length ; )
{
diff --cc sql/sql_class.h
index 88494f8c169,b1fc89db7f2..361340ee235
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@@ -4420,80 -4375,6 +4420,80 @@@ private
return raised;
}
+private:
+ void push_warning_truncated_priv(Sql_condition::enum_warning_level level,
+ uint sql_errno,
+ const char *type_str, const char *val)
+ {
+ DBUG_ASSERT(sql_errno == ER_TRUNCATED_WRONG_VALUE ||
+ sql_errno == ER_WRONG_VALUE);
+ char buff[MYSQL_ERRMSG_SIZE];
+ CHARSET_INFO *cs= &my_charset_latin1;
+ cs->cset->snprintf(cs, buff, sizeof(buff),
+ ER_THD(this, sql_errno), type_str, val);
+ /*
+ Note: the format string can vary between ER_TRUNCATED_WRONG_VALUE
+ and ER_WRONG_VALUE, but the code passed to push_warning() is
+ always ER_TRUNCATED_WRONG_VALUE. This is intentional.
+ */
+ push_warning(this, level, ER_TRUNCATED_WRONG_VALUE, buff);
+ }
+public:
+ void push_warning_truncated_wrong_value(Sql_condition::enum_warning_level level,
+ const char *type_str, const char *val)
+ {
+ return push_warning_truncated_priv(level, ER_TRUNCATED_WRONG_VALUE,
+ type_str, val);
+ }
+ void push_warning_wrong_value(Sql_condition::enum_warning_level level,
+ const char *type_str, const char *val)
+ {
+ return push_warning_truncated_priv(level, ER_WRONG_VALUE, type_str, val);
+ }
+ void push_warning_truncated_wrong_value(const char *type_str, const char *val)
+ {
+ return push_warning_truncated_wrong_value(Sql_condition::WARN_LEVEL_WARN,
+ type_str, val);
+ }
+ void push_warning_truncated_value_for_field(Sql_condition::enum_warning_level
+ level, const char *type_str,
+ const char *val,
+ const TABLE_SHARE *s,
+ const char *name)
+ {
+ DBUG_ASSERT(name);
+ char buff[MYSQL_ERRMSG_SIZE];
+ CHARSET_INFO *cs= &my_charset_latin1;
+ const char *db_name= s ? s->db.str : NULL;
- const char *table_name= s ? s->error_table_name() : NULL;
++ const char *table_name= s ? s->table_name.str : NULL;
+
+ if (!db_name)
+ db_name= "";
+ if (!table_name)
+ table_name= "";
+ cs->cset->snprintf(cs, buff, sizeof(buff),
+ ER_THD(this, ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
+ type_str, val, db_name, table_name, name,
+ (ulong) get_stmt_da()->current_row_for_warning());
+ push_warning(this, level, ER_TRUNCATED_WRONG_VALUE, buff);
+
+ }
+ void push_warning_wrong_or_truncated_value(Sql_condition::enum_warning_level level,
+ bool totally_useless_value,
+ const char *type_str,
+ const char *val,
+ const TABLE_SHARE *s,
+ const char *field_name)
+ {
+ if (field_name)
+ push_warning_truncated_value_for_field(level, type_str, val,
+ s, field_name);
+ else if (totally_useless_value)
+ push_warning_wrong_value(level, type_str, val);
+ else
+ push_warning_truncated_wrong_value(level, type_str, val);
+ }
+
public:
/** Overloaded to guard query/query_length fields */
virtual void set_statement(Statement *stmt);
diff --cc sql/sql_repl.cc
index 59f6a45a52f,fdca609f5af..647f83c31e7
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@@ -547,19 -556,29 +547,19 @@@ static my_bool adjust_callback(THD *thd
}
-bool log_in_use(const char* log_name)
+void adjust_linfo_offsets(my_off_t purge_offset)
{
- size_t log_name_len = strlen(log_name) + 1;
- THD *tmp;
- bool result = 0;
+ server_threads.iterate(adjust_callback, &purge_offset);
+}
- mysql_mutex_lock(&LOCK_thread_count);
- I_List_iterator<THD> it(threads);
- while ((tmp=it++))
- {
- LOG_INFO* linfo;
- if ((linfo = tmp->current_linfo))
- {
- mysql_mutex_lock(&linfo->lock);
- result = !strncmp(log_name, linfo->log_file_name, log_name_len);
- mysql_mutex_unlock(&linfo->lock);
- if (result)
- break;
- }
- }
-
- mysql_mutex_unlock(&LOCK_thread_count);
+static my_bool log_in_use_callback(THD *thd, const char *log_name)
+{
+ my_bool result= 0;
+ mysql_mutex_lock(&thd->LOCK_thd_data);
+ if (auto linfo= thd->current_linfo)
- result= !memcmp(log_name, linfo->log_file_name, strlen(log_name) + 1);
++ result= !strncmp(log_name, linfo->log_file_name, strlen(log_name) + 1);
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
return result;
}
diff --cc sql/sql_table.cc
index 4dd9d43a7b9,7f2003b765b..af92bc43c59
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@@ -9762,12 -9818,11 +9786,12 @@@ do_continue:
/* Mark that we have created table in storage engine. */
no_ha_table= false;
- new_table=
- thd->create_and_open_tmp_table(new_db_type, &frm, alter_ctx.get_tmp_path(),
- alter_ctx.new_db.str,
- alter_ctx.new_name.str,
- true, true);
+ /* Open the table since we need to copy the data. */
+ new_table= thd->create_and_open_tmp_table(new_db_type, &frm,
+ alter_ctx.get_tmp_path(),
+ alter_ctx.new_db.str,
- alter_ctx.tmp_name.str,
++ alter_ctx.new_name.str,
+ true, true);
if (!new_table)
goto err_new_table_cleanup;
@@@ -10687,9 -10732,12 +10710,12 @@@ bool mysql_checksum_table(THD *thd, TAB
{
/* calculating table's checksum */
ha_checksum crc= 0;
- uchar null_mask=256 - (1 << t->s->last_null_bit_pos);
+ DBUG_ASSERT(t->s->last_null_bit_pos < 8);
+ uchar null_mask= (t->s->last_null_bit_pos ?
+ (256 - (1 << t->s->last_null_bit_pos)):
+ 0);
- t->use_all_columns();
+ t->use_all_stored_columns();
if (t->file->ha_rnd_init(1))
protocol->store_null();
diff --cc sql/table.cc
index 7682119c241,10543a1b4f0..75f5a464186
--- a/sql/table.cc
+++ b/sql/table.cc
@@@ -5449,8 -5292,8 +5449,8 @@@ int TABLE::verify_constraints(bool igno
}
field_error.append((*chk)->name.str);
my_error(ER_CONSTRAINT_FAILED,
- MYF(ignore_failure ? ME_JUST_WARNING : 0), field_error.c_ptr(),
+ MYF(ignore_failure ? ME_WARNING : 0), field_error.c_ptr(),
- s->db.str, s->error_table_name());
+ s->db.str, s->table_name.str);
return ignore_failure ? VIEW_CHECK_SKIP : VIEW_CHECK_ERROR;
}
}
diff --cc sql/wsrep_mysqld.h
index dc2793c384d,cca66922a24..d12cc835136
--- a/sql/wsrep_mysqld.h
+++ b/sql/wsrep_mysqld.h
@@@ -20,25 -23,15 +20,26 @@@
#ifdef WITH_WSREP
+#include <mysql/plugin.h>
+#include "mysql/service_wsrep.h"
+
+#include <my_global.h>
+#include <my_pthread.h>
+#include "log.h"
+#include "mysqld.h"
+
typedef struct st_mysql_show_var SHOW_VAR;
#include <sql_priv.h>
-//#include "rpl_gtid.h"
-#include "../wsrep/wsrep_api.h"
#include "mdl.h"
-#include "mysqld.h"
#include "sql_table.h"
+ #include "wsrep_mysqld_c.h"
+#include "wsrep/provider.hpp"
+#include "wsrep/streaming_context.hpp"
+#include "wsrep_api.h"
+#include <vector>
+#include "wsrep_server_state.h"
+
#define WSREP_UNDEFINED_TRX_ID ULONGLONG_MAX
class set_var;
diff --cc storage/innobase/handler/handler0alter.cc
index 307374ec700,d3907f2d05e..b1dc295206a
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@@ -10176,12 -9087,12 +10191,13 @@@ commit_try_norebuild
after a successful commit_try_norebuild() call.
@param ha_alter_info algorithm=inplace context
@param ctx In-place ALTER TABLE context for the current partition
+@param altered_table the TABLE after the ALTER
@param table the TABLE before the ALTER
@param trx Data dictionary transaction
- (will be started and committed, for DROP INDEX) */
+ (will be started and committed, for DROP INDEX)
+ @return whether all replacements were found for dropped indexes */
inline MY_ATTRIBUTE((nonnull))
- void
+ bool
commit_cache_norebuild(
/*===================*/
Alter_inplace_info* ha_alter_info,
@@@ -11009,12 -9869,20 +11015,21 @@@ foreign_fail
m_user_thd,
Sql_condition::WARN_LEVEL_WARN,
ER_ALTER_INFO,
- "InnoDB: Could not add foreign"
- " key constraints.");
- } else {
- commit_cache_norebuild(ha_alter_info, ctx,
- altered_table,
- table, trx);
+ "failed to load FOREIGN KEY"
+ " constraints");
+ }
+ } else {
+ bool fk_fail = innobase_update_foreign_cache(
+ ctx, m_user_thd) != DB_SUCCESS;
+
- if (!commit_cache_norebuild(ha_alter_info, ctx, table,
++ if (!commit_cache_norebuild(ha_alter_info, ctx,
++ altered_table, table,
+ trx)) {
+ fk_fail = true;
+ }
+
+ if (fk_fail && m_prebuilt->trx->check_foreigns) {
+ goto foreign_fail;
}
}
1
0
revision-id: dadf5f78411b8f46ac53b8ea12c08ec317d9aab4 (mariadb-10.1.38-7-gdadf5f78411)
parent(s): 346e46089621e6951e076c82ed5690aa23dcb5fe
author: Jan Lindström
committer: Jan Lindström
timestamp: 2019-02-20 08:10:26 +0200
message:
Fix few compiler warnings.
dict_table_rename_in_cache
dict_create_add_foreign_id
Use of strncpy caused string truncation warnings and is
replaced with memcpy.
fts_fetch_index_words
dfield_get_len() can return UNIV_SQL_NULL (=ULINT32_UNDEFINED)
that is too big for used short datatype. Replaced with correct
ulint.
row_rename_table_for_mysql
Target string was exactly same length as maximum length
of copied string.
---
storage/innobase/dict/dict0dict.cc | 12 ++++++------
storage/innobase/fts/fts0opt.cc | 10 +++++-----
storage/innobase/include/dict0crea.ic | 4 ++--
storage/innobase/row/row0mysql.cc | 4 ++--
storage/xtradb/dict/dict0dict.cc | 12 ++++++------
storage/xtradb/fts/fts0opt.cc | 10 +++++-----
storage/xtradb/include/dict0crea.ic | 4 ++--
storage/xtradb/row/row0mysql.cc | 4 ++--
8 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 06c6c3effab..04b14e3ae06 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -1845,7 +1845,7 @@ dict_table_rename_in_cache(
ulint db_len;
char* old_id;
- char old_name_cs_filename[MAX_TABLE_NAME_LEN+20];
+ char old_name_cs_filename[MAX_TABLE_NAME_LEN+20]="";
uint errors = 0;
/* All table names are internally stored in charset
@@ -1855,13 +1855,13 @@ dict_table_rename_in_cache(
in UTF-8 charset. The variable fkid here is used
to store foreign key constraint name in charset
my_charset_filename for comparison further below. */
- char fkid[MAX_TABLE_NAME_LEN+20];
+ char fkid[MAX_TABLE_NAME_LEN+20]="";
ibool on_tmp = FALSE;
/* The old table name in my_charset_filename is stored
in old_name_cs_filename */
- strncpy(old_name_cs_filename, old_name,
+ memcpy(old_name_cs_filename, old_name,
MAX_TABLE_NAME_LEN);
if (strstr(old_name, TEMP_TABLE_PATH_PREFIX) == NULL) {
@@ -1883,7 +1883,7 @@ dict_table_rename_in_cache(
} else {
/* Old name already in
my_charset_filename */
- strncpy(old_name_cs_filename, old_name,
+ memcpy(old_name_cs_filename, old_name,
MAX_TABLE_NAME_LEN);
}
}
@@ -1922,7 +1922,7 @@ dict_table_rename_in_cache(
}
/* Convert the table name to UTF-8 */
- strncpy(table_name, table->name,
+ memcpy(table_name, table->name,
MAX_TABLE_NAME_LEN);
innobase_convert_to_system_charset(
strchr(table_name, '/') + 1,
@@ -1934,7 +1934,7 @@ dict_table_rename_in_cache(
from charset my_charset_filename to
UTF-8. This means that the table name
is already in UTF-8 (#mysql#50). */
- strncpy(table_name, table->name,
+ memcpy(table_name, table->name,
MAX_TABLE_NAME_LEN);
}
diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc
index 77293bc867a..2a97f0fa527 100644
--- a/storage/innobase/fts/fts0opt.cc
+++ b/storage/innobase/fts/fts0opt.cc
@@ -673,18 +673,18 @@ fts_fetch_index_words(
fts_zip_t* zip = static_cast<fts_zip_t*>(user_arg);
que_node_t* exp = sel_node->select_list;
dfield_t* dfield = que_node_get_val(exp);
- short len = static_cast<short>(dfield_get_len(dfield));
+ ulint len = dfield_get_len(dfield);
void* data = dfield_get_data(dfield);
+ ut_a(len <= FTS_MAX_WORD_LEN);
+
/* Skip the duplicate words. */
- if (zip->word.f_len == static_cast<ulint>(len)
+ if (zip->word.f_len == len
&& !memcmp(zip->word.f_str, data, len)) {
return(TRUE);
}
- ut_a(len <= FTS_MAX_WORD_LEN);
-
memcpy(zip->word.f_str, data, len);
zip->word.f_len = len;
@@ -693,7 +693,7 @@ fts_fetch_index_words(
/* The string is prefixed by len. */
zip->zp->next_in = reinterpret_cast<byte*>(&len);
- zip->zp->avail_in = sizeof(len);
+ zip->zp->avail_in = sizeof(static_cast<short>(len));
/* Compress the word, create output blocks as necessary. */
while (zip->zp->avail_in > 0) {
diff --git a/storage/innobase/include/dict0crea.ic b/storage/innobase/include/dict0crea.ic
index 1cbaa47032b..cebbcf73864 100644
--- a/storage/innobase/include/dict0crea.ic
+++ b/storage/innobase/include/dict0crea.ic
@@ -68,7 +68,7 @@ dict_create_add_foreign_id(
char table_name[MAX_TABLE_NAME_LEN + 20] = "";
uint errors = 0;
- strncpy(table_name, name,
+ memcpy(table_name, name,
MAX_TABLE_NAME_LEN + 20);
innobase_convert_to_system_charset(
@@ -77,7 +77,7 @@ dict_create_add_foreign_id(
MAX_TABLE_NAME_LEN, &errors);
if (errors) {
- strncpy(table_name, name,
+ memcpy(table_name, name,
MAX_TABLE_NAME_LEN + 20);
}
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index 2a9ade1da2c..84f30e226dd 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -5173,8 +5173,8 @@ row_rename_table_for_mysql(
if (!new_is_tmp) {
/* Rename all constraints. */
- char new_table_name[MAX_TABLE_NAME_LEN] = "";
- char old_table_utf8[MAX_TABLE_NAME_LEN] = "";
+ char new_table_name[MAX_TABLE_NAME_LEN+1] = "";
+ char old_table_utf8[MAX_TABLE_NAME_LEN+1] = "";
uint errors = 0;
strncpy(old_table_utf8, old_name, MAX_TABLE_NAME_LEN);
diff --git a/storage/xtradb/dict/dict0dict.cc b/storage/xtradb/dict/dict0dict.cc
index 1c489d13f1a..d23be874c2f 100644
--- a/storage/xtradb/dict/dict0dict.cc
+++ b/storage/xtradb/dict/dict0dict.cc
@@ -1851,7 +1851,7 @@ dict_table_rename_in_cache(
ulint db_len;
char* old_id;
- char old_name_cs_filename[MAX_TABLE_NAME_LEN+20];
+ char old_name_cs_filename[MAX_TABLE_NAME_LEN+20]="";
uint errors = 0;
/* All table names are internally stored in charset
@@ -1861,13 +1861,13 @@ dict_table_rename_in_cache(
in UTF-8 charset. The variable fkid here is used
to store foreign key constraint name in charset
my_charset_filename for comparison further below. */
- char fkid[MAX_TABLE_NAME_LEN+20];
+ char fkid[MAX_TABLE_NAME_LEN+20]="";
ibool on_tmp = FALSE;
/* The old table name in my_charset_filename is stored
in old_name_cs_filename */
- strncpy(old_name_cs_filename, old_name,
+ memcpy(old_name_cs_filename, old_name,
MAX_TABLE_NAME_LEN);
if (strstr(old_name, TEMP_TABLE_PATH_PREFIX) == NULL) {
@@ -1889,7 +1889,7 @@ dict_table_rename_in_cache(
} else {
/* Old name already in
my_charset_filename */
- strncpy(old_name_cs_filename, old_name,
+ memcpy(old_name_cs_filename, old_name,
MAX_TABLE_NAME_LEN);
}
}
@@ -1928,7 +1928,7 @@ dict_table_rename_in_cache(
}
/* Convert the table name to UTF-8 */
- strncpy(table_name, table->name,
+ memcpy(table_name, table->name,
MAX_TABLE_NAME_LEN);
innobase_convert_to_system_charset(
strchr(table_name, '/') + 1,
@@ -1940,7 +1940,7 @@ dict_table_rename_in_cache(
from charset my_charset_filename to
UTF-8. This means that the table name
is already in UTF-8 (#mysql#50). */
- strncpy(table_name, table->name,
+ memcpy(table_name, table->name,
MAX_TABLE_NAME_LEN);
}
diff --git a/storage/xtradb/fts/fts0opt.cc b/storage/xtradb/fts/fts0opt.cc
index 77293bc867a..2a97f0fa527 100644
--- a/storage/xtradb/fts/fts0opt.cc
+++ b/storage/xtradb/fts/fts0opt.cc
@@ -673,18 +673,18 @@ fts_fetch_index_words(
fts_zip_t* zip = static_cast<fts_zip_t*>(user_arg);
que_node_t* exp = sel_node->select_list;
dfield_t* dfield = que_node_get_val(exp);
- short len = static_cast<short>(dfield_get_len(dfield));
+ ulint len = dfield_get_len(dfield);
void* data = dfield_get_data(dfield);
+ ut_a(len <= FTS_MAX_WORD_LEN);
+
/* Skip the duplicate words. */
- if (zip->word.f_len == static_cast<ulint>(len)
+ if (zip->word.f_len == len
&& !memcmp(zip->word.f_str, data, len)) {
return(TRUE);
}
- ut_a(len <= FTS_MAX_WORD_LEN);
-
memcpy(zip->word.f_str, data, len);
zip->word.f_len = len;
@@ -693,7 +693,7 @@ fts_fetch_index_words(
/* The string is prefixed by len. */
zip->zp->next_in = reinterpret_cast<byte*>(&len);
- zip->zp->avail_in = sizeof(len);
+ zip->zp->avail_in = sizeof(static_cast<short>(len));
/* Compress the word, create output blocks as necessary. */
while (zip->zp->avail_in > 0) {
diff --git a/storage/xtradb/include/dict0crea.ic b/storage/xtradb/include/dict0crea.ic
index 1cbaa47032b..cebbcf73864 100644
--- a/storage/xtradb/include/dict0crea.ic
+++ b/storage/xtradb/include/dict0crea.ic
@@ -68,7 +68,7 @@ dict_create_add_foreign_id(
char table_name[MAX_TABLE_NAME_LEN + 20] = "";
uint errors = 0;
- strncpy(table_name, name,
+ memcpy(table_name, name,
MAX_TABLE_NAME_LEN + 20);
innobase_convert_to_system_charset(
@@ -77,7 +77,7 @@ dict_create_add_foreign_id(
MAX_TABLE_NAME_LEN, &errors);
if (errors) {
- strncpy(table_name, name,
+ memcpy(table_name, name,
MAX_TABLE_NAME_LEN + 20);
}
diff --git a/storage/xtradb/row/row0mysql.cc b/storage/xtradb/row/row0mysql.cc
index 93a4db98e7b..0ea2ae1b6d4 100644
--- a/storage/xtradb/row/row0mysql.cc
+++ b/storage/xtradb/row/row0mysql.cc
@@ -5183,8 +5183,8 @@ row_rename_table_for_mysql(
if (!new_is_tmp) {
/* Rename all constraints. */
- char new_table_name[MAX_TABLE_NAME_LEN] = "";
- char old_table_utf8[MAX_TABLE_NAME_LEN] = "";
+ char new_table_name[MAX_TABLE_NAME_LEN+1] = "";
+ char old_table_utf8[MAX_TABLE_NAME_LEN+1] = "";
uint errors = 0;
strncpy(old_table_utf8, old_name, MAX_TABLE_NAME_LEN);
2
1