summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2022-05-08 15:02:19 +0200
committerSergei Golubchik <serg@mariadb.org>2022-05-08 23:03:08 +0200
commita70a1cf3f4ed10c9d9194b2b8df6b6f08551a937 (patch)
tree517124ec5059f48bff1e02b934355e8162183efc
parent40b8f3ec1a76fc23eb6bf9c5a8fef1debcbf5843 (diff)
parent79660e59ee8fcd23f928c72dc77682b875bd58ce (diff)
downloadmariadb-git-a70a1cf3f4ed10c9d9194b2b8df6b6f08551a937.tar.gz
Merge branch '10.3' into 10.4
-rw-r--r--.gitignore1
-rwxr-xr-x.travis.compiler.sh55
-rw-r--r--.travis.yml209
-rw-r--r--client/mysqldump.c106
-rw-r--r--config.h.cmake2
-rw-r--r--configure.cmake16
-rwxr-xr-xdebian/additions/debian-start2
-rw-r--r--debian/mariadb-server-10.4.postrm5
-rw-r--r--debian/mariadb-server-10.4.preinst6
-rw-r--r--extra/mariabackup/backup_mysql.cc398
-rw-r--r--extra/mariabackup/xtrabackup.cc16
m---------libmariadb0
-rw-r--r--man/mysql_tzinfo_to_sql.14
-rw-r--r--mysql-test/include/grep.inc16
-rw-r--r--mysql-test/lib/My/CoreDump.pm5
-rw-r--r--mysql-test/main/check_constraint.result63
-rw-r--r--mysql-test/main/check_constraint.test47
-rw-r--r--mysql-test/main/create_select.result (renamed from mysql-test/main/create_select_tmp.result)22
-rw-r--r--mysql-test/main/create_select.test (renamed from mysql-test/main/create_select_tmp.test)51
-rw-r--r--mysql-test/main/ddl_i18n_koi8r.result16
-rw-r--r--mysql-test/main/ddl_i18n_utf8.result16
-rw-r--r--mysql-test/main/default.result27
-rw-r--r--mysql-test/main/default.test26
-rw-r--r--mysql-test/main/default_innodb.result18
-rw-r--r--mysql-test/main/default_innodb.test22
-rw-r--r--mysql-test/main/derived_view.result60
-rw-r--r--mysql-test/main/derived_view.test52
-rw-r--r--mysql-test/main/func_default.result52
-rw-r--r--mysql-test/main/func_default.test36
-rw-r--r--mysql-test/main/func_time.result6
-rw-r--r--mysql-test/main/func_time.test4
-rw-r--r--mysql-test/main/grant.result10
-rw-r--r--mysql-test/main/grant.test18
-rw-r--r--mysql-test/main/information_schema_columns.result47
-rw-r--r--mysql-test/main/information_schema_columns.test48
-rw-r--r--mysql-test/main/information_schema_tables.result77
-rw-r--r--mysql-test/main/information_schema_tables.test100
-rw-r--r--mysql-test/main/mysql_client_test_comp.test3
-rw-r--r--mysql-test/main/mysql_client_test_nonblock.test3
-rw-r--r--mysql-test/main/mysql_tzinfo_to_sql_symlink.result57
-rw-r--r--mysql-test/main/mysql_tzinfo_to_sql_symlink.test18
-rw-r--r--mysql-test/main/mysqldump-compat-102.result4
-rw-r--r--mysql-test/main/mysqldump-nl.result4
-rw-r--r--mysql-test/main/mysqldump.result315
-rw-r--r--mysql-test/main/mysqldump.test90
-rw-r--r--mysql-test/main/order_by.result20
-rw-r--r--mysql-test/main/order_by.test25
-rw-r--r--mysql-test/main/parser.result42
-rw-r--r--mysql-test/main/parser.test24
-rw-r--r--mysql-test/main/parser_not_embedded.result20
-rw-r--r--mysql-test/main/parser_not_embedded.test15
-rw-r--r--mysql-test/main/plugin.result9
-rw-r--r--mysql-test/main/plugin.test17
-rw-r--r--mysql-test/main/repair_symlink-5543.result2
-rw-r--r--mysql-test/main/repair_symlink-5543.test6
-rw-r--r--mysql-test/main/row-checksum-old.result45
-rw-r--r--mysql-test/main/row-checksum.result45
-rw-r--r--mysql-test/main/row-checksum.test35
-rw-r--r--mysql-test/main/subselect.result2
-rw-r--r--mysql-test/main/subselect4.result75
-rw-r--r--mysql-test/main/subselect4.test15
-rw-r--r--mysql-test/main/subselect_innodb.result48
-rw-r--r--mysql-test/main/subselect_innodb.test45
-rw-r--r--mysql-test/main/subselect_no_exists_to_in.result2
-rw-r--r--mysql-test/main/subselect_no_mat.result2
-rw-r--r--mysql-test/main/subselect_no_opts.result2
-rw-r--r--mysql-test/main/subselect_no_scache.result2
-rw-r--r--mysql-test/main/subselect_no_semijoin.result2
-rw-r--r--mysql-test/main/temp_table_symlink.test1
-rw-r--r--mysql-test/main/type_newdecimal.result24
-rw-r--r--mysql-test/main/type_newdecimal.test19
-rw-r--r--mysql-test/main/win.result42
-rw-r--r--mysql-test/main/win.test33
-rw-r--r--mysql-test/suite/binlog/t/binlog_mysqlbinlog_stop_never.test7
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_parallel.result1
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_ssl.result4
-rw-r--r--mysql-test/suite/compat/oracle/r/sp-package-mysqldump.result16
-rw-r--r--mysql-test/suite/encryption/r/tempfiles_encrypted.result42
-rw-r--r--mysql-test/suite/galera/r/mysql_tzinfo_to_sql.result154
-rw-r--r--mysql-test/suite/galera/t/mysql_tzinfo_to_sql.opt1
-rw-r--r--mysql-test/suite/galera/t/mysql_tzinfo_to_sql.test156
-rw-r--r--mysql-test/suite/handler/aria.result16
-rw-r--r--mysql-test/suite/handler/aria.test20
-rw-r--r--mysql-test/suite/handler/innodb.result16
-rw-r--r--mysql-test/suite/handler/innodb.test20
-rw-r--r--mysql-test/suite/handler/interface.result16
-rw-r--r--mysql-test/suite/handler/interface.test20
-rw-r--r--mysql-test/suite/handler/myisam.result14
-rw-r--r--mysql-test/suite/handler/myisam.test20
-rw-r--r--mysql-test/suite/innodb/r/foreign_key.result27
-rw-r--r--mysql-test/suite/innodb/r/gap_lock_split.result27
-rw-r--r--mysql-test/suite/innodb/r/innodb-autoinc-part.result34
-rw-r--r--mysql-test/suite/innodb/r/innodb-autoinc.result25
-rw-r--r--mysql-test/suite/innodb/t/foreign_key.test34
-rw-r--r--mysql-test/suite/innodb/t/gap_lock_split.test39
-rw-r--r--mysql-test/suite/innodb/t/innodb-autoinc-part.test24
-rw-r--r--mysql-test/suite/innodb/t/innodb-autoinc.test23
-rw-r--r--mysql-test/suite/innodb_gis/r/rtree_split.result7
-rw-r--r--mysql-test/suite/innodb_gis/r/rtree_temporary.result14
-rw-r--r--mysql-test/suite/innodb_gis/t/rtree_split.test8
-rw-r--r--mysql-test/suite/innodb_gis/t/rtree_temporary.test18
-rw-r--r--mysql-test/suite/mariabackup/include/show_xtrabackup_slave_info.inc14
-rw-r--r--mysql-test/suite/mariabackup/include/show_xtrabackup_slave_info_out.inc20
-rw-r--r--mysql-test/suite/mariabackup/incremental_newdb_while_backup.result24
-rw-r--r--mysql-test/suite/mariabackup/incremental_newdb_while_backup.test47
-rw-r--r--mysql-test/suite/mariabackup/rpl_slave_info.result7
-rw-r--r--mysql-test/suite/mariabackup/rpl_slave_info.test5
-rw-r--r--mysql-test/suite/mariabackup/slave_info_norpl.result59
-rw-r--r--mysql-test/suite/mariabackup/slave_info_norpl.test86
-rw-r--r--mysql-test/suite/parts/inc/part_alter_values.inc2
-rw-r--r--mysql-test/suite/parts/t/partition_alter_myisam.test1
-rw-r--r--mysql-test/suite/perfschema/include/socket_ipv6.inc4
-rw-r--r--mysql-test/suite/perfschema/r/socket_connect.result1
-rw-r--r--mysql-test/suite/perfschema/r/socket_summary_by_event_name_func.result1
-rw-r--r--mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test3
-rw-r--r--mysql-test/suite/roles/definer.result24
-rw-r--r--mysql-test/suite/rpl/include/rpl_parallel.inc1
-rw-r--r--mysql-test/suite/rpl/include/rpl_ssl.inc2
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_grouping.result54
-rw-r--r--mysql-test/suite/rpl/r/rpl_iodku,stmt.rdiff27
-rw-r--r--mysql-test/suite/rpl/r/rpl_iodku.result32
-rw-r--r--mysql-test/suite/rpl/r/rpl_mdev_17614.result72
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_temptable.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_ssl.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_unsafe_statements.result5
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_grouping.test97
-rw-r--r--mysql-test/suite/rpl/t/rpl_iodku.test50
-rw-r--r--mysql-test/suite/rpl/t/rpl_mdev_17614.test73
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel_temptable.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_unsafe_statements.test2
-rw-r--r--mysql-test/suite/vcol/r/vcol_misc.result22
-rw-r--r--mysql-test/suite/vcol/r/vcol_syntax.result9
-rw-r--r--mysql-test/suite/vcol/r/wrong_arena.result19
-rw-r--r--mysql-test/suite/vcol/t/vcol_misc.opt1
-rw-r--r--mysql-test/suite/vcol/t/vcol_misc.test15
-rw-r--r--mysql-test/suite/vcol/t/wrong_arena.test23
-rw-r--r--mysql-test/suite/versioning/r/delete_history.result3
-rw-r--r--mysql-test/suite/versioning/r/partition.result351
-rw-r--r--mysql-test/suite/versioning/r/rpl_row.result38
-rw-r--r--mysql-test/suite/versioning/t/delete_history.test1
-rw-r--r--mysql-test/suite/versioning/t/partition.test305
-rw-r--r--mysql-test/suite/versioning/t/rpl_row.test41
-rw-r--r--mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result174
-rw-r--r--mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result104
-rw-r--r--mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.opt1
-rw-r--r--mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.test41
-rw-r--r--mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.opt1
-rw-r--r--mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.test41
-rw-r--r--plugin/server_audit/server_audit.c24
-rw-r--r--sql/field.cc7
-rw-r--r--sql/ha_partition.cc16
-rw-r--r--sql/handler.cc3
-rw-r--r--sql/item.cc13
-rw-r--r--sql/item.h28
-rw-r--r--sql/item_func.cc2
-rw-r--r--sql/item_subselect.cc26
-rw-r--r--sql/item_sum.cc6
-rw-r--r--sql/partition_info.cc61
-rw-r--r--sql/partition_info.h6
-rw-r--r--sql/rpl_gtid.h1
-rw-r--r--sql/slave.cc165
-rw-r--r--sql/sp_cache.cc9
-rw-r--r--sql/sp_head.cc2
-rw-r--r--sql/sql_base.cc7
-rw-r--r--sql/sql_class.cc108
-rw-r--r--sql/sql_class.h65
-rw-r--r--sql/sql_expression_cache.cc4
-rw-r--r--sql/sql_expression_cache.h5
-rw-r--r--sql/sql_handler.cc4
-rw-r--r--sql/sql_insert.cc9
-rw-r--r--sql/sql_lex.cc28
-rw-r--r--sql/sql_lex.h23
-rw-r--r--sql/sql_parse.cc2
-rw-r--r--sql/sql_plugin.cc3
-rw-r--r--sql/sql_select.cc13
-rw-r--r--sql/sql_select.h4
-rw-r--r--sql/sql_show.cc32
-rw-r--r--sql/sql_table.cc13
-rw-r--r--sql/sql_type.cc1
-rw-r--r--sql/sql_window.cc68
-rw-r--r--sql/sql_window.h15
-rw-r--r--sql/sql_yacc.yy18
-rw-r--r--sql/sql_yacc_ora.yy14
-rw-r--r--sql/table.cc38
-rw-r--r--sql/tztime.cc6
-rw-r--r--storage/connect/tabrest.cpp6
-rw-r--r--storage/innobase/btr/btr0btr.cc6
-rw-r--r--storage/innobase/buf/buf0flu.cc27
-rw-r--r--storage/innobase/gis/gis0rtree.cc3
-rw-r--r--storage/innobase/handler/ha_innodb.cc4
-rw-r--r--storage/innobase/include/dict0types.h4
-rw-r--r--storage/innobase/include/lock0lock.h38
-rw-r--r--storage/innobase/lock/lock0lock.cc42
-rw-r--r--storage/innobase/row/row0ins.cc13
-rw-r--r--tests/mysql_client_fw.c2
-rw-r--r--tests/mysql_client_test.c8
197 files changed, 5208 insertions, 1289 deletions
diff --git a/.gitignore b/.gitignore
index 99c47b46966..437bd2023d7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -128,6 +128,7 @@ scripts/mysqld_safe
scripts/mysqldumpslow
scripts/mysqlhotcopy
scripts/mytop
+scripts/wsrep_sst_backup
scripts/wsrep_sst_common
scripts/wsrep_sst_mysqldump
scripts/wsrep_sst_rsync
diff --git a/.travis.compiler.sh b/.travis.compiler.sh
deleted file mode 100755
index 98d8197d371..00000000000
--- a/.travis.compiler.sh
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/bin/sh
-set -v -x
-
-# Exclude modules from build not directly affecting the current
-# test suites found in $MYSQL_TEST_SUITES, to conserve job time
-# as well as disk usage
-
-function exclude_modules() {
-# excludes for all
-CMAKE_OPT="${CMAKE_OPT} -DPLUGIN_TOKUDB=NO -DPLUGIN_MROONGA=NO -DPLUGIN_SPIDER=NO -DPLUGIN_OQGRAPH=NO -DPLUGIN_PERFSCHEMA=NO -DPLUGIN_SPHINX=NO"
-# exclude storage engines not being tested in current job
-if [[ ! "${MYSQL_TEST_SUITES}" =~ "archive" ]]; then
- CMAKE_OPT="${CMAKE_OPT} -DPLUGIN_ARCHIVE=NO"
-fi
-if [[ ! "${MYSQL_TEST_SUITES}" =~ "rocksdb" ]]; then
- CMAKE_OPT="${CMAKE_OPT} -DPLUGIN_ROCKSDB=NO"
-fi
-}
-
-if [[ "${TRAVIS_OS_NAME}" == 'linux' ]]; then
- TEST_CASE_TIMEOUT=2
- exclude_modules;
- if which ccache ; then
- CMAKE_OPT="${CMAKE_OPT} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
- fi
- if [[ "${CXX}" == 'clang++' ]]; then
- if [[ "${CC_VERSION}" == '6' ]]; then
- export CXX=${CXX}-${CC_VERSION}.0
- else
- export CXX=${CXX}-${CC_VERSION}
- fi
- export CC=${CXX/++/}
- # excess warnings about unused include path
- export CFLAGS='-Wno-unused-command-line-argument'
- export CXXFLAGS='-Wno-unused-command-line-argument'
- elif [[ "${CXX}" == 'g++' ]]; then
- export CXX=g++-${CC_VERSION}
- export CC=gcc-${CC_VERSION}
- fi
- if [[ ${CC_VERSION} == 7 ]]; then
- export WSREP_PROVIDER=/usr/lib/galera/libgalera_smm.so
- MYSQL_TEST_SUITES="${MYSQL_TEST_SUITES},wsrep"
- fi
-fi
-
-if [[ "${TRAVIS_OS_NAME}" == 'osx' ]]; then
- TEST_CASE_TIMEOUT=20
- exclude_modules;
- CMAKE_OPT="${CMAKE_OPT} -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl"
- if which ccache ; then
- CMAKE_OPT="${CMAKE_OPT} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
- fi
-fi
-
-set +v +x
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 5be0cba80f6..00000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,209 +0,0 @@
-# vim ft=yaml
-# travis-ci.org definition
-
-sudo: false
-dist: xenial
-
-git:
- depth: 2
-
-language: cpp
-os:
- - linux
- - osx
-osx_image: xcode12u
-compiler:
- - gcc
- - clang
-
-cache:
- timeout: 500
- apt: true
- ccache: true
-
-env:
- matrix:
- - CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main
- - CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts
- - CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rpl
- - CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption
- - CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rocksdb,versioning
- - CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,perfschema,plugins,multi_source,roles
- - CC_VERSION=8 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main
-
-matrix:
- exclude:
- - os: osx
- compiler: gcc
- - os: osx
- compiler: clang
- env: CC_VERSION=8 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main
- - os: linux
- compiler: clang
- env: CC_VERSION=8 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main
- include:
- - os: linux
- compiler: gcc
- env:
- - DebPackages
- addons:
- apt:
- packages: # make sure these match debian/control contents
- - bison
- - chrpath
- - cmake
- - debhelper
- - dh-apparmor
- - dh-exec
- - dpatch
- - gdb
- - libaio-dev
- - libboost-dev
- - libcurl3-dev
- - libdbd-mysql
- - libjudy-dev
- - libncurses5-dev
- - libpam0g-dev
- - libpcre3-dev
- - libreadline-gplv2-dev
- - libstemmer-dev
- - libssl-dev
- - libnuma-dev
- - libxml2-dev
- - lsb-release
- - perl
- - po-debconf
- - psmisc
- - zlib1g-dev
- - libcrack2-dev
- - cracklib-runtime
- - libjemalloc-dev
- - libsnappy-dev
- - liblzma-dev
- - libzmq-dev
- - libdistro-info-perl
- - uuid-dev
- - devscripts
- - fakeroot
- - dh-systemd
- - libsystemd-dev
- - libzstd-dev
- - unixodbc-dev
- script:
- - ${CC} --version ; ${CXX} --version
- - env DEB_BUILD_OPTIONS="parallel=4" debian/autobake-deb.sh;
- # Until OSX becomes a bit more stable: MDEV-12435 MDEV-16213
- allow_failures:
- - os: osx
- compiler: clang
- env: CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rpl
- - os: osx
- compiler: clang
- env: CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main
- - os: osx
- compiler: clang
- env: CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts
- - os: osx
- compiler: clang
- env: CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption
- - os: osx
- compiler: clang
- env: CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rocksdb,versioning
- - os: osx
- compiler: clang
- env: CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,perfschema,plugins,multi_source,roles
-
-addons:
- apt:
- sources:
- - ubuntu-toolchain-r-test
- - llvm-toolchain-xenial-6.0
- - llvm-toolchain-xenial-7
- - sourceline: 'deb [arch=amd64,arm64,i386,ppc64el] http://ftp.osuosl.org/pub/mariadb/repo/10.4/ubuntu xenial main'
- key_url: 'http://keyserver.ubuntu.com/pks/lookup?search=0xF1656F24C74CD1D8&op=get'
- packages: # make sure these include all compilers and all build dependencies (see list above)
- - gcc-6
- - g++-6
- - gcc-7
- - g++-7
- - gcc-8
- - g++-8
- - clang-6.0
- - llvm-6.0-dev
- - clang-7
- - llvm-7-dev
- - bison
- - chrpath
- - cmake
- - gdb
- - galera-4
- - libaio-dev
- - libboost-dev
- - libcurl3-dev
- - libdbd-mysql
- - libjudy-dev
- - libncurses5-dev
- - libpam0g-dev
- - libpcre3-dev
- - libreadline-gplv2-dev
- - libstemmer-dev
- - libssl-dev
- - libnuma-dev
- - libxml2-dev
- - lsb-release
- - perl
- - psmisc
- - zlib1g-dev
- - libcrack2-dev
- - cracklib-runtime
- - libjemalloc-dev
- - libsnappy-dev
- - liblzma-dev
- - libzmq-dev
- - uuid-dev
-
-# libsystemd-daemon-dev # https://github.com/travis-ci/apt-package-whitelist/issues/3882
-
-before_install:
- - if [[ "${TRAVIS_OS_NAME}" == 'osx' ]]; then
- brew update;
- brew install gnutls lz4 lzo xz snappy ccache jemalloc curl ossp-uuid pcre zstd;
- brew link ccache;
- export PATH="/usr/local/opt/ccache/libexec:$PATH";
- fi
-
-before_script:
- - df -h
- - ccache --version
- - ccache --show-stats
- - ccache --max-size=5G
-
-script:
-# following modules are disabled after sourcing .travis.compiler.sh:
-# clang disabled: mroonga just generates too many warnings with clang and travis stops the job
-# cland disabled: tokudb has fatal warnings
-# gcc/rpl: tokudb and mroonga
- - source .travis.compiler.sh
- - cmake .
- -DCMAKE_BUILD_TYPE=${TYPE}
- ${CMAKE_OPT}
- -DWITH_SSL=system -DWITH_ZLIB=system
- - make -j 4
- - cd mysql-test
- - travis_wait 30 ./mtr --force --max-test-fail=20 --parallel=4 --testcase-timeout=${TEST_CASE_TIMEOUT}
- --suite=${MYSQL_TEST_SUITES}
- --skip-test-list=unstable-tests
- --skip-test=binlog.binlog_unsafe
-
-after_script:
- - ccache --show-stats
- - df -h
-
-notifications:
- irc:
- channels:
- - "chat.freenode.net#maria"
- on_success: never # [always|never|change]
- on_failure: never
- template:
- - "%{repository}/%{branch} (%{commit} - %{author}): %{build_url}: %{message}"
diff --git a/client/mysqldump.c b/client/mysqldump.c
index fc5b3bfabaf..34a207208f8 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -2747,6 +2747,9 @@ static uint dump_routines_for_db(char *db)
create_caption_xml[i]);
continue;
}
+
+ switch_sql_mode(sql_file, ";", row[1]);
+
if (opt_drop)
fprintf(sql_file, "/*!50003 DROP %s IF EXISTS %s */;\n",
routine_type[i], routine_name);
@@ -2786,9 +2789,6 @@ static uint dump_routines_for_db(char *db)
"--\n");
}
-
- switch_sql_mode(sql_file, ";", row[1]);
-
fprintf(sql_file,
"DELIMITER ;;\n"
"%s ;;\n"
@@ -5220,6 +5220,55 @@ int init_dumping_views(char *qdatabase __attribute__((unused)))
/*
+mysql specific database initialization.
+
+SYNOPSIS
+ init_dumping_mysql_tables
+
+ protections around dumping general/slow query log
+ qdatabase quoted name of the "mysql" database
+
+RETURN VALUES
+ 0 Success.
+ 1 Failure.
+*/
+static int init_dumping_mysql_tables(char *qdatabase)
+{
+ DBUG_ENTER("init_dumping_mysql_tables");
+
+ if (opt_drop_database)
+ fprintf(md_result_file,
+ "\n/*!50106 SET @save_log_output=@@LOG_OUTPUT*/;\n"
+ "/*M!100203 EXECUTE IMMEDIATE IF(@@LOG_OUTPUT='TABLE' AND (@@SLOW_QUERY_LOG=1 OR @@GENERAL_LOG=1),"
+ "\"SET GLOBAL LOG_OUTPUT='NONE'\", \"DO 0\") */;\n");
+
+ DBUG_RETURN(init_dumping_tables(qdatabase));
+}
+
+
+static void dump_first_mysql_tables(char *database)
+{
+ char table_type[NAME_LEN];
+ char ignore_flag;
+ DBUG_ENTER("dump_first_mysql_tables");
+
+ if (!get_table_structure((char *) "general_log",
+ database, table_type, &ignore_flag) )
+ verbose_msg("-- Warning: get_table_structure() failed with some internal "
+ "error for 'general_log' table\n");
+ if (!get_table_structure((char *) "slow_log",
+ database, table_type, &ignore_flag) )
+ verbose_msg("-- Warning: get_table_structure() failed with some internal "
+ "error for 'slow_log' table\n");
+ /* general and slow query logs exist now */
+ if (opt_drop_database)
+ fprintf(md_result_file,
+ "\n/*!50106 SET GLOBAL LOG_OUTPUT=@save_log_output*/;\n\n");
+ DBUG_VOID_RETURN;
+}
+
+
+/*
Table Specific database initialization.
SYNOPSIS
@@ -5325,7 +5374,6 @@ static int dump_all_tables_in_db(char *database)
char table_buff[NAME_LEN*2+3];
char hash_key[2*NAME_LEN+2]; /* "db.tablename" */
char *afterdot;
- my_bool general_log_table_exists= 0, slow_log_table_exists=0;
my_bool transaction_registry_table_exists= 0;
int using_mysql_db= !my_strcasecmp(charset_info, database, "mysql");
DBUG_ENTER("dump_all_tables_in_db");
@@ -5333,11 +5381,15 @@ static int dump_all_tables_in_db(char *database)
afterdot= strmov(hash_key, database);
*afterdot++= '.';
- if (init_dumping(database, init_dumping_tables))
+ if (init_dumping(database, using_mysql_db ? init_dumping_mysql_tables
+ : init_dumping_tables))
DBUG_RETURN(1);
if (opt_xml)
print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS);
+ if (using_mysql_db)
+ dump_first_mysql_tables(database);
+
if (lock_tables)
{
DYNAMIC_STRING query;
@@ -5426,24 +5478,16 @@ static int dump_all_tables_in_db(char *database)
else
{
/*
- If general_log and slow_log exists in the 'mysql' database,
+ If transaction_registry exists in the 'mysql' database,
we should dump the table structure. But we cannot
call get_table_structure() here as 'LOCK TABLES' query got executed
above on the session and that 'LOCK TABLES' query does not contain
- 'general_log' and 'slow_log' tables. (you cannot acquire lock
- on log tables). Hence mark the existence of these log tables here and
+ 'transaction_registry'. Hence mark the existence of the table here and
after 'UNLOCK TABLES' query is executed on the session, get the table
structure from server and dump it in the file.
*/
- if (using_mysql_db)
- {
- if (!my_strcasecmp(charset_info, table, "general_log"))
- general_log_table_exists= 1;
- else if (!my_strcasecmp(charset_info, table, "slow_log"))
- slow_log_table_exists= 1;
- else if (!my_strcasecmp(charset_info, table, "transaction_registry"))
- transaction_registry_table_exists= 1;
- }
+ if (using_mysql_db && !my_strcasecmp(charset_info, table, "transaction_registry"))
+ transaction_registry_table_exists= 1;
}
}
@@ -5464,39 +5508,25 @@ static int dump_all_tables_in_db(char *database)
DBUG_PRINT("info", ("Dumping routines for database %s", database));
dump_routines_for_db(database);
}
- if (opt_xml)
- {
- fputs("</database>\n", md_result_file);
- check_io(md_result_file);
- }
if (lock_tables)
(void) mysql_query_with_error_report(mysql, 0, "UNLOCK TABLES");
if (using_mysql_db)
{
- char table_type[NAME_LEN];
- char ignore_flag;
- if (general_log_table_exists)
- {
- if (!get_table_structure((char *) "general_log",
- database, table_type, &ignore_flag) )
- verbose_msg("-- Warning: get_table_structure() failed with some internal "
- "error for 'general_log' table\n");
- }
- if (slow_log_table_exists)
- {
- if (!get_table_structure((char *) "slow_log",
- database, table_type, &ignore_flag) )
- verbose_msg("-- Warning: get_table_structure() failed with some internal "
- "error for 'slow_log' table\n");
- }
if (transaction_registry_table_exists)
{
+ char table_type[NAME_LEN];
+ char ignore_flag;
if (!get_table_structure((char *) "transaction_registry",
database, table_type, &ignore_flag) )
verbose_msg("-- Warning: get_table_structure() failed with some internal "
"error for 'transaction_registry' table\n");
}
}
+ if (opt_xml)
+ {
+ fputs("</database>\n", md_result_file);
+ check_io(md_result_file);
+ }
if (flush_privileges && using_mysql_db)
{
fprintf(md_result_file,"\n--\n-- Flush Grant Tables \n--\n");
diff --git a/config.h.cmake b/config.h.cmake
index a959d79c7ac..fafd1684633 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -565,3 +565,5 @@
#endif // !defined(__STDC_FORMAT_MACROS)
#endif
+
+#cmakedefine HAVE_VFORK 1
diff --git a/configure.cmake b/configure.cmake
index 634ae1d4940..6c44e799624 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -989,3 +989,19 @@ IF(NOT MSVC)
HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE
)
ENDIF()
+
+MY_CHECK_C_COMPILER_FLAG("-Werror")
+IF(have_C__Werror)
+ SET(SAVE_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+ SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror")
+ CHECK_C_SOURCE_COMPILES("
+ #include <unistd.h>
+ int main()
+ {
+ pid_t pid=vfork();
+ return (int)pid;
+ }"
+ HAVE_VFORK
+ )
+ SET(CMAKE_REQUIRED_FLAGS ${SAVE_CMAKE_REQUIRED_FLAGS})
+ENDIF()
diff --git a/debian/additions/debian-start b/debian/additions/debian-start
index 7de59ce1fe9..5c15e1e0130 100755
--- a/debian/additions/debian-start
+++ b/debian/additions/debian-start
@@ -16,7 +16,7 @@ fi
MYSQL="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf"
MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
# Don't run full mysql_upgrade on every server restart, use --version-check to do it only once
-MYUPGRADE="/usr/bin/mysql_upgrade --defaults-extra-file=/etc/mysql/debian.cnf --version-check"
+MYUPGRADE="/usr/bin/mysql_upgrade --defaults-extra-file=/etc/mysql/debian.cnf --version-check --silent"
MYCHECK="/usr/bin/mysqlcheck --defaults-file=/etc/mysql/debian.cnf"
MYCHECK_SUBJECT="WARNING: mysqlcheck has found corrupt tables"
MYCHECK_PARAMS="--all-databases --fast --silent"
diff --git a/debian/mariadb-server-10.4.postrm b/debian/mariadb-server-10.4.postrm
index 3cbd3721414..60d90c36280 100644
--- a/debian/mariadb-server-10.4.postrm
+++ b/debian/mariadb-server-10.4.postrm
@@ -11,6 +11,11 @@ MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
# do it himself. No database directories should be removed while the server
# is running!
stop_server() {
+ # Return immediately if there are no mysql processes running
+ # as there is no point in trying to shutdown in that case.
+ # Compatibility with versions that ran 'mariadbd'
+ if ! pgrep -x --nslist pid --ns $$ "mysqld|mariadbd" > /dev/null; then return; fi
+
set +e
systemctl stop mysql
errno=$?
diff --git a/debian/mariadb-server-10.4.preinst b/debian/mariadb-server-10.4.preinst
index 6e3b8e761e1..b3977a40bac 100644
--- a/debian/mariadb-server-10.4.preinst
+++ b/debian/mariadb-server-10.4.preinst
@@ -20,9 +20,11 @@ mysql_upgradedir=/var/lib/mysql-upgrade
# do it himself. No database directories should be removed while the server
# is running! Another mysqld in e.g. a different chroot is fine for us.
stop_server() {
- # Return immediately if there are no mysql processes running
+ # Return immediately if there are no mysql processes running on a host
+ # (leave containerized processes with the same name in other namespaces)
# as there is no point in trying to shutdown in that case.
- if ! pgrep -x --ns $$ mysqld > /dev/null; then return; fi
+ # Compatibility with versions that ran 'mariadbd'
+ if ! pgrep -x --nslist pid --ns $$ "mysqld|mariadbd" > /dev/null; then return; fi
set +e
systemctl stop mysql
diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc
index 475d438dca3..9fe450fe40b 100644
--- a/extra/mariabackup/backup_mysql.cc
+++ b/extra/mariabackup/backup_mysql.cc
@@ -266,7 +266,8 @@ free_mysql_variables(mysql_variable *vars)
static
char *
-read_mysql_one_value(MYSQL *connection, const char *query)
+read_mysql_one_value(MYSQL *connection, const char *query,
+ uint column, uint expect_columns)
{
MYSQL_RES *mysql_result;
MYSQL_ROW row;
@@ -274,10 +275,10 @@ read_mysql_one_value(MYSQL *connection, const char *query)
mysql_result = xb_mysql_query(connection, query, true);
- ut_ad(mysql_num_fields(mysql_result) == 1);
+ ut_ad(mysql_num_fields(mysql_result) == expect_columns);
if ((row = mysql_fetch_row(mysql_result))) {
- result = strdup(row[0]);
+ result = strdup(row[column]);
}
mysql_free_result(mysql_result);
@@ -285,6 +286,15 @@ read_mysql_one_value(MYSQL *connection, const char *query)
return(result);
}
+
+static
+char *
+read_mysql_one_value(MYSQL *mysql, const char *query)
+{
+ return read_mysql_one_value(mysql, query, 0/*offset*/, 1/*total columns*/);
+}
+
+
static
bool
check_server_version(unsigned long version_number,
@@ -1087,92 +1097,322 @@ cleanup:
}
+class Var
+{
+ const char *m_name;
+ char *m_value;
+ /*
+ Disable copying constructors for safety, as the default binary copying
+ which would be wrong. If we ever want them, the m_value
+ member should be copied using an strdup()-alike function.
+ */
+ Var(const Var &); // Disabled
+ Var(Var &); // Disabled
+public:
+ ~Var()
+ {
+ free(m_value);
+ }
+ Var(const char *name)
+ :m_name(name),
+ m_value(NULL)
+ { }
+ // Init using a SHOW VARIABLES LIKE 'name' query
+ Var(const char *name, MYSQL *mysql)
+ :m_name(name)
+ {
+ char buf[128];
+ my_snprintf(buf, sizeof(buf), "SHOW VARIABLES LIKE '%s'", m_name);
+ m_value= read_mysql_one_value(mysql, buf, 1/*offset*/, 2/*total columns*/);
+ }
+ /*
+ Init by name from a result set.
+ If the variable name is not found in the result set metadata field names,
+ it's value stays untouched.
+ */
+ bool init(MYSQL_RES *mysql_result, MYSQL_ROW row)
+ {
+ MYSQL_FIELD *field= mysql_fetch_fields(mysql_result);
+ for (uint i= 0; i < mysql_num_fields(mysql_result); i++)
+ {
+ if (!strcmp(field[i].name, m_name))
+ {
+ free(m_value); // In case it was initialized earlier
+ m_value= row[i] ? strdup(row[i]) : NULL;
+ return false;
+ }
+ }
+ return true;
+ }
+ void replace(char from, char to)
+ {
+ ut_ad(m_value);
+ for (char *ptr= strchr(m_value, from); ptr; ptr= strchr(ptr, from))
+ *ptr= to;
+ }
+
+ const char *value() const { return m_value; }
+ bool eq_value(const char *str, size_t length) const
+ {
+ return m_value && !strncmp(m_value, str, length) && m_value[length] == '\0';
+ }
+ bool is_null_or_empty() const { return !m_value || !m_value[0]; }
+ bool print(String *to) const
+ {
+ ut_ad(m_value);
+ return to->append(m_value);
+ }
+ bool print_quoted(String *to) const
+ {
+ ut_ad(m_value);
+ return to->append("'") || to->append(m_value) || to->append("'");
+ }
+ bool print_set_global(String *to) const
+ {
+ ut_ad(m_value);
+ return
+ to->append("SET GLOBAL ") ||
+ to->append(m_name) ||
+ to->append(" = '") ||
+ to->append(m_value) ||
+ to->append("';\n");
+ }
+};
+
+
+class Show_slave_status
+{
+ Var m_mariadb_connection_name; // MariaDB: e.g. 'master1'
+ Var m_master; // e.g. 'localhost'
+ Var m_filename; // e.g. 'source-bin.000002'
+ Var m_position; // a number
+ Var m_mysql_gtid_executed; // MySQL56: e.g. single '<UUID>:1-5" or multiline
+ // '<UUID1>:1-10,\n<UUID2>:1-20\n<UUID3>:1-30'
+ Var m_mariadb_using_gtid; // MariaDB: 'No','Slave_Pos','Current_Pos'
+
+public:
+
+ Show_slave_status()
+ :m_mariadb_connection_name("Connection_name"),
+ m_master("Master_Host"),
+ m_filename("Relay_Master_Log_File"),
+ m_position("Exec_Master_Log_Pos"),
+ m_mysql_gtid_executed("Executed_Gtid_Set"),
+ m_mariadb_using_gtid("Using_Gtid")
+ { }
+
+ void init(MYSQL_RES *res, MYSQL_ROW row)
+ {
+ m_mariadb_connection_name.init(res, row);
+ m_master.init(res, row);
+ m_filename.init(res, row);
+ m_position.init(res, row);
+ m_mysql_gtid_executed.init(res, row);
+ m_mariadb_using_gtid.init(res, row);
+ // Normalize
+ if (m_mysql_gtid_executed.value())
+ m_mysql_gtid_executed.replace('\n', ' ');
+ }
+
+ static void msg_is_not_slave()
+ {
+ msg("Failed to get master binlog coordinates "
+ "from SHOW SLAVE STATUS.This means that the server is not a "
+ "replication slave. Ignoring the --slave-info option");
+ }
+
+ bool is_mariadb_using_gtid() const
+ {
+ return !m_mariadb_using_gtid.eq_value("No", 2);
+ }
+
+ static bool start_comment_chunk(String *to)
+ {
+ return to->length() ? to->append("; ") : false;
+ }
+
+ bool print_connection_name_if_set(String *to) const
+ {
+ if (!m_mariadb_connection_name.is_null_or_empty())
+ return m_mariadb_connection_name.print_quoted(to) || to->append(' ');
+ return false;
+ }
+
+ bool print_comment_master_identity(String *comment) const
+ {
+ if (comment->append("master "))
+ return true;
+ if (!m_mariadb_connection_name.is_null_or_empty())
+ return m_mariadb_connection_name.print_quoted(comment);
+ return comment->append("''"); // Default not named master
+ }
+
+ bool print_using_master_log_pos(String *sql, String *comment) const
+ {
+ return
+ sql->append("CHANGE MASTER ") ||
+ print_connection_name_if_set(sql) ||
+ sql->append("TO MASTER_LOG_FILE=") || m_filename.print_quoted(sql) ||
+ sql->append(", MASTER_LOG_POS=") || m_position.print(sql) ||
+ sql->append(";\n") ||
+ print_comment_master_identity(comment) ||
+ comment->append(" filename ") || m_filename.print_quoted(comment) ||
+ comment->append(" position ") || m_position.print_quoted(comment);
+ }
+
+ bool print_mysql56(String *sql, String *comment) const
+ {
+ /*
+ SET @@GLOBAL.gtid_purged = '2174B383-5441-11E8-B90A-C80AA9429562:1-1029, '
+ '224DA167-0C0C-11E8-8442-00059A3C7B00:1-2695';
+ CHANGE MASTER TO MASTER_AUTO_POSITION=1;
+ */
+ return
+ sql->append("SET GLOBAL gtid_purged=") ||
+ m_mysql_gtid_executed.print_quoted(sql) ||
+ sql->append(";\n") ||
+ sql->append("CHANGE MASTER TO MASTER_AUTO_POSITION=1;\n") ||
+ print_comment_master_identity(comment) ||
+ comment->append(" purge list ") ||
+ m_mysql_gtid_executed.print_quoted(comment);
+ }
+
+ bool print_mariadb10_using_gtid(String *sql, String *comment) const
+ {
+ return
+ sql->append("CHANGE MASTER ") ||
+ print_connection_name_if_set(sql) ||
+ sql->append("TO master_use_gtid = slave_pos;\n") ||
+ print_comment_master_identity(comment) ||
+ comment->append(" master_use_gtid = slave_pos");
+ }
+
+ bool print(String *sql, String *comment, const Var &gtid_slave_pos) const
+ {
+ if (!m_mysql_gtid_executed.is_null_or_empty())
+ {
+ /* MySQL >= 5.6 with GTID enabled */
+ return print_mysql56(sql, comment);
+ }
+
+ if (!gtid_slave_pos.is_null_or_empty() && is_mariadb_using_gtid())
+ {
+ /* MariaDB >= 10.0 with GTID enabled */
+ return print_mariadb10_using_gtid(sql, comment);
+ }
+
+ return print_using_master_log_pos(sql, comment);
+ }
+
+ /*
+ Get master info into strings "sql" and "comment" from a MYSQL_RES.
+ @return false on success
+ @return true on error
+ */
+ static bool get_slave_info(MYSQL_RES *show_slave_info_result,
+ const Var &gtid_slave_pos,
+ String *sql, String *comment)
+ {
+ if (!gtid_slave_pos.is_null_or_empty())
+ {
+ // Print gtid_slave_pos if any of the masters really needs it.
+ while (MYSQL_ROW row= mysql_fetch_row(show_slave_info_result))
+ {
+ Show_slave_status status;
+ status.init(show_slave_info_result, row);
+ if (status.is_mariadb_using_gtid())
+ {
+ if (gtid_slave_pos.print_set_global(sql) ||
+ comment->append("gtid_slave_pos ") ||
+ gtid_slave_pos.print_quoted(comment))
+ return true; // Error
+ break;
+ }
+ }
+ }
+
+ // Print the list of masters
+ mysql_data_seek(show_slave_info_result, 0);
+ while (MYSQL_ROW row= mysql_fetch_row(show_slave_info_result))
+ {
+ Show_slave_status status;
+ status.init(show_slave_info_result, row);
+ if (start_comment_chunk(comment) ||
+ status.print(sql, comment, gtid_slave_pos))
+ return true; // Error
+ }
+ return false; // Success
+ }
+
+ /*
+ Get master info into strings "sql" and "comment".
+ @return false on success
+ @return true on error
+ */
+ static bool get_slave_info(MYSQL *mysql, bool show_all_slave_status,
+ String *sql, String *comment)
+ {
+ bool rc= false; // Success
+ // gtid_slave_pos - MariaDB variable : e.g. "0-1-1" or "1-10-100,2-20-500"
+ Var gtid_slave_pos("gtid_slave_pos", mysql);
+ const char *query= show_all_slave_status ? "SHOW ALL SLAVES STATUS" :
+ "SHOW SLAVE STATUS";
+ MYSQL_RES *mysql_result= xb_mysql_query(mysql, query, true);
+ if (!mysql_num_rows(mysql_result))
+ {
+ msg_is_not_slave();
+ // Don't change rc, we still want to continue the backup
+ }
+ else
+ {
+ rc= get_slave_info(mysql_result, gtid_slave_pos, sql, comment);
+ }
+ mysql_free_result(mysql_result);
+ return rc;
+ }
+};
+
+
+
/*********************************************************************//**
Retrieves MySQL binlog position of the master server in a replication
setup and saves it in a file. It also saves it in mysql_slave_position
-variable. */
+variable.
+@returns false on error
+@returns true on success
+*/
bool
write_slave_info(MYSQL *connection)
{
- char *master = NULL;
- char *filename = NULL;
- char *gtid_executed = NULL;
- char *using_gtid = NULL;
- char *position = NULL;
- char *gtid_slave_pos = NULL;
- char *ptr;
- bool result = false;
-
- mysql_variable status[] = {
- {"Master_Host", &master},
- {"Relay_Master_Log_File", &filename},
- {"Exec_Master_Log_Pos", &position},
- {"Executed_Gtid_Set", &gtid_executed},
- {"Using_Gtid", &using_gtid},
- {NULL, NULL}
- };
-
- mysql_variable variables[] = {
- {"gtid_slave_pos", &gtid_slave_pos},
- {NULL, NULL}
- };
-
- read_mysql_variables(connection, "SHOW SLAVE STATUS", status, false);
- read_mysql_variables(connection, "SHOW VARIABLES", variables, true);
-
- if (master == NULL || filename == NULL || position == NULL) {
- msg("Failed to get master binlog coordinates "
- "from SHOW SLAVE STATUS.This means that the server is not a "
- "replication slave. Ignoring the --slave-info option");
- /* we still want to continue the backup */
- result = true;
- goto cleanup;
- }
-
- /* Print slave status to a file.
- If GTID mode is used, construct a CHANGE MASTER statement with
- MASTER_AUTO_POSITION and correct a gtid_purged value. */
- if (gtid_executed != NULL && *gtid_executed) {
- /* MySQL >= 5.6 with GTID enabled */
+ String sql, comment;
+ bool show_all_slaves_status= false;
- for (ptr = strchr(gtid_executed, '\n');
- ptr;
- ptr = strchr(ptr, '\n')) {
- *ptr = ' ';
- }
+ switch (server_flavor)
+ {
+ case FLAVOR_MARIADB:
+ show_all_slaves_status= mysql_server_version >= 100000;
+ break;
+ case FLAVOR_UNKNOWN:
+ case FLAVOR_MYSQL:
+ case FLAVOR_PERCONA_SERVER:
+ break;
+ }
- result = backup_file_printf(XTRABACKUP_SLAVE_INFO,
- "SET GLOBAL gtid_purged='%s';\n"
- "CHANGE MASTER TO MASTER_AUTO_POSITION=1\n",
- gtid_executed);
-
- ut_a(asprintf(&mysql_slave_position,
- "master host '%s', purge list '%s'",
- master, gtid_executed) != -1);
- } else if (gtid_slave_pos && *gtid_slave_pos &&
- !(using_gtid && !strncmp(using_gtid, "No", 2))) {
- /* MariaDB >= 10.0 with GTID enabled */
- result = backup_file_printf(XTRABACKUP_SLAVE_INFO,
- "SET GLOBAL gtid_slave_pos = '%s';\n"
- "CHANGE MASTER TO master_use_gtid = slave_pos\n",
- gtid_slave_pos);
- ut_a(asprintf(&mysql_slave_position,
- "master host '%s', gtid_slave_pos %s",
- master, gtid_slave_pos) != -1);
- } else {
- result = backup_file_printf(XTRABACKUP_SLAVE_INFO,
- "CHANGE MASTER TO MASTER_LOG_FILE='%s', "
- "MASTER_LOG_POS=%s\n", filename, position);
- ut_a(asprintf(&mysql_slave_position,
- "master host '%s', filename '%s', position '%s'",
- master, filename, position) != -1);
- }
+ if (Show_slave_status::get_slave_info(connection, show_all_slaves_status,
+ &sql, &comment))
+ return false; // Error
-cleanup:
- free_mysql_variables(status);
- free_mysql_variables(variables);
+ if (!sql.length())
+ {
+ /*
+ SHOW [ALL] SLAVE STATUS returned no rows.
+ Don't create the file, but return success to continue the backup.
+ */
+ return true; // Success
+ }
- return(result);
+ mysql_slave_position= strdup(comment.c_ptr());
+ return backup_file_print_buf(XTRABACKUP_SLAVE_INFO, sql.ptr(), sql.length());
}
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index cd3870d0128..751edfdddcf 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -5616,11 +5616,23 @@ static ibool prepare_handle_new_files(const char *data_home_dir,
const char *file_name, void *arg)
{
const char *dest_dir = static_cast<const char *>(arg);
- std::string src_path = std::string(data_home_dir) + '/' + std::string(db_name) + '/' + file_name;
+ std::string src_path = std::string(data_home_dir) + '/' + std::string(db_name) + '/';
/* Copy "*.new" files from incremental to base dir for incremental backup */
std::string dest_path=
dest_dir ? std::string(dest_dir) + '/' + std::string(db_name) +
- '/' + file_name : src_path;
+ '/' : src_path;
+
+ /*
+ A CREATE DATABASE could have happened during the base mariabackup run.
+ In case if the current table file (e.g. `t1.new`) is from such
+ a new database, the database directory may not exist yet in
+ the base backup directory. Let's make sure to check if the directory
+ exists (and create if needed).
+ */
+ if (!directory_exists(dest_path.c_str(), true/*create if not exists*/))
+ return FALSE;
+ src_path+= file_name;
+ dest_path+= file_name;
size_t index = dest_path.find(".new");
DBUG_ASSERT(index != std::string::npos);
diff --git a/libmariadb b/libmariadb
-Subproject f6c3d9fd2af5d17db64cc996574aa312efd70fc
+Subproject ab7a81e79e4be4324a2d09d19d4f5249801ef66
diff --git a/man/mysql_tzinfo_to_sql.1 b/man/mysql_tzinfo_to_sql.1
index 7eb148b94e4..a655e2f57d8 100644
--- a/man/mysql_tzinfo_to_sql.1
+++ b/man/mysql_tzinfo_to_sql.1
@@ -41,6 +41,7 @@ can be invoked several ways:
shell> \fBmysql_tzinfo_to_sql \fR\fB\fItz_dir\fR\fR
shell> \fBmysql_tzinfo_to_sql \fR\fB\fItz_file tz_name\fR\fR
shell> \fBmysql_tzinfo_to_sql \-\-leap \fR\fB\fItz_file\fR\fR
+shell> \fBmysql_tzinfo_to_sql \-\-skip\-write\-binlog \fR\fB\fItz_dir\fR\fR
.fi
.if n \{\
.RE
@@ -100,6 +101,9 @@ shell> \fBmysql_tzinfo_to_sql \-\-leap \fR\fB\fItz_file\fR\fR\fB | mysql \-u roo
.RE
.\}
.PP
+Using the \-\-skip\-write\-binlog option prevents writing of changes to the binary log or to other Galera
+cluster members. This can be used with any form of running \fBmysql_tzinfo_to_sql\fR.
+.PP
After running
\fBmysql_tzinfo_to_sql\fR, it is best to restart the server so that it does not continue to use any previously cached time zone data\&.
.SH "COPYRIGHT"
diff --git a/mysql-test/include/grep.inc b/mysql-test/include/grep.inc
new file mode 100644
index 00000000000..9ce7cddb7b7
--- /dev/null
+++ b/mysql-test/include/grep.inc
@@ -0,0 +1,16 @@
+# Grep file for regular expression and output to STDOUT
+#
+# Usage:
+# --let $grep_file= /path/to/your/file
+# --let $grep_regex= your_regex_string
+# --source include/grep.inc
+
+--perl
+ open (my $fh, "<", "$ENV{grep_file}") or die $!;
+ while (<$fh>)
+ {
+ /$ENV{grep_regex}/ &&
+ print;
+ }
+ close $fh;
+EOF
diff --git a/mysql-test/lib/My/CoreDump.pm b/mysql-test/lib/My/CoreDump.pm
index ae30f4f6074..3f983b8e72f 100644
--- a/mysql-test/lib/My/CoreDump.pm
+++ b/mysql-test/lib/My/CoreDump.pm
@@ -78,7 +78,10 @@ sub _gdb {
my ($tmp, $tmp_name) = tempfile();
print $tmp
"bt\n",
- "thread apply all bt\n",
+ "set print sevenbit on\n",
+ "set print static-members off\n",
+ "set print frame-arguments all\n",
+ "thread apply all bt full\n",
"quit\n";
close $tmp or die "Error closing $tmp_name: $!";
diff --git a/mysql-test/main/check_constraint.result b/mysql-test/main/check_constraint.result
index f851b99e5c1..dab1d61cdb9 100644
--- a/mysql-test/main/check_constraint.result
+++ b/mysql-test/main/check_constraint.result
@@ -236,6 +236,66 @@ insert t1 (b) values (1);
ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
drop table t1;
#
+# MDEV-25638 Assertion `!result' failed in convert_const_to_int
+#
+create table t1 (v1 bigint check (v1 not in ('x' , 'x111'))) ;
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+Warning 1292 Truncated incorrect DOUBLE value: 'x111'
+select * from t1;
+v1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+Warning 1292 Truncated incorrect DOUBLE value: 'x111'
+select v1 from t1;
+v1
+select * from t1;
+v1
+prepare stmt from "select * from t1";
+execute stmt;
+v1
+execute stmt;
+v1
+flush tables;
+select * from t1;
+v1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+Warning 1292 Truncated incorrect DOUBLE value: 'x111'
+select * from t1;
+v1
+deallocate prepare stmt;
+drop table t1;
+#
+# MDEV-26061 MariaDB server crash at Field::set_default
+#
+create table t1 (v2 date check (v1 like default (v1)), v1 date default (from_days ('x')));
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'x'
+insert ignore into t1 values ( 'x' , 'x' ) ;
+Warnings:
+Warning 1265 Data truncated for column 'v2' at row 1
+Warning 1265 Data truncated for column 'v1' at row 1
+Warning 1292 Truncated incorrect INTEGER value: 'x'
+drop table t1;
+#
+# End of 10.2 tests
+#
+#
+# MDEV-26061 MariaDB server crash at Field::set_default
+#
+create table t1 (d timestamp check (default (d) is true)) as select 1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() CHECK (default(`d`) is true),
+ `1` int(1) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+#
+# End of 10.3 tests
+#
+#
# MDEV-24274 ALTER TABLE with CHECK CONSTRAINTS gives "Out of Memory" error
#
create table t1 (id varchar(2), constraint id check (id regexp '[a-z]'));
@@ -247,3 +307,6 @@ t1 CREATE TABLE `t1` (
CONSTRAINT `id` CHECK (`id` regexp '[a-z]')
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+#
+# End of 10.4 tests
+#
diff --git a/mysql-test/main/check_constraint.test b/mysql-test/main/check_constraint.test
index 1258a9e3be6..194fdc04399 100644
--- a/mysql-test/main/check_constraint.test
+++ b/mysql-test/main/check_constraint.test
@@ -178,9 +178,56 @@ insert t1 (b) values (1);
drop table t1;
--echo #
+--echo # MDEV-25638 Assertion `!result' failed in convert_const_to_int
+--echo #
+
+--enable_prepare_warnings
+create table t1 (v1 bigint check (v1 not in ('x' , 'x111'))) ;
+select * from t1;
+select v1 from t1;
+select * from t1;
+prepare stmt from "select * from t1";
+execute stmt;
+execute stmt;
+flush tables;
+select * from t1;
+select * from t1;
+deallocate prepare stmt;
+drop table t1;
+--disable_prepare_warnings
+
+--echo #
+--echo # MDEV-26061 MariaDB server crash at Field::set_default
+--echo #
+
+create table t1 (v2 date check (v1 like default (v1)), v1 date default (from_days ('x')));
+insert ignore into t1 values ( 'x' , 'x' ) ;
+drop table t1;
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
+
+--echo #
+--echo # MDEV-26061 MariaDB server crash at Field::set_default
+--echo #
+
+create table t1 (d timestamp check (default (d) is true)) as select 1;
+show create table t1;
+drop table t1;
+
+--echo #
+--echo # End of 10.3 tests
+--echo #
+
+--echo #
--echo # MDEV-24274 ALTER TABLE with CHECK CONSTRAINTS gives "Out of Memory" error
--echo #
create table t1 (id varchar(2), constraint id check (id regexp '[a-z]'));
alter table t1 force;
show create table t1;
drop table t1;
+
+--echo #
+--echo # End of 10.4 tests
+--echo #
diff --git a/mysql-test/main/create_select_tmp.result b/mysql-test/main/create_select.result
index 2842ab26c42..803f9a06213 100644
--- a/mysql-test/main/create_select_tmp.result
+++ b/mysql-test/main/create_select.result
@@ -1,4 +1,7 @@
-drop table if exists t1, t2;
+CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+#
+# Testcase for BUG#4551
+#
CREATE TABLE t1 ( a int );
INSERT INTO t1 VALUES (1),(2),(1);
CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
@@ -18,6 +21,20 @@ ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select * from t2;
ERROR 42S02: Table 'test.t2' doesn't exist
drop table t1;
+#
+# End of 4.1 tests
+#
+#
+# MDEV-28393 Server crashes in TABLE::mark_default_fields_for_write
+#
+create table t1 (a int, b text not null default '');
+alter table t1 character set = utf8;
+create table t2 select * from t1;
+insert into t1 values (1,'');
+drop table t1, t2;
+#
+# End of 10.2 tests
+#
set sql_mode='ignore_bad_table_options';
create table t1 (
f1 int invisible,
@@ -39,3 +56,6 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
drop table t1;
set sql_mode=default;
+#
+# End of 10.4 tests
+#
diff --git a/mysql-test/main/create_select_tmp.test b/mysql-test/main/create_select.test
index 3ed885ea382..d91f71133a0 100644
--- a/mysql-test/main/create_select_tmp.test
+++ b/mysql-test/main/create_select.test
@@ -1,42 +1,55 @@
-# Testcase for BUG#4551
+# This does not work for RBR yet.
+--source include/have_innodb.inc
+--source include/have_binlog_format_mixed_or_statement.inc
+
+CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+
+--echo #
+--echo # Testcase for BUG#4551
+--echo #
+
# The bug was that when the table was TEMPORARY, it was not deleted if
# the CREATE SELECT failed (the code intended too, but it actually
# didn't). And as the CREATE TEMPORARY TABLE was not written to the
# binlog if it was a transactional table, it resulted in an
# inconsistency between binlog and the internal list of temp tables.
-# This does not work for RBR yet.
---source include/have_binlog_format_mixed_or_statement.inc
-
---disable_query_log
-CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
---enable_query_log
-
--- source include/have_innodb.inc
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
CREATE TABLE t1 ( a int );
INSERT INTO t1 VALUES (1),(2),(1);
--error ER_DUP_ENTRY
CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
---error 1146
+--error ER_NO_SUCH_TABLE
select * from t2;
--error ER_DUP_ENTRY
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
---error 1146
+--error ER_NO_SUCH_TABLE
select * from t2;
--error ER_DUP_ENTRY
CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
---error 1146
+--error ER_NO_SUCH_TABLE
select * from t2;
--error ER_DUP_ENTRY
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
---error 1146
+--error ER_NO_SUCH_TABLE
select * from t2;
drop table t1;
-# End of 4.1 tests
+--echo #
+--echo # End of 4.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-28393 Server crashes in TABLE::mark_default_fields_for_write
+--echo #
+create table t1 (a int, b text not null default '');
+alter table t1 character set = utf8;
+create table t2 select * from t1;
+insert into t1 values (1,'');
+drop table t1, t2;
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
set sql_mode='ignore_bad_table_options';
create table t1 (
@@ -50,4 +63,6 @@ show create table t1;
drop table t1;
set sql_mode=default;
-# End of 10.4 tests
+--echo #
+--echo # End of 10.4 tests
+--echo #
diff --git a/mysql-test/main/ddl_i18n_koi8r.result b/mysql-test/main/ddl_i18n_koi8r.result
index 612a4a4cbff..66c85f12034 100644
--- a/mysql-test/main/ddl_i18n_koi8r.result
+++ b/mysql-test/main/ddl_i18n_koi8r.result
@@ -723,6 +723,8 @@ utf8_general_ci utf8_general_ci
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 */;
USE `mysqltest1`;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = '' */ ;
ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -730,8 +732,6 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET character_set_client = koi8r */ ;
/*!50003 SET character_set_results = koi8r */ ;
/*!50003 SET collation_connection = koi8r_general_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(
INOUT ÐÁÒÁÍ1 CHAR(10),
@@ -757,6 +757,8 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = '' */ ;
ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -764,8 +766,6 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET character_set_client = koi8r */ ;
/*!50003 SET character_set_results = koi8r */ ;
/*!50003 SET collation_connection = koi8r_general_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`(
INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8,
@@ -799,6 +799,8 @@ ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ;
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 */;
USE `mysqltest2`;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = '' */ ;
ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -806,8 +808,6 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET character_set_client = koi8r */ ;
/*!50003 SET character_set_results = koi8r */ ;
/*!50003 SET collation_connection = koi8r_general_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`(
INOUT ÐÁÒÁÍ1 CHAR(10),
@@ -833,6 +833,8 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
ALTER DATABASE `mysqltest2` CHARACTER SET cp866 COLLATE cp866_general_ci ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = '' */ ;
ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -840,8 +842,6 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET character_set_client = koi8r */ ;
/*!50003 SET character_set_results = koi8r */ ;
/*!50003 SET collation_connection = koi8r_general_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`(
INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8,
diff --git a/mysql-test/main/ddl_i18n_utf8.result b/mysql-test/main/ddl_i18n_utf8.result
index 2be5413f182..78ef487cdaf 100644
--- a/mysql-test/main/ddl_i18n_utf8.result
+++ b/mysql-test/main/ddl_i18n_utf8.result
@@ -723,6 +723,8 @@ utf8_general_ci utf8_general_ci
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 */;
USE `mysqltest1`;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = '' */ ;
ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -730,8 +732,6 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(
INOUT парам1 CHAR(10),
@@ -757,6 +757,8 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = '' */ ;
ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -764,8 +766,6 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`(
INOUT парам1 CHAR(10) CHARACTER SET utf8,
@@ -799,6 +799,8 @@ ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ;
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 */;
USE `mysqltest2`;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = '' */ ;
ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -806,8 +808,6 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`(
INOUT парам1 CHAR(10),
@@ -833,6 +833,8 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
ALTER DATABASE `mysqltest2` CHARACTER SET cp866 COLLATE cp866_general_ci ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = '' */ ;
ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -840,8 +842,6 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`(
INOUT парам1 CHAR(10) CHARACTER SET utf8,
diff --git a/mysql-test/main/default.result b/mysql-test/main/default.result
index e8f5bd8e48a..cbd18cdf9a8 100644
--- a/mysql-test/main/default.result
+++ b/mysql-test/main/default.result
@@ -3395,6 +3395,33 @@ ERROR 01000: Expression for field `a` is referring to uninitialized field `a`
show warnings;
Level Code Message
Error 4029 Expression for field `a` is referring to uninitialized field `a`
+#
+# MDEV-26423: MariaDB server crash in Create_tmp_table::finalize
+#
+CREATE TABLE t1 (pk varchar(36) DEFAULT uuid());
+INSERT INTO t1 VALUES (),();
+SELECT 1 FROM t1 GROUP BY DEFAULT(pk);
+1
+1
+DROP TABLE t1;
+#
+# MDEV-28402: ASAN heap-use-after-free in create_tmp_table,
+# Assertion `l_offset >= 0 && table->s->rec_buff_length - l_offset > 0'
+#
+CREATE TABLE t (a INT, KEY (a));
+INSERT INTO t VALUES (1),(2);
+SELECT DISTINCT DEFAULT(a), CASE a WHEN 0 THEN 1 ELSE 2 END FROM t GROUP BY a WITH ROLLUP;
+DEFAULT(a) CASE a WHEN 0 THEN 1 ELSE 2 END
+NULL 2
+DROP TABLE t;
+CREATE TABLE t (a INT, KEY (a));
+INSERT INTO t VALUES (1),(2);
+CREATE ALGORITHM=TEMPTABLE VIEW v AS SELECT * FROM t;
+SELECT DISTINCT DEFAULT(a), CASE a WHEN 0 THEN 1 ELSE 2 END FROM v GROUP BY a WITH ROLLUP;
+DEFAULT(a) CASE a WHEN 0 THEN 1 ELSE 2 END
+NULL 2
+DROP TABLE t;
+DROP VIEW v;
# end of 10.2 test
#
# MDEV-22703 DEFAULT() on a BLOB column can overwrite the default
diff --git a/mysql-test/main/default.test b/mysql-test/main/default.test
index bcd6ef7a9fb..1230f67c7d2 100644
--- a/mysql-test/main/default.test
+++ b/mysql-test/main/default.test
@@ -2116,6 +2116,32 @@ DROP TABLE t1;
create table t1 (a int as (a));
show warnings;
+
+--echo #
+--echo # MDEV-26423: MariaDB server crash in Create_tmp_table::finalize
+--echo #
+
+CREATE TABLE t1 (pk varchar(36) DEFAULT uuid());
+INSERT INTO t1 VALUES (),();
+SELECT 1 FROM t1 GROUP BY DEFAULT(pk);
+DROP TABLE t1;
+
+
+--echo #
+--echo # MDEV-28402: ASAN heap-use-after-free in create_tmp_table,
+--echo # Assertion `l_offset >= 0 && table->s->rec_buff_length - l_offset > 0'
+--echo #
+CREATE TABLE t (a INT, KEY (a));
+INSERT INTO t VALUES (1),(2);
+SELECT DISTINCT DEFAULT(a), CASE a WHEN 0 THEN 1 ELSE 2 END FROM t GROUP BY a WITH ROLLUP;
+DROP TABLE t;
+
+CREATE TABLE t (a INT, KEY (a));
+INSERT INTO t VALUES (1),(2);
+CREATE ALGORITHM=TEMPTABLE VIEW v AS SELECT * FROM t;
+SELECT DISTINCT DEFAULT(a), CASE a WHEN 0 THEN 1 ELSE 2 END FROM v GROUP BY a WITH ROLLUP;
+DROP TABLE t;
+DROP VIEW v;
--echo # end of 10.2 test
--echo #
diff --git a/mysql-test/main/default_innodb.result b/mysql-test/main/default_innodb.result
new file mode 100644
index 00000000000..81e9672df24
--- /dev/null
+++ b/mysql-test/main/default_innodb.result
@@ -0,0 +1,18 @@
+#
+# MDEV-26423: MariaDB server crash in Create_tmp_table::finalize
+#
+CREATE TABLE v0 (
+v2 DATE DEFAULT ( v1 MOD 68321183.000000 ) ,
+v1 DATETIME NULL ) engine=innodb;
+SHOW DATABASES LIKE 'x';
+Database (x)
+SELECT DISTINCT v2 , v1 , DEFAULT ( v2 ) FROM v0;
+v2 v1 DEFAULT ( v2 )
+DROP TABLE v0;
+CREATE TABLE t1 (v1 DATE, v2 DATE DEFAULT(v1)) engine=innodb;
+SELECT DISTINCT DEFAULT(v2) FROM t1 ;
+DEFAULT(v2)
+DROP TABLE t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/main/default_innodb.test b/mysql-test/main/default_innodb.test
new file mode 100644
index 00000000000..2fc74950845
--- /dev/null
+++ b/mysql-test/main/default_innodb.test
@@ -0,0 +1,22 @@
+
+--source include/have_innodb.inc
+
+--echo #
+--echo # MDEV-26423: MariaDB server crash in Create_tmp_table::finalize
+--echo #
+
+CREATE TABLE v0 (
+ v2 DATE DEFAULT ( v1 MOD 68321183.000000 ) ,
+ v1 DATETIME NULL ) engine=innodb;
+SHOW DATABASES LIKE 'x';
+SELECT DISTINCT v2 , v1 , DEFAULT ( v2 ) FROM v0;
+DROP TABLE v0;
+
+CREATE TABLE t1 (v1 DATE, v2 DATE DEFAULT(v1)) engine=innodb;
+SELECT DISTINCT DEFAULT(v2) FROM t1 ;
+DROP TABLE t1;
+
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/main/derived_view.result b/mysql-test/main/derived_view.result
index 268c0ae13b9..3df1acc66e4 100644
--- a/mysql-test/main/derived_view.result
+++ b/mysql-test/main/derived_view.result
@@ -3630,4 +3630,64 @@ f2 f3
DROP PROCEDURE p1;
DROP VIEW v1,v2,v3;
DROP TABLE t1;
+#
+# MDEV-27212: 2-nd execution of PS for select with embedded derived tables
+# and correlated subquery in select list of outer derived
+#
+create table t1 ( id int, id2 int ) engine=myisam;
+create table t2 ( x3 int , x1 int , x2 int, a1 int) engine=myisam;
+insert into t1 values (3, 2), (4, 2), (3, 4);
+insert into t2 values (1, 2, 2, 1), (1, 3, 3, 2), (2, 3, 3, 1);
+prepare stmt from "select id from t1
+join
+( select dt2.x1,
+( select sum(a1) from t2 where t2.x1 = dt2.x1 ) m
+from ( select x1 from t2 u where x3 = 1 ) dt2
+) dt
+on t1.id = dt.x1
+where t1.id2 < dt.m";
+execute stmt;
+id
+3
+execute stmt;
+id
+3
+deallocate prepare stmt;
+create procedure sp1() select id from t1
+join
+( select dt2.x1,
+( select sum(a1) from t2 where t2.x1 = dt2.x1 ) m
+from ( select x1 from t2 u where x3 = 1 ) dt2
+) dt
+on t1.id = dt.x1
+where t1.id2 < dt.m;
+call sp1();
+id
+3
+call sp1();
+id
+3
+create view v2 as select x1 from t2 u where x3 = 1;
+create view v as
+select v2.x1,
+( select sum(a1) from t2 where t2.x1 = v2.x1 ) m from v2;
+prepare stmt from "select id from t1 join v on t1.id = v.x1 where t1.id2 < v.m";
+execute stmt;
+id
+3
+execute stmt;
+id
+3
+deallocate prepare stmt;
+create procedure sp2() select id from t1 join v on t1.id = v.x1 where t1.id2 < v.m;
+call sp2();
+id
+3
+call sp2();
+id
+3
+drop procedure sp1;
+drop procedure sp2;
+drop view v, v2;
+drop table t1,t2;
# End of 10.2 tests
diff --git a/mysql-test/main/derived_view.test b/mysql-test/main/derived_view.test
index 584bde2d75d..006bdaea5ef 100644
--- a/mysql-test/main/derived_view.test
+++ b/mysql-test/main/derived_view.test
@@ -2400,4 +2400,56 @@ DROP PROCEDURE p1;
DROP VIEW v1,v2,v3;
DROP TABLE t1;
+--echo #
+--echo # MDEV-27212: 2-nd execution of PS for select with embedded derived tables
+--echo # and correlated subquery in select list of outer derived
+--echo #
+create table t1 ( id int, id2 int ) engine=myisam;
+create table t2 ( x3 int , x1 int , x2 int, a1 int) engine=myisam;
+insert into t1 values (3, 2), (4, 2), (3, 4);
+insert into t2 values (1, 2, 2, 1), (1, 3, 3, 2), (2, 3, 3, 1);
+
+let $q=
+select id from t1
+ join
+ ( select dt2.x1,
+ ( select sum(a1) from t2 where t2.x1 = dt2.x1 ) m
+ from ( select x1 from t2 u where x3 = 1 ) dt2
+ ) dt
+ on t1.id = dt.x1
+where t1.id2 < dt.m;
+
+eval prepare stmt from "$q";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+eval create procedure sp1() $q;
+call sp1();
+call sp1();
+
+create view v2 as select x1 from t2 u where x3 = 1;
+create view v as
+select v2.x1,
+ ( select sum(a1) from t2 where t2.x1 = v2.x1 ) m from v2;
+
+let $q=
+select id from t1 join v on t1.id = v.x1 where t1.id2 < v.m;
+
+eval prepare stmt from "$q";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+eval create procedure sp2() $q;
+call sp2();
+call sp2();
+
+drop procedure sp1;
+drop procedure sp2;
+
+drop view v, v2;
+
+drop table t1,t2;
+
--echo # End of 10.2 tests
diff --git a/mysql-test/main/func_default.result b/mysql-test/main/func_default.result
index 8721270ca1c..55efbda546d 100644
--- a/mysql-test/main/func_default.result
+++ b/mysql-test/main/func_default.result
@@ -159,5 +159,57 @@ a
10
DROP TABLE t1;
#
+# MDEV-21028 Server crashes in Query_arena::set_query_arena upon SELECT from view
+#
+create table t1 (a datetime default current_timestamp);
+insert into t1 () values (),();
+create algorithm=temptable view v1 as select * from t1;
+create algorithm=merge view v2 as select * from t1;
+select default(a) = now() from v1;
+default(a) = now()
+1
+1
+select default(a) = now() from v2;
+default(a) = now()
+1
+1
+drop view v1, v2;
+drop table t1;
+create table t1 (v1 timestamp) select 'x';
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `x` varchar(1) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select default(v1) from (select v1 from t1) dt;
+default(v1)
+2001-01-01 10:20:30
+select default(v1) from (select v1 from t1 group by v1) dt;
+default(v1)
+2001-01-01 10:20:30
+drop table t1;
+create table t1 (a text default '');
+create algorithm=temptable view v1 as select * from t1;
+insert into t1 values ('a');
+select default(a) from v1;
+default(a)
+
+drop view v1;
+drop table t1;
+#
+# MDEV-28403 ASAN heap-use-after-free in String::copy / get_field_default_value
+#
+create table t (a blob default 'x');
+create view v as select * from t;
+insert into t () values ();
+update t set a = default;
+select table_name,column_name,column_default from information_schema.columns where table_name = 'v';
+table_name v
+column_name a
+column_default 'x'
+drop view v;
+drop table t;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/main/func_default.test b/mysql-test/main/func_default.test
index cba7842c68f..d2099d3ef4c 100644
--- a/mysql-test/main/func_default.test
+++ b/mysql-test/main/func_default.test
@@ -140,5 +140,41 @@ SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END IS FALSE;
DROP TABLE t1;
--echo #
+--echo # MDEV-21028 Server crashes in Query_arena::set_query_arena upon SELECT from view
+--echo #
+create table t1 (a datetime default current_timestamp);
+insert into t1 () values (),();
+create algorithm=temptable view v1 as select * from t1;
+create algorithm=merge view v2 as select * from t1;
+select default(a) = now() from v1;
+select default(a) = now() from v2;
+drop view v1, v2;
+drop table t1;
+
+create table t1 (v1 timestamp) select 'x';
+show create table t1;
+select default(v1) from (select v1 from t1) dt;
+select default(v1) from (select v1 from t1 group by v1) dt;
+drop table t1;
+
+create table t1 (a text default '');
+create algorithm=temptable view v1 as select * from t1;
+insert into t1 values ('a');
+select default(a) from v1;
+drop view v1;
+drop table t1;
+
+--echo #
+--echo # MDEV-28403 ASAN heap-use-after-free in String::copy / get_field_default_value
+--echo #
+create table t (a blob default 'x');
+create view v as select * from t;
+insert into t () values ();
+update t set a = default;
+query_vertical select table_name,column_name,column_default from information_schema.columns where table_name = 'v';
+drop view v;
+drop table t;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/func_time.result b/mysql-test/main/func_time.result
index 725e156ddd4..b52a78e851f 100644
--- a/mysql-test/main/func_time.result
+++ b/mysql-test/main/func_time.result
@@ -991,6 +991,12 @@ ADDTIME('916:40:00', '416:40:00')
Warnings:
Warning 1292 Truncated incorrect time value: '916:40:00'
Warning 1292 Truncated incorrect time value: '1255:39:59.999999'
+SELECT ADDTIME(20010101,1e0), ADDTIME(20010101,1.1e0);
+ADDTIME(20010101,1e0) ADDTIME(20010101,1.1e0)
+2001-01-01 00:00:01.000000 2001-01-01 00:00:01.100000
+SELECT ADDTIME(ADDTIME(20010101,1e0), 0);
+ADDTIME(ADDTIME(20010101,1e0), 0)
+2001-01-01 00:00:01.000000
SELECT SUBTIME('916:40:00', '416:40:00');
SUBTIME('916:40:00', '416:40:00')
422:19:59.999999
diff --git a/mysql-test/main/func_time.test b/mysql-test/main/func_time.test
index 71f82ddba7b..c7122016b46 100644
--- a/mysql-test/main/func_time.test
+++ b/mysql-test/main/func_time.test
@@ -513,6 +513,10 @@ SELECT TIME_TO_SEC('916:40:00');
SELECT ADDTIME('500:00:00', '416:40:00');
SELECT ADDTIME('916:40:00', '416:40:00');
+# check if ADDTIME() handles NOT_FIXED_DEC correctly
+SELECT ADDTIME(20010101,1e0), ADDTIME(20010101,1.1e0);
+SELECT ADDTIME(ADDTIME(20010101,1e0), 0);
+
# check if SUBTIME() handles out-of-range values correctly
SELECT SUBTIME('916:40:00', '416:40:00');
SELECT SUBTIME('-916:40:00', '416:40:00');
diff --git a/mysql-test/main/grant.result b/mysql-test/main/grant.result
index 8cb2ebd551f..e445c077dd0 100644
--- a/mysql-test/main/grant.result
+++ b/mysql-test/main/grant.result
@@ -3,8 +3,6 @@ set LOCAL sql_mode="";
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
select priv into @root_priv from mysql.global_priv where user='root' and host='localhost';
-drop table if exists t1;
-drop database if exists mysqltest;
connect master,localhost,root,,;
connection master;
SET NAMES binary;
@@ -2784,6 +2782,14 @@ DROP USER foo;
DROP TABLE db.t;
DROP DATABASE db;
#
+# Bug#33578113: DROP privilege on performance_schema.* can't be revoked
+#
+connection default;
+CREATE USER bug33578113;
+GRANT DROP ON performance_schema.* TO bug33578113;
+REVOKE DROP ON performance_schema.* FROM bug33578113;
+DROP USER bug33578113;
+#
# End of 10.2 tests
#
#
diff --git a/mysql-test/main/grant.test b/mysql-test/main/grant.test
index 38baf673825..598c223c374 100644
--- a/mysql-test/main/grant.test
+++ b/mysql-test/main/grant.test
@@ -1,7 +1,7 @@
# Test of GRANT commands
# Grant tests not performed with embedded server
--- source include/not_embedded.inc
+--source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
@@ -12,12 +12,6 @@ SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creato
SET GLOBAL log_bin_trust_function_creators = 1;
select priv into @root_priv from mysql.global_priv where user='root' and host='localhost';
-# Cleanup
---disable_warnings
-drop table if exists t1;
-drop database if exists mysqltest;
---enable_warnings
-
connect (master,localhost,root,,);
connection master;
SET NAMES binary;
@@ -2285,6 +2279,16 @@ DROP TABLE db.t;
DROP DATABASE db;
--echo #
+--echo # Bug#33578113: DROP privilege on performance_schema.* can't be revoked
+--echo #
+connection default;
+CREATE USER bug33578113;
+GRANT DROP ON performance_schema.* TO bug33578113;
+REVOKE DROP ON performance_schema.* FROM bug33578113;
+DROP USER bug33578113;
+--source include/wait_until_count_sessions.inc
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/information_schema_columns.result b/mysql-test/main/information_schema_columns.result
new file mode 100644
index 00000000000..3624a6db368
--- /dev/null
+++ b/mysql-test/main/information_schema_columns.result
@@ -0,0 +1,47 @@
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-25243 ASAN heap-use-after-free in Item_func_sp::execute_impl upon concurrent view DDL and I_S query with view and function
+#
+CREATE FUNCTION f1() RETURNS INT RETURN 1;
+CREATE VIEW v01 AS SELECT f1();
+CREATE VIEW v02 AS SELECT f1();
+connect con1,localhost,root,,;
+SELECT GET_LOCK('v01',30);
+GET_LOCK('v01',30)
+1
+SELECT GET_LOCK('v02',30);
+GET_LOCK('v02',30)
+1
+connection default;
+SELECT * FROM INFORMATION_SCHEMA.COLUMNS
+WHERE TABLE_SCHEMA='test'
+ AND TABLE_NAME LIKE 'v0%'
+ AND GET_LOCK(TABLE_NAME,30)
+AND RELEASE_LOCK(TABLE_NAME)
+AND f1()=1
+ORDER BY TABLE_NAME;
+connection con1;
+connection con1;
+SELECT RELEASE_LOCK('v01') /* Let the first row evaluate f1 */;
+RELEASE_LOCK('v01')
+1
+CREATE FUNCTION f2() RETURNS INT RETURN 1 /* Invalidate SP cache*/;
+SELECT RELEASE_LOCK('v02') /* Let the second row evaluate f1() */;
+RELEASE_LOCK('v02')
+1
+DROP FUNCTION f2;
+disconnect con1;
+connection default;
+SELECT RELEASE_LOCK('v01');
+RELEASE_LOCK('v01')
+NULL
+SELECT RELEASE_LOCK('v02');
+RELEASE_LOCK('v02')
+NULL
+DROP VIEW v01, v02;
+DROP FUNCTION f1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/main/information_schema_columns.test b/mysql-test/main/information_schema_columns.test
new file mode 100644
index 00000000000..0171b221110
--- /dev/null
+++ b/mysql-test/main/information_schema_columns.test
@@ -0,0 +1,48 @@
+--echo #
+--echo # Start of 10.2 tests
+--echo #
+
+--echo #
+--echo # MDEV-25243 ASAN heap-use-after-free in Item_func_sp::execute_impl upon concurrent view DDL and I_S query with view and function
+--echo #
+
+
+CREATE FUNCTION f1() RETURNS INT RETURN 1;
+CREATE VIEW v01 AS SELECT f1();
+CREATE VIEW v02 AS SELECT f1();
+
+--connect(con1,localhost,root,,)
+SELECT GET_LOCK('v01',30);
+SELECT GET_LOCK('v02',30);
+--connection default
+
+--send
+ SELECT * FROM INFORMATION_SCHEMA.COLUMNS
+ WHERE TABLE_SCHEMA='test'
+ AND TABLE_NAME LIKE 'v0%'
+ AND GET_LOCK(TABLE_NAME,30)
+ AND RELEASE_LOCK(TABLE_NAME)
+ AND f1()=1
+ ORDER BY TABLE_NAME;
+
+--connection con1
+--connection con1
+SELECT RELEASE_LOCK('v01') /* Let the first row evaluate f1 */;
+CREATE FUNCTION f2() RETURNS INT RETURN 1 /* Invalidate SP cache*/;
+SELECT RELEASE_LOCK('v02') /* Let the second row evaluate f1() */;
+DROP FUNCTION f2;
+--disconnect con1
+
+--connection default
+--disable_result_log
+--reap
+--enable_result_log
+SELECT RELEASE_LOCK('v01');
+SELECT RELEASE_LOCK('v02');
+
+DROP VIEW v01, v02;
+DROP FUNCTION f1;
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/main/information_schema_tables.result b/mysql-test/main/information_schema_tables.result
new file mode 100644
index 00000000000..a3dd068831c
--- /dev/null
+++ b/mysql-test/main/information_schema_tables.result
@@ -0,0 +1,77 @@
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-25243 ASAN heap-use-after-free in Item_func_sp::execute_impl upon concurrent view DDL and I_S query with view and function
+#
+# The originally reported non-deterministic test.
+# It did not fail reliably on every run.
+CREATE TABLE t (a INT);
+INSERT INTO t VALUES (1),(2);
+CREATE FUNCTION f(b INT) RETURNS INT RETURN 1;
+CREATE VIEW v AS SELECT f(SUM(a)) FROM t;
+connect con1,localhost,root,,test;
+LOOP
+CREATE OR REPLACE VIEW vv AS SELECT 1;
+END LOOP $
+connection default;
+SELECT v.* FROM v JOIN INFORMATION_SCHEMA.TABLES WHERE DATA_LENGTH = -1;
+f(SUM(a))
+KILL CONID;
+disconnect con1;
+connection default;
+DROP VIEW IF EXISTS vv;
+DROP VIEW v;
+DROP FUNCTION f;
+DROP TABLE t;
+# The second test version from the MDEV.
+# It failed more reliably, but still was not deterministic.
+CREATE FUNCTION f() RETURNS INT RETURN 1;
+CREATE VIEW v AS SELECT f() FROM seq_1_to_10;
+SELECT * FROM INFORMATION_SCHEMA.TABLES, v;;
+connect con1,localhost,root,,;
+CREATE VIEW v2 AS SELECT 1;
+connection default;
+disconnect con1;
+DROP VIEW v;
+DROP VIEW v2;
+DROP FUNCTION f;
+# The third test version from the MDEV.
+# It failed reliably, and should be deterninistic.
+CREATE FUNCTION f1() RETURNS INT RETURN 1;
+CREATE VIEW v01 AS SELECT f1();
+CREATE VIEW v02 AS SELECT f1();
+connect con1,localhost,root,,;
+SELECT GET_LOCK('v01',30);
+GET_LOCK('v01',30)
+1
+SELECT GET_LOCK('v02',30);
+GET_LOCK('v02',30)
+1
+connection default;
+SELECT * FROM INFORMATION_SCHEMA.TABLES
+WHERE TABLE_SCHEMA='test'
+ AND TABLE_NAME LIKE 'v0%'
+ AND GET_LOCK(TABLE_NAME,30)
+AND RELEASE_LOCK(TABLE_NAME)
+AND f1()=1
+ORDER BY TABLE_NAME;
+connection con1;
+SELECT RELEASE_LOCK('v01') /* Let the first row evaluate f1 */;
+RELEASE_LOCK('v01')
+1
+CREATE FUNCTION f2() RETURNS INT RETURN 1 /* Invalidate SP cache*/;
+SELECT RELEASE_LOCK('v02') /* Let the second row evaluate f1() */;
+RELEASE_LOCK('v02')
+1
+DROP FUNCTION f2;
+disconnect con1;
+connection default;
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT MAX_INDEX_LENGTH TEMPORARY
+def test v01 VIEW NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL VIEW NULL NULL
+def test v02 VIEW NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL VIEW NULL NULL
+DROP VIEW v01, v02;
+DROP FUNCTION f1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/main/information_schema_tables.test b/mysql-test/main/information_schema_tables.test
new file mode 100644
index 00000000000..bc4f269a3fb
--- /dev/null
+++ b/mysql-test/main/information_schema_tables.test
@@ -0,0 +1,100 @@
+--source include/have_sequence.inc
+
+--echo #
+--echo # Start of 10.2 tests
+--echo #
+
+--echo #
+--echo # MDEV-25243 ASAN heap-use-after-free in Item_func_sp::execute_impl upon concurrent view DDL and I_S query with view and function
+--echo #
+
+--echo # The originally reported non-deterministic test.
+--echo # It did not fail reliably on every run.
+
+CREATE TABLE t (a INT);
+INSERT INTO t VALUES (1),(2);
+CREATE FUNCTION f(b INT) RETURNS INT RETURN 1;
+CREATE VIEW v AS SELECT f(SUM(a)) FROM t;
+--connect (con1,localhost,root,,test)
+--let $conid= `SELECT CONNECTION_ID()`
+--delimiter $
+--send
+LOOP
+ CREATE OR REPLACE VIEW vv AS SELECT 1;
+END LOOP $
+--delimiter ;
+--connection default
+# Avoid "Prepared statement needs to be re-prepared"
+# Note, the code could probably eventually fixed to avoid forcing re-pepare if
+# the *temporary* instance of Sp_caches (not the permanent one) was invalidated.
+--disable_ps_protocol
+--disable_warnings
+SELECT v.* FROM v JOIN INFORMATION_SCHEMA.TABLES WHERE DATA_LENGTH = -1;
+--enable_warnings
+--enable_ps_protocol
+# Cleanup
+--replace_result $conid CONID
+--eval KILL $conid
+--disconnect con1
+--connection default
+DROP VIEW IF EXISTS vv;
+DROP VIEW v;
+DROP FUNCTION f;
+DROP TABLE t;
+
+
+--echo # The second test version from the MDEV.
+--echo # It failed more reliably, but still was not deterministic.
+
+
+CREATE FUNCTION f() RETURNS INT RETURN 1;
+CREATE VIEW v AS SELECT f() FROM seq_1_to_10;
+--send SELECT * FROM INFORMATION_SCHEMA.TABLES, v;
+--connect(con1,localhost,root,,)
+CREATE VIEW v2 AS SELECT 1;
+--connection default
+--disable_result_log
+--reap
+--enable_result_log
+--disconnect con1
+DROP VIEW v;
+DROP VIEW v2;
+DROP FUNCTION f;
+
+--echo # The third test version from the MDEV.
+--echo # It failed reliably, and should be deterninistic.
+
+CREATE FUNCTION f1() RETURNS INT RETURN 1;
+CREATE VIEW v01 AS SELECT f1();
+CREATE VIEW v02 AS SELECT f1();
+
+--connect(con1,localhost,root,,)
+SELECT GET_LOCK('v01',30);
+SELECT GET_LOCK('v02',30);
+--connection default
+
+--send
+ SELECT * FROM INFORMATION_SCHEMA.TABLES
+ WHERE TABLE_SCHEMA='test'
+ AND TABLE_NAME LIKE 'v0%'
+ AND GET_LOCK(TABLE_NAME,30)
+ AND RELEASE_LOCK(TABLE_NAME)
+ AND f1()=1
+ ORDER BY TABLE_NAME;
+
+--connection con1
+SELECT RELEASE_LOCK('v01') /* Let the first row evaluate f1 */;
+CREATE FUNCTION f2() RETURNS INT RETURN 1 /* Invalidate SP cache*/;
+SELECT RELEASE_LOCK('v02') /* Let the second row evaluate f1() */;
+DROP FUNCTION f2;
+--disconnect con1
+--connection default
+--reap
+
+
+DROP VIEW v01, v02;
+DROP FUNCTION f1;
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/main/mysql_client_test_comp.test b/mysql-test/main/mysql_client_test_comp.test
index 13a9d4944a4..f8bd80fc48a 100644
--- a/mysql-test/main/mysql_client_test_comp.test
+++ b/mysql-test/main/mysql_client_test_comp.test
@@ -1,7 +1,8 @@
# run mysql_client_test with performance schema
# No need to run this with embedded server
--- source include/not_embedded.inc
+--source include/not_embedded.inc
+--source include/check_ipv6.inc
# need to have the dynamic loading turned on for the client plugin tests
--source include/have_plugin_auth.inc
diff --git a/mysql-test/main/mysql_client_test_nonblock.test b/mysql-test/main/mysql_client_test_nonblock.test
index 19489bf9e0e..73e7a6d378d 100644
--- a/mysql-test/main/mysql_client_test_nonblock.test
+++ b/mysql-test/main/mysql_client_test_nonblock.test
@@ -2,7 +2,8 @@
# This runs the mysql_client_test using the non-blocking API.
# The non-blocking API is not supported in the embedded server.
--- source include/not_embedded.inc
+--source include/not_embedded.inc
+--source include/check_ipv6.inc
# This test is slow on buildbot.
--source include/big_test.inc
diff --git a/mysql-test/main/mysql_tzinfo_to_sql_symlink.result b/mysql-test/main/mysql_tzinfo_to_sql_symlink.result
index 9456b5515e3..a9ada2d6fdb 100644
--- a/mysql-test/main/mysql_tzinfo_to_sql_symlink.result
+++ b/mysql-test/main/mysql_tzinfo_to_sql_symlink.result
@@ -142,9 +142,9 @@ COUNT(*)
#
# Run on zoneinfo directory --skip-write-binlog
#
-set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
-prepare set_wsrep_write_binlog from @prep1;
-set @toggle=0; execute set_wsrep_write_binlog using @toggle;
+set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION WSREP_ON=OFF', 'do 0');
+SET SESSION SQL_LOG_BIN=0;
+execute immediate @prep1;
TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
@@ -250,9 +250,9 @@ TRUNCATE TABLE time_zone_leap_second;
#
# Testing with explicit timezonefile --skip-write-binlog
#
-set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
-prepare set_wsrep_write_binlog from @prep1;
-set @toggle=0; execute set_wsrep_write_binlog using @toggle;
+set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION WSREP_ON=OFF', 'do 0');
+SET SESSION SQL_LOG_BIN=0;
+execute immediate @prep1;
SELECT 'skip truncate tables';
LOCK TABLES time_zone WRITE,
time_zone_leap_second WRITE,
@@ -353,9 +353,9 @@ TRUNCATE TABLE time_zone_leap_second;
#
# Testing --skip-write-binlog --leap
#
-set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
-prepare set_wsrep_write_binlog from @prep1;
-set @toggle=0; execute set_wsrep_write_binlog using @toggle;
+set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION WSREP_ON=OFF', 'do 0');
+SET SESSION SQL_LOG_BIN=0;
+execute immediate @prep1;
SELECT 'skip truncate tables';
LOCK TABLES time_zone WRITE,
time_zone_leap_second WRITE,
@@ -384,6 +384,45 @@ SELECT COUNT(*) FROM time_zone_leap_second;
COUNT(*)
0
#
+# MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases
+#
+#
+# Testing --skip-write-binlog
+#
+set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION WSREP_ON=OFF', 'do 0');
+SET SESSION SQL_LOG_BIN=0;
+execute immediate @prep1;
+SELECT 'skip truncate tables';
+LOCK TABLES time_zone WRITE,
+ time_zone_leap_second WRITE,
+ time_zone_name WRITE,
+ time_zone_transition WRITE,
+ time_zone_transition_type WRITE;
+INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
+SET @time_zone_id= LAST_INSERT_ID();
+INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('XXX', @time_zone_id);
+INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
+ (@time_zone_id, 0, 0, 0, 'GMT')
+;
+UNLOCK TABLES;
+COMMIT;
+set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION WSREP_ON=OFF', 'do 0');
+SET SESSION SQL_LOG_BIN=0;
+execute immediate @prep1;
+SELECT 'skip truncate tables';
+LOCK TABLES time_zone WRITE,
+ time_zone_leap_second WRITE,
+ time_zone_name WRITE,
+ time_zone_transition WRITE,
+ time_zone_transition_type WRITE;
+TRUNCATE TABLE time_zone_leap_second;
+ALTER TABLE time_zone_leap_second ORDER BY Transition_time;
+UNLOCK TABLES;
+COMMIT;
+#
+# End of 10.2 tests
+#
+#
# MDEV-6236 - [PATCH] mysql_tzinfo_to_sql may produce invalid SQL
#
\d |
diff --git a/mysql-test/main/mysql_tzinfo_to_sql_symlink.test b/mysql-test/main/mysql_tzinfo_to_sql_symlink.test
index fe7275294d5..8970bf88341 100644
--- a/mysql-test/main/mysql_tzinfo_to_sql_symlink.test
+++ b/mysql-test/main/mysql_tzinfo_to_sql_symlink.test
@@ -130,7 +130,23 @@ SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second;
-#
+--echo #
+--echo # MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases
+--echo #
+
+--echo #
+--echo # Testing --skip-write-binlog
+--echo #
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo/GMT XXX 2>&1
+
+--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog --leap $MYSQLTEST_VARDIR/zoneinfo/GMT 2>&1
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
+
#
# Cleanup
#
diff --git a/mysql-test/main/mysqldump-compat-102.result b/mysql-test/main/mysqldump-compat-102.result
index aa8fe5a4de3..86a2ebc47e0 100644
--- a/mysql-test/main/mysqldump-compat-102.result
+++ b/mysql-test/main/mysqldump-compat-102.result
@@ -77,6 +77,8 @@ $$
--
-- Dumping routines for database 'db1_mdev17429'
--
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER,SIMULTANEOUS_ASSIGNMENT' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `p1` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -84,8 +86,6 @@ $$
/*!50003 SET character_set_client = latin1 */ ;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER,SIMULTANEOUS_ASSIGNMENT' */ ;
DELIMITER ;;
CREATE DEFINER="root"@"localhost" PROCEDURE "p1"(a INT)
AS BEGIN
diff --git a/mysql-test/main/mysqldump-nl.result b/mysql-test/main/mysqldump-nl.result
index d2d0e09546b..89fb3144867 100644
--- a/mysql-test/main/mysqldump-nl.result
+++ b/mysql-test/main/mysqldump-nl.result
@@ -64,14 +64,14 @@ SET character_set_client = @saved_cs_client;
-- Dumping routines for database 'mysqltest1
-- 1tsetlqsym'
--
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = latin1 */ ;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp`()
select * from `v1
diff --git a/mysql-test/main/mysqldump.result b/mysql-test/main/mysqldump.result
index 81a8d0b8162..33fb00a2876 100644
--- a/mysql-test/main/mysqldump.result
+++ b/mysql-test/main/mysqldump.result
@@ -2779,6 +2779,8 @@ LOCK TABLES `t1` WRITE;
INSERT INTO `t1` VALUES (1),(2),(3),(4),(5);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP FUNCTION IF EXISTS `bug9056_func1` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -2786,8 +2788,6 @@ UNLOCK TABLES;
/*!50003 SET character_set_client = latin1 */ ;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `bug9056_func1`(a INT, b INT) RETURNS int(11)
RETURN a+b ;;
@@ -2796,6 +2796,8 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP FUNCTION IF EXISTS `bug9056_func2` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -2803,8 +2805,6 @@ DELIMITER ;
/*!50003 SET character_set_client = latin1 */ ;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `bug9056_func2`(f1 char binary) RETURNS char(1) CHARSET latin1
begin
@@ -2816,6 +2816,8 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `a'b` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -2823,8 +2825,6 @@ DELIMITER ;
/*!50003 SET character_set_client = latin1 */ ;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI' */ ;
DELIMITER ;;
CREATE DEFINER="root"@"localhost" PROCEDURE "a'b"()
select 1 ;;
@@ -2833,6 +2833,8 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `bug9056_proc1` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -2840,8 +2842,6 @@ DELIMITER ;
/*!50003 SET character_set_client = latin1 */ ;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `bug9056_proc1`(IN a INT, IN b INT, OUT c INT)
BEGIN SELECT a+b INTO c; end ;;
@@ -2850,6 +2850,8 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `bug9056_proc2` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -2857,8 +2859,6 @@ DELIMITER ;
/*!50003 SET character_set_client = latin1 */ ;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `bug9056_proc2`(OUT a INT)
BEGIN
@@ -3854,14 +3854,14 @@ create procedure mysqldump_test_db.sp1() select 'hello';
-- insufficient privileges to SHOW CREATE PROCEDURE `sp1`
-- does user2 have permissions on mysql.proc?
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = latin1 */ ;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`user1`@`%` PROCEDURE `sp1`()
select 'hello' ;;
@@ -5429,6 +5429,8 @@ CREATE DATABASE `a\"'``b`;
USE `a\"'``b`;
CREATE PROCEDURE p1() BEGIN END;
ALTER DATABASE `a\"'``b` COLLATE utf8_general_ci;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = '' */ ;
ALTER DATABASE `a\"'``b` CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -5436,8 +5438,6 @@ ALTER DATABASE `a\"'``b` CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
BEGIN END ;;
@@ -5740,34 +5740,6 @@ DROP TABLE t1;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-DROP TABLE IF EXISTS `innodb_index_stats`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `innodb_index_stats` (
- `database_name` varchar(64) COLLATE utf8_bin NOT NULL,
- `table_name` varchar(199) COLLATE utf8_bin NOT NULL,
- `index_name` varchar(64) COLLATE utf8_bin NOT NULL,
- `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
- `stat_name` varchar(64) COLLATE utf8_bin NOT NULL,
- `stat_value` bigint(20) unsigned NOT NULL,
- `sample_size` bigint(20) unsigned DEFAULT NULL,
- `stat_description` varchar(1024) COLLATE utf8_bin NOT NULL,
- PRIMARY KEY (`database_name`,`table_name`,`index_name`,`stat_name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0;
-/*!40101 SET character_set_client = @saved_cs_client */;
-DROP TABLE IF EXISTS `innodb_table_stats`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `innodb_table_stats` (
- `database_name` varchar(64) COLLATE utf8_bin NOT NULL,
- `table_name` varchar(199) COLLATE utf8_bin NOT NULL,
- `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
- `n_rows` bigint(20) unsigned NOT NULL,
- `clustered_index_size` bigint(20) unsigned NOT NULL,
- `sum_of_other_index_sizes` bigint(20) unsigned NOT NULL,
- PRIMARY KEY (`database_name`,`table_name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0;
-/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE IF NOT EXISTS `general_log` (
@@ -5797,6 +5769,34 @@ CREATE TABLE IF NOT EXISTS `slow_log` (
`rows_affected` int(11) NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log';
/*!40101 SET character_set_client = @saved_cs_client */;
+DROP TABLE IF EXISTS `innodb_index_stats`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `innodb_index_stats` (
+ `database_name` varchar(64) COLLATE utf8_bin NOT NULL,
+ `table_name` varchar(199) COLLATE utf8_bin NOT NULL,
+ `index_name` varchar(64) COLLATE utf8_bin NOT NULL,
+ `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `stat_name` varchar(64) COLLATE utf8_bin NOT NULL,
+ `stat_value` bigint(20) unsigned NOT NULL,
+ `sample_size` bigint(20) unsigned DEFAULT NULL,
+ `stat_description` varchar(1024) COLLATE utf8_bin NOT NULL,
+ PRIMARY KEY (`database_name`,`table_name`,`index_name`,`stat_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0;
+/*!40101 SET character_set_client = @saved_cs_client */;
+DROP TABLE IF EXISTS `innodb_table_stats`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `innodb_table_stats` (
+ `database_name` varchar(64) COLLATE utf8_bin NOT NULL,
+ `table_name` varchar(199) COLLATE utf8_bin NOT NULL,
+ `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `n_rows` bigint(20) unsigned NOT NULL,
+ `clustered_index_size` bigint(20) unsigned NOT NULL,
+ `sum_of_other_index_sizes` bigint(20) unsigned NOT NULL,
+ PRIMARY KEY (`database_name`,`table_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0;
+/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE IF NOT EXISTS `transaction_registry` (
@@ -5835,6 +5835,35 @@ CREATE TABLE IF NOT EXISTS `transaction_registry` (
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE IF NOT EXISTS `general_log` (
+ `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
+ `user_host` mediumtext NOT NULL,
+ `thread_id` bigint(21) unsigned NOT NULL,
+ `server_id` int(10) unsigned NOT NULL,
+ `command_type` varchar(64) NOT NULL,
+ `argument` mediumtext NOT NULL
+) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log';
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE IF NOT EXISTS `slow_log` (
+ `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
+ `user_host` mediumtext NOT NULL,
+ `query_time` time(6) NOT NULL,
+ `lock_time` time(6) NOT NULL,
+ `rows_sent` int(11) NOT NULL,
+ `rows_examined` int(11) NOT NULL,
+ `db` varchar(512) NOT NULL,
+ `last_insert_id` int(11) NOT NULL,
+ `insert_id` int(11) NOT NULL,
+ `server_id` int(10) unsigned NOT NULL,
+ `sql_text` mediumtext NOT NULL,
+ `thread_id` bigint(21) unsigned NOT NULL,
+ `rows_affected` int(11) NOT NULL
+) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log';
+/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `innodb_index_stats`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
@@ -5875,35 +5904,6 @@ LOCK TABLES `innodb_table_stats` WRITE;
UNLOCK TABLES;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE IF NOT EXISTS `general_log` (
- `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
- `user_host` mediumtext NOT NULL,
- `thread_id` bigint(21) unsigned NOT NULL,
- `server_id` int(10) unsigned NOT NULL,
- `command_type` varchar(64) NOT NULL,
- `argument` mediumtext NOT NULL
-) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log';
-/*!40101 SET character_set_client = @saved_cs_client */;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE IF NOT EXISTS `slow_log` (
- `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
- `user_host` mediumtext NOT NULL,
- `query_time` time(6) NOT NULL,
- `lock_time` time(6) NOT NULL,
- `rows_sent` int(11) NOT NULL,
- `rows_examined` int(11) NOT NULL,
- `db` varchar(512) NOT NULL,
- `last_insert_id` int(11) NOT NULL,
- `insert_id` int(11) NOT NULL,
- `server_id` int(10) unsigned NOT NULL,
- `sql_text` mediumtext NOT NULL,
- `thread_id` bigint(21) unsigned NOT NULL,
- `rows_affected` int(11) NOT NULL
-) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log';
-/*!40101 SET character_set_client = @saved_cs_client */;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
CREATE TABLE IF NOT EXISTS `transaction_registry` (
`transaction_id` bigint(20) unsigned NOT NULL,
`commit_id` bigint(20) unsigned NOT NULL,
@@ -5940,6 +5940,35 @@ CREATE TABLE IF NOT EXISTS `transaction_registry` (
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE IF NOT EXISTS `general_log` (
+ `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
+ `user_host` mediumtext NOT NULL,
+ `thread_id` bigint(21) unsigned NOT NULL,
+ `server_id` int(10) unsigned NOT NULL,
+ `command_type` varchar(64) NOT NULL,
+ `argument` mediumtext NOT NULL
+) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log';
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE IF NOT EXISTS `slow_log` (
+ `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
+ `user_host` mediumtext NOT NULL,
+ `query_time` time(6) NOT NULL,
+ `lock_time` time(6) NOT NULL,
+ `rows_sent` int(11) NOT NULL,
+ `rows_examined` int(11) NOT NULL,
+ `db` varchar(512) NOT NULL,
+ `last_insert_id` int(11) NOT NULL,
+ `insert_id` int(11) NOT NULL,
+ `server_id` int(10) unsigned NOT NULL,
+ `sql_text` mediumtext NOT NULL,
+ `thread_id` bigint(21) unsigned NOT NULL,
+ `rows_affected` int(11) NOT NULL
+) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log';
+/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `innodb_index_stats`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
@@ -5980,35 +6009,6 @@ LOCK TABLES `innodb_table_stats` WRITE;
UNLOCK TABLES;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE IF NOT EXISTS `general_log` (
- `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
- `user_host` mediumtext NOT NULL,
- `thread_id` bigint(21) unsigned NOT NULL,
- `server_id` int(10) unsigned NOT NULL,
- `command_type` varchar(64) NOT NULL,
- `argument` mediumtext NOT NULL
-) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log';
-/*!40101 SET character_set_client = @saved_cs_client */;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE IF NOT EXISTS `slow_log` (
- `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
- `user_host` mediumtext NOT NULL,
- `query_time` time(6) NOT NULL,
- `lock_time` time(6) NOT NULL,
- `rows_sent` int(11) NOT NULL,
- `rows_examined` int(11) NOT NULL,
- `db` varchar(512) NOT NULL,
- `last_insert_id` int(11) NOT NULL,
- `insert_id` int(11) NOT NULL,
- `server_id` int(10) unsigned NOT NULL,
- `sql_text` mediumtext NOT NULL,
- `thread_id` bigint(21) unsigned NOT NULL,
- `rows_affected` int(11) NOT NULL
-) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log';
-/*!40101 SET character_set_client = @saved_cs_client */;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
CREATE TABLE IF NOT EXISTS `transaction_registry` (
`transaction_id` bigint(20) unsigned NOT NULL,
`commit_id` bigint(20) unsigned NOT NULL,
@@ -6330,4 +6330,119 @@ SETVAL(`seq_t_i`, 1, 0)
1
DROP DATABASE IF EXISTS test1;
DROP DATABASE IF EXISTS test2;
+#
+# MDEV-27186 Server fails to load a dump, taken on the same version
+# Oracle mode with packages
+#
+CREATE DATABASE test1;
+CREATE DATABASE test2;
+USE test1;
+SET @save_sql_mode=@@sql_mode;
+SET sql_mode=ORACLE;
+CREATE OR REPLACE PACKAGE pkg AS
+END;
+$$
+# Dump database 1
+# Restore from database 1 to database 2
+use test2;
+SHOW CREATE PACKAGE pkg;
+Package sql_mode Create Package character_set_client collation_connection Database Collation
+pkg PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER,SIMULTANEOUS_ASSIGNMENT CREATE DEFINER="root"@"localhost" PACKAGE "pkg" AS
+END utf8 utf8_general_ci latin1_swedish_ci
+DROP DATABASE test1;
+DROP DATABASE test2;
+SET sql_mode=@save_sql_mode;
+#
+# MDEV-4875 Can't restore a mysqldump if --add-drop-database meets general_log
+#
+CREATE DATABASE test1;
+# Dump mysql database
+DROP VIEW IF EXISTS mysql.user;
+DROP TABLE IF EXISTS mysql.global_priv;
+DROP TABLE IF EXISTS mysql.user;
+DROP TABLE IF EXISTS mysql.time_zone_transition_type;
+DROP TABLE IF EXISTS mysql.time_zone_transition;
+DROP TABLE IF EXISTS mysql.time_zone_name;
+DROP TABLE IF EXISTS mysql.time_zone_leap_second;
+DROP TABLE IF EXISTS mysql.time_zone;
+DROP TABLE IF EXISTS mysql.tables_priv;
+DROP TABLE IF EXISTS mysql.table_stats;
+DROP TABLE IF EXISTS mysql.servers;
+DROP TABLE IF EXISTS mysql.roles_mapping;
+DROP TABLE IF EXISTS mysql.proxies_priv;
+DROP TABLE IF EXISTS mysql.procs_priv;
+DROP TABLE IF EXISTS mysql.proc;
+DROP TABLE IF EXISTS mysql.plugin;
+DROP TABLE IF EXISTS mysql.innodb_table_stats;
+DROP TABLE IF EXISTS mysql.innodb_index_stats;
+DROP TABLE IF EXISTS mysql.index_stats;
+DROP TABLE IF EXISTS mysql.help_topic;
+DROP TABLE IF EXISTS mysql.help_relation;
+DROP TABLE IF EXISTS mysql.help_keyword;
+DROP TABLE IF EXISTS mysql.help_category;
+DROP TABLE IF EXISTS mysql.gtid_slave_pos;
+DROP TABLE IF EXISTS mysql.func;
+DROP TABLE IF EXISTS mysql.event;
+DROP TABLE IF EXISTS mysql.db;
+DROP TABLE IF EXISTS mysql.columns_priv;
+DROP TABLE IF EXISTS mysql.column_stats;
+# Abbreviated contents
+<?xml version="1.0"?>
+<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<database name="mysql">
+ <table_structure name="general_log">
+ <field Field="event_time" Type="timestamp(6)" Null="NO" Key="" Default="current_timestamp(6)" Extra="on update current_timestamp(6)" Comment="" />
+ <field Field="user_host" Type="mediumtext" Null="NO" Key="" Extra="" Comment="" />
+ <field Field="thread_id" Type="bigint(21) unsigned" Null="NO" Key="" Extra="" Comment="" />
+ <field Field="server_id" Type="int(10) unsigned" Null="NO" Key="" Extra="" Comment="" />
+ <field Field="command_type" Type="varchar(64)" Null="NO" Key="" Extra="" Comment="" />
+ <field Field="argument" Type="mediumtext" Null="NO" Key="" Extra="" Comment="" />
+ <options Name="general_log" Engine="CSV" Version="10" Row_format="Dynamic" Rows="2" Avg_row_length="0" Data_length="0" Max_data_length="0" Index_length="0" Data_free="0" Collation="utf8_general_ci" Create_options="" Comment="General log" Max_index_length="0" Temporary="N" />
+ </table_structure>
+ <table_structure name="slow_log">
+ <field Field="start_time" Type="timestamp(6)" Null="NO" Key="" Default="current_timestamp(6)" Extra="on update current_timestamp(6)" Comment="" />
+ <field Field="user_host" Type="mediumtext" Null="NO" Key="" Extra="" Comment="" />
+ <field Field="query_time" Type="time(6)" Null="NO" Key="" Extra="" Comment="" />
+ <field Field="lock_time" Type="time(6)" Null="NO" Key="" Extra="" Comment="" />
+ <field Field="rows_sent" Type="int(11)" Null="NO" Key="" Extra="" Comment="" />
+ <field Field="rows_examined" Type="int(11)" Null="NO" Key="" Extra="" Comment="" />
+ <field Field="db" Type="varchar(512)" Null="NO" Key="" Extra="" Comment="" />
+ <field Field="last_insert_id" Type="int(11)" Null="NO" Key="" Extra="" Comment="" />
+ <field Field="insert_id" Type="int(11)" Null="NO" Key="" Extra="" Comment="" />
+ <field Field="server_id" Type="int(10) unsigned" Null="NO" Key="" Extra="" Comment="" />
+ <field Field="sql_text" Type="mediumtext" Null="NO" Key="" Extra="" Comment="" />
+ <field Field="thread_id" Type="bigint(21) unsigned" Null="NO" Key="" Extra="" Comment="" />
+ <field Field="rows_affected" Type="int(11)" Null="NO" Key="" Extra="" Comment="" />
+ <options Name="slow_log" Engine="CSV" Version="10" Row_format="Dynamic" Rows="2" Avg_row_length="0" Data_length="0" Max_data_length="0" Index_length="0" Data_free="0" Collation="utf8_general_ci" Create_options="" Comment="Slow log" Max_index_length="0" Temporary="N" />
+ </table_structure>
+
+/*!50106 SET GLOBAL LOG_OUTPUT=@save_log_output*/;
+
+ <table_structure name="transaction_registry">
+ <field Field="transaction_id" Type="bigint(20) unsigned" Null="NO" Key="PRI" Extra="" Comment="" />
+ <field Field="commit_id" Type="bigint(20) unsigned" Null="NO" Key="UNI" Extra="" Comment="" />
+ <field Field="begin_timestamp" Type="timestamp(6)" Null="NO" Key="MUL" Default="'0000-00-00 00:00:00.000000'" Extra="" Comment="" />
+ <field Field="commit_timestamp" Type="timestamp(6)" Null="NO" Key="MUL" Default="'0000-00-00 00:00:00.000000'" Extra="" Comment="" />
+ <field Field="isolation_level" Type="enum('READ-UNCOMMITTED','READ-COMMITTED','REPEATABLE-READ','SERIALIZABLE')" Null="NO" Key="" Extra="" Comment="" />
+ <key Table="transaction_registry" Non_unique="0" Key_name="PRIMARY" Seq_in_index="1" Column_name="transaction_id" Collation="A" Cardinality="0" Null="" Index_type="BTREE" Comment="" Index_comment="" />
+ <key Table="transaction_registry" Non_unique="0" Key_name="commit_id" Seq_in_index="1" Column_name="commit_id" Collation="A" Cardinality="0" Null="" Index_type="BTREE" Comment="" Index_comment="" />
+ <key Table="transaction_registry" Non_unique="1" Key_name="begin_timestamp" Seq_in_index="1" Column_name="begin_timestamp" Collation="A" Cardinality="0" Null="" Index_type="BTREE" Comment="" Index_comment="" />
+ <key Table="transaction_registry" Non_unique="1" Key_name="commit_timestamp" Seq_in_index="1" Column_name="commit_timestamp" Collation="A" Cardinality="0" Null="" Index_type="BTREE" Comment="" Index_comment="" />
+ <key Table="transaction_registry" Non_unique="1" Key_name="commit_timestamp" Seq_in_index="2" Column_name="transaction_id" Collation="A" Cardinality="0" Null="" Index_type="BTREE" Comment="" Index_comment="" />
+ <options Name="transaction_registry" Engine="InnoDB" Version="10" Row_format="Dynamic" Rows="0" Avg_row_length="0" Data_length="16384" Max_data_length="0" Index_length="49152" Data_free="0" Create_time="TIMESTAMP" Collation="utf8_bin" Create_options="stats_persistent=0" Comment="" Max_index_length="0" Temporary="N" />
+ </table_structure>
+</database>
+<database name="test1">
+</database>
+</mysqldump>
+SET @save_general_log=@@GENERAL_LOG;
+SET GLOBAL LOG_OUTPUT='TABLE', GLOBAL GENERAL_LOG=1;
+# Restore mysql database while general log is active
+# No failure at this stage is the object of the test
+SELECT @@GLOBAL.LOG_OUTPUT, @@GLOBAL.GENERAL_LOG;
+@@GLOBAL.LOG_OUTPUT @@GLOBAL.GENERAL_LOG
+TABLE 1
+SET GLOBAL LOG_OUTPUT=DEFAULT, GLOBAL GENERAL_LOG=@save_general_log;
+TRUNCATE TABLE mysql.general_log;
+DROP DATABASE test1;
# End of 10.3 tests
diff --git a/mysql-test/main/mysqldump.test b/mysql-test/main/mysqldump.test
index 799f24665ee..135787973bd 100644
--- a/mysql-test/main/mysqldump.test
+++ b/mysql-test/main/mysqldump.test
@@ -2885,4 +2885,94 @@ INSERT INTO t VALUES (1,1),(2,2),(3,3),(4,4);
DROP DATABASE IF EXISTS test1;
DROP DATABASE IF EXISTS test2;
+--echo #
+--echo # MDEV-27186 Server fails to load a dump, taken on the same version
+--echo # Oracle mode with packages
+--echo #
+
+CREATE DATABASE test1;
+CREATE DATABASE test2;
+USE test1;
+SET @save_sql_mode=@@sql_mode;
+SET sql_mode=ORACLE;
+
+DELIMITER $$;
+CREATE OR REPLACE PACKAGE pkg AS
+END;
+$$
+
+DELIMITER ;$$
+
+--echo # Dump database 1
+--exec $MYSQL_DUMP --routines test1 > $MYSQLTEST_VARDIR/tmp/dumptest1.sql
+--echo # Restore from database 1 to database 2
+
+--exec $MYSQL test2 < $MYSQLTEST_VARDIR/tmp/dumptest1.sql
+use test2;
+SHOW CREATE PACKAGE pkg;
+
+DROP DATABASE test1;
+DROP DATABASE test2;
+SET sql_mode=@save_sql_mode;
+--remove_file $MYSQLTEST_VARDIR/tmp/dumptest1.sql
+
+--echo #
+--echo # MDEV-4875 Can't restore a mysqldump if --add-drop-database meets general_log
+--echo #
+
+CREATE DATABASE test1;
+--echo # Dump mysql database
+--exec $MYSQL_DUMP --add-drop-database --databases mysql test1 > $MYSQLTEST_VARDIR/tmp/dumptest1.sql
+
+--disable_warnings
+DROP VIEW IF EXISTS mysql.user;
+DROP TABLE IF EXISTS mysql.global_priv;
+DROP TABLE IF EXISTS mysql.user;
+--enable_warnings
+#DROP TABLE IF EXISTS mysql.transaction_registry;
+#DROP TABLE IF EXISTS mysql.slow_log;
+#DROP TABLE IF EXISTS mysql.general_log;
+DROP TABLE IF EXISTS mysql.time_zone_transition_type;
+DROP TABLE IF EXISTS mysql.time_zone_transition;
+DROP TABLE IF EXISTS mysql.time_zone_name;
+DROP TABLE IF EXISTS mysql.time_zone_leap_second;
+DROP TABLE IF EXISTS mysql.time_zone;
+DROP TABLE IF EXISTS mysql.tables_priv;
+DROP TABLE IF EXISTS mysql.table_stats;
+DROP TABLE IF EXISTS mysql.servers;
+DROP TABLE IF EXISTS mysql.roles_mapping;
+DROP TABLE IF EXISTS mysql.proxies_priv;
+DROP TABLE IF EXISTS mysql.procs_priv;
+DROP TABLE IF EXISTS mysql.proc;
+DROP TABLE IF EXISTS mysql.plugin;
+DROP TABLE IF EXISTS mysql.innodb_table_stats;
+DROP TABLE IF EXISTS mysql.innodb_index_stats;
+DROP TABLE IF EXISTS mysql.index_stats;
+DROP TABLE IF EXISTS mysql.help_topic;
+DROP TABLE IF EXISTS mysql.help_relation;
+DROP TABLE IF EXISTS mysql.help_keyword;
+DROP TABLE IF EXISTS mysql.help_category;
+DROP TABLE IF EXISTS mysql.gtid_slave_pos;
+DROP TABLE IF EXISTS mysql.func;
+DROP TABLE IF EXISTS mysql.event;
+DROP TABLE IF EXISTS mysql.db;
+DROP TABLE IF EXISTS mysql.columns_priv;
+DROP TABLE IF EXISTS mysql.column_stats;
+
+--echo # Abbreviated contents
+--replace_regex /Create_time="[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}"/Create_time="TIMESTAMP"/
+--exec $MYSQL_DUMP --xml --skip-comments --no-data --add-drop-database --databases mysql test1
+
+SET @save_general_log=@@GENERAL_LOG;
+SET GLOBAL LOG_OUTPUT='TABLE', GLOBAL GENERAL_LOG=1;
+
+--echo # Restore mysql database while general log is active
+--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/dumptest1.sql
+--echo # No failure at this stage is the object of the test
+SELECT @@GLOBAL.LOG_OUTPUT, @@GLOBAL.GENERAL_LOG;
+SET GLOBAL LOG_OUTPUT=DEFAULT, GLOBAL GENERAL_LOG=@save_general_log;
+TRUNCATE TABLE mysql.general_log;
+DROP DATABASE test1;
+--remove_file $MYSQLTEST_VARDIR/tmp/dumptest1.sql
+
--echo # End of 10.3 tests
diff --git a/mysql-test/main/order_by.result b/mysql-test/main/order_by.result
index 46d7544eb4e..19169282fc7 100644
--- a/mysql-test/main/order_by.result
+++ b/mysql-test/main/order_by.result
@@ -3584,6 +3584,26 @@ DELETE FROM t1 ORDER BY c;
DROP TABLE t1;
SET @@SESSION.max_sort_length=DEFAULT;
SET sql_mode=DEFAULT;
+#
+# MDEV-25994 Crash with union of my_decimal type in ORDER BY clause
+#
+CREATE TABLE t1 (v1 INTEGER) ;
+INSERT INTO t1 (v1) VALUES (8);
+UPDATE t1 SET v1 = 1 ORDER BY (SELECT 1.1 UNION SELECT -1);
+ERROR 21000: Subquery returns more than 1 row
+# This one must be successful
+UPDATE t1 SET v1 = 2 ORDER BY (SELECT 1 UNION SELECT 1);
+UPDATE t1 SET v1 = 3 ORDER BY (SELECT 'a' UNION SELECT 'b');
+ERROR 21000: Subquery returns more than 1 row
+# Insert some more data
+INSERT INTO t1 (v1) VALUES (8),(9),(100),(-234),(46584),(0);
+UPDATE t1 SET v1 = v1+1 ORDER BY (SELECT 100.122 UNION SELECT -189.2);
+ERROR 21000: Subquery returns more than 1 row
+# This one must be successful
+UPDATE t1 SET v1 = v1-200 ORDER BY (SELECT 1 UNION SELECT 1);
+UPDATE t1 SET v1 = v1 ORDER BY (SELECT 'abc' UNION SELECT 'bbb');
+ERROR 21000: Subquery returns more than 1 row
+DROP TABLE t1;
# End of 10.2 tests
#
# MDEV-16214: Incorrect plan taken by the optimizer , uses INDEX instead of ref access with ORDER BY
diff --git a/mysql-test/main/order_by.test b/mysql-test/main/order_by.test
index 191e6d02673..9ba2b49a5a8 100644
--- a/mysql-test/main/order_by.test
+++ b/mysql-test/main/order_by.test
@@ -2332,6 +2332,31 @@ DROP TABLE t1;
SET @@SESSION.max_sort_length=DEFAULT;
SET sql_mode=DEFAULT;
+--echo #
+--echo # MDEV-25994 Crash with union of my_decimal type in ORDER BY clause
+--echo #
+
+CREATE TABLE t1 (v1 INTEGER) ;
+INSERT INTO t1 (v1) VALUES (8);
+--error ER_SUBQUERY_NO_1_ROW
+UPDATE t1 SET v1 = 1 ORDER BY (SELECT 1.1 UNION SELECT -1);
+--echo # This one must be successful
+UPDATE t1 SET v1 = 2 ORDER BY (SELECT 1 UNION SELECT 1);
+--error ER_SUBQUERY_NO_1_ROW
+UPDATE t1 SET v1 = 3 ORDER BY (SELECT 'a' UNION SELECT 'b');
+
+-- echo # Insert some more data
+INSERT INTO t1 (v1) VALUES (8),(9),(100),(-234),(46584),(0);
+--error ER_SUBQUERY_NO_1_ROW
+UPDATE t1 SET v1 = v1+1 ORDER BY (SELECT 100.122 UNION SELECT -189.2);
+--echo # This one must be successful
+UPDATE t1 SET v1 = v1-200 ORDER BY (SELECT 1 UNION SELECT 1);
+--error ER_SUBQUERY_NO_1_ROW
+UPDATE t1 SET v1 = v1 ORDER BY (SELECT 'abc' UNION SELECT 'bbb');
+
+
+DROP TABLE t1;
+
--echo # End of 10.2 tests
diff --git a/mysql-test/main/parser.result b/mysql-test/main/parser.result
index 2044cbc708f..d1af5636b25 100644
--- a/mysql-test/main/parser.result
+++ b/mysql-test/main/parser.result
@@ -1364,6 +1364,48 @@ SELECT tmp 1.e.test FROM scientific_notation AS tmp;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1.e.test FROM scientific_notation AS tmp' at line 1
DROP TABLE scientific_notation;
#
+# MDEV-6899 extra semicolon in show create event syntax
+#
+set timestamp=unix_timestamp('2020-10-10 5:5:5');
+create table t1 (a int);
+create trigger a before insert on t1 for each row set @a:=1;select 2$
+2
+2
+show create trigger a;
+Trigger a
+sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
+SQL Original Statement CREATE DEFINER=`root`@`localhost` trigger a before insert on t1 for each row set @a:=1
+character_set_client latin1
+collation_connection latin1_swedish_ci
+Database Collation latin1_swedish_ci
+Created 2020-10-10 05:05:05.00
+drop table t1;
+create procedure a() select 1;select 2$
+2
+2
+show create procedure a;
+Procedure a
+sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
+Create Procedure CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
+select 1
+character_set_client latin1
+collation_connection latin1_swedish_ci
+Database Collation latin1_swedish_ci
+drop procedure a;
+create function a() returns int return 1;select 2$
+2
+2
+show create function a;
+Function a
+sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
+Create Function CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
+return 1
+character_set_client latin1
+collation_connection latin1_swedish_ci
+Database Collation latin1_swedish_ci
+drop function a;
+set timestamp=default;
+#
# End of 10.2 tests
#
#
diff --git a/mysql-test/main/parser.test b/mysql-test/main/parser.test
index d6521b6758b..5ffd379cefd 100644
--- a/mysql-test/main/parser.test
+++ b/mysql-test/main/parser.test
@@ -1403,6 +1403,30 @@ SELECT tmp 1.e.test FROM scientific_notation AS tmp;
DROP TABLE scientific_notation;
--echo #
+--echo # MDEV-6899 extra semicolon in show create event syntax
+--echo #
+set timestamp=unix_timestamp('2020-10-10 5:5:5');
+create table t1 (a int);
+delimiter $;
+create trigger a before insert on t1 for each row set @a:=1;select 2$
+delimiter ;$
+query_vertical show create trigger a;
+drop table t1;
+
+delimiter $;
+create procedure a() select 1;select 2$
+delimiter ;$
+query_vertical show create procedure a;
+drop procedure a;
+
+delimiter $;
+create function a() returns int return 1;select 2$
+delimiter ;$
+query_vertical show create function a;
+drop function a;
+set timestamp=default;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/parser_not_embedded.result b/mysql-test/main/parser_not_embedded.result
index 25349e51577..2147e25b3b1 100644
--- a/mysql-test/main/parser_not_embedded.result
+++ b/mysql-test/main/parser_not_embedded.result
@@ -102,3 +102,23 @@ ROLLBACK AND NO CHAIN NO RELEASE;
#
# End of 5.5 tests
#
+#
+# MDEV-6899 extra semicolon in show create event syntax
+#
+set timestamp=unix_timestamp('2020-10-10 5:5:5');
+create event a on schedule every 1 day do set @a:=1;select 2$
+2
+2
+show create event a;
+Event a
+sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
+time_zone SYSTEM
+Create Event CREATE DEFINER=`root`@`localhost` EVENT `a` ON SCHEDULE EVERY 1 DAY STARTS '2020-10-10 05:05:05' ON COMPLETION NOT PRESERVE ENABLE DO set @a:=1
+character_set_client latin1
+collation_connection latin1_swedish_ci
+Database Collation latin1_swedish_ci
+drop event a;
+set timestamp=default;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/main/parser_not_embedded.test b/mysql-test/main/parser_not_embedded.test
index 3af1260f4ad..270573ece93 100644
--- a/mysql-test/main/parser_not_embedded.test
+++ b/mysql-test/main/parser_not_embedded.test
@@ -99,3 +99,18 @@ ROLLBACK AND NO CHAIN NO RELEASE;
--echo #
--echo # End of 5.5 tests
--echo #
+
+--echo #
+--echo # MDEV-6899 extra semicolon in show create event syntax
+--echo #
+set timestamp=unix_timestamp('2020-10-10 5:5:5');
+delimiter $;
+create event a on schedule every 1 day do set @a:=1;select 2$
+delimiter ;$
+query_vertical show create event a;
+drop event a;
+set timestamp=default;
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/main/plugin.result b/mysql-test/main/plugin.result
index 6cc6afd38ff..032bf489f3d 100644
--- a/mysql-test/main/plugin.result
+++ b/mysql-test/main/plugin.result
@@ -357,6 +357,15 @@ select * from mysql.plugin WHERE name='unexisting_plugin';
name dl
UNINSTALL PLUGIN unexisting_plugin;
ERROR 42000: PLUGIN unexisting_plugin does not exist
+#
+# MDEV-26323 use-after-poison issue of MariaDB server
+#
+INSTALL PLUGIN DEALLOCATE SONAME '';
+ERROR HY000: Can't open shared library '.so'
+INSTALL PLUGIN DEALLOCATE SONAME 'x';
+ERROR HY000: Can't open shared library 'x.so'
+INSTALL PLUGIN DEALLOCATE SONAME 'xx';
+ERROR HY000: Can't open shared library 'xx.so'
# End of 10.2 tests
#
# MDEV-16294: INSTALL PLUGIN IF NOT EXISTS / UNINSTALL PLUGIN IF EXISTS
diff --git a/mysql-test/main/plugin.test b/mysql-test/main/plugin.test
index 60773c3e190..967364a3e03 100644
--- a/mysql-test/main/plugin.test
+++ b/mysql-test/main/plugin.test
@@ -296,6 +296,23 @@ select * from mysql.plugin WHERE name='unexisting_plugin';
--error ER_SP_DOES_NOT_EXIST
UNINSTALL PLUGIN unexisting_plugin;
+--echo #
+--echo # MDEV-26323 use-after-poison issue of MariaDB server
+--echo #
+
+--replace_regex /library '.*[\\/].(dll|so)' [(].*[)]/library '.so'/
+--error ER_CANT_OPEN_LIBRARY
+INSTALL PLUGIN DEALLOCATE SONAME '';
+
+--replace_regex /library '.*[\\/]x.(dll|so)' [(].*[)]/library 'x.so'/
+--error ER_CANT_OPEN_LIBRARY
+INSTALL PLUGIN DEALLOCATE SONAME 'x';
+
+--replace_regex /library '.*[\\/]xx.(dll|so)' [(].*[)]/library 'xx.so'/
+--error ER_CANT_OPEN_LIBRARY
+INSTALL PLUGIN DEALLOCATE SONAME 'xx';
+
+
--echo # End of 10.2 tests
--source include/install_plugin_if_exists.inc
diff --git a/mysql-test/main/repair_symlink-5543.result b/mysql-test/main/repair_symlink-5543.result
index 2024c9f5684..4f816d407b9 100644
--- a/mysql-test/main/repair_symlink-5543.result
+++ b/mysql-test/main/repair_symlink-5543.result
@@ -1,6 +1,6 @@
create table t1 (a int) engine=myisam data directory='MYSQL_TMP_DIR';
insert t1 values (1);
-# Some systems fail with errcode 40, or 90 (MIPS) when doing openat,
+# Some systems fail with errcode 31 (FreeBSD), 40, or 90 (MIPS) when doing openat,
# while others don't have openat and fail with errcode 20.
repair table t1;
Table Op Msg_type Msg_text
diff --git a/mysql-test/main/repair_symlink-5543.test b/mysql-test/main/repair_symlink-5543.test
index ac7bb497f24..747e3f6ca1c 100644
--- a/mysql-test/main/repair_symlink-5543.test
+++ b/mysql-test/main/repair_symlink-5543.test
@@ -9,9 +9,9 @@
eval create table t1 (a int) engine=myisam data directory='$MYSQL_TMP_DIR';
insert t1 values (1);
--system ln -s $MYSQL_TMP_DIR/foobar5543 $MYSQL_TMP_DIR/t1.TMD
---echo # Some systems fail with errcode 40, or 90 (MIPS) when doing openat,
+--echo # Some systems fail with errcode 31 (FreeBSD), 40, or 90 (MIPS) when doing openat,
--echo # while others don't have openat and fail with errcode 20.
---replace_regex / '.*\/t1/ 'MYSQL_TMP_DIR\/t1/ /[49]0/20/ /".*"/"<errmsg>"/
+--replace_regex / '.*\/t1/ 'MYSQL_TMP_DIR\/t1/ /[49]0|31/20/ /".*"/"<errmsg>"/
repair table t1;
drop table t1;
@@ -19,7 +19,7 @@ drop table t1;
eval create table t2 (a int) engine=aria data directory='$MYSQL_TMP_DIR';
insert t2 values (1);
--system ln -s $MYSQL_TMP_DIR/foobar5543 $MYSQL_TMP_DIR/t2.TMD
---replace_regex / '.*\/t2/ 'MYSQL_TMP_DIR\/t2/ /[49]0/20/ /".*"/"<errmsg>"/
+--replace_regex / '.*\/t2/ 'MYSQL_TMP_DIR\/t2/ /[49]0|31/20/ /".*"/"<errmsg>"/
repair table t2;
drop table t2;
diff --git a/mysql-test/main/row-checksum-old.result b/mysql-test/main/row-checksum-old.result
index d374013f61c..7caed4fc7dc 100644
--- a/mysql-test/main/row-checksum-old.result
+++ b/mysql-test/main/row-checksum-old.result
@@ -1,4 +1,3 @@
-drop table if exists t1;
create table t1 (a int null, v varchar(100)) engine=myisam checksum=0;
insert into t1 values(null, null), (1, "hello");
checksum table t1;
@@ -98,4 +97,48 @@ CHECKSUM TABLE t1 EXTENDED;
Table Checksum
test.t1 2326430205
drop table t1;
+#
# End of 5.5 tests
+#
+#
+# MDEV-28020 CHECKSUM TABLE calculates different checksums
+#
+create table t1 ( a int, b int as (a) virtual, c text) engine=myisam checksum=1;
+insert ignore t1 values (1,2,'foo'),(2,3,'bar');
+Warnings:
+Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored
+Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored
+checksum table t1 extended;
+Table Checksum
+test.t1 4101438232
+checksum table t1;
+Table Checksum
+test.t1 4101438232
+drop table t1;
+create table t1 ( a int, b int as (a) virtual, c text, key(b)) engine=myisam checksum=1;
+insert ignore t1 values (1,2,'foo'),(2,3,'bar');
+Warnings:
+Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored
+Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored
+checksum table t1 extended;
+Table Checksum
+test.t1 4101438232
+checksum table t1;
+Table Checksum
+test.t1 4101438232
+drop table t1;
+create table t1 ( a int, b int as (a) stored, c text) engine=myisam checksum=1;
+insert ignore t1 values (1,2,'foo'),(2,3,'bar');
+Warnings:
+Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored
+Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored
+checksum table t1 extended;
+Table Checksum
+test.t1 2897795735
+checksum table t1;
+Table Checksum
+test.t1 2897795735
+drop table t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/main/row-checksum.result b/mysql-test/main/row-checksum.result
index 4625e09c060..c80ca4eed9a 100644
--- a/mysql-test/main/row-checksum.result
+++ b/mysql-test/main/row-checksum.result
@@ -1,4 +1,3 @@
-drop table if exists t1;
create table t1 (a int null, v varchar(100)) engine=myisam checksum=0;
insert into t1 values(null, null), (1, "hello");
checksum table t1;
@@ -98,4 +97,48 @@ CHECKSUM TABLE t1 EXTENDED;
Table Checksum
test.t1 2326430205
drop table t1;
+#
# End of 5.5 tests
+#
+#
+# MDEV-28020 CHECKSUM TABLE calculates different checksums
+#
+create table t1 ( a int, b int as (a) virtual, c text) engine=myisam checksum=1;
+insert ignore t1 values (1,2,'foo'),(2,3,'bar');
+Warnings:
+Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored
+Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored
+checksum table t1 extended;
+Table Checksum
+test.t1 4101438232
+checksum table t1;
+Table Checksum
+test.t1 4101438232
+drop table t1;
+create table t1 ( a int, b int as (a) virtual, c text, key(b)) engine=myisam checksum=1;
+insert ignore t1 values (1,2,'foo'),(2,3,'bar');
+Warnings:
+Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored
+Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored
+checksum table t1 extended;
+Table Checksum
+test.t1 4101438232
+checksum table t1;
+Table Checksum
+test.t1 4101438232
+drop table t1;
+create table t1 ( a int, b int as (a) stored, c text) engine=myisam checksum=1;
+insert ignore t1 values (1,2,'foo'),(2,3,'bar');
+Warnings:
+Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored
+Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored
+checksum table t1 extended;
+Table Checksum
+test.t1 2897795735
+checksum table t1;
+Table Checksum
+test.t1 2897795735
+drop table t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/main/row-checksum.test b/mysql-test/main/row-checksum.test
index 5acfda45f75..3b510abba84 100644
--- a/mysql-test/main/row-checksum.test
+++ b/mysql-test/main/row-checksum.test
@@ -2,12 +2,8 @@
# Test checksum
#
--- source include/have_innodb.inc
--- source include/have_maria.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
+--source include/have_innodb.inc
+--source include/have_maria.inc
create table t1 (a int null, v varchar(100)) engine=myisam checksum=0;
insert into t1 values(null, null), (1, "hello");
@@ -76,4 +72,31 @@ CHECKSUM TABLE t1 EXTENDED;
drop table t1;
+--echo #
--echo # End of 5.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-28020 CHECKSUM TABLE calculates different checksums
+--echo #
+create table t1 ( a int, b int as (a) virtual, c text) engine=myisam checksum=1;
+insert ignore t1 values (1,2,'foo'),(2,3,'bar');
+checksum table t1 extended;
+checksum table t1;
+drop table t1;
+
+create table t1 ( a int, b int as (a) virtual, c text, key(b)) engine=myisam checksum=1;
+insert ignore t1 values (1,2,'foo'),(2,3,'bar');
+checksum table t1 extended;
+checksum table t1;
+drop table t1;
+
+create table t1 ( a int, b int as (a) stored, c text) engine=myisam checksum=1;
+insert ignore t1 values (1,2,'foo'),(2,3,'bar');
+checksum table t1 extended;
+checksum table t1;
+drop table t1;
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/main/subselect.result b/mysql-test/main/subselect.result
index 15ebaa33474..035fdf864b3 100644
--- a/mysql-test/main/subselect.result
+++ b/mysql-test/main/subselect.result
@@ -1261,7 +1261,7 @@ a
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(3) NOT NULL
+ `a` int(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int);
diff --git a/mysql-test/main/subselect4.result b/mysql-test/main/subselect4.result
index 600a546e87a..aa486fc0903 100644
--- a/mysql-test/main/subselect4.result
+++ b/mysql-test/main/subselect4.result
@@ -2905,6 +2905,81 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY tn eq_ref PRIMARY PRIMARY 32 test.tms.key1 1 Using where
set optimizer_switch=@tmp_os;
drop table t1, t10, t11;
+#
+# MDEV-28268: Server crashes in Expression_cache_tracker::fetch_current_stats
+#
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES (1,2),(3,4);
+ANALYZE FORMAT=JSON
+SELECT DISTINCT
+(SELECT MIN(a) FROM t1 WHERE b <= ANY (SELECT a FROM t1)) AS f
+FROM t1;
+ANALYZE
+{
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "duplicate_removal": {
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "subqueries": [
+ {
+ "expression_cache": {
+ "state": "disabled",
+ "r_loops": 0,
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 50,
+ "attached_condition": "<nop>(<in_optimizer>(t1.b,(subquery#3) >= 4))"
+ },
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 3,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+}
+DROP TABLE t1;
# End of 10.2 tests
# End of 10.3 tests
#
diff --git a/mysql-test/main/subselect4.test b/mysql-test/main/subselect4.test
index 192791c4c37..8834134e880 100644
--- a/mysql-test/main/subselect4.test
+++ b/mysql-test/main/subselect4.test
@@ -2421,6 +2421,21 @@ set optimizer_switch=@tmp_os;
drop table t1, t10, t11;
+--echo #
+--echo # MDEV-28268: Server crashes in Expression_cache_tracker::fetch_current_stats
+--echo #
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES (1,2),(3,4);
+
+--source include/analyze-format.inc
+ANALYZE FORMAT=JSON
+SELECT DISTINCT
+ (SELECT MIN(a) FROM t1 WHERE b <= ANY (SELECT a FROM t1)) AS f
+FROM t1;
+
+# Cleanup
+DROP TABLE t1;
+
--echo # End of 10.2 tests
--echo # End of 10.3 tests
diff --git a/mysql-test/main/subselect_innodb.result b/mysql-test/main/subselect_innodb.result
index 467ed218198..5d714d9c91e 100644
--- a/mysql-test/main/subselect_innodb.result
+++ b/mysql-test/main/subselect_innodb.result
@@ -581,7 +581,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t2 ref key1 key1 5 test.t1.a # Using where; Using filesort
drop table t1,t2;
#
-# mdev-12931: semi-join in ON expression of STRAIGHT_JOIN
+# MDEV-12931: semi-join in ON expression of STRAIGHT_JOIN
# joining a base table and a mergeable derived table
#
CREATE TABLE t1 (f1 int) ENGINE=InnoDB;
@@ -633,6 +633,52 @@ a b
2019-03-10 02:55:05 2019-03-10 02:55:05
DROP TABLE t1,t2;
set character_set_connection=@save_character_set_connection;
+#
+# MDEV-26047: MariaDB server crash at Item_subselect::init_expr_cache_tracker
+#
+CREATE TABLE t1 (a int) engine=innodb;
+SELECT 1 IN (
+SELECT NULL
+FROM t1
+WHERE
+a IS NOT NULL
+GROUP BY
+(SELECT NULL from dual WHERE a = 1)
+);
+1 IN (
+SELECT NULL
+FROM t1
+WHERE
+a IS NOT NULL
+GROUP BY
+(SELECT NULL from dual WHERE a = 1)
+)
+0
+drop table t1;
+# Testcase from MDEV-26164
+create table t1(a int);
+# Disable the warning as it includes current time and changes for every test run.
+select 1 from t1 where not exists
+(
+select 1 from t1 where binary current_time()
+group by (select a),(select 1)
+);
+1
+drop table t1;
+#
+# MDEV-28437: Assertion `!eliminated' failed in Item_subselect::exec
+#
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (3),(4);
+SELECT 1 IN (SELECT a FROM t1 LEFT JOIN t2 ON (a = b AND EXISTS (SELECT * FROM t1)));
+1 IN (SELECT a FROM t1 LEFT JOIN t2 ON (a = b AND EXISTS (SELECT * FROM t1)))
+1
+drop table t1,t2;
+#
+# End of 10.2 tests
+#
#
# MDEV-17362: SIGSEGV in JOIN::optimize_inner or Assertion `fixed == 0'
# failed in Item_equal::fix_fields, server crashes after 2nd execution
diff --git a/mysql-test/main/subselect_innodb.test b/mysql-test/main/subselect_innodb.test
index 8ff3a5acf7d..fef954edc28 100644
--- a/mysql-test/main/subselect_innodb.test
+++ b/mysql-test/main/subselect_innodb.test
@@ -575,7 +575,7 @@ from
drop table t1,t2;
--echo #
---echo # mdev-12931: semi-join in ON expression of STRAIGHT_JOIN
+--echo # MDEV-12931: semi-join in ON expression of STRAIGHT_JOIN
--echo # joining a base table and a mergeable derived table
--echo #
@@ -625,6 +625,49 @@ DROP TABLE t1,t2;
set character_set_connection=@save_character_set_connection;
+--echo #
+--echo # MDEV-26047: MariaDB server crash at Item_subselect::init_expr_cache_tracker
+--echo #
+CREATE TABLE t1 (a int) engine=innodb;
+
+SELECT 1 IN (
+ SELECT NULL
+ FROM t1
+ WHERE
+ a IS NOT NULL
+ GROUP BY
+ (SELECT NULL from dual WHERE a = 1)
+);
+drop table t1;
+
+--echo # Testcase from MDEV-26164
+create table t1(a int);
+--echo # Disable the warning as it includes current time and changes for every test run.
+--disable_warnings
+select 1 from t1 where not exists
+(
+ select 1 from t1 where binary current_time()
+ group by (select a),(select 1)
+);
+--enable_warnings
+drop table t1;
+
+--echo #
+--echo # MDEV-28437: Assertion `!eliminated' failed in Item_subselect::exec
+--echo #
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (3),(4);
+
+SELECT 1 IN (SELECT a FROM t1 LEFT JOIN t2 ON (a = b AND EXISTS (SELECT * FROM t1)));
+
+drop table t1,t2;
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
+
--echo #
--echo # MDEV-17362: SIGSEGV in JOIN::optimize_inner or Assertion `fixed == 0'
--echo # failed in Item_equal::fix_fields, server crashes after 2nd execution
diff --git a/mysql-test/main/subselect_no_exists_to_in.result b/mysql-test/main/subselect_no_exists_to_in.result
index b1432cf0979..4af48680232 100644
--- a/mysql-test/main/subselect_no_exists_to_in.result
+++ b/mysql-test/main/subselect_no_exists_to_in.result
@@ -1265,7 +1265,7 @@ a
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(3) NOT NULL
+ `a` int(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int);
diff --git a/mysql-test/main/subselect_no_mat.result b/mysql-test/main/subselect_no_mat.result
index da60f98bf00..45687896592 100644
--- a/mysql-test/main/subselect_no_mat.result
+++ b/mysql-test/main/subselect_no_mat.result
@@ -1268,7 +1268,7 @@ a
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(3) NOT NULL
+ `a` int(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int);
diff --git a/mysql-test/main/subselect_no_opts.result b/mysql-test/main/subselect_no_opts.result
index fb99e237a1c..0c0fe634b0c 100644
--- a/mysql-test/main/subselect_no_opts.result
+++ b/mysql-test/main/subselect_no_opts.result
@@ -1264,7 +1264,7 @@ a
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(3) NOT NULL
+ `a` int(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int);
diff --git a/mysql-test/main/subselect_no_scache.result b/mysql-test/main/subselect_no_scache.result
index 4b910009248..bf6c863a006 100644
--- a/mysql-test/main/subselect_no_scache.result
+++ b/mysql-test/main/subselect_no_scache.result
@@ -1267,7 +1267,7 @@ a
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(3) NOT NULL
+ `a` int(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int);
diff --git a/mysql-test/main/subselect_no_semijoin.result b/mysql-test/main/subselect_no_semijoin.result
index f2230718754..027fa4ee9f3 100644
--- a/mysql-test/main/subselect_no_semijoin.result
+++ b/mysql-test/main/subselect_no_semijoin.result
@@ -1264,7 +1264,7 @@ a
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(3) NOT NULL
+ `a` int(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int);
diff --git a/mysql-test/main/temp_table_symlink.test b/mysql-test/main/temp_table_symlink.test
index 9297b472805..5bd8c5ac5bc 100644
--- a/mysql-test/main/temp_table_symlink.test
+++ b/mysql-test/main/temp_table_symlink.test
@@ -14,6 +14,7 @@ for (<#sql*.MYI>) {
symlink "$ENV{datadir}/test/d1.MYI", sprintf "#sql$1_$2%x.MYI", hex($3)+1;
symlink "$ENV{datadir}/test/d1.MYI", sprintf "#sql$1_$2%x.MAI", hex($3)+1;
symlink "$ENV{datadir}/test/d1.MYI", sprintf "#sql$1_$2%x.MAI", hex($3)+2;
+ symlink "$ENV{datadir}/test/d1.MYI", sprintf "#sql$1_$2%x.MAI", hex($3)+3;
symlink "$ENV{datadir}/test/d1.MYI", "#sql_$1_0.MAI";
}
EOF
diff --git a/mysql-test/main/type_newdecimal.result b/mysql-test/main/type_newdecimal.result
index 13974c84e15..b76ba029ad6 100644
--- a/mysql-test/main/type_newdecimal.result
+++ b/mysql-test/main/type_newdecimal.result
@@ -2456,6 +2456,30 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
#
+# MDEV-25317 Assertion `scale <= precision' failed in
+# decimal_bin_size And Assertion `scale >= 0 && precision > 0 && scale <= precision'
+# failed in decimal_bin_size_inline/decimal_bin_size.
+#
+SELECT AVG(DISTINCT 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001);
+AVG(DISTINCT 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+0.00000000000000000000000000000000000000
+CREATE TABLE t1 AS SELECT NULL AS v1;
+SELECT 1 FROM t1 GROUP BY v1 ORDER BY AVG ( from_unixtime ( '' ) ) ;
+1
+1
+Warnings:
+Warning 1292 Truncated incorrect DECIMAL value: ''
+DROP TABLE t1;
+SELECT SUM(DISTINCT 0.000000000000000000000000000000000000001);
+SUM(DISTINCT 0.000000000000000000000000000000000000001)
+0.00000000000000000000000000000000000000
+CREATE TABLE t1 AS SELECT 1.000000000000000000000000000000000 AS a;
+ALTER TABLE t1 ADD COLUMN b INT;
+SELECT ROUND (a,b) AS c FROM t1 ORDER BY c;
+c
+NULL
+DROP TABLE t1;
+#
# End of 10.2 tests
#
#
diff --git a/mysql-test/main/type_newdecimal.test b/mysql-test/main/type_newdecimal.test
index 5b7ecf89a07..011c6dbc743 100644
--- a/mysql-test/main/type_newdecimal.test
+++ b/mysql-test/main/type_newdecimal.test
@@ -1895,6 +1895,25 @@ show create table t1;
drop table t1;
--echo #
+--echo # MDEV-25317 Assertion `scale <= precision' failed in
+--echo # decimal_bin_size And Assertion `scale >= 0 && precision > 0 && scale <= precision'
+--echo # failed in decimal_bin_size_inline/decimal_bin_size.
+--echo #
+
+SELECT AVG(DISTINCT 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001);
+
+CREATE TABLE t1 AS SELECT NULL AS v1;
+SELECT 1 FROM t1 GROUP BY v1 ORDER BY AVG ( from_unixtime ( '' ) ) ;
+DROP TABLE t1;
+
+SELECT SUM(DISTINCT 0.000000000000000000000000000000000000001);
+
+CREATE TABLE t1 AS SELECT 1.000000000000000000000000000000000 AS a;
+ALTER TABLE t1 ADD COLUMN b INT;
+SELECT ROUND (a,b) AS c FROM t1 ORDER BY c;
+DROP TABLE t1;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/win.result b/mysql-test/main/win.result
index 0174441ed43..bb4acddf1f6 100644
--- a/mysql-test/main/win.result
+++ b/mysql-test/main/win.result
@@ -4238,6 +4238,48 @@ SELECT 1 UNION SELECT a FROM t1 ORDER BY (row_number() over ());
ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION
DROP TABLE t1;
#
+# MDEV-19398: Assertion `item1->type() == Item::FIELD_ITEM &&
+# item2->type() == Item::FIELD_ITEM' failed in compare_order_elements
+#
+CREATE TABLE t1 ( id varchar(10));
+INSERT INTO t1 values (1),(2),(3);
+SELECT
+dense_rank() over (ORDER BY avg(1)+3),
+rank() over (ORDER BY avg(1))
+FROM t1
+GROUP BY nullif(id, 15532);
+dense_rank() over (ORDER BY avg(1)+3) rank() over (ORDER BY avg(1))
+1 1
+1 1
+1 1
+SELECT
+dense_rank() over (ORDER BY avg(1)),
+rank() over (ORDER BY avg(1))
+FROM t1
+GROUP BY nullif(id, 15532);
+dense_rank() over (ORDER BY avg(1)) rank() over (ORDER BY avg(1))
+1 1
+1 1
+1 1
+drop table t1;
+CREATE TABLE t1 ( a char(25), b text);
+INSERT INTO t1 VALUES ('foo','bar');
+SELECT
+SUM(b) OVER (PARTITION BY a),
+ROW_NUMBER() OVER (PARTITION BY b)
+FROM t1
+GROUP BY
+LEFT((SYSDATE()), 'foo')
+WITH ROLLUP;
+SUM(b) OVER (PARTITION BY a) ROW_NUMBER() OVER (PARTITION BY b)
+NULL 1
+NULL 1
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'foo'
+Warning 1292 Truncated incorrect INTEGER value: 'foo'
+drop table t1;
+#
+#
# End of 10.2 tests
#
#
diff --git a/mysql-test/main/win.test b/mysql-test/main/win.test
index 1e0f89b5542..ce32626510a 100644
--- a/mysql-test/main/win.test
+++ b/mysql-test/main/win.test
@@ -2741,6 +2741,39 @@ SELECT 1 UNION SELECT a FROM t1 ORDER BY (row_number() over ());
DROP TABLE t1;
--echo #
+--echo # MDEV-19398: Assertion `item1->type() == Item::FIELD_ITEM &&
+--echo # item2->type() == Item::FIELD_ITEM' failed in compare_order_elements
+--echo #
+CREATE TABLE t1 ( id varchar(10));
+INSERT INTO t1 values (1),(2),(3);
+
+SELECT
+ dense_rank() over (ORDER BY avg(1)+3),
+ rank() over (ORDER BY avg(1))
+FROM t1
+GROUP BY nullif(id, 15532);
+
+SELECT
+ dense_rank() over (ORDER BY avg(1)),
+ rank() over (ORDER BY avg(1))
+FROM t1
+GROUP BY nullif(id, 15532);
+drop table t1;
+
+CREATE TABLE t1 ( a char(25), b text);
+INSERT INTO t1 VALUES ('foo','bar');
+
+SELECT
+ SUM(b) OVER (PARTITION BY a),
+ ROW_NUMBER() OVER (PARTITION BY b)
+FROM t1
+GROUP BY
+ LEFT((SYSDATE()), 'foo')
+WITH ROLLUP;
+drop table t1;
+
+--echo #
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_stop_never.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_stop_never.test
index d73e453ce96..b6a95c2c9be 100644
--- a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_stop_never.test
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_stop_never.test
@@ -43,10 +43,7 @@ DROP TABLE t1;
set @@SESSION.SQL_LOG_BIN = 1;
--echo # Step-3: Execute MYSQL_BINLOG with --stop-never and source it to mysql client.
---write_file $MYSQL_TMP_DIR/mysqlbinlog_stop_never.sh
-(`$MYSQL_BINLOG --read-from-remote-server --stop-never --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 | $MYSQL --user=root --protocol=tcp --host=127.0.0.1 --port=$MASTER_MYPORT`) < /dev/null > /dev/null 2>&1 &
-EOF
---exec /bin/bash $MYSQL_TMP_DIR/mysqlbinlog_stop_never.sh
+--exec ($MYSQL_BINLOG --read-from-remote-server --stop-never --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 | $MYSQL --user=root --protocol=tcp --host=127.0.0.1 --port=$MASTER_MYPORT) < /dev/null > /dev/null 2>&1 &
--echo # Step-4: Wait till dump thread transfer is completed.
let $wait_condition= SELECT id from information_schema.processlist where processlist.command like '%Binlog%' and state like '%Master has sent%';
@@ -62,5 +59,3 @@ source include/wait_until_rows_count.inc;
--source include/stop_dump_threads.inc
DROP TABLE t1;
---remove_file $MYSQL_TMP_DIR/mysqlbinlog_stop_never.sh
-
diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel.result b/mysql-test/suite/binlog_encryption/rpl_parallel.result
index 4e1740f1dc6..b75a66a634a 100644
--- a/mysql-test/suite/binlog_encryption/rpl_parallel.result
+++ b/mysql-test/suite/binlog_encryption/rpl_parallel.result
@@ -1379,6 +1379,7 @@ include/stop_slave.inc
SET GLOBAL slave_parallel_threads=1;
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000";
+CALL mtr.add_suppression("Unexpected break of being relay-logged GTID");
connection server_1;
INSERT INTO t2 VALUES (101);
INSERT INTO t2 VALUES (102);
diff --git a/mysql-test/suite/binlog_encryption/rpl_ssl.result b/mysql-test/suite/binlog_encryption/rpl_ssl.result
index 0b3a6cd0eca..ce9e4d486cf 100644
--- a/mysql-test/suite/binlog_encryption/rpl_ssl.result
+++ b/mysql-test/suite/binlog_encryption/rpl_ssl.result
@@ -23,6 +23,8 @@ t
Master_SSL_Allowed = 'Yes'
Master_SSL_CA_Path = ''
Master_SSL_CA_File = 'MYSQL_TEST_DIR/std_data/cacert.pem'
+Master_SSL_Crl = ''
+Master_SSL_Crlpath = ''
Master_SSL_Cert = 'MYSQL_TEST_DIR/std_data/client-cert.pem'
Master_SSL_Key = 'MYSQL_TEST_DIR/std_data/client-key.pem'
include/check_slave_is_running.inc
@@ -37,6 +39,8 @@ include/wait_for_slave_to_start.inc
Master_SSL_Allowed = 'Yes'
Master_SSL_CA_Path = ''
Master_SSL_CA_File = 'MYSQL_TEST_DIR/std_data/cacert.pem'
+Master_SSL_Crl = ''
+Master_SSL_Crlpath = ''
Master_SSL_Cert = 'MYSQL_TEST_DIR/std_data/client-cert.pem'
Master_SSL_Key = 'MYSQL_TEST_DIR/std_data/client-key.pem'
include/check_slave_is_running.inc
diff --git a/mysql-test/suite/compat/oracle/r/sp-package-mysqldump.result b/mysql-test/suite/compat/oracle/r/sp-package-mysqldump.result
index 21bead42b0a..24211c6318e 100644
--- a/mysql-test/suite/compat/oracle/r/sp-package-mysqldump.result
+++ b/mysql-test/suite/compat/oracle/r/sp-package-mysqldump.result
@@ -45,6 +45,8 @@ $$
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER,SIMULTANEOUS_ASSIGNMENT' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `p1` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -52,8 +54,6 @@ $$
/*!50003 SET character_set_client = latin1 */ ;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER,SIMULTANEOUS_ASSIGNMENT' */ ;
DELIMITER ;;
CREATE DEFINER="root"@"localhost" PROCEDURE "p1"()
AS
@@ -65,6 +65,8 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER,SIMULTANEOUS_ASSIGNMENT' */ ;
/*!50003 DROP PACKAGE IF EXISTS `pkg1` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -72,8 +74,6 @@ DELIMITER ;
/*!50003 SET character_set_client = latin1 */ ;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER,SIMULTANEOUS_ASSIGNMENT' */ ;
DELIMITER ;;
CREATE DEFINER="root"@"localhost" PACKAGE "pkg1" AS
PROCEDURE p1;
@@ -84,6 +84,8 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER,SIMULTANEOUS_ASSIGNMENT' */ ;
/*!50003 DROP PACKAGE IF EXISTS `pkg2` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -91,8 +93,6 @@ DELIMITER ;
/*!50003 SET character_set_client = latin1 */ ;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER,SIMULTANEOUS_ASSIGNMENT' */ ;
DELIMITER ;;
CREATE DEFINER="root"@"localhost" PACKAGE "pkg2" AS
PROCEDURE p1;
@@ -103,6 +103,8 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER,SIMULTANEOUS_ASSIGNMENT' */ ;
/*!50003 DROP PACKAGE BODY IF EXISTS `pkg1` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -110,8 +112,6 @@ DELIMITER ;
/*!50003 SET character_set_client = latin1 */ ;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER,SIMULTANEOUS_ASSIGNMENT' */ ;
DELIMITER ;;
CREATE DEFINER="root"@"localhost" PACKAGE BODY "pkg1" AS
PROCEDURE p1 AS
diff --git a/mysql-test/suite/encryption/r/tempfiles_encrypted.result b/mysql-test/suite/encryption/r/tempfiles_encrypted.result
index a92a3a04a1a..1d559891bd7 100644
--- a/mysql-test/suite/encryption/r/tempfiles_encrypted.result
+++ b/mysql-test/suite/encryption/r/tempfiles_encrypted.result
@@ -4244,6 +4244,48 @@ SELECT 1 UNION SELECT a FROM t1 ORDER BY (row_number() over ());
ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION
DROP TABLE t1;
#
+# MDEV-19398: Assertion `item1->type() == Item::FIELD_ITEM &&
+# item2->type() == Item::FIELD_ITEM' failed in compare_order_elements
+#
+CREATE TABLE t1 ( id varchar(10));
+INSERT INTO t1 values (1),(2),(3);
+SELECT
+dense_rank() over (ORDER BY avg(1)+3),
+rank() over (ORDER BY avg(1))
+FROM t1
+GROUP BY nullif(id, 15532);
+dense_rank() over (ORDER BY avg(1)+3) rank() over (ORDER BY avg(1))
+1 1
+1 1
+1 1
+SELECT
+dense_rank() over (ORDER BY avg(1)),
+rank() over (ORDER BY avg(1))
+FROM t1
+GROUP BY nullif(id, 15532);
+dense_rank() over (ORDER BY avg(1)) rank() over (ORDER BY avg(1))
+1 1
+1 1
+1 1
+drop table t1;
+CREATE TABLE t1 ( a char(25), b text);
+INSERT INTO t1 VALUES ('foo','bar');
+SELECT
+SUM(b) OVER (PARTITION BY a),
+ROW_NUMBER() OVER (PARTITION BY b)
+FROM t1
+GROUP BY
+LEFT((SYSDATE()), 'foo')
+WITH ROLLUP;
+SUM(b) OVER (PARTITION BY a) ROW_NUMBER() OVER (PARTITION BY b)
+NULL 1
+NULL 1
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'foo'
+Warning 1292 Truncated incorrect INTEGER value: 'foo'
+drop table t1;
+#
+#
# End of 10.2 tests
#
#
diff --git a/mysql-test/suite/galera/r/mysql_tzinfo_to_sql.result b/mysql-test/suite/galera/r/mysql_tzinfo_to_sql.result
new file mode 100644
index 00000000000..e0cee3a50bf
--- /dev/null
+++ b/mysql-test/suite/galera/r/mysql_tzinfo_to_sql.result
@@ -0,0 +1,154 @@
+connection node_2;
+connection node_1;
+#
+# MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases
+#
+
+# On node_1
+connection node_1;
+CREATE TABLE time_zone LIKE mysql.time_zone;
+CREATE TABLE time_zone_name LIKE mysql.time_zone_name;
+CREATE TABLE time_zone_transition LIKE mysql.time_zone_transition;
+CREATE TABLE time_zone_transition_type LIKE mysql.time_zone_transition_type;
+CREATE TABLE time_zone_leap_second LIKE mysql.time_zone_leap_second;
+#
+# Run on zoneinfo directory --skip-write-binlog
+#
+
+# Apply on node_1
+
+load timezones
+'binlog stationary as expected'
+SELECT COUNT(*) FROM time_zone;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_name;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_transition;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition_type;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_leap_second;
+COUNT(*)
+0
+
+# On node_2 (not replicated)
+
+connection node_2;
+SELECT COUNT(*) FROM time_zone;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_name;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition_type;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_leap_second;
+COUNT(*)
+0
+#
+# Run on zoneinfo directory without --skip-write-binlog
+#
+
+# Apply on node_1
+
+connection node_1;
+load timezones
+'binlog advanced as expected'
+SELECT COUNT(*) FROM time_zone;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_name;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_transition;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition_type;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_leap_second;
+COUNT(*)
+0
+
+# On node_2 (replicated via InnoDB)
+
+connection node_2;
+SELECT COUNT(*) FROM time_zone;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_name;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_transition;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition_type;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_leap_second;
+COUNT(*)
+0
+TRUNCATE TABLE time_zone;
+TRUNCATE TABLE time_zone_name;
+TRUNCATE TABLE time_zone_transition;
+TRUNCATE TABLE time_zone_transition_type;
+TRUNCATE TABLE time_zone_leap_second;
+
+# Apply on node_1 (with wsrep_on=OFF)
+
+connection node_1;
+SET GLOBAL WSREP_ON=OFF;
+load timezones
+SET GLOBAL WSREP_ON=ON;
+'binlog advanced as expected'
+SELECT COUNT(*) FROM time_zone;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_name;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_transition;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition_type;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_leap_second;
+COUNT(*)
+0
+
+# On node_2 (Should not have been replicated)
+
+connection node_2;
+SELECT COUNT(*) FROM time_zone;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_name;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition_type;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_leap_second;
+COUNT(*)
+0
+connection node_1;
+DROP TABLE time_zone;
+DROP TABLE time_zone_name;
+DROP TABLE time_zone_transition;
+DROP TABLE time_zone_transition_type;
+DROP TABLE time_zone_leap_second;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/suite/galera/t/mysql_tzinfo_to_sql.opt b/mysql-test/suite/galera/t/mysql_tzinfo_to_sql.opt
new file mode 100644
index 00000000000..beae84b3862
--- /dev/null
+++ b/mysql-test/suite/galera/t/mysql_tzinfo_to_sql.opt
@@ -0,0 +1 @@
+--log-bin
diff --git a/mysql-test/suite/galera/t/mysql_tzinfo_to_sql.test b/mysql-test/suite/galera/t/mysql_tzinfo_to_sql.test
new file mode 100644
index 00000000000..6bfad2f18b5
--- /dev/null
+++ b/mysql-test/suite/galera/t/mysql_tzinfo_to_sql.test
@@ -0,0 +1,156 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/not_embedded.inc
+# merge note: 10.6 change not_embedded.inc to no_protocol.inc
+
+# Unlike the similar galera.mariadb_tzinfo_to_sql.test in 10.6+, this
+# tests that the output can be parsed by the mysql client.
+--echo #
+--echo # MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases
+--echo #
+
+--exec mkdir $MYSQLTEST_VARDIR/zoneinfo
+--exec ln -s $MYSQLTEST_VARDIR/zoneinfo $MYSQLTEST_VARDIR/zoneinfo/posix
+--copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/GMT
+
+--echo
+--echo # On node_1
+--connection node_1
+
+CREATE TABLE time_zone LIKE mysql.time_zone;
+CREATE TABLE time_zone_name LIKE mysql.time_zone_name;
+CREATE TABLE time_zone_transition LIKE mysql.time_zone_transition;
+CREATE TABLE time_zone_transition_type LIKE mysql.time_zone_transition_type;
+CREATE TABLE time_zone_leap_second LIKE mysql.time_zone_leap_second;
+
+--echo #
+--echo # Run on zoneinfo directory --skip-write-binlog
+--echo #
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo 2>/dev/null > $MYSQL_TMP_DIR/tz.sql
+
+--echo
+--echo # Apply on node_1
+--echo
+--let $snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1)
+--echo load timezones
+--exec $MYSQL test < "$MYSQL_TMP_DIR/tz.sql"
+--let $new_snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1)
+
+if ($snap_pos == $new_snap_pos)
+{
+--echo 'binlog stationary as expected'
+}
+
+SELECT COUNT(*) FROM time_zone;
+SELECT COUNT(*) FROM time_zone_name;
+SELECT COUNT(*) FROM time_zone_transition;
+SELECT COUNT(*) FROM time_zone_transition_type;
+SELECT COUNT(*) FROM time_zone_leap_second;
+
+--echo
+--echo # On node_2 (not replicated)
+--echo
+--connection node_2
+
+SELECT COUNT(*) FROM time_zone;
+SELECT COUNT(*) FROM time_zone_name;
+SELECT COUNT(*) FROM time_zone_transition;
+SELECT COUNT(*) FROM time_zone_transition_type;
+SELECT COUNT(*) FROM time_zone_leap_second;
+
+--echo #
+--echo # Run on zoneinfo directory without --skip-write-binlog
+--echo #
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo 2>/dev/null > $MYSQL_TMP_DIR/tz.sql
+
+--echo
+--echo # Apply on node_1
+--echo
+--connection node_1
+
+--echo load timezones
+--exec $MYSQL test < "$MYSQL_TMP_DIR/tz.sql"
+--let $new_snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1)
+
+if ($snap_pos < $new_snap_pos)
+{
+--echo 'binlog advanced as expected'
+}
+
+SELECT COUNT(*) FROM time_zone;
+SELECT COUNT(*) FROM time_zone_name;
+SELECT COUNT(*) FROM time_zone_transition;
+SELECT COUNT(*) FROM time_zone_transition_type;
+SELECT COUNT(*) FROM time_zone_leap_second;
+
+--echo
+--echo # On node_2 (replicated via InnoDB)
+--echo
+--connection node_2
+
+SELECT COUNT(*) FROM time_zone;
+SELECT COUNT(*) FROM time_zone_name;
+SELECT COUNT(*) FROM time_zone_transition;
+SELECT COUNT(*) FROM time_zone_transition_type;
+SELECT COUNT(*) FROM time_zone_leap_second;
+
+TRUNCATE TABLE time_zone;
+TRUNCATE TABLE time_zone_name;
+TRUNCATE TABLE time_zone_transition;
+TRUNCATE TABLE time_zone_transition_type;
+TRUNCATE TABLE time_zone_leap_second;
+
+--echo
+--echo # Apply on node_1 (with wsrep_on=OFF)
+--echo
+--connection node_1
+
+SET GLOBAL WSREP_ON=OFF;
+--let $snap_pos= $new_snap_pos
+--echo load timezones
+--exec $MYSQL test < "$MYSQL_TMP_DIR/tz.sql"
+--let $new_snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1)
+SET GLOBAL WSREP_ON=ON;
+
+if ($snap_pos < $new_snap_pos)
+{
+--echo 'binlog advanced as expected'
+}
+
+SELECT COUNT(*) FROM time_zone;
+SELECT COUNT(*) FROM time_zone_name;
+SELECT COUNT(*) FROM time_zone_transition;
+SELECT COUNT(*) FROM time_zone_transition_type;
+SELECT COUNT(*) FROM time_zone_leap_second;
+
+--echo
+--echo # On node_2 (Should not have been replicated)
+--echo
+--connection node_2
+
+SELECT COUNT(*) FROM time_zone;
+SELECT COUNT(*) FROM time_zone_name;
+SELECT COUNT(*) FROM time_zone_transition;
+SELECT COUNT(*) FROM time_zone_transition_type;
+SELECT COUNT(*) FROM time_zone_leap_second;
+
+#
+# Cleanup
+#
+
+--connection node_1
+--remove_file $MYSQL_TMP_DIR/tz.sql
+--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo
+DROP TABLE time_zone;
+DROP TABLE time_zone_name;
+DROP TABLE time_zone_transition;
+DROP TABLE time_zone_transition_type;
+DROP TABLE time_zone_leap_second;
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/suite/handler/aria.result b/mysql-test/suite/handler/aria.result
index 1896e30f7d5..657f26c27c3 100644
--- a/mysql-test/suite/handler/aria.result
+++ b/mysql-test/suite/handler/aria.result
@@ -1849,3 +1849,19 @@ a b
HANDLER t1 CLOSE;
DROP TABLE t1;
End of 5.1 tests
+#
+# 10.2 Test
+#
+# MDEV-20207: Assertion `! is_set()' failed in
+# Diagnostics_area::set_eof_status upon HANDLER READ
+#
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 'test.t1'
+CREATE TABLE t1 (a POINT, KEY(a));
+HANDLER t1 OPEN h;
+HANDLER h READ a = (0);
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+HANDLER h CLOSE;
+DROP TABLE t1;
+# End of 10.2 Test
diff --git a/mysql-test/suite/handler/aria.test b/mysql-test/suite/handler/aria.test
index 1913d2b791c..912a9e89721 100644
--- a/mysql-test/suite/handler/aria.test
+++ b/mysql-test/suite/handler/aria.test
@@ -80,3 +80,23 @@ HANDLER t1 CLOSE;
DROP TABLE t1;
--echo End of 5.1 tests
+
+--echo #
+--echo # 10.2 Test
+--echo #
+--echo # MDEV-20207: Assertion `! is_set()' failed in
+--echo # Diagnostics_area::set_eof_status upon HANDLER READ
+--echo #
+
+DROP TABLE IF EXISTS t1;
+
+CREATE TABLE t1 (a POINT, KEY(a));
+HANDLER t1 OPEN h;
+
+--error ER_CANT_CREATE_GEOMETRY_OBJECT
+HANDLER h READ a = (0);
+
+HANDLER h CLOSE;
+DROP TABLE t1;
+
+--echo # End of 10.2 Test
diff --git a/mysql-test/suite/handler/innodb.result b/mysql-test/suite/handler/innodb.result
index a1b2b318911..9a3c2d115f1 100644
--- a/mysql-test/suite/handler/innodb.result
+++ b/mysql-test/suite/handler/innodb.result
@@ -1752,3 +1752,19 @@ HANDLER t1 READ `PRIMARY` PREV;
f1 f2
3 3
DROP TABLE t1;
+#
+# 10.2 Test
+#
+# MDEV-20207: Assertion `! is_set()' failed in
+# Diagnostics_area::set_eof_status upon HANDLER READ
+#
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 'test.t1'
+CREATE TABLE t1 (a POINT, KEY(a));
+HANDLER t1 OPEN h;
+HANDLER h READ a = (0);
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+HANDLER h CLOSE;
+DROP TABLE t1;
+# End of 10.2 Test
diff --git a/mysql-test/suite/handler/innodb.test b/mysql-test/suite/handler/innodb.test
index 6527c4bb8bb..52c09f2e7c7 100644
--- a/mysql-test/suite/handler/innodb.test
+++ b/mysql-test/suite/handler/innodb.test
@@ -26,3 +26,23 @@ HANDLER t1 OPEN;
HANDLER t1 READ FIRST WHERE f2 <= 1;
HANDLER t1 READ `PRIMARY` PREV;
DROP TABLE t1;
+
+--echo #
+--echo # 10.2 Test
+--echo #
+--echo # MDEV-20207: Assertion `! is_set()' failed in
+--echo # Diagnostics_area::set_eof_status upon HANDLER READ
+--echo #
+
+DROP TABLE IF EXISTS t1;
+
+CREATE TABLE t1 (a POINT, KEY(a));
+HANDLER t1 OPEN h;
+
+--error ER_CANT_CREATE_GEOMETRY_OBJECT
+HANDLER h READ a = (0);
+
+HANDLER h CLOSE;
+DROP TABLE t1;
+
+--echo # End of 10.2 Test
diff --git a/mysql-test/suite/handler/interface.result b/mysql-test/suite/handler/interface.result
index 8c39b15b6c9..a17979cbd39 100644
--- a/mysql-test/suite/handler/interface.result
+++ b/mysql-test/suite/handler/interface.result
@@ -315,6 +315,22 @@ handler v read next;
ERROR 42S02: Unknown table 'v' in HANDLER
drop view v;
#
+# 10.2 Test
+#
+# MDEV-20207: Assertion `! is_set()' failed in
+# Diagnostics_area::set_eof_status upon HANDLER READ
+#
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 'test.t1'
+CREATE TABLE t1 (a POINT, KEY(a));
+HANDLER t1 OPEN h;
+HANDLER h READ a = (0);
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+HANDLER h CLOSE;
+DROP TABLE t1;
+# End of 10.2 Test
+#
# MDEV-15813 ASAN use-after-poison in hp_hashnr upon
# HANDLER READ on a versioned HEAP table
#
diff --git a/mysql-test/suite/handler/interface.test b/mysql-test/suite/handler/interface.test
index 0ecdbf9c5cf..a4ed640dbc0 100644
--- a/mysql-test/suite/handler/interface.test
+++ b/mysql-test/suite/handler/interface.test
@@ -358,6 +358,26 @@ handler v read next;
drop view v;
--echo #
+--echo # 10.2 Test
+--echo #
+--echo # MDEV-20207: Assertion `! is_set()' failed in
+--echo # Diagnostics_area::set_eof_status upon HANDLER READ
+--echo #
+
+DROP TABLE IF EXISTS t1;
+
+CREATE TABLE t1 (a POINT, KEY(a));
+HANDLER t1 OPEN h;
+
+--error ER_CANT_CREATE_GEOMETRY_OBJECT
+HANDLER h READ a = (0);
+
+HANDLER h CLOSE;
+DROP TABLE t1;
+
+--echo # End of 10.2 Test
+
+--echo #
--echo # MDEV-15813 ASAN use-after-poison in hp_hashnr upon
--echo # HANDLER READ on a versioned HEAP table
--echo #
diff --git a/mysql-test/suite/handler/myisam.result b/mysql-test/suite/handler/myisam.result
index 2c5f8c3bfde..97ce5cdbb0f 100644
--- a/mysql-test/suite/handler/myisam.result
+++ b/mysql-test/suite/handler/myisam.result
@@ -1935,3 +1935,17 @@ test.t1 preload_keys status OK
HANDLER t1 READ FIRST;
ERROR 42S02: Unknown table 't1' in HANDLER
End of 5.1 tests
+#
+# 10.2 Test
+#
+# MDEV-20207: Assertion `! is_set()' failed in
+# Diagnostics_area::set_eof_status upon HANDLER READ
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a POINT, KEY(a));
+HANDLER t1 OPEN h;
+HANDLER h READ a = (0);
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+HANDLER h CLOSE;
+DROP TABLE t1;
+# End of 10.2 Test
diff --git a/mysql-test/suite/handler/myisam.test b/mysql-test/suite/handler/myisam.test
index a2d87630aef..2fce8548322 100644
--- a/mysql-test/suite/handler/myisam.test
+++ b/mysql-test/suite/handler/myisam.test
@@ -169,3 +169,23 @@ HANDLER t1 READ FIRST;
--echo End of 5.1 tests
+
+--echo #
+--echo # 10.2 Test
+--echo #
+--echo # MDEV-20207: Assertion `! is_set()' failed in
+--echo # Diagnostics_area::set_eof_status upon HANDLER READ
+--echo #
+
+DROP TABLE IF EXISTS t1;
+
+CREATE TABLE t1 (a POINT, KEY(a));
+HANDLER t1 OPEN h;
+
+--error ER_CANT_CREATE_GEOMETRY_OBJECT
+HANDLER h READ a = (0);
+
+HANDLER h CLOSE;
+DROP TABLE t1;
+
+--echo # End of 10.2 Test
diff --git a/mysql-test/suite/innodb/r/foreign_key.result b/mysql-test/suite/innodb/r/foreign_key.result
index 4068551ec44..6a8fded4819 100644
--- a/mysql-test/suite/innodb/r/foreign_key.result
+++ b/mysql-test/suite/innodb/r/foreign_key.result
@@ -137,7 +137,34 @@ SELECT unique_constraint_name FROM information_schema.referential_constraints
WHERE table_name = 't2';
unique_constraint_name
PRIMARY
+#
+# MDEV-28317 Assertion failure on rollback of FOREIGN KEY operation
+#
+SET foreign_key_checks=0;
+CREATE TABLE parent(a INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE child(a INT,FOREIGN KEY(a) REFERENCES parent(a) ON DELETE CASCADE)
+ENGINE=InnoDB;
+INSERT INTO child VALUES(1);
+ALTER TABLE child DROP INDEX a;
+connect incomplete, localhost, root,,;
+BEGIN;
+DELETE FROM child;
+connection default;
+INSERT INTO parent SET a=0;
+FLUSH TABLES;
# restart
+disconnect incomplete;
+INSERT INTO child SET a=0;
+INSERT INTO child SET a=1;
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`a`) REFERENCES `parent` (`a`) ON DELETE CASCADE)
+DELETE FROM parent;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`a`) REFERENCES `parent` (`a`) ON DELETE CASCADE)
+ALTER TABLE child ADD INDEX(a);
+DELETE FROM parent;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`a`) REFERENCES `parent` (`a`) ON DELETE CASCADE)
+ALTER TABLE child FORCE;
+DELETE FROM parent;
+DROP TABLE child,parent;
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
SELECT unique_constraint_name FROM information_schema.referential_constraints
diff --git a/mysql-test/suite/innodb/r/gap_lock_split.result b/mysql-test/suite/innodb/r/gap_lock_split.result
new file mode 100644
index 00000000000..25a3cf711f9
--- /dev/null
+++ b/mysql-test/suite/innodb/r/gap_lock_split.result
@@ -0,0 +1,27 @@
+SET @save_frequency=@@GLOBAL.innodb_purge_rseg_truncate_frequency;
+SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
+CREATE TABLE t1(id INT PRIMARY key, val VARCHAR(16000)) ENGINE=InnoDB;
+INSERT INTO t1 (id,val) SELECT 2*seq,'x' FROM seq_0_to_1023;
+connect con1,localhost,root,,;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+connection default;
+DELETE FROM t1 WHERE id=1788;
+BEGIN;
+SELECT * FROM t1 WHERE id=1788 FOR UPDATE;
+id val
+connection con1;
+COMMIT;
+InnoDB 0 transactions not purged
+connection default;
+INSERT INTO t1 (id,val) VALUES (1787, REPEAT('x',2000));
+connection con1;
+SET innodb_lock_wait_timeout=0;
+INSERT INTO t1 (id,val) VALUES (1788, 'x');
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+SELECT * FROM t1 WHERE id=1788 FOR UPDATE;
+id val
+disconnect con1;
+connection default;
+COMMIT;
+DROP TABLE t1;
+SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency;
diff --git a/mysql-test/suite/innodb/r/innodb-autoinc-part.result b/mysql-test/suite/innodb/r/innodb-autoinc-part.result
new file mode 100644
index 00000000000..6872b5e02f5
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-autoinc-part.result
@@ -0,0 +1,34 @@
+#
+# MDEV-28416 Incorrect AUTO_INCREMENT may be issued
+#
+SET @aii=@@auto_increment_increment;
+SET auto_increment_increment=300;
+CREATE TABLE t1 (a SERIAL) ENGINE=innodb
+PARTITION BY RANGE (a) (
+PARTITION p0 VALUES LESS THAN (6),
+PARTITION p1 VALUES LESS THAN MAXVALUE
+);
+INSERT INTO t1 VALUES (18446744073709551613);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ UNIQUE KEY `a` (`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=18446744073709551614 DEFAULT CHARSET=latin1
+ PARTITION BY RANGE (`a`)
+(PARTITION `p0` VALUES LESS THAN (6) ENGINE = InnoDB,
+ PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
+INSERT INTO t1 VALUES (NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ UNIQUE KEY `a` (`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=298 DEFAULT CHARSET=latin1
+ PARTITION BY RANGE (`a`)
+(PARTITION `p0` VALUES LESS THAN (6) ENGINE = InnoDB,
+ PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
+DROP TABLE t1;
+SET auto_increment_increment=@aii;
+# End of 10.2 tests
diff --git a/mysql-test/suite/innodb/r/innodb-autoinc.result b/mysql-test/suite/innodb/r/innodb-autoinc.result
index 1efd5c61af7..b41e1c90a43 100644
--- a/mysql-test/suite/innodb/r/innodb-autoinc.result
+++ b/mysql-test/suite/innodb/r/innodb-autoinc.result
@@ -1,4 +1,3 @@
-drop table if exists t1;
CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (9223372036854775807, null);
INSERT INTO t1 (c2) VALUES ('innodb');
@@ -1622,3 +1621,27 @@ id name
-1 dog
2 cat
DROP PROCEDURE autoinc_mdev15353_one;
+#
+# MDEV-28416 Incorrect AUTO_INCREMENT may be issued
+#
+SET @aii=@@auto_increment_increment;
+SET auto_increment_increment=300;
+CREATE TABLE t1 (a SERIAL) ENGINE=innodb;
+INSERT INTO t1 VALUES (18446744073709551613);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ UNIQUE KEY `a` (`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=18446744073709551614 DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (NULL);
+ERROR 22003: Out of range value for column 'a' at row 1
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ UNIQUE KEY `a` (`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=18446744073709551615 DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SET auto_increment_increment=@aii;
+# End of 10.2 tests
diff --git a/mysql-test/suite/innodb/t/foreign_key.test b/mysql-test/suite/innodb/t/foreign_key.test
index 79f9767670b..5997d97f3a5 100644
--- a/mysql-test/suite/innodb/t/foreign_key.test
+++ b/mysql-test/suite/innodb/t/foreign_key.test
@@ -102,7 +102,41 @@ INSERT INTO t2 VALUES (1);
SELECT unique_constraint_name FROM information_schema.referential_constraints
WHERE table_name = 't2';
+--echo #
+--echo # MDEV-28317 Assertion failure on rollback of FOREIGN KEY operation
+--echo #
+
+SET foreign_key_checks=0;
+CREATE TABLE parent(a INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE child(a INT,FOREIGN KEY(a) REFERENCES parent(a) ON DELETE CASCADE)
+ENGINE=InnoDB;
+INSERT INTO child VALUES(1);
+ALTER TABLE child DROP INDEX a;
+
+connect(incomplete, localhost, root,,);
+BEGIN;
+DELETE FROM child;
+
+connection default;
+INSERT INTO parent SET a=0;
+FLUSH TABLES;
+
+--let $shutdown_timeout=0
--source include/restart_mysqld.inc
+--let $shutdown_timeout=
+disconnect incomplete;
+
+INSERT INTO child SET a=0;
+--error ER_NO_REFERENCED_ROW_2
+INSERT INTO child SET a=1;
+--error ER_ROW_IS_REFERENCED_2
+DELETE FROM parent;
+ALTER TABLE child ADD INDEX(a);
+--error ER_ROW_IS_REFERENCED_2
+DELETE FROM parent;
+ALTER TABLE child FORCE;
+DELETE FROM parent;
+DROP TABLE child,parent;
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
diff --git a/mysql-test/suite/innodb/t/gap_lock_split.test b/mysql-test/suite/innodb/t/gap_lock_split.test
new file mode 100644
index 00000000000..462f073ddce
--- /dev/null
+++ b/mysql-test/suite/innodb/t/gap_lock_split.test
@@ -0,0 +1,39 @@
+--source include/have_innodb.inc
+--source include/have_sequence.inc
+--source include/have_debug.inc
+
+SET @save_frequency=@@GLOBAL.innodb_purge_rseg_truncate_frequency;
+SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
+
+CREATE TABLE t1(id INT PRIMARY key, val VARCHAR(16000)) ENGINE=InnoDB;
+INSERT INTO t1 (id,val) SELECT 2*seq,'x' FROM seq_0_to_1023;
+
+connect(con1,localhost,root,,);
+# Prevent purge.
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+connection default;
+
+DELETE FROM t1 WHERE id=1788;
+
+BEGIN;
+# This will return no result, but should acquire a gap lock.
+SELECT * FROM t1 WHERE id=1788 FOR UPDATE;
+
+connection con1;
+COMMIT;
+source include/wait_all_purged.inc;
+connection default;
+
+INSERT INTO t1 (id,val) VALUES (1787, REPEAT('x',2000));
+
+connection con1;
+SET innodb_lock_wait_timeout=0;
+--error ER_LOCK_WAIT_TIMEOUT
+INSERT INTO t1 (id,val) VALUES (1788, 'x');
+SELECT * FROM t1 WHERE id=1788 FOR UPDATE;
+disconnect con1;
+
+connection default;
+COMMIT;
+DROP TABLE t1;
+SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency;
diff --git a/mysql-test/suite/innodb/t/innodb-autoinc-part.test b/mysql-test/suite/innodb/t/innodb-autoinc-part.test
new file mode 100644
index 00000000000..100546704ce
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-autoinc-part.test
@@ -0,0 +1,24 @@
+--source include/have_partition.inc
+--source include/have_innodb.inc
+
+--echo #
+--echo # MDEV-28416 Incorrect AUTO_INCREMENT may be issued
+--echo #
+
+SET @aii=@@auto_increment_increment;
+SET auto_increment_increment=300;
+
+CREATE TABLE t1 (a SERIAL) ENGINE=innodb
+PARTITION BY RANGE (a) (
+ PARTITION p0 VALUES LESS THAN (6),
+ PARTITION p1 VALUES LESS THAN MAXVALUE
+);
+INSERT INTO t1 VALUES (18446744073709551613);
+SHOW CREATE TABLE t1;
+--error HA_ERR_AUTOINC_ERANGE
+INSERT INTO t1 VALUES (NULL);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+SET auto_increment_increment=@aii;
+
+--echo # End of 10.2 tests
diff --git a/mysql-test/suite/innodb/t/innodb-autoinc.test b/mysql-test/suite/innodb/t/innodb-autoinc.test
index ca7727d4cef..158460558d5 100644
--- a/mysql-test/suite/innodb/t/innodb-autoinc.test
+++ b/mysql-test/suite/innodb/t/innodb-autoinc.test
@@ -1,10 +1,4 @@
--source include/have_innodb.inc
-# embedded server ignores 'delayed', so skip this
--- source include/not_embedded.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
#
# Bug #34335
@@ -770,3 +764,20 @@ DROP TABLE t1;
SET @engine='INNODB';
--source include/autoinc_mdev15353.inc
+
+--echo #
+--echo # MDEV-28416 Incorrect AUTO_INCREMENT may be issued
+--echo #
+
+SET @aii=@@auto_increment_increment;
+SET auto_increment_increment=300;
+CREATE TABLE t1 (a SERIAL) ENGINE=innodb;
+INSERT INTO t1 VALUES (18446744073709551613);
+SHOW CREATE TABLE t1;
+--error HA_ERR_AUTOINC_ERANGE
+INSERT INTO t1 VALUES (NULL);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+SET auto_increment_increment=@aii;
+
+--echo # End of 10.2 tests
diff --git a/mysql-test/suite/innodb_gis/r/rtree_split.result b/mysql-test/suite/innodb_gis/r/rtree_split.result
index 2d6e8a1dfbe..df88960ba3d 100644
--- a/mysql-test/suite/innodb_gis/r/rtree_split.result
+++ b/mysql-test/suite/innodb_gis/r/rtree_split.result
@@ -61,10 +61,3 @@ select count(*) from t1 where MBRWithin(t1.c2, @g1);
count(*)
57344
drop table t1;
-#
-# MDEV-27417 Spatial index tries to update
-# change buffer bookkeeping page
-#
-CREATE TEMPORARY TABLE t1 (c POINT NOT NULL, SPATIAL(c)) ENGINE=InnoDB;
-INSERT INTO t1 SELECT PointFromText('POINT(0 0)') FROM seq_1_to_366;
-DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_gis/r/rtree_temporary.result b/mysql-test/suite/innodb_gis/r/rtree_temporary.result
new file mode 100644
index 00000000000..5ce02c881cc
--- /dev/null
+++ b/mysql-test/suite/innodb_gis/r/rtree_temporary.result
@@ -0,0 +1,14 @@
+#
+# MDEV-27417 Spatial index tries to update
+# change buffer bookkeeping page
+#
+CREATE TEMPORARY TABLE t1 (c POINT NOT NULL, SPATIAL(c)) ENGINE=InnoDB;
+INSERT INTO t1 SELECT PointFromText('POINT(0 0)') FROM seq_1_to_366;
+DROP TABLE t1;
+#
+# MDEV-28478 Assertion mtr->get_log_mode() == MTR_LOG_NO_REDO
+#
+CREATE TEMPORARY TABLE t1 (c POINT NOT NULL,SPATIAL (c)) ENGINE=InnoDB;
+INSERT INTO t1 SELECT POINT(0,0) FROM seq_1_to_366;
+INSERT INTO t1 VALUES (POINT(1e-270,1e-130));
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_gis/t/rtree_split.test b/mysql-test/suite/innodb_gis/t/rtree_split.test
index 8697141ddea..6f285187508 100644
--- a/mysql-test/suite/innodb_gis/t/rtree_split.test
+++ b/mysql-test/suite/innodb_gis/t/rtree_split.test
@@ -73,11 +73,3 @@ select count(*) from t1 where MBRWithin(t1.c2, @g1);
# Clean up.
drop table t1;
-
---echo #
---echo # MDEV-27417 Spatial index tries to update
---echo # change buffer bookkeeping page
---echo #
-CREATE TEMPORARY TABLE t1 (c POINT NOT NULL, SPATIAL(c)) ENGINE=InnoDB;
-INSERT INTO t1 SELECT PointFromText('POINT(0 0)') FROM seq_1_to_366;
-DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_gis/t/rtree_temporary.test b/mysql-test/suite/innodb_gis/t/rtree_temporary.test
new file mode 100644
index 00000000000..5c4df251970
--- /dev/null
+++ b/mysql-test/suite/innodb_gis/t/rtree_temporary.test
@@ -0,0 +1,18 @@
+--source include/have_innodb.inc
+--source include/have_sequence.inc
+
+--echo #
+--echo # MDEV-27417 Spatial index tries to update
+--echo # change buffer bookkeeping page
+--echo #
+CREATE TEMPORARY TABLE t1 (c POINT NOT NULL, SPATIAL(c)) ENGINE=InnoDB;
+INSERT INTO t1 SELECT PointFromText('POINT(0 0)') FROM seq_1_to_366;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-28478 Assertion mtr->get_log_mode() == MTR_LOG_NO_REDO
+--echo #
+CREATE TEMPORARY TABLE t1 (c POINT NOT NULL,SPATIAL (c)) ENGINE=InnoDB;
+INSERT INTO t1 SELECT POINT(0,0) FROM seq_1_to_366;
+INSERT INTO t1 VALUES (POINT(1e-270,1e-130));
+DROP TABLE t1;
diff --git a/mysql-test/suite/mariabackup/include/show_xtrabackup_slave_info.inc b/mysql-test/suite/mariabackup/include/show_xtrabackup_slave_info.inc
new file mode 100644
index 00000000000..4a83c9c394e
--- /dev/null
+++ b/mysql-test/suite/mariabackup/include/show_xtrabackup_slave_info.inc
@@ -0,0 +1,14 @@
+--disable_query_log
+--file_exists $targetdir/xtrabackup_slave_info
+CREATE TEMPORARY TABLE tmp_slave_info(lineno SERIAL, line TEXT);
+--replace_result $targetdir TARGETDIR
+--eval LOAD DATA LOCAL INFILE '$targetdir/xtrabackup_slave_info' INTO TABLE tmp_slave_info (line);
+SELECT
+ lineno,
+ regexp_replace(
+ regexp_replace(line, '(?<=MASTER_LOG_POS=)[0-9]+', '<NUM>'),
+ '[0-9]+-[0-9]+-[0-9]+', '<NUM-NUM-NUM>')
+ AS line
+FROM tmp_slave_info ORDER BY lineno;
+DROP TEMPORARY TABLE tmp_slave_info;
+--enable_query_log
diff --git a/mysql-test/suite/mariabackup/include/show_xtrabackup_slave_info_out.inc b/mysql-test/suite/mariabackup/include/show_xtrabackup_slave_info_out.inc
new file mode 100644
index 00000000000..90b2d00b61d
--- /dev/null
+++ b/mysql-test/suite/mariabackup/include/show_xtrabackup_slave_info_out.inc
@@ -0,0 +1,20 @@
+--disable_query_log
+--file_exists $XTRABACKUP_OUT
+CREATE TEMPORARY TABLE tmp_slave_info_out(lineno SERIAL, line TEXT);
+--replace_result $targetdir TARGETDIR
+--eval LOAD DATA LOCAL INFILE '$XTRABACKUP_OUT' INTO TABLE tmp_slave_info_out (line);
+SELECT
+ replace(
+ regexp_replace(
+ regexp_replace(line,
+ '[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]',
+ 'YYYY-MM-DD hh:mm:ss'),
+ '[0-9]+-[0-9]+-[0-9]+', '<NUM-NUM-NUM>'),
+ '\r','' /* Remove CR on Windows */)
+ AS line
+FROM tmp_slave_info_out
+WHERE line LIKE '%MySQL slave binlog position%'
+ OR line LIKE '%Failed to get master binlog coordinates%'
+ORDER BY lineno;
+DROP TEMPORARY TABLE tmp_slave_info_out;
+--enable_query_log
diff --git a/mysql-test/suite/mariabackup/incremental_newdb_while_backup.result b/mysql-test/suite/mariabackup/incremental_newdb_while_backup.result
new file mode 100644
index 00000000000..ac74893d2cf
--- /dev/null
+++ b/mysql-test/suite/mariabackup/incremental_newdb_while_backup.result
@@ -0,0 +1,24 @@
+call mtr.add_suppression("InnoDB: New log files created");
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-28446 mariabackup prepare fails for incrementals if a new schema is created after full backup is taken
+#
+CREATE TABLE t1(i INT PRIMARY KEY) ENGINE INNODB;
+# Prepare full backup, apply incremental one
+# shutdown server
+# remove datadir
+# xtrabackup move back
+# restart
+SELECT COUNT(*) FROM test.t1;
+COUNT(*)
+0
+SELECT COUNT(*) FROM test1.t1;
+COUNT(*)
+10000
+DROP TABLE t1;
+DROP DATABASE test1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/suite/mariabackup/incremental_newdb_while_backup.test b/mysql-test/suite/mariabackup/incremental_newdb_while_backup.test
new file mode 100644
index 00000000000..c4695edb845
--- /dev/null
+++ b/mysql-test/suite/mariabackup/incremental_newdb_while_backup.test
@@ -0,0 +1,47 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+
+call mtr.add_suppression("InnoDB: New log files created");
+
+--echo #
+--echo # Start of 10.2 tests
+--echo #
+
+--echo #
+--echo # MDEV-28446 mariabackup prepare fails for incrementals if a new schema is created after full backup is taken
+--echo #
+
+--let $basedir=$MYSQLTEST_VARDIR/tmp/backup
+--let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1
+
+CREATE TABLE t1(i INT PRIMARY KEY) ENGINE INNODB;
+
+--disable_result_log
+--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir
+--enable_result_log
+
+--let after_load_tablespaces=BEGIN NOT ATOMIC CREATE DATABASE test1; CREATE TABLE test1.t1 ENGINE=INNODB SELECT UUID() from test.seq_1_to_10000; END
+
+--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir --dbug=+d,mariabackup_events,mariabackup_inject_code
+--let after_load_tablespaces=
+--disable_result_log
+--echo # Prepare full backup, apply incremental one
+--exec $XTRABACKUP --prepare --target-dir=$basedir
+--exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir
+--enable_result_log
+
+--let $targetdir=$basedir
+--source include/restart_and_restore.inc
+--enable_result_log
+
+SELECT COUNT(*) FROM test.t1;
+SELECT COUNT(*) FROM test1.t1;
+
+DROP TABLE t1;
+DROP DATABASE test1;
+--rmdir $basedir
+--rmdir $incremental_dir
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/suite/mariabackup/rpl_slave_info.result b/mysql-test/suite/mariabackup/rpl_slave_info.result
index 13044fd6c39..ec27166ecfb 100644
--- a/mysql-test/suite/mariabackup/rpl_slave_info.result
+++ b/mysql-test/suite/mariabackup/rpl_slave_info.result
@@ -13,6 +13,9 @@ connection slave;
"using_gtid: Slave_Pos"
FOUND 1 /gtid_slave_pos/ in xtrabackup_slave_info
NOT FOUND /MASTER_LOG_FILE/ in xtrabackup_slave_info
+lineno line
+1 SET GLOBAL gtid_slave_pos = '<NUM-NUM-NUM>';
+2 CHANGE MASTER TO master_use_gtid = slave_pos;
###############
# If Using_Gtid != 'No' and !gtid_slave_pos, backup master position
########################
@@ -20,6 +23,8 @@ include/stop_slave.inc
SET GLOBAL gtid_slave_pos="";
NOT FOUND /gtid_slave_pos/ in xtrabackup_slave_info
FOUND 1 /MASTER_LOG_FILE/ in xtrabackup_slave_info
+lineno line
+1 CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=<NUM>;
###############
# If Using_Gtid == 'No', backup Exec_Master_Log_Pos
########################
@@ -31,6 +36,8 @@ connection slave;
"using_gtid: No"
NOT FOUND /gtid_slave_pos/ in xtrabackup_slave_info
FOUND 1 /MASTER_LOG_FILE/ in xtrabackup_slave_info
+lineno line
+1 CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=<NUM>;
connection master;
DROP TABLE t;
connection slave;
diff --git a/mysql-test/suite/mariabackup/rpl_slave_info.test b/mysql-test/suite/mariabackup/rpl_slave_info.test
index ca7682d8af9..1c5dd89acc9 100644
--- a/mysql-test/suite/mariabackup/rpl_slave_info.test
+++ b/mysql-test/suite/mariabackup/rpl_slave_info.test
@@ -27,6 +27,7 @@ exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffi
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=MASTER_LOG_FILE
--source include/search_pattern_in_file.inc
+--source include/show_xtrabackup_slave_info.inc
rmdir $targetdir;
@@ -35,7 +36,9 @@ rmdir $targetdir;
--echo ########################
--source include/stop_slave.inc
+--disable_warnings
SET GLOBAL gtid_slave_pos="";
+--enable_warnings
--let $targetdir=$MYSQLTEST_VARDIR/tmp/backup
--disable_result_log
@@ -47,6 +50,7 @@ exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffi
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=MASTER_LOG_FILE
--source include/search_pattern_in_file.inc
+--source include/show_xtrabackup_slave_info.inc
rmdir $targetdir;
@@ -74,6 +78,7 @@ exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffi
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=MASTER_LOG_FILE
--source include/search_pattern_in_file.inc
+--source include/show_xtrabackup_slave_info.inc
rmdir $targetdir;
diff --git a/mysql-test/suite/mariabackup/slave_info_norpl.result b/mysql-test/suite/mariabackup/slave_info_norpl.result
new file mode 100644
index 00000000000..9fcd67a8916
--- /dev/null
+++ b/mysql-test/suite/mariabackup/slave_info_norpl.result
@@ -0,0 +1,59 @@
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-21037 mariabackup does not detect multi-source replication slave
+#
+SELECT @@global.gtid_slave_pos;
+@@global.gtid_slave_pos
+
+
+# Without any masters the file xtrabackup_slave_info is not created
+line
+[00] YYYY-MM-DD hh:mm:ss Failed to get master binlog coordinates from SHOW SLAVE STATUS.This means that the server is not a replication slave. Ignoring the --slave-info option
+
+CHANGE MASTER TO MASTER_HOST='localhost', MASTER_PORT=10000;
+lineno line
+1 CHANGE MASTER TO MASTER_LOG_FILE='', MASTER_LOG_POS=<NUM>;
+line
+[00] YYYY-MM-DD hh:mm:ss MySQL slave binlog position: master '' filename '' position '0'
+
+CHANGE MASTER 'master2' TO MASTER_HOST='localhost', MASTER_PORT=10002;
+lineno line
+1 CHANGE MASTER TO MASTER_LOG_FILE='', MASTER_LOG_POS=<NUM>;
+2 CHANGE MASTER 'master2' TO MASTER_LOG_FILE='', MASTER_LOG_POS=<NUM>;
+line
+[00] YYYY-MM-DD hh:mm:ss MySQL slave binlog position: master '' filename '' position '0'; master 'master2' filename '' position '0'
+
+SET GLOBAL gtid_slave_pos='1-1-1,2-2-2';
+CHANGE MASTER 'master3' TO MASTER_HOST='localhost', MASTER_PORT=10003, MASTER_USE_GTID=slave_pos;
+CHANGE MASTER 'master4' TO MASTER_HOST='localhost', MASTER_PORT=10004, MASTER_USE_GTID=no;
+CHANGE MASTER 'master5' TO MASTER_HOST='localhost', MASTER_PORT=10005, MASTER_USE_GTID=slave_pos;
+lineno line
+1 SET GLOBAL gtid_slave_pos = '<NUM-NUM-NUM>,<NUM-NUM-NUM>';
+2 CHANGE MASTER TO MASTER_LOG_FILE='', MASTER_LOG_POS=<NUM>;
+3 CHANGE MASTER 'master2' TO MASTER_LOG_FILE='', MASTER_LOG_POS=<NUM>;
+4 CHANGE MASTER 'master3' TO master_use_gtid = slave_pos;
+5 CHANGE MASTER 'master4' TO MASTER_LOG_FILE='', MASTER_LOG_POS=<NUM>;
+6 CHANGE MASTER 'master5' TO master_use_gtid = slave_pos;
+line
+[00] YYYY-MM-DD hh:mm:ss MySQL slave binlog position: gtid_slave_pos '<NUM-NUM-NUM>,<NUM-NUM-NUM>'; master '' filename '' position '0'; master 'master2' filename '' position '0'; master 'master3' master_use_gtid = slave_pos; master 'master4' filename '' position '0'; master 'master5' master_use_gtid = slave_pos
+
+CHANGE MASTER TO MASTER_HOST='localhost', MASTER_PORT=10000, MASTER_USE_GTID=slave_pos;
+lineno line
+1 SET GLOBAL gtid_slave_pos = '<NUM-NUM-NUM>,<NUM-NUM-NUM>';
+2 CHANGE MASTER TO master_use_gtid = slave_pos;
+3 CHANGE MASTER 'master2' TO MASTER_LOG_FILE='', MASTER_LOG_POS=<NUM>;
+4 CHANGE MASTER 'master3' TO master_use_gtid = slave_pos;
+5 CHANGE MASTER 'master4' TO MASTER_LOG_FILE='', MASTER_LOG_POS=<NUM>;
+6 CHANGE MASTER 'master5' TO master_use_gtid = slave_pos;
+line
+[00] YYYY-MM-DD hh:mm:ss MySQL slave binlog position: gtid_slave_pos '<NUM-NUM-NUM>,<NUM-NUM-NUM>'; master '' master_use_gtid = slave_pos; master 'master2' filename '' position '0'; master 'master3' master_use_gtid = slave_pos; master 'master4' filename '' position '0'; master 'master5' master_use_gtid = slave_pos
+RESET SLAVE ALL;
+RESET SLAVE 'master2' ALL;
+RESET SLAVE 'master3' ALL;
+RESET SLAVE 'master4' ALL;
+RESET SLAVE 'master5' ALL;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/suite/mariabackup/slave_info_norpl.test b/mysql-test/suite/mariabackup/slave_info_norpl.test
new file mode 100644
index 00000000000..0d2d2ed4861
--- /dev/null
+++ b/mysql-test/suite/mariabackup/slave_info_norpl.test
@@ -0,0 +1,86 @@
+#
+# "mariabackup --slave-info" tests that can be run without
+# actually starting the replication.
+#
+
+--echo #
+--echo # Start of 10.2 tests
+--echo #
+
+--echo #
+--echo # MDEV-21037 mariabackup does not detect multi-source replication slave
+--echo #
+
+--let $targetdir=$MYSQLTEST_VARDIR/tmp/backup
+--let $XTRABACKUP_ARGS=--defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.2 --slave-info --backup --databases=test --target-dir=$targetdir
+--let $XTRABACKUP_OUT=$MYSQLTEST_VARDIR/tmp/xtrabackup_out
+
+# Should be empty by default
+SELECT @@global.gtid_slave_pos;
+
+--echo
+--echo # Without any masters the file xtrabackup_slave_info is not created
+
+--disable_result_log
+exec $XTRABACKUP $XTRABACKUP_ARGS >$XTRABACKUP_OUT;
+--enable_result_log
+--error 1
+--file_exists $targetdir/xtrabackup_slave_info
+--source include/show_xtrabackup_slave_info_out.inc
+--remove_file $XTRABACKUP_OUT
+rmdir $targetdir;
+
+--echo
+CHANGE MASTER TO MASTER_HOST='localhost', MASTER_PORT=10000;
+--disable_result_log
+exec $XTRABACKUP $XTRABACKUP_ARGS >$XTRABACKUP_OUT;
+--enable_result_log
+--source include/show_xtrabackup_slave_info.inc
+--source include/show_xtrabackup_slave_info_out.inc
+--remove_file $XTRABACKUP_OUT
+rmdir $targetdir;
+
+--echo
+CHANGE MASTER 'master2' TO MASTER_HOST='localhost', MASTER_PORT=10002;
+--disable_result_log
+exec $XTRABACKUP $XTRABACKUP_ARGS >$XTRABACKUP_OUT;
+--enable_result_log
+--source include/show_xtrabackup_slave_info.inc
+--source include/show_xtrabackup_slave_info_out.inc
+--remove_file $XTRABACKUP_OUT
+rmdir $targetdir;
+
+--echo
+SET GLOBAL gtid_slave_pos='1-1-1,2-2-2';
+CHANGE MASTER 'master3' TO MASTER_HOST='localhost', MASTER_PORT=10003, MASTER_USE_GTID=slave_pos;
+CHANGE MASTER 'master4' TO MASTER_HOST='localhost', MASTER_PORT=10004, MASTER_USE_GTID=no;
+CHANGE MASTER 'master5' TO MASTER_HOST='localhost', MASTER_PORT=10005, MASTER_USE_GTID=slave_pos;
+
+--disable_result_log
+exec $XTRABACKUP $XTRABACKUP_ARGS >$XTRABACKUP_OUT;
+--enable_result_log
+--source include/show_xtrabackup_slave_info.inc
+--source include/show_xtrabackup_slave_info_out.inc
+--remove_file $XTRABACKUP_OUT
+rmdir $targetdir;
+
+--echo
+CHANGE MASTER TO MASTER_HOST='localhost', MASTER_PORT=10000, MASTER_USE_GTID=slave_pos;
+--disable_result_log
+exec $XTRABACKUP $XTRABACKUP_ARGS >$XTRABACKUP_OUT;
+--enable_result_log
+--source include/show_xtrabackup_slave_info.inc
+--source include/show_xtrabackup_slave_info_out.inc
+--remove_file $XTRABACKUP_OUT
+rmdir $targetdir;
+
+RESET SLAVE ALL;
+RESET SLAVE 'master2' ALL;
+RESET SLAVE 'master3' ALL;
+RESET SLAVE 'master4' ALL;
+RESET SLAVE 'master5' ALL;
+
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/suite/parts/inc/part_alter_values.inc b/mysql-test/suite/parts/inc/part_alter_values.inc
index 2f16476c78b..ca18faa5758 100644
--- a/mysql-test/suite/parts/inc/part_alter_values.inc
+++ b/mysql-test/suite/parts/inc/part_alter_values.inc
@@ -1,3 +1,5 @@
+--source include/have_symlink.inc
+
--echo #
--echo # MDEV-14641 Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine
--echo #
diff --git a/mysql-test/suite/parts/t/partition_alter_myisam.test b/mysql-test/suite/parts/t/partition_alter_myisam.test
index 326cf52b018..d3abb8842e1 100644
--- a/mysql-test/suite/parts/t/partition_alter_myisam.test
+++ b/mysql-test/suite/parts/t/partition_alter_myisam.test
@@ -1,5 +1,4 @@
--source include/have_partition.inc
---source include/have_symlink.inc
--let $engine=MyISAM
--source inc/part_alter_values.inc
diff --git a/mysql-test/suite/perfschema/include/socket_ipv6.inc b/mysql-test/suite/perfschema/include/socket_ipv6.inc
index dd077a12c7a..0c9f47abe47 100644
--- a/mysql-test/suite/perfschema/include/socket_ipv6.inc
+++ b/mysql-test/suite/perfschema/include/socket_ipv6.inc
@@ -20,6 +20,7 @@ let $check_ipv6_just_check= 1;
#==============================================================================
--disable_query_log
--disable_result_log
+--disable_connect_log
--disable_abort_on_error
let $check_ipv6_supported= 1;
@@ -44,6 +45,7 @@ if(!$mysql_errno)
connection default;
--enable_abort_on_error
+--enable_connect_log
--enable_result_log
--enable_query_log
@@ -62,6 +64,7 @@ let $check_ipv4_mapped_just_check= 1;
#==============================================================================
--disable_query_log
--disable_result_log
+--disable_connect_log
--disable_abort_on_error
let $check_ipv4_mapped_supported= 1;
@@ -86,6 +89,7 @@ if(!$mysql_errno)
connection default;
--enable_abort_on_error
+--enable_connect_log
--enable_result_log
--enable_query_log
diff --git a/mysql-test/suite/perfschema/r/socket_connect.result b/mysql-test/suite/perfschema/r/socket_connect.result
index 304521b044f..cbb83b94891 100644
--- a/mysql-test/suite/perfschema/r/socket_connect.result
+++ b/mysql-test/suite/perfschema/r/socket_connect.result
@@ -1,7 +1,6 @@
#==============================================================================
# Establish the level of IPV6 support
#==============================================================================
-connection default;
#==============================================================================
# Get hostname, port number
#==============================================================================
diff --git a/mysql-test/suite/perfschema/r/socket_summary_by_event_name_func.result b/mysql-test/suite/perfschema/r/socket_summary_by_event_name_func.result
index 455b6a2ad00..4fd3a4a237c 100644
--- a/mysql-test/suite/perfschema/r/socket_summary_by_event_name_func.result
+++ b/mysql-test/suite/perfschema/r/socket_summary_by_event_name_func.result
@@ -1,7 +1,6 @@
#==============================================================================
# Establish the level of IPV6 support
#==============================================================================
-connection default;
#==============================================================================
# Get hostname, port number
#==============================================================================
diff --git a/mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test b/mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test
index 42bcb3e4d70..445be52a089 100644
--- a/mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test
+++ b/mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test
@@ -38,8 +38,6 @@
# prepared statement.
--source include/no_protocol.inc
-set global session_track_schema=FALSE;
-
#===================================
# Set IP address defaults with respect to IPV6 support
#
@@ -73,6 +71,7 @@ if($my_socket_debug)
--echo IPV6=$check_ipv6_supported, IPV4_MAPPED = $check_ipv4_mapped_supported, LOCALHOST = $my_localhost
}
#===================================
+set global session_track_schema=FALSE;
--echo # The logging of commands and result sets is mostly disabled.
--echo # There are some messages which help to observe the progress of the test.
diff --git a/mysql-test/suite/roles/definer.result b/mysql-test/suite/roles/definer.result
index 30911265436..a5551e7dede 100644
--- a/mysql-test/suite/roles/definer.result
+++ b/mysql-test/suite/roles/definer.result
@@ -438,14 +438,14 @@ DELIMITER ;;
/*!50003 SET collation_connection = @saved_col_connection */ ;;
DELIMITER ;
/*!50106 SET TIME_ZONE= @save_time_zone */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = latin1 */ ;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`role1` FUNCTION `fn1`() RETURNS int(11)
return (select sum(a+b) from t1) ;;
@@ -454,14 +454,14 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = latin1 */ ;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`role2` FUNCTION `fn2`() RETURNS int(11)
return (select sum(a+b) from t1) ;;
@@ -470,14 +470,14 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = latin1 */ ;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`role3`@`%` FUNCTION `fn3`() RETURNS int(11)
return (select sum(a+b) from t1) ;;
@@ -486,14 +486,14 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = latin1 */ ;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`role1` PROCEDURE `pr1`()
insert t1 values (111, 222, 333) ;;
@@ -502,14 +502,14 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = latin1 */ ;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`role2`@`%` PROCEDURE `pr2`()
insert t1 values (111, 222, 333) ;;
@@ -518,14 +518,14 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = latin1 */ ;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`role3`@`%` PROCEDURE `pr3`()
insert t1 values (111, 222, 333) ;;
diff --git a/mysql-test/suite/rpl/include/rpl_parallel.inc b/mysql-test/suite/rpl/include/rpl_parallel.inc
index b88d2126d4d..9ba7a30f2eb 100644
--- a/mysql-test/suite/rpl/include/rpl_parallel.inc
+++ b/mysql-test/suite/rpl/include/rpl_parallel.inc
@@ -1872,6 +1872,7 @@ SET GLOBAL slave_parallel_threads=10;
SET GLOBAL slave_parallel_threads=1;
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000";
+CALL mtr.add_suppression("Unexpected break of being relay-logged GTID");
--connection server_1
INSERT INTO t2 VALUES (101);
diff --git a/mysql-test/suite/rpl/include/rpl_ssl.inc b/mysql-test/suite/rpl/include/rpl_ssl.inc
index aff5499c8e5..bd77f213ae1 100644
--- a/mysql-test/suite/rpl/include/rpl_ssl.inc
+++ b/mysql-test/suite/rpl/include/rpl_ssl.inc
@@ -37,7 +37,7 @@ select * from t1;
# The slave is synced and waiting/reading from master
# SHOW SLAVE STATUS will show "Waiting for master to send event"
-let $status_items= Master_SSL_Allowed, Master_SSL_CA_Path, Master_SSL_CA_File, Master_SSL_Cert, Master_SSL_Key;
+let $status_items= Master_SSL_Allowed, Master_SSL_CA_Path, Master_SSL_CA_File, Master_SSL_Crl, Master_SSL_Crlpath, Master_SSL_Cert, Master_SSL_Key;
source include/show_slave_status.inc;
source include/check_slave_is_running.inc;
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_grouping.result b/mysql-test/suite/rpl/r/rpl_gtid_grouping.result
new file mode 100644
index 00000000000..ad7d6116c49
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_gtid_grouping.result
@@ -0,0 +1,54 @@
+include/master-slave.inc
+[connection master]
+connection slave;
+call mtr.add_suppression("Unexpected break of being relay-logged GTID 0-27697-1000");
+call mtr.add_suppression("Relay log write failure: could not queue event from master");
+call mtr.add_suppression("The current group of events starts with a non-GTID");
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
+include/start_slave.inc
+connection master;
+CREATE TABLE t (a INT) ENGINE=innodb;
+INSERT INTO t VALUES(1);
+### A. Simulate an unnoticeable loss of Xid event
+connection slave;
+SET @@global.debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000";
+connection master;
+SET @@gtid_seq_no=1000;
+set @@server_id=27697;
+INSERT INTO t VALUES(1000);
+set @@server_id=default;
+INSERT INTO t VALUES(1001);
+## Prove the error occurs.
+connection slave;
+include/wait_for_slave_io_error.inc [errno=1595]
+## Prove the slave recovers after the simulation condtion is lifted.
+SET @@global.debug_dbug=default;
+include/start_slave.inc
+### B. Do the same to GTID event.
+connection slave;
+SET @@global.debug_dbug="+d,slave_discard_gtid_0_x_1002";
+connection master;
+SET @@gtid_seq_no=1002;
+set @@server_id=27697;
+INSERT INTO t VALUES(1002);
+set @@server_id=default;
+INSERT INTO t VALUES(1003);
+## Prove the error occurs.
+connection slave;
+include/wait_for_slave_io_error.inc [errno=1595]
+## Prove the slave recovers after the simulation condtion is lifted.
+SET @@global.debug_dbug=default;
+include/start_slave.inc
+connection master;
+connection slave;
+include/diff_tables.inc [master:t,slave:t]
+"===== Clean up ====="
+connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=no;
+include/start_slave.inc
+connection master;
+DROP TABLE t;
+SET GLOBAL LOG_WARNINGS=default;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_iodku,stmt.rdiff b/mysql-test/suite/rpl/r/rpl_iodku,stmt.rdiff
new file mode 100644
index 00000000000..e31f1e5d991
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_iodku,stmt.rdiff
@@ -0,0 +1,27 @@
+--- r/rpl_iodku.result 2022-05-04 18:51:24.956414404 +0300
++++ r/rpl_iodku,stmt.reject 2022-05-04 18:51:49.520106231 +0300
+@@ -1,10 +1,15 @@
+ include/master-slave.inc
+ [connection master]
++call mtr.add_suppression("Unsafe statement written to the binary log using statement");
+ CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, a INT, b INT, c INT,
+ UNIQUE (a), UNIQUE (b)) ENGINE=innodb;
+ INSERT INTO t1 (`a`,`c`) VALUES (1,1), (2,1) ON DUPLICATE KEY UPDATE c = 1;
++Warnings:
++Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe
+ # UNSAFE
+ INSERT INTO t1 (`a`,`c`) VALUES (3, 1),(2,1), (1,1) ON DUPLICATE KEY UPDATE c = a * 10 + VALUES(c);
++Warnings:
++Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe
+ SELECT * from t1;
+ id a b c
+ 1 1 NULL 11
+@@ -17,6 +22,8 @@
+ INSERT INTO t1 VALUES (1,10,1);
+ # eligable for the statement format run unsafe warning
+ INSERT INTO t1 VALUES (2,20,2) ON DUPLICATE KEY UPDATE c = 100;
++Warnings:
++Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe
+ # not eligable: no warning in the statement format run
+ INSERT INTO t1 (`a`,`c`) VALUES (3, 1) ON DUPLICATE KEY UPDATE c = 99;
+ SELECT * from t1;
diff --git a/mysql-test/suite/rpl/r/rpl_iodku.result b/mysql-test/suite/rpl/r/rpl_iodku.result
new file mode 100644
index 00000000000..55348da1439
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_iodku.result
@@ -0,0 +1,32 @@
+include/master-slave.inc
+[connection master]
+CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, a INT, b INT, c INT,
+UNIQUE (a), UNIQUE (b)) ENGINE=innodb;
+INSERT INTO t1 (`a`,`c`) VALUES (1,1), (2,1) ON DUPLICATE KEY UPDATE c = 1;
+# UNSAFE
+INSERT INTO t1 (`a`,`c`) VALUES (3, 1),(2,1), (1,1) ON DUPLICATE KEY UPDATE c = a * 10 + VALUES(c);
+SELECT * from t1;
+id a b c
+1 1 NULL 11
+2 2 NULL 21
+3 3 NULL 1
+connection slave;
+include/diff_tables.inc [master:t1,slave:t1]
+connection master;
+CREATE OR REPLACE TABLE t1 (a INT, b INT, c INT, UNIQUE (a), UNIQUE (b)) ENGINE=innodb;
+INSERT INTO t1 VALUES (1,10,1);
+# eligable for the statement format run unsafe warning
+INSERT INTO t1 VALUES (2,20,2) ON DUPLICATE KEY UPDATE c = 100;
+# not eligable: no warning in the statement format run
+INSERT INTO t1 (`a`,`c`) VALUES (3, 1) ON DUPLICATE KEY UPDATE c = 99;
+SELECT * from t1;
+a b c
+1 10 1
+2 20 2
+3 NULL 1
+connection slave;
+include/diff_tables.inc [master:t1,slave:t1]
+connection master;
+DROP TABLE t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_mdev_17614.result b/mysql-test/suite/rpl/r/rpl_mdev_17614.result
index 39057334926..ba077111522 100644
--- a/mysql-test/suite/rpl/r/rpl_mdev_17614.result
+++ b/mysql-test/suite/rpl/r/rpl_mdev_17614.result
@@ -1,5 +1,6 @@
include/master-slave.inc
[connection master]
+# Case 1: UNSAFE
call mtr.add_suppression("Unsafe statement written to the binary log using statement format");
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY , b INT,
UNIQUE(b), c int) engine=innodb;
@@ -37,6 +38,7 @@ drop table t1;
connection slave;
start slave;
include/wait_for_slave_to_start.inc
+# Case 2: UNSAFE
connection master;
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY auto_increment, b INT,
UNIQUE(b), c int) engine=innodb;
@@ -45,8 +47,12 @@ connection master;
INSERT INTO t1 VALUES (default, 1, 1);
BEGIN;
INSERT INTO t1 VALUES (default, 1, 2) ON DUPLICATE KEY UPDATE b=VALUES(b), c=VALUES(c);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe
connection master1;
INSERT INTO t1 VALUES(default, 2, 3) ON DUPLICATE KEY UPDATE b=VALUES(b), c=VALUES(c);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe
connection master;
COMMIT;
SELECT * FROM t1;
@@ -62,6 +68,7 @@ a b c
connection master;
drop table t1;
connection slave;
+# Case 3A: UNSAFE
connection master;
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT,
UNIQUE(b), c int, d int ) engine=innodb;
@@ -93,6 +100,67 @@ a b c d
connection master;
drop table t1;
connection slave;
+# Case 3B: UNSAFE - all column specified.
+connection master;
+CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT,
+UNIQUE(b), c int, d int ) engine=innodb;
+connection slave;
+connection master;
+INSERT INTO t1 VALUES (1, 1, 1, 1);
+BEGIN;
+INSERT INTO t1 VALUES (2, NULL, 2, 2) ON DUPLICATE KEY UPDATE c=VALUES(c);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe
+connection master1;
+INSERT INTO t1 VALUES(3, NULL, 2, 3) ON DUPLICATE KEY UPDATE c=VALUES(c);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe
+connection master;
+COMMIT;
+SELECT * FROM t1;
+a b c d
+1 1 1 1
+2 NULL 2 2
+3 NULL 2 3
+connection slave;
+#same data as master
+SELECT * FROM t1;
+a b c d
+1 1 1 1
+2 NULL 2 2
+3 NULL 2 3
+connection master;
+drop table t1;
+connection slave;
+# Case 3C: SAFE - only one unique key (PK) specified.
+connection master;
+CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT,
+UNIQUE(b), c int, d int ) engine=innodb;
+connection slave;
+connection master;
+INSERT INTO t1 VALUES (1, 1, 1, 1);
+BEGIN;
+INSERT INTO t1 (`a`, `c`, `d`) VALUES (2, 2, 2) ON DUPLICATE KEY UPDATE c=99;
+connection master1;
+INSERT INTO t1 (`a`, `c`, `d`) VALUES(3, 2, 3) ON DUPLICATE KEY UPDATE c=100;
+connection master;
+COMMIT;
+SELECT * FROM t1;
+a b c d
+1 1 1 1
+2 NULL 2 2
+3 NULL 2 3
+connection slave;
+#same data as master
+SELECT * FROM t1;
+a b c d
+1 1 1 1
+2 NULL 2 2
+3 NULL 2 3
+connection master;
+drop table t1;
+connection slave;
+# Case 4: UNSAFE
connection master;
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY auto_increment, b INT,
UNIQUE(b), c int) engine=innodb;
@@ -101,8 +169,12 @@ connection master;
INSERT INTO t1 VALUES (1, 1, 1);
BEGIN;
INSERT INTO t1 VALUES (2, 1, 2) ON DUPLICATE KEY UPDATE b=VALUES(b), c=VALUES(c);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe
connection master1;
INSERT INTO t1 VALUES(2, 2, 3) ON DUPLICATE KEY UPDATE b=VALUES(b), c=VALUES(c);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe
connection master;
COMMIT;
SELECT * FROM t1;
diff --git a/mysql-test/suite/rpl/r/rpl_parallel.result b/mysql-test/suite/rpl/r/rpl_parallel.result
index c5ae4d9984c..9b2e68d366e 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel.result
@@ -1378,6 +1378,7 @@ include/stop_slave.inc
SET GLOBAL slave_parallel_threads=1;
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000";
+CALL mtr.add_suppression("Unexpected break of being relay-logged GTID");
connection server_1;
INSERT INTO t2 VALUES (101);
INSERT INTO t2 VALUES (102);
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_temptable.result b/mysql-test/suite/rpl/r/rpl_parallel_temptable.result
index 52efed22541..1a1c12f836d 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel_temptable.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel_temptable.result
@@ -132,8 +132,13 @@ connection server_1;
INSERT INTO t1 VALUES (0, 1);
include/save_master_gtid.inc
connection server_2;
+set @@sql_log_bin=0;
+call mtr.add_suppression("Unexpected break of being relay-logged GTID 1-1-32 event group by the current GTID event 0-1-4");
+set @@sql_log_bin=1;
+set @@global.debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000";
include/start_slave.inc
include/sync_with_master_gtid.inc
+set @@global.debug_dbug="";
SELECT * FROM t1 ORDER BY a;
a b
0 1
diff --git a/mysql-test/suite/rpl/r/rpl_ssl.result b/mysql-test/suite/rpl/r/rpl_ssl.result
index 0b3a6cd0eca..ce9e4d486cf 100644
--- a/mysql-test/suite/rpl/r/rpl_ssl.result
+++ b/mysql-test/suite/rpl/r/rpl_ssl.result
@@ -23,6 +23,8 @@ t
Master_SSL_Allowed = 'Yes'
Master_SSL_CA_Path = ''
Master_SSL_CA_File = 'MYSQL_TEST_DIR/std_data/cacert.pem'
+Master_SSL_Crl = ''
+Master_SSL_Crlpath = ''
Master_SSL_Cert = 'MYSQL_TEST_DIR/std_data/client-cert.pem'
Master_SSL_Key = 'MYSQL_TEST_DIR/std_data/client-key.pem'
include/check_slave_is_running.inc
@@ -37,6 +39,8 @@ include/wait_for_slave_to_start.inc
Master_SSL_Allowed = 'Yes'
Master_SSL_CA_Path = ''
Master_SSL_CA_File = 'MYSQL_TEST_DIR/std_data/cacert.pem'
+Master_SSL_Crl = ''
+Master_SSL_Crlpath = ''
Master_SSL_Cert = 'MYSQL_TEST_DIR/std_data/client-cert.pem'
Master_SSL_Key = 'MYSQL_TEST_DIR/std_data/client-key.pem'
include/check_slave_is_running.inc
diff --git a/mysql-test/suite/rpl/r/rpl_unsafe_statements.result b/mysql-test/suite/rpl/r/rpl_unsafe_statements.result
index 0ce94ca63d0..ca790f5d148 100644
--- a/mysql-test/suite/rpl/r/rpl_unsafe_statements.result
+++ b/mysql-test/suite/rpl/r/rpl_unsafe_statements.result
@@ -1,6 +1,5 @@
include/master-slave.inc
[connection master]
-call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
CREATE TABLE t1(id INT AUTO_INCREMENT, i INT, PRIMARY KEY (id)) ENGINE=INNODB;
CREATE TABLE t2(id INT AUTO_INCREMENT, i INT, PRIMARY KEY (id)) ENGINE=INNODB;
CREATE TRIGGER trig1 AFTER INSERT ON t1
@@ -50,13 +49,9 @@ connection master;
DROP TABLE t1;
CREATE TABLE t1(i INT, j INT, UNIQUE KEY(i), UNIQUE KEY(j)) ENGINE=INNODB;
INSERT INTO t1 (i,j) VALUES (1,2) ON DUPLICATE KEY UPDATE j=j+1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe
START TRANSACTION;
LOCK TABLES t1 WRITE;
INSERT INTO t1 (i,j) VALUES (1,2) ON DUPLICATE KEY UPDATE j=j+1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe
UNLOCK TABLES;
COMMIT;
connection slave;
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_grouping.test b/mysql-test/suite/rpl/t/rpl_gtid_grouping.test
new file mode 100644
index 00000000000..66448c4f96c
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_gtid_grouping.test
@@ -0,0 +1,97 @@
+# ==== Purpose ====
+#
+# Test verifies that replicated transaction boundaries are set properly
+# at receiving from master time.
+#
+# ==== Implementation ====
+#
+# A. Simulate an unnoticeable loss of Xid event to observe a slave error,
+# then restart slave to recover from the failure.
+# B. Do the same to GTID event.
+#
+# ==== References ====
+#
+# MDEV-27697 slave must recognize incomplete replication event group
+#
+--source include/have_binlog_format_mixed.inc
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/master-slave.inc
+
+--connection slave
+call mtr.add_suppression("Unexpected break of being relay-logged GTID 0-27697-1000");
+call mtr.add_suppression("Relay log write failure: could not queue event from master");
+call mtr.add_suppression("The current group of events starts with a non-GTID");
+
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
+--source include/start_slave.inc
+
+--connection master
+CREATE TABLE t (a INT) ENGINE=innodb;
+INSERT INTO t VALUES(1);
+save_master_pos;
+
+--echo ### A. Simulate an unnoticeable loss of Xid event
+--sync_slave_with_master
+SET @@global.debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000";
+
+--connection master
+SET @@gtid_seq_no=1000;
+set @@server_id=27697;
+INSERT INTO t VALUES(1000);
+set @@server_id=default;
+INSERT INTO t VALUES(1001);
+
+--echo ## Prove the error occurs.
+--connection slave
+# ER_SLAVE_RELAY_LOG_WRITE_FAILURE
+--let $slave_io_errno = 1595
+--source include/wait_for_slave_io_error.inc
+## EOP
+
+--echo ## Prove the slave recovers after the simulation condtion is lifted.
+SET @@global.debug_dbug=default;
+--source include/start_slave.inc
+
+--echo ### B. Do the same to GTID event.
+--connection slave
+SET @@global.debug_dbug="+d,slave_discard_gtid_0_x_1002";
+
+--connection master
+SET @@gtid_seq_no=1002;
+set @@server_id=27697;
+INSERT INTO t VALUES(1002);
+set @@server_id=default;
+INSERT INTO t VALUES(1003);
+
+--echo ## Prove the error occurs.
+--connection slave
+# ER_SLAVE_RELAY_LOG_WRITE_FAILURE
+--let $slave_io_errno = 1595
+--source include/wait_for_slave_io_error.inc
+## EOP
+
+--echo ## Prove the slave recovers after the simulation condtion is lifted.
+SET @@global.debug_dbug=default;
+--source include/start_slave.inc
+
+--connection master
+save_master_pos;
+
+--sync_slave_with_master
+## EOP
+
+--let $diff_tables=master:t,slave:t
+--source include/diff_tables.inc
+
+--echo "===== Clean up ====="
+--connection slave
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=no;
+--source include/start_slave.inc
+
+--connection master
+DROP TABLE t;
+SET GLOBAL LOG_WARNINGS=default;
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_iodku.test b/mysql-test/suite/rpl/t/rpl_iodku.test
new file mode 100644
index 00000000000..815b927c350
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_iodku.test
@@ -0,0 +1,50 @@
+--source include/have_innodb.inc
+--source include/master-slave.inc
+
+if (`select @@binlog_format = "statement"`)
+{
+ call mtr.add_suppression("Unsafe statement written to the binary log using statement");
+}
+
+## MDEV-28310 loss of binlog event for multi-record IODKU
+# Check that the duplicate key error does not cause
+# loss of replication event for IODKU that specifies values
+# for at least two unique columns per record.
+# "Implicit" NULL value of the auto-increment column also counts.
+
+CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, a INT, b INT, c INT,
+ UNIQUE (a), UNIQUE (b)) ENGINE=innodb;
+INSERT INTO t1 (`a`,`c`) VALUES (1,1), (2,1) ON DUPLICATE KEY UPDATE c = 1;
+--echo # UNSAFE
+# because of two keys involved: a UK and PK even though implicitly via auto-inc
+INSERT INTO t1 (`a`,`c`) VALUES (3, 1),(2,1), (1,1) ON DUPLICATE KEY UPDATE c = a * 10 + VALUES(c);
+SELECT * from t1;
+
+--sync_slave_with_master
+--let $diff_tables = master:t1,slave:t1
+--source include/diff_tables.inc
+
+## MDEV-21810 MBR: Unexpected "Unsafe statement" warning for unsafe IODKU
+# Unnecessary unsafe statement warning is not error-logged anymore.
+
+
+--connection master
+CREATE OR REPLACE TABLE t1 (a INT, b INT, c INT, UNIQUE (a), UNIQUE (b)) ENGINE=innodb;
+INSERT INTO t1 VALUES (1,10,1);
+--echo # eligable for the statement format run unsafe warning
+INSERT INTO t1 VALUES (2,20,2) ON DUPLICATE KEY UPDATE c = 100;
+--echo # not eligable: no warning in the statement format run
+INSERT INTO t1 (`a`,`c`) VALUES (3, 1) ON DUPLICATE KEY UPDATE c = 99;
+SELECT * from t1;
+
+--sync_slave_with_master
+--let $diff_tables = master:t1,slave:t1
+--source include/diff_tables.inc
+
+# Cleanup
+--connection master
+DROP TABLE t1;
+--sync_slave_with_master
+
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_mdev_17614.test b/mysql-test/suite/rpl/t/rpl_mdev_17614.test
index 9b86c8c15b5..c11aad3305e 100644
--- a/mysql-test/suite/rpl/t/rpl_mdev_17614.test
+++ b/mysql-test/suite/rpl/t/rpl_mdev_17614.test
@@ -2,15 +2,22 @@ source include/have_debug.inc;
source include/have_innodb.inc;
-- source include/have_binlog_format_statement.inc
source include/master-slave.inc;
-# MDEV-17614
-# INSERT on dup key update is replication unsafe
-# There can be three case
-# 1. 2 unique key, Replication is unsafe.
-# 2. 2 unique key , with one auto increment key, Safe to replicate because Innodb will acquire gap lock
-# 3. n no of unique keys (n>1) but insert is only in 1 unique key
-# 4. 2 unique key , with one auto increment key(but user gives auto inc value), unsafe to replicate
+# MDEV-17614 INSERT on dup key update is replication unsafe
+#
+# The following cases are tested below:
+# 1. 2 unique key, replication is UNSAFE
+# 2. 2 unique key, with one auto increment key and implicit value to it.
+# It is UNSAFE because autoinc column values of being inserted records
+# are revealed dynamically, so unknown at the binlog-format decision time
+# and hence this pessimistic expectation
+# 3. 2 unique keys
+# A. insert is only in 1 unique key, still all colums are specified => UNSAFE
+# B. both unique keys are specified => UNSAFE
+# C. only one unique key is specified => SAFE (motivated by MDEV-28310)
+# 4. 2 unique key, with one auto increment key(but user gives auto inc value) =>
+# UNSAFE to replicate
-# Case 1
+--echo # Case 1: UNSAFE
call mtr.add_suppression("Unsafe statement written to the binary log using statement format");
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY , b INT,
UNIQUE(b), c int) engine=innodb;
@@ -42,7 +49,8 @@ drop table t1;
connection slave;
start slave;
--source include/wait_for_slave_to_start.inc
-# Case 2
+
+--echo # Case 2: UNSAFE
--connection master
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY auto_increment, b INT,
UNIQUE(b), c int) engine=innodb;
@@ -64,7 +72,7 @@ connection master;
drop table t1;
--sync_slave_with_master
-# Case 3
+--echo # Case 3A: UNSAFE
--connection master
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT,
UNIQUE(b), c int, d int ) engine=innodb;
@@ -85,7 +93,50 @@ connection master;
drop table t1;
--sync_slave_with_master
-# Case 4
+--echo # Case 3B: UNSAFE - all column specified.
+--connection master
+CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT,
+UNIQUE(b), c int, d int ) engine=innodb;
+sync_slave_with_master;
+connection master;
+INSERT INTO t1 VALUES (1, 1, 1, 1);
+BEGIN;
+INSERT INTO t1 VALUES (2, NULL, 2, 2) ON DUPLICATE KEY UPDATE c=VALUES(c);
+ --connection master1
+ INSERT INTO t1 VALUES(3, NULL, 2, 3) ON DUPLICATE KEY UPDATE c=VALUES(c);
+--connection master
+COMMIT;
+SELECT * FROM t1;
+--sync_slave_with_master
+--echo #same data as master
+SELECT * FROM t1;
+connection master;
+drop table t1;
+--sync_slave_with_master
+
+
+--echo # Case 3C: SAFE - only one unique key (PK) specified.
+--connection master
+CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT,
+UNIQUE(b), c int, d int ) engine=innodb;
+sync_slave_with_master;
+connection master;
+INSERT INTO t1 VALUES (1, 1, 1, 1);
+BEGIN;
+INSERT INTO t1 (`a`, `c`, `d`) VALUES (2, 2, 2) ON DUPLICATE KEY UPDATE c=99;
+ --connection master1
+ INSERT INTO t1 (`a`, `c`, `d`) VALUES(3, 2, 3) ON DUPLICATE KEY UPDATE c=100;
+--connection master
+COMMIT;
+SELECT * FROM t1;
+--sync_slave_with_master
+--echo #same data as master
+SELECT * FROM t1;
+connection master;
+drop table t1;
+--sync_slave_with_master
+
+--echo # Case 4: UNSAFE
--connection master
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY auto_increment, b INT,
UNIQUE(b), c int) engine=innodb;
diff --git a/mysql-test/suite/rpl/t/rpl_parallel_temptable.test b/mysql-test/suite/rpl/t/rpl_parallel_temptable.test
index 04165ee4752..edb854842e1 100644
--- a/mysql-test/suite/rpl/t/rpl_parallel_temptable.test
+++ b/mysql-test/suite/rpl/t/rpl_parallel_temptable.test
@@ -201,9 +201,16 @@ INSERT INTO t1 VALUES (0, 1);
# execution of format_description event will not wait infinitely
# for a commit of the incomplete group that never happens.
+# Apart from the suppression, MDEV-27697 refinement to the original test needs
+# an allowance to one time accept malformed event group.
+set @@sql_log_bin=0;
+call mtr.add_suppression("Unexpected break of being relay-logged GTID 1-1-32 event group by the current GTID event 0-1-4");
+set @@sql_log_bin=1;
+set @@global.debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000";
--source include/start_slave.inc
#--sync_with_master
--source include/sync_with_master_gtid.inc
+set @@global.debug_dbug="";
SELECT * FROM t1 ORDER BY a;
SHOW STATUS LIKE 'Slave_open_temp_tables';
diff --git a/mysql-test/suite/rpl/t/rpl_unsafe_statements.test b/mysql-test/suite/rpl/t/rpl_unsafe_statements.test
index aa0bd076398..cbb4b54a220 100644
--- a/mysql-test/suite/rpl/t/rpl_unsafe_statements.test
+++ b/mysql-test/suite/rpl/t/rpl_unsafe_statements.test
@@ -24,7 +24,7 @@
--source include/have_innodb.inc
--source include/have_binlog_format_mixed.inc
--source include/master-slave.inc
-call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+
# Case-1: BINLOG_STMT_UNSAFE_AUTOINC_COLUMNS
# Statement is unsafe because it invokes a trigger or a
# stored function that inserts into an AUTO_INCREMENT column.
diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result
index b7bd63f662e..6b2457ff323 100644
--- a/mysql-test/suite/vcol/r/vcol_misc.result
+++ b/mysql-test/suite/vcol/r/vcol_misc.result
@@ -247,7 +247,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(20) DEFAULT NULL,
- `b` bigint(20) GENERATED ALWAYS AS (`a` > '2') VIRTUAL
+ `b` bigint(20) GENERATED ALWAYS AS (`a` > 2) VIRTUAL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 (a) values (1),(3);
select * from t1;
@@ -531,5 +531,25 @@ a b
DROP TABLE t1;
SET sql_mode=DEFAULT;
#
+# CONTEXT_ANALYSIS_ONLY_VCOL_EXPR
+#
+create table t1 (c1 char(1) character set ucs2 collate ucs2_test_ci,
+v1 char(1) character set ucs2 collate ucs2_test_ci as (c1),
+v2 int as (c1 = 'b'),
+v3 int as (v1 = 'b'));
+insert into t1 (c1) values ('a');
+select * from t1 where v1 = 'b';
+c1 v1 v2 v3
+a a 1 1
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` char(1) CHARACTER SET ucs2 COLLATE ucs2_test_ci DEFAULT NULL,
+ `v1` char(1) CHARACTER SET ucs2 GENERATED ALWAYS AS (`c1`) VIRTUAL,
+ `v2` int(11) GENERATED ALWAYS AS (`c1` = 'b') VIRTUAL,
+ `v3` int(11) GENERATED ALWAYS AS (`v1` = 'b') VIRTUAL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/suite/vcol/r/vcol_syntax.result b/mysql-test/suite/vcol/r/vcol_syntax.result
index a799c13cd92..ffe5ec495c3 100644
--- a/mysql-test/suite/vcol/r/vcol_syntax.result
+++ b/mysql-test/suite/vcol/r/vcol_syntax.result
@@ -183,8 +183,17 @@ select a from t1 order by 'x' = b;
a
drop table t1;
create table t1 (a int , b date as (1 in ('x' ,(database ()) ))) ;
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+Warning 1292 Truncated incorrect DOUBLE value: 'test'
select b from t1;
b
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+Warning 1292 Truncated incorrect DOUBLE value: 'test'
select a from t1 order by 'x' = b;
a
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+Warning 1292 Truncated incorrect DOUBLE value: 'test'
drop table t1;
diff --git a/mysql-test/suite/vcol/r/wrong_arena.result b/mysql-test/suite/vcol/r/wrong_arena.result
index cd36801f601..d5ba19b3db3 100644
--- a/mysql-test/suite/vcol/r/wrong_arena.result
+++ b/mysql-test/suite/vcol/r/wrong_arena.result
@@ -1,3 +1,6 @@
+#
+# MDEV-9690 concurrent queries with virtual columns crash in temporal code
+#
create table t1 (a datetime,
# get_datetime_value
b int as (a > 1), # Arg_comparator
@@ -59,6 +62,9 @@ a b
Warnings:
Warning 1292 Truncated incorrect datetime value: '1'
drop table t1;
+#
+# MDEV-13435 Crash when selecting virtual columns generated using JSON functions
+#
create table t1 (
id int not null ,
js varchar(1000) not null,
@@ -68,3 +74,16 @@ select * from t1;
id js t
0 {"default" : {"start": "00:00:00", "end":"23:59:50"}} NULL
drop table t1;
+#
+# MDEV-26281 ASAN use-after-poison when complex conversion is involved in blob
+#
+create table t1 (v2 blob as ('a' is null), a1 int, a char(1) as (cast(a1 in (0,current_user() is null) as char(16777216) )));
+insert ignore into t1 values ('x','x',v2) ;
+Warnings:
+Warning 1906 The value specified for generated column 'v2' in table 't1' has been ignored
+Warning 1366 Incorrect integer value: 'x' for column `test`.`t1`.`a1` at row 1
+Warning 1906 The value specified for generated column 'a' in table 't1' has been ignored
+drop table t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/suite/vcol/t/vcol_misc.opt b/mysql-test/suite/vcol/t/vcol_misc.opt
new file mode 100644
index 00000000000..fd1faea4f8e
--- /dev/null
+++ b/mysql-test/suite/vcol/t/vcol_misc.opt
@@ -0,0 +1 @@
+--character-sets-dir=$MYSQL_TEST_DIR/std_data/ldml/
diff --git a/mysql-test/suite/vcol/t/vcol_misc.test b/mysql-test/suite/vcol/t/vcol_misc.test
index 6f770190bb1..93fc84ba74c 100644
--- a/mysql-test/suite/vcol/t/vcol_misc.test
+++ b/mysql-test/suite/vcol/t/vcol_misc.test
@@ -506,5 +506,20 @@ DROP TABLE t1;
SET sql_mode=DEFAULT;
--echo #
+--echo # CONTEXT_ANALYSIS_ONLY_VCOL_EXPR
+--echo #
+
+--source include/have_ucs2.inc
+create table t1 (c1 char(1) character set ucs2 collate ucs2_test_ci,
+ v1 char(1) character set ucs2 collate ucs2_test_ci as (c1),
+ v2 int as (c1 = 'b'),
+ v3 int as (v1 = 'b'));
+insert into t1 (c1) values ('a');
+select * from t1 where v1 = 'b';
+show create table t1;
+drop table t1;
+
+--echo #
--echo # End of 10.2 tests
--echo #
+
diff --git a/mysql-test/suite/vcol/t/wrong_arena.test b/mysql-test/suite/vcol/t/wrong_arena.test
index 8ac1af5c36b..296cb68f5c0 100644
--- a/mysql-test/suite/vcol/t/wrong_arena.test
+++ b/mysql-test/suite/vcol/t/wrong_arena.test
@@ -3,9 +3,9 @@
# not in the TABLE::expr_arena.
#
-#
-# MDEV-9690 concurrent queries with virtual columns crash in temporal code
-#
+--echo #
+--echo # MDEV-9690 concurrent queries with virtual columns crash in temporal code
+--echo #
create table t1 (a datetime,
# get_datetime_value
b int as (a > 1), # Arg_comparator
@@ -40,9 +40,9 @@ connection default;
select * from t1;
drop table t1;
-#
-# MDEV-13435 Crash when selecting virtual columns generated using JSON functions
-#
+--echo #
+--echo # MDEV-13435 Crash when selecting virtual columns generated using JSON functions
+--echo #
create table t1 (
id int not null ,
js varchar(1000) not null,
@@ -50,3 +50,14 @@ create table t1 (
insert into t1(id,js) values (0, '{"default" : {"start": "00:00:00", "end":"23:59:50"}}');
select * from t1;
drop table t1;
+
+--echo #
+--echo # MDEV-26281 ASAN use-after-poison when complex conversion is involved in blob
+--echo #
+create table t1 (v2 blob as ('a' is null), a1 int, a char(1) as (cast(a1 in (0,current_user() is null) as char(16777216) )));
+insert ignore into t1 values ('x','x',v2) ;
+drop table t1;
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/suite/versioning/r/delete_history.result b/mysql-test/suite/versioning/r/delete_history.result
index 40d519b3e98..9cbe3b1ae1f 100644
--- a/mysql-test/suite/versioning/r/delete_history.result
+++ b/mysql-test/suite/versioning/r/delete_history.result
@@ -65,6 +65,9 @@ partition pn current);
insert into t values (1);
update t set a= 2;
update t set a= 3;
+Warnings:
+Warning 4114 Versioned table `test`.`t`: partition `p1` is full, add more HISTORY partitions
+# You see warning above ^
delete history from t;
select * from t for system_time all;
a
diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result
index af5db4802d6..c189495c12b 100644
--- a/mysql-test/suite/versioning/r/partition.result
+++ b/mysql-test/suite/versioning/r/partition.result
@@ -1,3 +1,5 @@
+set @save_persistent=@@global.innodb_stats_persistent;
+set global innodb_stats_persistent= 0;
set system_versioning_alter_history=keep;
# Check conventional partitioning on temporal tables
create or replace table t1 (
@@ -254,6 +256,9 @@ x
6
delete from t1 where x < 4;
delete from t1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
+# You see warning above ^
select * from t1 partition (p0);
x
1
@@ -265,12 +270,11 @@ x
5
6
insert into t1 values (7), (8);
-Warnings:
-Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
### warn about full partition
delete from t1;
Warnings:
Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
+# You see warning above ^
select * from t1 partition (p1) order by x;
x
4
@@ -330,20 +334,26 @@ x
### warn about full partition
delete from t1 where x < 3;
delete from t1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
+# You see warning above ^
delete from t1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
+# You see warning above ^ (no matter if nothing was deleted)
select * from t1 partition (p0sp0);
x
1
-3
-5
select * from t1 partition (p0sp1);
x
2
-4
select * from t1 partition (p1sp0);
x
+3
+5
select * from t1 partition (p1sp1);
x
+4
create or replace table t1 (
a bigint,
row_start SYS_DATATYPE as row start invisible,
@@ -421,7 +431,13 @@ partition p1 history,
partition p2 history,
partition pn current);
delete from t1 where x = 1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: partition `p2` is full, add more HISTORY partitions
+# You see warning above ^
delete from t1 where x = 2;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: partition `p2` is full, add more HISTORY partitions
+# You see warning above ^
# MDEV-14923 Assertion upon INSERT into locked versioned partitioned table
create or replace table t1 (x int) with system versioning
partition by system_time (partition p1 history, partition pn current);
@@ -583,9 +599,13 @@ create or replace table t1 (x int) with system versioning partition by system_ti
lock tables t1 write;
insert into t1 values (0), (1), (2), (3);
delete from t1 where x < 3;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
+# You see warning above ^
delete from t1;
Warnings:
Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
+# You see warning above ^
unlock tables;
#
# MDEV-20336 Assertion bitmap_is_set(read_partitions) upon SELECT FOR UPDATE from versioned table
@@ -686,6 +706,9 @@ partition by system_time limit 1
insert into t1 values (null);
update t1 set f= 'foo';
update t1 set f= 'bar';
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: partition `p2` is full, add more HISTORY partitions
+# You see warning above ^
create or replace view v1 as select * from t1 for system_time all;
update v1 set f= '';
ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
@@ -807,8 +830,323 @@ delete from t1 partition (p0, p1, pn);
ERROR HY000: Not allowed for system-versioned table `test`.`t1`
drop table t1;
set timestamp= default;
+#
+# MDEV-25546 LIMIT partitioning does not respect ROLLBACK
+#
+create or replace table t1 (pk int primary key)
+with system versioning engine innodb
+partition by system_time limit 100 (
+partition p0 history,
+partition p1 history,
+partition pn current);
+insert into t1 select seq from seq_1_to_90;
+start transaction;
+replace into t1 select seq from seq_1_to_80;
+replace into t1 select seq from seq_1_to_70;
+replace into t1 select seq from seq_1_to_60;
+select partition_name, table_rows
+from information_schema.partitions
+where table_name = 't1';
+partition_name table_rows
+p0 150
+p1 60
+pn 90
+rollback;
+select partition_name, table_rows
+from information_schema.partitions
+where table_name = 't1';
+partition_name table_rows
+p0 0
+p1 0
+pn 90
+replace into t1 select seq from seq_1_to_10;
+select partition_name, table_rows
+from information_schema.partitions
+where table_name = 't1';
+partition_name table_rows
+p0 10
+p1 0
+pn 90
+drop table t1;
+#
+# MDEV-28271 Assertion on TRUNCATE PARTITION for PARTITION BY SYSTEM_TIME
+#
+create table t1 (x int) with system versioning
+partition by system_time limit 1 (
+partition p0 history,
+partition p1 history,
+partition p2 history, # p2 just disables warning about p1 partition full
+partition pn current);
+insert into t1 values (0);
+update t1 set x= x + 1;
+update t1 set x= x + 1;
+select * from t1 partition (p0);
+x
+0
+select * from t1 partition (p1);
+x
+1
+select * from t1 partition (pn);
+x
+2
+delete from t1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: partition `p2` is full, add more HISTORY partitions
+delete history from t1;
+select * from t1 partition (p0);
+x
+select * from t1 partition (p1);
+x
+select * from t1 partition (pn);
+x
+insert into t1 values (0);
+update t1 set x= x + 1;
+update t1 set x= x + 1;
+# TRUNCATE PARTITION ALL does the same
+alter table t1 truncate partition all;
+select * from t1 partition (p0);
+x
+select * from t1 partition (p1);
+x
+select * from t1 partition (pn);
+x
+insert into t1 values (0);
+update t1 set x= x + 1;
+update t1 set x= x + 1;
+# TRUNCATE PARTITION deletes data from HISTORY partition
+alter table t1 truncate partition p1;
+select * from t1 partition (p0);
+x
+0
+select * from t1 partition (p1);
+x
+select * from t1 partition (pn);
+x
+2
+# or from CURRENT partition
+alter table t1 truncate partition pn;
+select * from t1 partition (p0);
+x
+0
+select * from t1 partition (p1);
+x
+select * from t1 partition (pn);
+x
+drop table t1;
+#
+# MDEV-20077 Warning on full history partition is delayed until next DML statement
+#
+# DELETE
+create table t1 (x int) with system versioning
+partition by system_time limit 100 (
+partition p0 history,
+partition p1 history,
+partition pn current);
+insert into t1 select seq from seq_0_to_200;
+# p0 is filled with 100 records (no warnings):
+delete from t1 where x <= 99;
+# p1 is filled with 1 + 100 records (warning is printed):
+delete from t1 where x <= 100;
+delete from t1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
+# You see warning above ^
+select count(*) from t1 partition (p0);
+count(*)
+100
+select count(*) from t1 partition (p1);
+count(*)
+101
+drop table t1;
+# DELETE under LOCK TABLES
+create table t1 (x int) with system versioning
+partition by system_time limit 100 (
+partition p0 history,
+partition p1 history,
+partition pn current);
+insert into t1 select seq from seq_0_to_200;
+lock tables t1 write;
+# (LOCK TABLES) p0 is filled with 100 records (no warnings):
+delete from t1 where x <= 99;
+# (LOCK TABLES) p1 is filled with 1 + 100 records (warning is printed):
+delete from t1 where x <= 100;
+delete from t1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
+# You see warning above ^
+unlock tables;
+select count(*) from t1 partition (p0);
+count(*)
+100
+select count(*) from t1 partition (p1);
+count(*)
+101
+drop table t1;
+# DELETE multitable
+create table t1 (x int) with system versioning
+partition by system_time limit 100 (
+partition p0 history,
+partition p1 history,
+partition pn current);
+create table t2 (y int);
+insert into t1 select seq from seq_0_to_200;
+insert into t2 select seq from seq_0_to_3;
+delete t1, t2 from t1 join t2 where x < 50 and y = 0;
+delete t1, t2 from t1 join t2 where x < 100 and y = 1;
+delete t1, t2 from t1 join t2 where x < 150 and y = 2;
+delete t1, t2 from t1 join t2;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
+# You see warning above ^
+select count(*) from t1 partition (p0);
+count(*)
+100
+select count(*) from t1 partition (p1);
+count(*)
+101
+drop table t1;
+# UDPATE
+create table t1 (x int) with system versioning
+partition by system_time limit 100 (
+partition p0 history,
+partition p1 history,
+partition pn current);
+insert into t1 select seq from seq_0_to_49;
+update t1 set x= x + 1;
+update t1 set x= x + 1;
+update t1 set x= x + 1;
+update t1 set x= x + 1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
+# You see warning above ^
+select count(*) from t1 partition (p0);
+count(*)
+100
+select count(*) from t1 partition (p1);
+count(*)
+100
+drop tables t1, t2;
+# UPDATE multitable
+create table t1 (x int) with system versioning
+partition by system_time limit 100 (
+partition p0 history,
+partition p1 history,
+partition pn current);
+create table t2 (y int);
+insert into t1 select seq from seq_0_to_49;
+insert into t2 values (5);
+update t1, t2 set x= x + 1;
+update t1, t2 set x= x + 1;
+update t1, t2 set x= x + 1;
+update t1, t2 set x= x + 1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
+# You see warning above ^
+select count(*) from t1 partition (p0);
+count(*)
+100
+select count(*) from t1 partition (p1);
+count(*)
+100
+drop tables t1, t2;
+# INSERT .. ON DUPLICATE KEY UPDATE (ODKU)
+create table t1 (x int primary key) with system versioning
+partition by system_time limit 100 (
+partition p0 history,
+partition p1 history,
+partition pn current);
+insert into t1 select seq from seq_0_to_100;
+delete from t1 where x <= 99;
+insert into t1 values (100) on duplicate key update x= 400;
+select count(*) from t1 partition (p0);
+count(*)
+100
+select count(*) from t1 partition (p1);
+count(*)
+1
+drop table t1;
+# INSERT .. SELECT .. ON DUPLICATE KEY UPDATE (ODKU)
+create table t1 (x int primary key) with system versioning
+partition by system_time limit 100 (
+partition p0 history,
+partition p1 history,
+partition pn current);
+create table t2 (y int);
+insert into t2 values (100);
+insert into t1 select seq from seq_0_to_100;
+delete from t1 where x <= 99;
+insert into t1 select * from t2 on duplicate key update x= 500;
+select count(*) from t1 partition (p0);
+count(*)
+100
+select count(*) from t1 partition (p1);
+count(*)
+1
+drop tables t1, t2;
+# REPLACE
+create table t1 (x int primary key) with system versioning
+partition by system_time limit 100 (
+partition p0 history,
+partition p1 history,
+partition pn current);
+insert into t1 select seq from seq_0_to_100;
+delete from t1 where x < 99;
+replace t1 values (100);
+replace t1 values (100);
+select count(*) from t1 partition (p0);
+count(*)
+100
+select count(*) from t1 partition (p1);
+count(*)
+1
+drop table t1;
+# LOAD DATA .. REPLACE
+create table t1 (x int primary key) with system versioning
+partition by system_time limit 100 (
+partition p0 history,
+partition p1 history,
+partition pn current);
+insert into t1 select seq from seq_0_to_49;
+select x into outfile 'MDEV-20077.data' from t1;
+load data infile 'MDEV-20077.data' replace into table t1 (x);
+load data infile 'MDEV-20077.data' replace into table t1 (x);
+load data infile 'MDEV-20077.data' replace into table t1 (x);
+load data infile 'MDEV-20077.data' replace into table t1 (x);
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
+# You see warning above ^
+select count(*) from t1 partition (p0);
+count(*)
+100
+select count(*) from t1 partition (p1);
+count(*)
+100
+drop table t1;
+# REPLACE .. SELECT
+create table t1 (x int primary key) with system versioning
+partition by system_time limit 100 (
+partition p0 history,
+partition p1 history,
+partition pn current);
+insert into t1 select seq from seq_0_to_49;
+replace t1 select * from t1;
+replace t1 select * from t1;
+replace t1 select * from t1;
+replace t1 select * from t1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
+# You see warning above ^
+select count(*) from t1 partition (p0);
+count(*)
+100
+select count(*) from t1 partition (p1);
+count(*)
+100
+drop table t1;
+#
# End of 10.3 tests
#
+#
# MDEV-22283 Server crashes in key_copy or unexpected error 156: The table already existed in the storage engine
#
create table t1 (a int primary key) engine=aria page_checksum=0
@@ -828,4 +1166,7 @@ partition by system_time (partition p1 history, partition pn current);
insert into t1 values (1);
replace into t1 values (1);
drop table t1;
+#
# End of 10.4 tests
+#
+set global innodb_stats_persistent= @save_persistent;
diff --git a/mysql-test/suite/versioning/r/rpl_row.result b/mysql-test/suite/versioning/r/rpl_row.result
index 03ac8dc9eb8..e5db01b9e78 100644
--- a/mysql-test/suite/versioning/r/rpl_row.result
+++ b/mysql-test/suite/versioning/r/rpl_row.result
@@ -11,4 +11,42 @@ connection slave;
connection master;
drop table t1;
set binlog_row_image= @old_row_image;
+#
+# MDEV-28254 Wrong position for row_start, row_end after adding column
+# to implicit versioned table
+#
+set @@system_versioning_alter_history= keep;
+set @@session.time_zone='+00:00';
+create table t1 (x int) with system versioning engine innodb;
+alter table t1 add column y int, algorithm=inplace;
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+connection slave;
+drop table t1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL,
+ `y` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
+connection master;
+set timestamp= 12345;
+insert t1 values (1, 1);
+select *, unix_timestamp(row_start) as row_start, unix_timestamp(row_end) as row_end from t1;
+x y row_start row_end
+1 1 12345.000000 2147483647.999999
+set timestamp= default;
+### INSERT INTO `test`.`t1`
+### SET
+### @1=1
+### @2=1
+### @3=12345.000000
+### @4=2147483647.999999
+connection slave;
+select * from t1;
+x y
+1 1
+connection master;
+drop table t1;
include/rpl_end.inc
diff --git a/mysql-test/suite/versioning/t/delete_history.test b/mysql-test/suite/versioning/t/delete_history.test
index 5c4aa6154bd..e57779d07d3 100644
--- a/mysql-test/suite/versioning/t/delete_history.test
+++ b/mysql-test/suite/versioning/t/delete_history.test
@@ -65,6 +65,7 @@ partition by system_time limit 1 (
insert into t values (1);
update t set a= 2;
update t set a= 3;
+--echo # You see warning above ^
delete history from t;
select * from t for system_time all;
diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test
index 71ddbace3d7..e9156c1d3eb 100644
--- a/mysql-test/suite/versioning/t/partition.test
+++ b/mysql-test/suite/versioning/t/partition.test
@@ -1,6 +1,10 @@
-- source include/have_partition.inc
-- source suite/versioning/common.inc
-- source suite/versioning/engines.inc
+-- source include/have_sequence.inc
+
+set @save_persistent=@@global.innodb_stats_persistent;
+set global innodb_stats_persistent= 0;
set system_versioning_alter_history=keep;
--echo # Check conventional partitioning on temporal tables
@@ -224,12 +228,14 @@ insert into t1 values (1), (2), (3), (4), (5), (6);
select * from t1 partition (pn);
delete from t1 where x < 4;
delete from t1;
+--echo # You see warning above ^
select * from t1 partition (p0);
select * from t1 partition (p1);
insert into t1 values (7), (8);
--echo ### warn about full partition
delete from t1;
+--echo # You see warning above ^
select * from t1 partition (p1) order by x;
--echo ### Assertion in ALTER on warning from partitioning LIMIT [#446]
@@ -279,7 +285,9 @@ select * from t1 partition (pnsp1);
--echo ### warn about full partition
delete from t1 where x < 3;
delete from t1;
+--echo # You see warning above ^
delete from t1;
+--echo # You see warning above ^ (no matter if nothing was deleted)
select * from t1 partition (p0sp0);
select * from t1 partition (p0sp1);
select * from t1 partition (p1sp0);
@@ -368,7 +376,9 @@ alter table t1 partition by system_time limit 1 (
partition p2 history,
partition pn current);
delete from t1 where x = 1;
+--echo # You see warning above ^
delete from t1 where x = 2;
+--echo # You see warning above ^
--echo # MDEV-14923 Assertion upon INSERT into locked versioned partitioned table
create or replace table t1 (x int) with system versioning
@@ -516,7 +526,9 @@ create or replace table t1 (x int) with system versioning partition by system_ti
lock tables t1 write;
insert into t1 values (0), (1), (2), (3);
delete from t1 where x < 3;
+--echo # You see warning above ^
delete from t1;
+--echo # You see warning above ^
unlock tables;
--echo #
@@ -627,6 +639,7 @@ partition by system_time limit 1
insert into t1 values (null);
update t1 set f= 'foo';
update t1 set f= 'bar';
+--echo # You see warning above ^
create or replace view v1 as select * from t1 for system_time all;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
@@ -773,7 +786,295 @@ delete from t1 partition (p0, pn);
delete from t1 partition (p0, p1, pn);
drop table t1;
set timestamp= default;
+
+--echo #
+--echo # MDEV-25546 LIMIT partitioning does not respect ROLLBACK
+--echo #
+create or replace table t1 (pk int primary key)
+with system versioning engine innodb
+partition by system_time limit 100 (
+ partition p0 history,
+ partition p1 history,
+ partition pn current);
+insert into t1 select seq from seq_1_to_90;
+
+start transaction;
+# Puts 80 rows into p0
+replace into t1 select seq from seq_1_to_80;
+# Puts another 70 rows into p0
+replace into t1 select seq from seq_1_to_70;
+# Puts 60 rows into p1
+replace into t1 select seq from seq_1_to_60;
+
+select partition_name, table_rows
+from information_schema.partitions
+where table_name = 't1';
+rollback;
+
+select partition_name, table_rows
+from information_schema.partitions
+where table_name = 't1';
+
+# Should put 10 rows into the empty partition p0
+replace into t1 select seq from seq_1_to_10;
+select partition_name, table_rows
+from information_schema.partitions
+where table_name = 't1';
+ # Cleanup
+drop table t1;
+
+--echo #
+--echo # MDEV-28271 Assertion on TRUNCATE PARTITION for PARTITION BY SYSTEM_TIME
+--echo #
+create table t1 (x int) with system versioning
+partition by system_time limit 1 (
+ partition p0 history,
+ partition p1 history,
+ partition p2 history, # p2 just disables warning about p1 partition full
+ partition pn current);
+
+insert into t1 values (0);
+update t1 set x= x + 1;
+update t1 set x= x + 1;
+
+select * from t1 partition (p0);
+select * from t1 partition (p1);
+select * from t1 partition (pn);
+
+delete from t1;
+delete history from t1;
+select * from t1 partition (p0);
+select * from t1 partition (p1);
+select * from t1 partition (pn);
+
+insert into t1 values (0);
+update t1 set x= x + 1;
+update t1 set x= x + 1;
+
+--echo # TRUNCATE PARTITION ALL does the same
+alter table t1 truncate partition all;
+select * from t1 partition (p0);
+select * from t1 partition (p1);
+select * from t1 partition (pn);
+
+insert into t1 values (0);
+update t1 set x= x + 1;
+update t1 set x= x + 1;
+
+--echo # TRUNCATE PARTITION deletes data from HISTORY partition
+alter table t1 truncate partition p1;
+select * from t1 partition (p0);
+select * from t1 partition (p1);
+select * from t1 partition (pn);
+
+--echo # or from CURRENT partition
+alter table t1 truncate partition pn;
+select * from t1 partition (p0);
+select * from t1 partition (p1);
+select * from t1 partition (pn);
+
+drop table t1;
+
+--echo #
+--echo # MDEV-20077 Warning on full history partition is delayed until next DML statement
+--echo #
+--echo # DELETE
+create table t1 (x int) with system versioning
+partition by system_time limit 100 (
+ partition p0 history,
+ partition p1 history,
+ partition pn current);
+
+insert into t1 select seq from seq_0_to_200;
+
+--echo # p0 is filled with 100 records (no warnings):
+delete from t1 where x <= 99;
+--echo # p1 is filled with 1 + 100 records (warning is printed):
+delete from t1 where x <= 100;
+delete from t1;
+--echo # You see warning above ^
+
+select count(*) from t1 partition (p0);
+select count(*) from t1 partition (p1);
+drop table t1;
+
+--echo # DELETE under LOCK TABLES
+create table t1 (x int) with system versioning
+partition by system_time limit 100 (
+ partition p0 history,
+ partition p1 history,
+ partition pn current);
+
+insert into t1 select seq from seq_0_to_200;
+
+lock tables t1 write;
+--echo # (LOCK TABLES) p0 is filled with 100 records (no warnings):
+delete from t1 where x <= 99;
+--echo # (LOCK TABLES) p1 is filled with 1 + 100 records (warning is printed):
+delete from t1 where x <= 100;
+delete from t1;
+--echo # You see warning above ^
+unlock tables;
+
+select count(*) from t1 partition (p0);
+select count(*) from t1 partition (p1);
+drop table t1;
+
+--echo # DELETE multitable
+create table t1 (x int) with system versioning
+partition by system_time limit 100 (
+ partition p0 history,
+ partition p1 history,
+ partition pn current);
+
+create table t2 (y int);
+
+insert into t1 select seq from seq_0_to_200;
+insert into t2 select seq from seq_0_to_3;
+delete t1, t2 from t1 join t2 where x < 50 and y = 0;
+delete t1, t2 from t1 join t2 where x < 100 and y = 1;
+delete t1, t2 from t1 join t2 where x < 150 and y = 2;
+delete t1, t2 from t1 join t2;
+--echo # You see warning above ^
+
+select count(*) from t1 partition (p0);
+select count(*) from t1 partition (p1);
+drop table t1;
+
+--echo # UDPATE
+create table t1 (x int) with system versioning
+partition by system_time limit 100 (
+ partition p0 history,
+ partition p1 history,
+ partition pn current);
+
+insert into t1 select seq from seq_0_to_49;
+
+update t1 set x= x + 1;
+update t1 set x= x + 1;
+update t1 set x= x + 1;
+update t1 set x= x + 1;
+--echo # You see warning above ^
+
+select count(*) from t1 partition (p0);
+select count(*) from t1 partition (p1);
+drop tables t1, t2;
+
+--echo # UPDATE multitable
+create table t1 (x int) with system versioning
+partition by system_time limit 100 (
+ partition p0 history,
+ partition p1 history,
+ partition pn current);
+
+create table t2 (y int);
+
+insert into t1 select seq from seq_0_to_49;
+insert into t2 values (5);
+
+update t1, t2 set x= x + 1;
+update t1, t2 set x= x + 1;
+update t1, t2 set x= x + 1;
+update t1, t2 set x= x + 1;
+--echo # You see warning above ^
+
+select count(*) from t1 partition (p0);
+select count(*) from t1 partition (p1);
+drop tables t1, t2;
+
+--echo # INSERT .. ON DUPLICATE KEY UPDATE (ODKU)
+create table t1 (x int primary key) with system versioning
+partition by system_time limit 100 (
+ partition p0 history,
+ partition p1 history,
+ partition pn current);
+
+insert into t1 select seq from seq_0_to_100;
+
+delete from t1 where x <= 99;
+insert into t1 values (100) on duplicate key update x= 400;
+
+select count(*) from t1 partition (p0);
+select count(*) from t1 partition (p1);
+drop table t1;
+
+--echo # INSERT .. SELECT .. ON DUPLICATE KEY UPDATE (ODKU)
+create table t1 (x int primary key) with system versioning
+partition by system_time limit 100 (
+ partition p0 history,
+ partition p1 history,
+ partition pn current);
+
+create table t2 (y int);
+insert into t2 values (100);
+insert into t1 select seq from seq_0_to_100;
+
+delete from t1 where x <= 99;
+insert into t1 select * from t2 on duplicate key update x= 500;
+
+select count(*) from t1 partition (p0);
+select count(*) from t1 partition (p1);
+drop tables t1, t2;
+
+--echo # REPLACE
+create table t1 (x int primary key) with system versioning
+partition by system_time limit 100 (
+ partition p0 history,
+ partition p1 history,
+ partition pn current);
+
+insert into t1 select seq from seq_0_to_100;
+
+delete from t1 where x < 99;
+replace t1 values (100);
+replace t1 values (100);
+
+select count(*) from t1 partition (p0);
+select count(*) from t1 partition (p1);
+drop table t1;
+
+--echo # LOAD DATA .. REPLACE
+create table t1 (x int primary key) with system versioning
+partition by system_time limit 100 (
+ partition p0 history,
+ partition p1 history,
+ partition pn current);
+
+insert into t1 select seq from seq_0_to_49;
+select x into outfile 'MDEV-20077.data' from t1;
+
+load data infile 'MDEV-20077.data' replace into table t1 (x);
+load data infile 'MDEV-20077.data' replace into table t1 (x);
+load data infile 'MDEV-20077.data' replace into table t1 (x);
+load data infile 'MDEV-20077.data' replace into table t1 (x);
+--echo # You see warning above ^
+
+select count(*) from t1 partition (p0);
+select count(*) from t1 partition (p1);
+drop table t1;
+--remove_file $datadir/test/MDEV-20077.data
+
+--echo # REPLACE .. SELECT
+create table t1 (x int primary key) with system versioning
+partition by system_time limit 100 (
+ partition p0 history,
+ partition p1 history,
+ partition pn current);
+
+insert into t1 select seq from seq_0_to_49;
+replace t1 select * from t1;
+replace t1 select * from t1;
+replace t1 select * from t1;
+replace t1 select * from t1;
+--echo # You see warning above ^
+
+select count(*) from t1 partition (p0);
+select count(*) from t1 partition (p1);
+drop table t1;
+
+--echo #
--echo # End of 10.3 tests
+--echo #
--echo #
--echo # MDEV-22283 Server crashes in key_copy or unexpected error 156: The table already existed in the storage engine
@@ -794,6 +1095,10 @@ replace into t1 values (1);
# cleanup
drop table t1;
+--echo #
--echo # End of 10.4 tests
+--echo #
+
+set global innodb_stats_persistent= @save_persistent;
--source suite/versioning/common_finish.inc
diff --git a/mysql-test/suite/versioning/t/rpl_row.test b/mysql-test/suite/versioning/t/rpl_row.test
index 17ce2dfdcf8..2e5d4c76f4a 100644
--- a/mysql-test/suite/versioning/t/rpl_row.test
+++ b/mysql-test/suite/versioning/t/rpl_row.test
@@ -1,5 +1,6 @@
--source include/have_binlog_format_row.inc
--source include/master-slave.inc
+--source include/have_innodb.inc
--echo # MDEV-16252: MINIMAL binlog_row_image does not work for versioned tables
set @old_row_image= @@binlog_row_image;
@@ -15,4 +16,44 @@ update t1 set i = 0;
drop table t1;
set binlog_row_image= @old_row_image;
+--echo #
+--echo # MDEV-28254 Wrong position for row_start, row_end after adding column
+--echo # to implicit versioned table
+--echo #
+--let TMP= $MYSQLTEST_VARDIR/tmp
+--let $MYSQLD_DATADIR= `select @@datadir`
+set @@system_versioning_alter_history= keep;
+set @@session.time_zone='+00:00';
+
+create table t1 (x int) with system versioning engine innodb;
+alter table t1 add column y int, algorithm=inplace;
+check table t1;
+--exec $MYSQL_DUMP --databases test > $TMP/dump.sql
+
+--sync_slave_with_master
+drop table t1;
+--exec $MYSQL_SLAVE test < $TMP/dump.sql
+show create table t1;
+
+--connection master
+set timestamp= 12345;
+--let $start_pos= query_get_value("SHOW MASTER STATUS", Position, 1)
+insert t1 values (1, 1);
+select *, unix_timestamp(row_start) as row_start, unix_timestamp(row_end) as row_end from t1;
+--let $stop_pos= query_get_value("SHOW MASTER STATUS", Position, 1)
+set timestamp= default;
+
+# NOTE: pipe grep is not Windows-compatible
+--let grep_file= $TMP/out.txt
+--let grep_regex= ^###
+--exec $MYSQL_BINLOG -v -j $start_pos --stop-position=$stop_pos -o 3 $MYSQLD_DATADIR/master-bin.000001 > $grep_file
+--source include/grep.inc
+--sync_slave_with_master
+select * from t1;
+
+--connection master
+drop table t1;
+--remove_files_wildcard $TMP *.txt
+--remove_files_wildcard $TMP *.sql
+
--source include/rpl_end.inc
diff --git a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result b/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result
deleted file mode 100644
index 5e4e0bd3598..00000000000
--- a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result
+++ /dev/null
@@ -1,174 +0,0 @@
-#
-# MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
-#
-# Verbose run
-\d |
-IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on' and variable_value='ON') = 1 THEN
-ALTER TABLE time_zone ENGINE=InnoDB;
-ALTER TABLE time_zone_name ENGINE=InnoDB;
-ALTER TABLE time_zone_transition ENGINE=InnoDB;
-ALTER TABLE time_zone_transition_type ENGINE=InnoDB;
-TRUNCATE TABLE time_zone;
-TRUNCATE TABLE time_zone_name;
-TRUNCATE TABLE time_zone_transition;
-TRUNCATE TABLE time_zone_transition_type;
-START TRANSACTION;
-ELSE
-TRUNCATE TABLE time_zone;
-TRUNCATE TABLE time_zone_name;
-TRUNCATE TABLE time_zone_transition;
-TRUNCATE TABLE time_zone_transition_type;
-END IF|
-\d ;
-INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
-SET @time_zone_id= LAST_INSERT_ID();
-INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
-INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
- (@time_zone_id, 0, 0, 0, 'GMT')
-;
-Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/garbage' as time zone. Skipping it.
-Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/ignored.tab' as time zone. Skipping it.
-INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
-SET @time_zone_id= LAST_INSERT_ID();
-INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('posix/GMT', @time_zone_id);
-INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
- (@time_zone_id, 0, 0, 0, 'GMT')
-;
-Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
-Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it.
-Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion.
-UNLOCK TABLES;
-COMMIT;
-ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
-ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
-\d |
-IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on' and variable_value='ON') = 1 THEN
-ALTER TABLE time_zone ENGINE=Aria;
-ALTER TABLE time_zone_name ENGINE=Aria;
-ALTER TABLE time_zone_transition ENGINE=Aria, ORDER BY Time_zone_id, Transition_time;
-ALTER TABLE time_zone_transition_type ENGINE=Aria, ORDER BY Time_zone_id, Transition_type_id;
-END IF|
-\d ;
-# Silent run
-\d |
-IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on' and variable_value='ON') = 1 THEN
-ALTER TABLE time_zone ENGINE=InnoDB;
-ALTER TABLE time_zone_name ENGINE=InnoDB;
-ALTER TABLE time_zone_transition ENGINE=InnoDB;
-ALTER TABLE time_zone_transition_type ENGINE=InnoDB;
-TRUNCATE TABLE time_zone;
-TRUNCATE TABLE time_zone_name;
-TRUNCATE TABLE time_zone_transition;
-TRUNCATE TABLE time_zone_transition_type;
-START TRANSACTION;
-ELSE
-TRUNCATE TABLE time_zone;
-TRUNCATE TABLE time_zone_name;
-TRUNCATE TABLE time_zone_transition;
-TRUNCATE TABLE time_zone_transition_type;
-END IF|
-\d ;
-INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
-SET @time_zone_id= LAST_INSERT_ID();
-INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
-INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
- (@time_zone_id, 0, 0, 0, 'GMT')
-;
-Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/garbage' as time zone. Skipping it.
-INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
-SET @time_zone_id= LAST_INSERT_ID();
-INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('posix/GMT', @time_zone_id);
-INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
- (@time_zone_id, 0, 0, 0, 'GMT')
-;
-Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
-UNLOCK TABLES;
-COMMIT;
-ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
-ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
-\d |
-IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on' and variable_value='ON') = 1 THEN
-ALTER TABLE time_zone ENGINE=Aria;
-ALTER TABLE time_zone_name ENGINE=Aria;
-ALTER TABLE time_zone_transition ENGINE=Aria, ORDER BY Time_zone_id, Transition_time;
-ALTER TABLE time_zone_transition_type ENGINE=Aria, ORDER BY Time_zone_id, Transition_type_id;
-END IF|
-\d ;
-#
-# Testing with explicit timezonefile
-#
-\d |
-IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on' and variable_value='ON') = 1 THEN
-ALTER TABLE time_zone ENGINE=InnoDB;
-ALTER TABLE time_zone_name ENGINE=InnoDB;
-ALTER TABLE time_zone_transition ENGINE=InnoDB;
-ALTER TABLE time_zone_transition_type ENGINE=InnoDB;
-SELECT 'skip truncate tables';
-START TRANSACTION;
-ELSE
-SELECT 'skip truncate tables';
-END IF|
-\d ;
-INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
-SET @time_zone_id= LAST_INSERT_ID();
-INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('XXX', @time_zone_id);
-INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
- (@time_zone_id, 0, 0, 0, 'GMT')
-;
-UNLOCK TABLES;
-COMMIT;
-\d |
-IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on' and variable_value='ON') = 1 THEN
-ALTER TABLE time_zone ENGINE=Aria;
-ALTER TABLE time_zone_name ENGINE=Aria;
-ALTER TABLE time_zone_transition ENGINE=Aria, ORDER BY Time_zone_id, Transition_time;
-ALTER TABLE time_zone_transition_type ENGINE=Aria, ORDER BY Time_zone_id, Transition_type_id;
-END IF|
-\d ;
-#
-# Testing --leap
-#
-\d |
-IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on' and variable_value='ON') = 1 THEN
-ALTER TABLE time_zone ENGINE=InnoDB;
-ALTER TABLE time_zone_name ENGINE=InnoDB;
-ALTER TABLE time_zone_transition ENGINE=InnoDB;
-ALTER TABLE time_zone_transition_type ENGINE=InnoDB;
-SELECT 'skip truncate tables';
-START TRANSACTION;
-ELSE
-SELECT 'skip truncate tables';
-END IF|
-\d ;
-\d |
-IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on' and variable_value='ON') = 1 THEN
-ALTER TABLE time_zone_leap_second ENGINE=InnoDB;
-END IF|
-\d ;
-TRUNCATE TABLE time_zone_leap_second;
-\d |
-IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on' and variable_value='ON') = 1 THEN
-ALTER TABLE time_zone_leap_second ENGINE=Aria;
-END IF|
-\d ;
-ALTER TABLE time_zone_leap_second ORDER BY Transition_time;
-UNLOCK TABLES;
-COMMIT;
-\d |
-IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on' and variable_value='ON') = 1 THEN
-ALTER TABLE time_zone ENGINE=Aria;
-ALTER TABLE time_zone_name ENGINE=Aria;
-ALTER TABLE time_zone_transition ENGINE=Aria, ORDER BY Time_zone_id, Transition_time;
-ALTER TABLE time_zone_transition_type ENGINE=Aria, ORDER BY Time_zone_id, Transition_type_id;
-END IF|
-\d ;
diff --git a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result b/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result
deleted file mode 100644
index 20e986c10ed..00000000000
--- a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result
+++ /dev/null
@@ -1,104 +0,0 @@
-#
-# MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
-#
-# Verbose run
-set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
-prepare set_wsrep_write_binlog from @prep1;
-set @toggle=0; execute set_wsrep_write_binlog using @toggle;
-TRUNCATE TABLE time_zone;
-TRUNCATE TABLE time_zone_name;
-TRUNCATE TABLE time_zone_transition;
-TRUNCATE TABLE time_zone_transition_type;
-LOCK TABLES time_zone WRITE,
- time_zone_leap_second WRITE,
- time_zone_name WRITE,
- time_zone_transition WRITE,
- time_zone_transition_type WRITE;
-INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
-SET @time_zone_id= LAST_INSERT_ID();
-INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
-INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
- (@time_zone_id, 0, 0, 0, 'GMT')
-;
-Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/garbage' as time zone. Skipping it.
-Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/ignored.tab' as time zone. Skipping it.
-INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
-SET @time_zone_id= LAST_INSERT_ID();
-INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('posix/GMT', @time_zone_id);
-INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
- (@time_zone_id, 0, 0, 0, 'GMT')
-;
-Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
-Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it.
-Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion.
-UNLOCK TABLES;
-COMMIT;
-ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
-ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
-# Silent run
-set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
-prepare set_wsrep_write_binlog from @prep1;
-set @toggle=0; execute set_wsrep_write_binlog using @toggle;
-TRUNCATE TABLE time_zone;
-TRUNCATE TABLE time_zone_name;
-TRUNCATE TABLE time_zone_transition;
-TRUNCATE TABLE time_zone_transition_type;
-LOCK TABLES time_zone WRITE,
- time_zone_leap_second WRITE,
- time_zone_name WRITE,
- time_zone_transition WRITE,
- time_zone_transition_type WRITE;
-INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
-SET @time_zone_id= LAST_INSERT_ID();
-INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
-INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
- (@time_zone_id, 0, 0, 0, 'GMT')
-;
-Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/garbage' as time zone. Skipping it.
-INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
-SET @time_zone_id= LAST_INSERT_ID();
-INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('posix/GMT', @time_zone_id);
-INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
- (@time_zone_id, 0, 0, 0, 'GMT')
-;
-Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
-UNLOCK TABLES;
-COMMIT;
-ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
-ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
-#
-# Testing with explicit timezonefile
-#
-set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
-prepare set_wsrep_write_binlog from @prep1;
-set @toggle=0; execute set_wsrep_write_binlog using @toggle;
-SELECT 'skip truncate tables';
-LOCK TABLES time_zone WRITE,
- time_zone_leap_second WRITE,
- time_zone_name WRITE,
- time_zone_transition WRITE,
- time_zone_transition_type WRITE;
-INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
-SET @time_zone_id= LAST_INSERT_ID();
-INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('XXX', @time_zone_id);
-INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
- (@time_zone_id, 0, 0, 0, 'GMT')
-;
-UNLOCK TABLES;
-COMMIT;
-#
-# Testing --leap
-#
-set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
-prepare set_wsrep_write_binlog from @prep1;
-set @toggle=0; execute set_wsrep_write_binlog using @toggle;
-SELECT 'skip truncate tables';
-LOCK TABLES time_zone WRITE,
- time_zone_leap_second WRITE,
- time_zone_name WRITE,
- time_zone_transition WRITE,
- time_zone_transition_type WRITE;
-TRUNCATE TABLE time_zone_leap_second;
-ALTER TABLE time_zone_leap_second ORDER BY Transition_time;
-UNLOCK TABLES;
-COMMIT;
diff --git a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.opt b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.opt
deleted file mode 100644
index a8b72174076..00000000000
--- a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.opt
+++ /dev/null
@@ -1 +0,0 @@
---wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep_on=1 --binlog_format=ROW
diff --git a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.test b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.test
deleted file mode 100644
index 87554635666..00000000000
--- a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.test
+++ /dev/null
@@ -1,41 +0,0 @@
---source include/have_wsrep.inc
---source include/have_symlink.inc
---source include/not_windows.inc
---source include/have_innodb.inc
-
---echo #
---echo # MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
---echo #
-
---exec mkdir $MYSQLTEST_VARDIR/zoneinfo
---exec ln -s $MYSQLTEST_VARDIR/zoneinfo $MYSQLTEST_VARDIR/zoneinfo/posix
---copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/GMT
---copy_file std_data/words.dat $MYSQLTEST_VARDIR/zoneinfo/garbage
---copy_file std_data/words.dat $MYSQLTEST_VARDIR/zoneinfo/ignored.tab
-
---echo # Verbose run
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYSQL_TZINFO_TO_SQL --verbose $MYSQLTEST_VARDIR/zoneinfo 2>&1
-
---echo # Silent run
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo 2>&1
-
---echo #
---echo # Testing with explicit timezonefile
---echo #
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo/GMT XXX 2>&1
-
---echo #
---echo # Testing --leap
---echo #
-
---exec $MYSQL_TZINFO_TO_SQL --leap $MYSQLTEST_VARDIR/zoneinfo/GMT 2>&1
-
-#
-# Cleanup
-#
-
---exec rm -rf $MYSQLTEST_VARDIR/zoneinfo
diff --git a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.opt b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.opt
deleted file mode 100644
index a8b72174076..00000000000
--- a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.opt
+++ /dev/null
@@ -1 +0,0 @@
---wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep_on=1 --binlog_format=ROW
diff --git a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.test b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.test
deleted file mode 100644
index ab1f94cc1cf..00000000000
--- a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.test
+++ /dev/null
@@ -1,41 +0,0 @@
---source include/have_wsrep.inc
---source include/have_symlink.inc
---source include/not_windows.inc
---source include/have_innodb.inc
-
---echo #
---echo # MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
---echo #
-
---exec mkdir $MYSQLTEST_VARDIR/zoneinfo
---exec ln -s $MYSQLTEST_VARDIR/zoneinfo $MYSQLTEST_VARDIR/zoneinfo/posix
---copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/GMT
---copy_file std_data/words.dat $MYSQLTEST_VARDIR/zoneinfo/garbage
---copy_file std_data/words.dat $MYSQLTEST_VARDIR/zoneinfo/ignored.tab
-
---echo # Verbose run
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYSQL_TZINFO_TO_SQL --verbose --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo 2>&1
-
---echo # Silent run
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo 2>&1
-
---echo #
---echo # Testing with explicit timezonefile
---echo #
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo/GMT XXX 2>&1
-
---echo #
---echo # Testing --leap
---echo #
-
---exec $MYSQL_TZINFO_TO_SQL --leap --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo/GMT 2>&1
-
-#
-# Cleanup
-#
-
---exec rm -rf $MYSQLTEST_VARDIR/zoneinfo
diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c
index b53ecad55fb..86f38edf724 100644
--- a/plugin/server_audit/server_audit.c
+++ b/plugin/server_audit/server_audit.c
@@ -16,7 +16,7 @@
#define PLUGIN_VERSION 0x104
-#define PLUGIN_STR_VERSION "1.4.13"
+#define PLUGIN_STR_VERSION "1.4.14"
#define _my_thread_var loc_thread_var
@@ -946,7 +946,19 @@ static unsigned long long query_counter= 1;
static struct connection_info *get_loc_info(MYSQL_THD thd)
{
+ /*
+ This is the original code and supposed to be returned
+ bach to this as the MENT-1438 is finally understood/resolved.
return (struct connection_info *) THDVAR(thd, loc_info);
+ */
+ struct connection_info *ci= (struct connection_info *) THDVAR(thd, loc_info);
+ if ((size_t) ci->user_length > sizeof(ci->user))
+ {
+ ci->user_length= 0;
+ ci->host_length= 0;
+ ci->ip_length= 0;
+ }
+ return ci;
}
@@ -1374,6 +1386,16 @@ static size_t log_header(char *message, size_t message_len,
host= userip;
}
+ /*
+ That was added to find the possible cause of the MENT-1438.
+ Supposed to be removed after that.
+ */
+ if (username_len > 1024)
+ {
+ username= "unknown_user";
+ username_len= (unsigned int) strlen(username);
+ }
+
if (output_type == OUTPUT_SYSLOG)
return my_snprintf(message, message_len,
"%.*s,%.*s,%.*s,%d,%lld,%s",
diff --git a/sql/field.cc b/sql/field.cc
index 7d34054a4a2..b5f7e468d46 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -3207,11 +3207,12 @@ Field_new_decimal::Field_new_decimal(uchar *ptr_arg,
uint8 dec_arg,bool zero_arg,
bool unsigned_arg)
:Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
- unireg_check_arg, field_name_arg, dec_arg, zero_arg, unsigned_arg)
+ unireg_check_arg, field_name_arg,
+ MY_MIN(dec_arg, DECIMAL_MAX_SCALE), zero_arg, unsigned_arg)
{
precision= get_decimal_precision(len_arg, dec_arg, unsigned_arg);
- DBUG_ASSERT((precision <= DECIMAL_MAX_PRECISION) &&
- (dec <= DECIMAL_MAX_SCALE));
+ DBUG_ASSERT(precision <= DECIMAL_MAX_PRECISION);
+ DBUG_ASSERT(dec <= DECIMAL_MAX_SCALE);
bin_size= my_decimal_get_binary_size(precision, dec);
}
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 0fcf966f71b..bf430a00f18 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -4012,6 +4012,8 @@ int ha_partition::external_lock(THD *thd, int lock_type)
if (lock_type == F_UNLCK)
{
bitmap_clear_all(used_partitions);
+ if (m_lock_type == F_WRLCK && m_part_info->vers_require_hist_part(thd))
+ m_part_info->vers_check_limit(thd);
}
else
{
@@ -4032,13 +4034,7 @@ int ha_partition::external_lock(THD *thd, int lock_type)
{
if (m_part_info->part_expr)
m_part_info->part_expr->walk(&Item::register_field_in_read_map, 1, 0);
- if (m_part_info->part_type == VERSIONING_PARTITION &&
- /* TODO: MDEV-20345 exclude more inapproriate commands like INSERT
- These commands may be excluded because working history partition is needed
- only for versioned DML. */
- thd->lex->sql_command != SQLCOM_SELECT &&
- thd->lex->sql_command != SQLCOM_INSERT_SELECT &&
- (error= m_part_info->vers_set_hist_part(thd)))
+ if ((error= m_part_info->vers_set_hist_part(thd)))
goto err_handler;
}
DBUG_RETURN(0);
@@ -4191,11 +4187,7 @@ int ha_partition::start_stmt(THD *thd, thr_lock_type lock_type)
case TL_WRITE_ONLY:
if (m_part_info->part_expr)
m_part_info->part_expr->walk(&Item::register_field_in_read_map, 1, 0);
- if (m_part_info->part_type == VERSIONING_PARTITION &&
- // TODO: MDEV-20345 (see above)
- thd->lex->sql_command != SQLCOM_SELECT &&
- thd->lex->sql_command != SQLCOM_INSERT_SELECT)
- error= m_part_info->vers_set_hist_part(thd);
+ error= m_part_info->vers_set_hist_part(thd);
default:;
}
DBUG_RETURN(error);
diff --git a/sql/handler.cc b/sql/handler.cc
index 22f5aa4e7e7..4092ee99e0b 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -5182,6 +5182,9 @@ int handler::calculate_checksum()
for (uint i= 0; i < table->s->fields; i++ )
{
Field *f= table->field[i];
+ if (!f->stored_in_db())
+ continue;
+
if (! thd->variables.old_mode && f->is_real_null(0))
{
diff --git a/sql/item.cc b/sql/item.cc
index 4c699bb974d..a791d5bf8ca 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -924,8 +924,7 @@ bool Item_field::check_field_expression_processor(void *arg)
(!field->vcol_info && !org_field->vcol_info)) &&
field->field_index >= org_field->field_index))
{
- my_error(ER_EXPRESSION_REFERS_TO_UNINIT_FIELD,
- MYF(0),
+ my_error(ER_EXPRESSION_REFERS_TO_UNINIT_FIELD, MYF(0),
org_field->field_name.str, field->field_name.str);
return 1;
}
@@ -9377,6 +9376,12 @@ bool Item_default_value::eq(const Item *item, bool binary_cmp) const
}
+bool Item_default_value::check_field_expression_processor(void *)
+{
+ field->default_value= ((Item_field *)(arg->real_item()))->field->default_value;
+ return 0;
+}
+
bool Item_default_value::fix_fields(THD *thd, Item **items)
{
Item *real_arg;
@@ -9418,7 +9423,6 @@ bool Item_default_value::fix_fields(THD *thd, Item **items)
}
if (!(def_field= (Field*) thd->alloc(field_arg->field->size_of())))
goto error;
- cached_field= def_field;
memcpy((void *)def_field, (void *)field_arg->field,
field_arg->field->size_of());
def_field->reset_fields();
@@ -9447,8 +9451,7 @@ error:
void Item_default_value::cleanup()
{
- delete cached_field; // Free cached blob data
- cached_field= 0;
+ delete field; // Free cached blob data
Item_field::cleanup();
}
diff --git a/sql/item.h b/sql/item.h
index af6f350216d..f074ea1e3da 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -6457,12 +6457,11 @@ class Item_default_value : public Item_field
void calculate();
public:
Item *arg;
- Field *cached_field;
Item_default_value(THD *thd, Name_resolution_context *context_arg, Item *a,
bool vcol_assignment_arg)
:Item_field(thd, context_arg, (const char *)NULL, (const char *)NULL,
&null_clex_str), vcol_assignment_ok(vcol_assignment_arg),
- arg(a), cached_field(NULL) {}
+ arg(a) {}
enum Type type() const { return DEFAULT_VALUE_ITEM; }
bool eq(const Item *item, bool binary_cmp) const;
bool fix_fields(THD *, Item **);
@@ -6475,6 +6474,10 @@ public:
bool get_date(THD *thd, MYSQL_TIME *ltime,date_mode_t fuzzydate);
bool val_native(THD *thd, Native *to);
bool val_native_result(THD *thd, Native *to);
+ longlong val_datetime_packed(THD *thd)
+ { return Item::val_datetime_packed(thd); }
+ longlong val_time_packed(THD *thd)
+ { return Item::val_time_packed(thd); }
/* Result variants */
double val_result();
@@ -6495,16 +6498,16 @@ public:
return false;
}
table_map used_tables() const;
- virtual void update_used_tables()
+ void update_used_tables()
{
if (field && field->default_value)
field->default_value->expr->update_used_tables();
}
bool vcol_assignment_allowed_value() const { return vcol_assignment_ok; }
- Field *get_tmp_table_field() { return 0; }
Item *get_tmp_table_item(THD *thd) { return this; }
Item_field *field_for_view_update() { return 0; }
bool update_vcol_processor(void *arg) { return 0; }
+ bool check_field_expression_processor(void *arg);
bool check_func_default_processor(void *arg) { return true; }
bool walk(Item_processor processor, bool walk_subquery, void *args)
@@ -6782,7 +6785,7 @@ public:
for any value.
*/
-class Item_cache: public Item,
+class Item_cache: public Item_fixed_hybrid,
public Type_handler_hybrid_field_type
{
protected:
@@ -6813,7 +6816,7 @@ public:
bool null_value_inside;
Item_cache(THD *thd):
- Item(thd),
+ Item_fixed_hybrid(thd),
Type_handler_hybrid_field_type(&type_handler_string),
example(0), cached_field(0),
value_cached(0),
@@ -6822,10 +6825,11 @@ public:
maybe_null= 1;
null_value= 1;
null_value_inside= true;
+ fixed= 1;
}
protected:
Item_cache(THD *thd, const Type_handler *handler):
- Item(thd),
+ Item_fixed_hybrid(thd),
Type_handler_hybrid_field_type(handler),
example(0), cached_field(0),
value_cached(0),
@@ -6834,6 +6838,7 @@ protected:
maybe_null= 1;
null_value= 1;
null_value_inside= true;
+ fixed= 1;
}
public:
@@ -6885,10 +6890,17 @@ public:
}
return mark_unsupported_function("cache", arg, VCOL_IMPOSSIBLE);
}
+ bool fix_fields(THD *thd, Item **ref)
+ {
+ fixed= 1;
+ if (example && !example->is_fixed())
+ return example->fix_fields(thd, ref);
+ return 0;
+ }
void cleanup()
{
clear();
- Item::cleanup();
+ Item_fixed_hybrid::cleanup();
}
/**
Check if saved item has a non-NULL value.
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 1660652001c..935208423a4 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2447,7 +2447,7 @@ void Item_func_round::fix_arg_decimal()
set_handler(&type_handler_newdecimal);
unsigned_flag= args[0]->unsigned_flag;
decimals= args[0]->decimals;
- max_length= float_length(args[0]->decimals) + 1;
+ max_length= args[0]->max_length;
}
}
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index d19e89ad6af..50b8d9192c5 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -773,6 +773,7 @@ bool Item_subselect::exec()
DBUG_ENTER("Item_subselect::exec");
DBUG_ASSERT(fixed);
+ DBUG_ASSERT(!eliminated);
DBUG_EXECUTE_IF("Item_subselect",
Item::Print print(this,
@@ -1282,11 +1283,18 @@ bool Item_singlerow_subselect::fix_length_and_dec()
}
unsigned_flag= value->unsigned_flag;
/*
- If there are not tables in subquery then ability to have NULL value
- depends on SELECT list (if single row subquery have tables then it
- always can be NULL if there are not records fetched).
+ If the subquery has no tables (1) and is not a UNION (2), like:
+
+ (SELECT subq_value)
+
+ then its NULLability is the same as subq_value's NULLability.
+
+ (1): A subquery that uses a table will return NULL when the table is empty.
+ (2): A UNION subquery will return NULL if it produces a "Subquery returns
+ more than one row" error.
*/
- if (engine->no_tables())
+ if (engine->no_tables() &&
+ engine->engine_type() != subselect_engine::UNION_ENGINE)
maybe_null= engine->may_be_null();
else
{
@@ -1322,6 +1330,16 @@ Item* Item_singlerow_subselect::expr_cache_insert_transformer(THD *tmp_thd,
DBUG_ASSERT(thd == tmp_thd);
+ /*
+ Do not create subquery cache if the subquery was eliminated.
+ The optimizer may eliminate subquery items (see
+ eliminate_subselect_processor). However it does not update
+ all query's data structures, so the eliminated item may be
+ still reachable.
+ */
+ if (eliminated)
+ DBUG_RETURN(this);
+
if (expr_cache)
DBUG_RETURN(expr_cache);
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 8098d1aa5e0..f80b89bc828 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1540,6 +1540,8 @@ void Item_sum_sum::fix_length_and_dec_decimal()
decimals= args[0]->decimals;
/* SUM result can't be longer than length(arg) + length(MAX_ROWS) */
int precision= args[0]->decimal_precision() + DECIMAL_LONGLONG_DIGITS;
+ decimals= MY_MIN(decimals, DECIMAL_MAX_SCALE);
+ precision= MY_MIN(precision, DECIMAL_MAX_PRECISION);
max_length= my_decimal_precision_to_length_no_truncation(precision,
decimals,
unsigned_flag);
@@ -1950,12 +1952,12 @@ void Item_sum_avg::fix_length_and_dec_decimal()
{
Item_sum_sum::fix_length_and_dec_decimal();
int precision= args[0]->decimal_precision() + prec_increment;
- decimals= MY_MIN(args[0]->decimals + prec_increment, DECIMAL_MAX_SCALE);
+ decimals= MY_MIN(args[0]->decimal_scale() + prec_increment, DECIMAL_MAX_SCALE);
max_length= my_decimal_precision_to_length_no_truncation(precision,
decimals,
unsigned_flag);
f_precision= MY_MIN(precision+DECIMAL_LONGLONG_DIGITS, DECIMAL_MAX_PRECISION);
- f_scale= args[0]->decimals;
+ f_scale= args[0]->decimal_scale();
dec_bin_size= my_decimal_get_binary_size(f_precision, f_scale);
}
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index edcdd6d2b37..90ef388f3b9 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -835,6 +835,9 @@ bool partition_info::has_unique_name(partition_element *element)
int partition_info::vers_set_hist_part(THD *thd)
{
+ if (!vers_require_hist_part(thd))
+ return 0;
+
if (table->pos_in_table_list &&
table->pos_in_table_list->partition_names)
{
@@ -843,12 +846,10 @@ int partition_info::vers_set_hist_part(THD *thd)
if (vers_info->limit)
{
ha_partition *hp= (ha_partition*)(table->file);
- partition_element *next= NULL;
+ partition_element *next;
List_iterator<partition_element> it(partitions);
- while (next != vers_info->hist_part)
- next= it++;
- DBUG_ASSERT(bitmap_is_set(&read_partitions, next->id));
- ha_rows records= hp->part_records(next);
+ ha_rows records= 0;
+ vers_info->hist_part= partitions.head();
while ((next= it++) != vers_info->now_part)
{
DBUG_ASSERT(bitmap_is_set(&read_partitions, next->id));
@@ -858,12 +859,8 @@ int partition_info::vers_set_hist_part(THD *thd)
vers_info->hist_part= next;
records= next_records;
}
- if (records > vers_info->limit)
- {
- if (next == vers_info->now_part)
- goto warn;
+ if (records >= vers_info->limit && next != vers_info->now_part)
vers_info->hist_part= next;
- }
return 0;
}
@@ -885,11 +882,45 @@ int partition_info::vers_set_hist_part(THD *thd)
}
}
return 0;
-warn:
- my_error(WARN_VERS_PART_FULL, MYF(ME_WARNING|ME_ERROR_LOG),
- table->s->db.str, table->s->table_name.str,
- vers_info->hist_part->partition_name);
- return 0;
+}
+
+
+/**
+ Warn at the end of DML command if the last history partition is out of LIMIT.
+*/
+void partition_info::vers_check_limit(THD *thd)
+{
+ if (!vers_info->limit ||
+ vers_info->hist_part->id + 1 < vers_info->now_part->id)
+ return;
+
+ /*
+ NOTE: at this point read_partitions bitmap is already pruned by DML code,
+ we have to set read bits for working history partition. We could use
+ bitmap_set_all(), but this is not optimal since there can be quite a number
+ of partitions.
+ */
+ const uint32 sub_factor= num_subparts ? num_subparts : 1;
+ uint32 part_id= vers_info->hist_part->id * sub_factor;
+ const uint32 part_id_end= part_id + sub_factor;
+ DBUG_ASSERT(part_id_end <= num_parts * sub_factor);
+ for (; part_id < part_id_end; ++part_id)
+ bitmap_set_bit(&read_partitions, part_id);
+
+ ha_partition *hp= (ha_partition*)(table->file);
+ ha_rows hist_rows= hp->part_records(vers_info->hist_part);
+ if (hist_rows >= vers_info->limit)
+ {
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ WARN_VERS_PART_FULL,
+ ER_THD(thd, WARN_VERS_PART_FULL),
+ table->s->db.str, table->s->table_name.str,
+ vers_info->hist_part->partition_name);
+
+ sql_print_warning(ER_THD(thd, WARN_VERS_PART_FULL),
+ table->s->db.str, table->s->table_name.str,
+ vers_info->hist_part->partition_name);
+ }
}
diff --git a/sql/partition_info.h b/sql/partition_info.h
index 9fb20268738..2f8b1a7fafd 100644
--- a/sql/partition_info.h
+++ b/sql/partition_info.h
@@ -421,7 +421,13 @@ public:
vers_info->limit= limit;
return !limit;
}
+ bool vers_require_hist_part(THD *thd) const
+ {
+ return part_type == VERSIONING_PARTITION &&
+ thd->lex->vers_history_generating();
+ }
int vers_set_hist_part(THD *thd);
+ void vers_check_limit(THD *thd);
bool vers_setup_expression(THD *thd, uint32 alter_add= 0); /* Stage 1. */
partition_element *get_partition(uint part_id)
{
diff --git a/sql/rpl_gtid.h b/sql/rpl_gtid.h
index b633716bfe5..081f7e309f4 100644
--- a/sql/rpl_gtid.h
+++ b/sql/rpl_gtid.h
@@ -26,6 +26,7 @@
extern const LEX_CSTRING rpl_gtid_slave_state_table_name;
class String;
+#define PARAM_GTID(G) G.domain_id, G.server_id, G.seq_no
struct rpl_gtid
{
diff --git a/sql/slave.cc b/sql/slave.cc
index 029fd0f5aaf..d0bc7e474df 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -3240,9 +3240,9 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full,
protocol->store((uint32) mi->master_id);
// SQL_Delay
// Master_Ssl_Crl
- protocol->store(mi->ssl_ca, &my_charset_bin);
+ protocol->store(mi->ssl_crl, &my_charset_bin);
// Master_Ssl_Crlpath
- protocol->store(mi->ssl_capath, &my_charset_bin);
+ protocol->store(mi->ssl_crlpath, &my_charset_bin);
// Using_Gtid
protocol->store(mi->using_gtid_astext(mi->using_gtid), &my_charset_bin);
// Gtid_IO_Pos
@@ -3334,7 +3334,7 @@ bool show_all_master_info(THD* thd)
String gtid_pos;
Master_info **tmp;
List<Item> field_list;
- DBUG_ENTER("show_master_info");
+ DBUG_ENTER("show_all_master_info");
mysql_mutex_assert_owner(&LOCK_active_mi);
gtid_pos.length(0);
@@ -6615,17 +6615,75 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
mi->gtid_event_seen= true;
/*
- We have successfully queued to relay log everything before this GTID, so
+ Unless the previous group is malformed,
+ we have successfully queued to relay log everything before this GTID, so
in case of reconnect we can start from after any previous GTID.
- (Normally we would have updated gtid_current_pos earlier at the end of
- the previous event group, but better leave an extra check here for
- safety).
+ (We must have updated gtid_current_pos earlier at the end of
+ the previous event group. Unless ...)
*/
- if (mi->events_queued_since_last_gtid)
+ if (unlikely(mi->events_queued_since_last_gtid > 0))
{
- mi->gtid_current_pos.update(&mi->last_queued_gtid);
- mi->events_queued_since_last_gtid= 0;
+ /*
+ ...unless the last group has not been completed. An assert below
+ can be satisfied only with the strict mode that ensures
+ against "genuine" gtid duplicates.
+ */
+ rpl_gtid *gtid_in_slave_state=
+ mi->gtid_current_pos.find(mi->last_queued_gtid.domain_id);
+
+ // Slave gtid state must not have updated yet to the last received gtid.
+ DBUG_ASSERT((mi->using_gtid == Master_info::USE_GTID_NO ||
+ !opt_gtid_strict_mode) ||
+ (!gtid_in_slave_state ||
+ !(*gtid_in_slave_state == mi->last_queued_gtid)));
+
+ DBUG_EXECUTE_IF("slave_discard_xid_for_gtid_0_x_1000",
+ {
+ /* Inject an event group that is missing its XID commit event. */
+ if ((mi->last_queued_gtid.domain_id == 0 &&
+ mi->last_queued_gtid.seq_no == 1000) ||
+ (mi->last_queued_gtid.domain_id == 1 &&
+ mi->last_queued_gtid.seq_no == 32))
+ {
+ sql_print_warning(
+ "Unexpected break of being relay-logged GTID %u-%u-%llu "
+ "event group by the current GTID event %u-%u-%llu",
+ PARAM_GTID(mi->last_queued_gtid),PARAM_GTID(event_gtid));
+ DBUG_SET("-d,slave_discard_xid_for_gtid_0_x_1000");
+ goto dbug_gtid_accept;
+ }
+ });
+ error= ER_SLAVE_RELAY_LOG_WRITE_FAILURE;
+ sql_print_error("Unexpected break of being relay-logged GTID %u-%u-%llu "
+ "event group by the current GTID event %u-%u-%llu",
+ PARAM_GTID(mi->last_queued_gtid),PARAM_GTID(event_gtid));
+ goto err;
}
+ else if (unlikely(mi->gtid_reconnect_event_skip_count > 0))
+ {
+ if (mi->gtid_reconnect_event_skip_count ==
+ mi->events_queued_since_last_gtid)
+ {
+ DBUG_ASSERT(event_gtid == mi->last_queued_gtid);
+
+ goto default_action;
+ }
+
+ DBUG_ASSERT(0);
+ }
+ // else_likely{...
+#ifndef DBUG_OFF
+dbug_gtid_accept:
+ DBUG_EXECUTE_IF("slave_discard_gtid_0_x_1002",
+ {
+ if (mi->last_queued_gtid.server_id == 27697 &&
+ mi->last_queued_gtid.seq_no == 1002)
+ {
+ DBUG_SET("-d,slave_discard_gtid_0_x_1002");
+ goto skip_relay_logging;
+ }
+ });
+#endif
mi->last_queued_gtid= event_gtid;
mi->last_queued_gtid_standalone=
(gtid_flag & Gtid_log_event::FL_STANDALONE) != 0;
@@ -6635,6 +6693,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
++mi->events_queued_since_last_gtid;
inc_pos= event_len;
+ // ...} eof else_likely
}
break;
/*
@@ -6713,6 +6772,12 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
case XID_EVENT:
DBUG_EXECUTE_IF("slave_discard_xid_for_gtid_0_x_1000",
{
+ if (mi->last_queued_gtid.server_id == 27697 &&
+ mi->last_queued_gtid.seq_no == 1000)
+ {
+ DBUG_SET("-d,slave_discard_xid_for_gtid_0_x_1000");
+ goto skip_relay_logging;
+ }
/* Inject an event group that is missing its XID commit event. */
if (mi->last_queued_gtid.domain_id == 0 &&
mi->last_queued_gtid.seq_no == 1000)
@@ -6758,15 +6823,48 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
}
};);
- if (mi->using_gtid != Master_info::USE_GTID_NO && mi->gtid_event_seen)
+ if (mi->using_gtid != Master_info::USE_GTID_NO)
{
- if (unlikely(mi->gtid_reconnect_event_skip_count))
+ if (likely(mi->gtid_event_seen))
{
- --mi->gtid_reconnect_event_skip_count;
- gtid_skip_enqueue= true;
+ if (unlikely(mi->gtid_reconnect_event_skip_count))
+ {
+ if (!got_gtid_event &&
+ mi->gtid_reconnect_event_skip_count ==
+ mi->events_queued_since_last_gtid)
+ goto gtid_not_start; // the 1st re-sent must be gtid
+
+ --mi->gtid_reconnect_event_skip_count;
+ gtid_skip_enqueue= true;
+ }
+ else if (likely(mi->events_queued_since_last_gtid))
+ {
+ DBUG_ASSERT(!got_gtid_event);
+
+ ++mi->events_queued_since_last_gtid;
+ }
+ else if (Log_event::is_group_event((Log_event_type) (uchar)
+ buf[EVENT_TYPE_OFFSET]))
+ {
+ goto gtid_not_start; // no first gtid event in this group
+ }
+ }
+ else if (Log_event::is_group_event((Log_event_type) (uchar)
+ buf[EVENT_TYPE_OFFSET]))
+ {
+ gtid_not_start:
+
+ DBUG_ASSERT(!got_gtid_event);
+
+ error= ER_SLAVE_RELAY_LOG_WRITE_FAILURE;
+ sql_print_error("The current group of events starts with "
+ "a non-GTID %s event; "
+ "the last seen GTID is %u-%u-%llu",
+ Log_event::get_type_str((Log_event_type) (uchar)
+ buf[EVENT_TYPE_OFFSET]),
+ mi->last_queued_gtid);
+ goto err;
}
- else if (mi->events_queued_since_last_gtid)
- ++mi->events_queued_since_last_gtid;
}
if (!is_compress_event)
@@ -6959,11 +7057,13 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
The whole of the current event group is queued. So in case of
reconnect we can start from after the current GTID.
*/
- if (mi->gtid_reconnect_event_skip_count)
+ if (gtid_skip_enqueue)
{
bool first= true;
StringBuffer<1024> gtid_text;
+ DBUG_ASSERT(mi->events_queued_since_last_gtid > 1);
+
rpl_slave_state_tostring_helper(&gtid_text, &mi->last_queued_gtid,
&first);
sql_print_error("Slave IO thread received a terminal event from "
@@ -6973,12 +7073,39 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
gtid_text.ptr(),
mi->gtid_reconnect_event_skip_count,
mi->events_queued_since_last_gtid);
+ error= ER_SLAVE_RELAY_LOG_WRITE_FAILURE;
+ goto err;
}
mi->gtid_current_pos.update(&mi->last_queued_gtid);
mi->events_queued_since_last_gtid= 0;
- /* Reset the domain_id_filter flag. */
- mi->domain_id_filter.reset_filter();
+ if (unlikely(gtid_skip_enqueue))
+ {
+ error= ER_SLAVE_RELAY_LOG_WRITE_FAILURE;
+ sql_print_error("Recieved a group closing %s event "
+ "at %llu position in the group while there are "
+ "still %llu events to skip upon reconnecting; "
+ "the last seen GTID is %u-%u-%llu",
+ Log_event::get_type_str((Log_event_type) (uchar)
+ buf[EVENT_TYPE_OFFSET]),
+ (mi->events_queued_since_last_gtid -
+ mi->gtid_reconnect_event_skip_count),
+ mi->events_queued_since_last_gtid,
+ mi->last_queued_gtid);
+ goto err;
+ }
+ else
+ {
+ /*
+ The whole of the current event group is queued. So in case of
+ reconnect we can start from after the current GTID.
+ */
+ mi->gtid_current_pos.update(&mi->last_queued_gtid);
+ mi->events_queued_since_last_gtid= 0;
+
+ /* Reset the domain_id_filter flag. */
+ mi->domain_id_filter.reset_filter();
+ }
}
skip_relay_logging:
diff --git a/sql/sp_cache.cc b/sql/sp_cache.cc
index e4ffbdcb155..e97f24c5487 100644
--- a/sql/sp_cache.cc
+++ b/sql/sp_cache.cc
@@ -312,3 +312,12 @@ sp_cache::cleanup()
{
my_hash_free(&m_hashtable);
}
+
+
+void Sp_caches::sp_caches_clear()
+{
+ sp_cache_clear(&sp_proc_cache);
+ sp_cache_clear(&sp_func_cache);
+ sp_cache_clear(&sp_package_spec_cache);
+ sp_cache_clear(&sp_package_body_cache);
+}
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index ab950c50251..6102769a47d 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -769,7 +769,7 @@ void
sp_head::set_stmt_end(THD *thd)
{
Lex_input_stream *lip= & thd->m_parser_state->m_lip; /* shortcut */
- const char *end_ptr= lip->get_cpp_ptr(); /* shortcut */
+ const char *end_ptr= lip->get_cpp_tok_start(); /* shortcut */
/* Make the string of parameters. */
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index ef7a075e304..42285e9b3a4 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -907,7 +907,14 @@ void close_thread_tables(THD *thd)
table->s->table_name.str, (ulong) table->query_id));
if (thd->locked_tables_mode)
+ {
+#ifdef WITH_PARTITION_STORAGE_ENGINE
+ if (table->part_info && table->part_info->vers_require_hist_part(thd) &&
+ !thd->stmt_arena->is_stmt_prepare())
+ table->part_info->vers_check_limit(thd);
+#endif
table->vcol_cleanup_expr(thd);
+ }
/* Detach MERGE children after every statement. Even under LOCK TABLES. */
if (thd->locked_tables_mode <= LTM_LOCK_TABLES ||
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 6fb657d3c00..775f3c173ef 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
- Copyright (c) 2008, 2021, MariaDB Corporation.
+ Copyright (c) 2008, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -818,11 +818,6 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
(my_hash_get_key) get_sequence_last_key,
(my_hash_free_key) free_sequence_last, HASH_THREAD_SPECIFIC);
- sp_proc_cache= NULL;
- sp_func_cache= NULL;
- sp_package_spec_cache= NULL;
- sp_package_body_cache= NULL;
-
/* For user vars replication*/
if (opt_bin_log)
my_init_dynamic_array(&user_var_events,
@@ -1431,10 +1426,7 @@ void THD::change_user(void)
my_hash_init(&sequences, system_charset_info, SEQUENCES_HASH_SIZE, 0, 0,
(my_hash_get_key) get_sequence_last_key,
(my_hash_free_key) free_sequence_last, HASH_THREAD_SPECIFIC);
- sp_cache_clear(&sp_proc_cache);
- sp_cache_clear(&sp_func_cache);
- sp_cache_clear(&sp_package_spec_cache);
- sp_cache_clear(&sp_package_body_cache);
+ sp_caches_clear();
opt_trace.delete_traces();
}
@@ -1563,10 +1555,7 @@ void THD::cleanup(void)
my_hash_free(&user_vars);
my_hash_free(&sequences);
- sp_cache_clear(&sp_proc_cache);
- sp_cache_clear(&sp_func_cache);
- sp_cache_clear(&sp_package_spec_cache);
- sp_cache_clear(&sp_package_body_cache);
+ sp_caches_clear();
auto_inc_intervals_forced.empty();
auto_inc_intervals_in_cur_stmt_for_binlog.empty();
@@ -6420,47 +6409,84 @@ int THD::decide_logging_format(TABLE_LIST *tables)
DBUG_RETURN(0);
}
-int THD::decide_logging_format_low(TABLE *table)
+
+/*
+ Reconsider logging format in case of INSERT...ON DUPLICATE KEY UPDATE
+ for tables with more than one unique keys in case of MIXED binlog format.
+
+ Unsafe means that a master could execute the statement differently than
+ the slave.
+ This could can happen in the following cases:
+ - The unique check are done in different order on master or slave
+ (different engine or different key order).
+ - There is a conflict on another key than the first and before the
+ statement is committed, another connection commits a row that conflicts
+ on an earlier unique key. Example follows:
+
+ Below a and b are unique keys, the table has a row (1,1,0)
+ connection 1:
+ INSERT INTO t1 set a=2,b=1,c=0 ON DUPLICATE KEY UPDATE c=1;
+ connection 2:
+ INSERT INTO t1 set a=2,b=2,c=0;
+
+ If 2 commits after 1 has been executed but before 1 has committed
+ (and are thus put before the other in the binary log), one will
+ get different data on the slave:
+ (1,1,1),(2,2,1) instead of (1,1,1),(2,2,0)
+*/
+
+void THD::reconsider_logging_format_for_iodup(TABLE *table)
{
- /*
- INSERT...ON DUPLICATE KEY UPDATE on a table with more than one unique keys
- can be unsafe.
- */
- if(wsrep_binlog_format() <= BINLOG_FORMAT_STMT &&
- !is_current_stmt_binlog_format_row() &&
- !lex->is_stmt_unsafe() &&
- lex->sql_command == SQLCOM_INSERT &&
- lex->duplicates == DUP_UPDATE)
+ DBUG_ENTER("reconsider_logging_format_for_iodup");
+ enum_binlog_format bf= (enum_binlog_format) wsrep_binlog_format();
+
+ DBUG_ASSERT(lex->duplicates == DUP_UPDATE);
+
+ if (bf <= BINLOG_FORMAT_STMT &&
+ !is_current_stmt_binlog_format_row())
{
+ KEY *end= table->s->key_info + table->s->keys;
uint unique_keys= 0;
- uint keys= table->s->keys, i= 0;
- Field *field;
- for (KEY* keyinfo= table->s->key_info;
- i < keys && unique_keys <= 1; i++, keyinfo++)
- if (keyinfo->flags & HA_NOSAME &&
- !(keyinfo->key_part->field->flags & AUTO_INCREMENT_FLAG &&
- //User given auto inc can be unsafe
- !keyinfo->key_part->field->val_int()))
+
+ for (KEY *keyinfo= table->s->key_info; keyinfo < end ; keyinfo++)
+ {
+ if (keyinfo->flags & HA_NOSAME)
{
+ /*
+ We assume that the following cases will guarantee that the
+ key is unique if a key part is not set:
+ - The key part is an autoincrement (autogenerated)
+ - The key part has a default value that is null and it not
+ a virtual field that will be calculated later.
+ */
for (uint j= 0; j < keyinfo->user_defined_key_parts; j++)
{
- field= keyinfo->key_part[j].field;
- if(!bitmap_is_set(table->write_set,field->field_index))
- goto exit;
+ Field *field= keyinfo->key_part[j].field;
+ if (!bitmap_is_set(table->write_set, field->field_index))
+ {
+ /* Check auto_increment */
+ if (field == table->next_number_field)
+ goto exit;
+ if (field->is_real_null() && !field->default_value)
+ goto exit;
+ }
}
- unique_keys++;
+ if (unique_keys++)
+ break;
exit:;
}
-
+ }
if (unique_keys > 1)
{
- lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_INSERT_TWO_KEYS);
- binlog_unsafe_warning_flags|= lex->get_stmt_unsafe_flags();
+ if (bf == BINLOG_FORMAT_STMT && !lex->is_stmt_unsafe())
+ {
+ lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_INSERT_TWO_KEYS);
+ binlog_unsafe_warning_flags|= lex->get_stmt_unsafe_flags();
+ }
set_current_stmt_binlog_format_row_if_mixed();
- return 1;
}
}
- return 0;
+ DBUG_VOID_RETURN;
}
/*
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 0d1e14b1679..19466b3de90 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2016, Oracle and/or its affiliates.
- Copyright (c) 2009, 2021, MariaDB Corporation.
+ Copyright (c) 2009, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1054,7 +1054,7 @@ public:
/* We build without RTTI, so dynamic_cast can't be used. */
enum Type
{
- STATEMENT, PREPARED_STATEMENT, STORED_PROCEDURE, TABLE_ARENA
+ STATEMENT, PREPARED_STATEMENT, STORED_PROCEDURE
};
Query_arena(MEM_ROOT *mem_root_arg, enum enum_state state_arg) :
@@ -2169,6 +2169,39 @@ struct wait_for_commit
void reinit();
};
+
+class Sp_caches
+{
+public:
+ sp_cache *sp_proc_cache;
+ sp_cache *sp_func_cache;
+ sp_cache *sp_package_spec_cache;
+ sp_cache *sp_package_body_cache;
+ Sp_caches()
+ :sp_proc_cache(NULL),
+ sp_func_cache(NULL),
+ sp_package_spec_cache(NULL),
+ sp_package_body_cache(NULL)
+ { }
+ ~Sp_caches()
+ {
+ // All caches must be freed by the caller explicitly
+ DBUG_ASSERT(sp_proc_cache == NULL);
+ DBUG_ASSERT(sp_func_cache == NULL);
+ DBUG_ASSERT(sp_package_spec_cache == NULL);
+ DBUG_ASSERT(sp_package_body_cache == NULL);
+ }
+ void sp_caches_swap(Sp_caches &rhs)
+ {
+ swap_variables(sp_cache*, sp_proc_cache, rhs.sp_proc_cache);
+ swap_variables(sp_cache*, sp_func_cache, rhs.sp_func_cache);
+ swap_variables(sp_cache*, sp_package_spec_cache, rhs.sp_package_spec_cache);
+ swap_variables(sp_cache*, sp_package_body_cache, rhs.sp_package_body_cache);
+ }
+ void sp_caches_clear();
+};
+
+
extern "C" void my_message_sql(uint error, const char *str, myf MyFlags);
@@ -2189,7 +2222,8 @@ class THD: public THD_count, /* this must be first */
*/
public Item_change_list,
public MDL_context_owner,
- public Open_tables_state
+ public Open_tables_state,
+ public Sp_caches
{
private:
inline bool is_stmt_prepare() const
@@ -3183,10 +3217,6 @@ public:
enum_sql_command last_sql_command; // Last sql_command exceuted in mysql_execute_command()
sp_rcontext *spcont; // SP runtime context
- sp_cache *sp_proc_cache;
- sp_cache *sp_func_cache;
- sp_cache *sp_package_spec_cache;
- sp_cache *sp_package_body_cache;
/** number of name_const() substitutions, see sp_head.cc:subst_spvars() */
uint query_name_consts;
@@ -3969,8 +3999,7 @@ public:
bool is_item_tree_change_register_required()
{
- return !stmt_arena->is_conventional()
- || stmt_arena->type() == Query_arena::TABLE_ARENA;
+ return !stmt_arena->is_conventional();
}
void change_item_tree(Item **place, Item *new_value)
@@ -4588,18 +4617,18 @@ public:
mdl_context.release_transactional_locks(this);
}
int decide_logging_format(TABLE_LIST *tables);
+
/*
- In Some cases when decide_logging_format is called it does not have all
- information to decide the logging format. So that cases we call decide_logging_format_2
- at later stages in execution.
- One example would be binlog format for IODKU but column with unique key is not inserted.
- We dont have inserted columns info when we call decide_logging_format so on later stage we call
- decide_logging_format_low
+ In Some cases when decide_logging_format is called it does not have
+ all information to decide the logging format. So that cases we call
+ decide_logging_format_2 at later stages in execution.
- @returns 0 if no format is changed
- 1 if there is change in binlog format
+ One example would be binlog format for insert on duplicate key
+ (IODKU) but column with unique key is not inserted. We do not have
+ inserted columns info when we call decide_logging_format so on
+ later stage we call reconsider_logging_format_for_iodup()
*/
- int decide_logging_format_low(TABLE *table);
+ void reconsider_logging_format_for_iodup(TABLE *table);
enum need_invoker { INVOKER_NONE=0, INVOKER_USER, INVOKER_ROLE};
void binlog_invoker(bool role) { m_binlog_invoker= role ? INVOKER_ROLE : INVOKER_USER; }
diff --git a/sql/sql_expression_cache.cc b/sql/sql_expression_cache.cc
index 351ec258ddb..bc44ecd79fa 100644
--- a/sql/sql_expression_cache.cc
+++ b/sql/sql_expression_cache.cc
@@ -63,7 +63,7 @@ void Expression_cache_tmptable::disable_cache()
cache_table= NULL;
update_tracker();
if (tracker)
- tracker->cache= NULL;
+ tracker->detach_from_cache();
}
@@ -189,6 +189,8 @@ Expression_cache_tmptable::~Expression_cache_tmptable()
else
{
update_tracker();
+ if (tracker)
+ tracker->detach_from_cache();
tracker= NULL;
}
}
diff --git a/sql/sql_expression_cache.h b/sql/sql_expression_cache.h
index 61e0c4c69b3..d4bb252dccb 100644
--- a/sql/sql_expression_cache.h
+++ b/sql/sql_expression_cache.h
@@ -83,7 +83,11 @@ public:
cache(c), hit(0), miss(0), state(UNINITED)
{}
+private:
+ // This can be NULL if the cache is already deleted
Expression_cache *cache;
+
+public:
ulong hit, miss;
enum expr_cache_state state;
@@ -91,6 +95,7 @@ public:
void set(ulong h, ulong m, enum expr_cache_state s)
{hit= h; miss= m; state= s;}
+ void detach_from_cache() { cache= NULL; }
void fetch_current_stats()
{
if (cache)
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index 073d523b876..eb0dc1c2b3f 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -699,8 +699,10 @@ mysql_ha_fix_cond_and_key(SQL_HANDLER *handler,
if (!in_prepare)
{
MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->write_set);
- (void) item->save_in_field(key_part->field, 1);
+ int res= item->save_in_field(key_part->field, 1);
dbug_tmp_restore_column_map(&table->write_set, old_map);
+ if (res)
+ return 1;
}
key_len+= key_part->store_length;
keypart_map= (keypart_map << 1) | 1;
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 460fbba4ac5..7e848b3906e 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2016, Oracle and/or its affiliates.
- Copyright (c) 2010, 2021, MariaDB Corporation
+ Copyright (c) 2010, 2022, MariaDB Corporation
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -951,6 +951,12 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
}
THD_STAGE_INFO(thd, stage_update);
+
+ if (duplic == DUP_UPDATE)
+ {
+ restore_record(table,s->default_values); // Get empty record
+ thd->reconsider_logging_format_for_iodup(table);
+ }
do
{
DBUG_PRINT("info", ("iteration %llu", iteration));
@@ -1063,7 +1069,6 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
break;
}
- thd->decide_logging_format_low(table);
#ifndef EMBEDDED_LIBRARY
if (lock_type == TL_WRITE_DELAYED)
{
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index e622d5fb863..290dcdb33b9 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2019, Oracle and/or its affiliates.
- Copyright (c) 2009, 2021, MariaDB Corporation.
+ Copyright (c) 2009, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -209,7 +209,6 @@ init_lex_with_single_table(THD *thd, TABLE *table, LEX *lex)
return TRUE;
context->resolve_in_table_list_only(table_list);
lex->use_only_table_context= TRUE;
- lex->context_analysis_only|= CONTEXT_ANALYSIS_ONLY_VCOL_EXPR;
select_lex->cur_pos_in_select_list= UNDEF_POS;
table->map= 1; //To ensure correct calculation of const item
table_list->table= table;
@@ -4608,17 +4607,21 @@ void SELECT_LEX::update_used_tables()
while ((tl= ti++))
{
TABLE_LIST *embedding= tl;
- do
+ if (!is_eliminated_table(join->eliminated_tables, tl))
{
- bool maybe_null;
- if ((maybe_null= MY_TEST(embedding->outer_join)))
+ do
{
- tl->table->maybe_null= maybe_null;
- break;
+ bool maybe_null;
+ if ((maybe_null= MY_TEST(embedding->outer_join)))
+ {
+ tl->table->maybe_null= maybe_null;
+ break;
+ }
}
+ while ((embedding= embedding->embedding));
}
- while ((embedding= embedding->embedding));
- if (tl->on_expr)
+
+ if (tl->on_expr && !is_eliminated_table(join->eliminated_tables, tl))
{
tl->on_expr->update_used_tables();
tl->on_expr->walk(&Item::eval_not_null_tables, 0, NULL);
@@ -4642,8 +4645,11 @@ void SELECT_LEX::update_used_tables()
if (embedding->on_expr &&
embedding->nested_join->join_list.head() == tl)
{
- embedding->on_expr->update_used_tables();
- embedding->on_expr->walk(&Item::eval_not_null_tables, 0, NULL);
+ if (!is_eliminated_table(join->eliminated_tables, embedding))
+ {
+ embedding->on_expr->update_used_tables();
+ embedding->on_expr->walk(&Item::eval_not_null_tables, 0, NULL);
+ }
}
tl= embedding;
embedding= tl->embedding;
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 6a3a01f69d6..3db50222a27 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -4436,6 +4436,29 @@ public:
return create_info.vers_info;
}
+ /* The list of history-generating DML commands */
+ bool vers_history_generating() const
+ {
+ switch (sql_command)
+ {
+ case SQLCOM_DELETE:
+ return !vers_conditions.delete_history;
+ case SQLCOM_UPDATE:
+ case SQLCOM_UPDATE_MULTI:
+ case SQLCOM_DELETE_MULTI:
+ case SQLCOM_REPLACE:
+ case SQLCOM_REPLACE_SELECT:
+ return true;
+ case SQLCOM_INSERT:
+ case SQLCOM_INSERT_SELECT:
+ return duplicates == DUP_UPDATE;
+ case SQLCOM_LOAD:
+ return duplicates == DUP_REPLACE;
+ default:
+ return false;
+ }
+ }
+
int add_period(Lex_ident name, Lex_ident_sys_st start, Lex_ident_sys_st end)
{
if (lex_string_cmp(system_charset_info, &start, &end) == 0)
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 6a1b849b912..b5e6b6540c5 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -8852,6 +8852,7 @@ bool st_select_lex::add_window_def(THD *thd,
fields_in_window_functions+= win_part_list_ptr->elements +
win_order_list_ptr->elements;
}
+ win_def->win_spec_number= window_specs.elements;
return (win_def == NULL || window_specs.push_back(win_def));
}
@@ -8879,6 +8880,7 @@ bool st_select_lex::add_window_spec(THD *thd,
win_order_list_ptr->elements;
}
thd->lex->win_spec= win_spec;
+ win_spec->win_spec_number= window_specs.elements;
return (win_spec == NULL || window_specs.push_back(win_spec));
}
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 87b4d241028..2790f69e41e 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -355,7 +355,8 @@ bool check_valid_path(const char *path, size_t len)
static void fix_dl_name(MEM_ROOT *root, LEX_CSTRING *dl)
{
const size_t so_ext_len= sizeof(SO_EXT) - 1;
- if (my_strcasecmp(&my_charset_latin1, dl->str + dl->length - so_ext_len,
+ if (dl->length < so_ext_len ||
+ my_strcasecmp(&my_charset_latin1, dl->str + dl->length - so_ext_len,
SO_EXT))
{
char *s= (char*)alloc_root(root, dl->length + so_ext_len + 1);
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 735e00dd091..1b8147a6cfb 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -18087,7 +18087,7 @@ Field *Item_default_value::create_tmp_field_ex(TABLE *table,
Tmp_field_src *src,
const Tmp_field_param *param)
{
- if (field->default_value && (field->flags & BLOB_FLAG))
+ if (field->default_value || (field->flags & BLOB_FLAG))
{
/*
We have to use a copy function when using a blob with default value
@@ -18488,6 +18488,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
table->copy_blobs= 1;
table->in_use= thd;
table->no_rows_with_nulls= param->force_not_null_cols;
+ table->expr_arena= thd;
table->update_handler= NULL;
table->check_unique_buf= NULL;
@@ -25483,15 +25484,17 @@ change_to_use_tmp_fields(THD *thd, Ref_ptr_array ref_pointer_array,
for (uint i= 0; (item= it++); i++)
{
Field *field;
- if ((item->with_sum_func() && item->type() != Item::SUM_FUNC_ITEM) ||
+ enum Item::Type item_type= item->type();
+ if ((item->with_sum_func() && item_type != Item::SUM_FUNC_ITEM) ||
item->with_window_func)
item_field= item;
- else if (item->type() == Item::FIELD_ITEM)
+ else if (item_type == Item::FIELD_ITEM ||
+ item_type == Item::DEFAULT_VALUE_ITEM)
{
if (!(item_field= item->get_tmp_table_item(thd)))
DBUG_RETURN(true);
}
- else if (item->type() == Item::FUNC_ITEM &&
+ else if (item_type == Item::FUNC_ITEM &&
((Item_func*)item)->functype() == Item_func::SUSERVAR_FUNC)
{
field= item->get_tmp_table_field();
@@ -27369,7 +27372,7 @@ static void print_table_array(THD *thd,
too)
*/
-static bool is_eliminated_table(table_map eliminated_tables, TABLE_LIST *tbl)
+bool is_eliminated_table(table_map eliminated_tables, TABLE_LIST *tbl)
{
return eliminated_tables &&
((tbl->table && (tbl->table->map & eliminated_tables)) ||
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 28bf33997a0..9a6237f00a6 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -2,7 +2,7 @@
#define SQL_SELECT_INCLUDED
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
- Copyright (c) 2008, 2020, MariaDB Corporation.
+ Copyright (c) 2008, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -2540,6 +2540,8 @@ int create_sort_index(THD *thd, JOIN *join, JOIN_TAB *tab, Filesort *fsort);
JOIN_TAB *first_explain_order_tab(JOIN* join);
JOIN_TAB *next_explain_order_tab(JOIN* join, JOIN_TAB* tab);
+bool is_eliminated_table(table_map eliminated_tables, TABLE_LIST *tbl);
+
bool check_simple_equality(THD *thd, const Item::Context &ctx,
Item *left_item, Item *right_item,
COND_EQUAL *cond_equal);
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index d9d5c5d135c..eb3ee3d5f74 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -5181,6 +5181,7 @@ public:
int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
{
+ DBUG_ENTER("get_all_tables");
LEX *lex= thd->lex;
TABLE *table= tables->table;
TABLE_LIST table_acl_check;
@@ -5198,7 +5199,29 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
uint table_open_method= tables->table_open_method;
bool can_deadlock;
MEM_ROOT tmp_mem_root;
- DBUG_ENTER("get_all_tables");
+ /*
+ We're going to open FRM files for tables.
+ In case of VIEWs that contain stored function calls,
+ these stored functions will be parsed and put to the SP cache.
+
+ Suppose we have a view containing a stored function call:
+ CREATE VIEW v1 AS SELECT f1() AS c1;
+ and now we're running:
+ SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME=f1();
+ If a parallel thread invalidates the cache,
+ e.g. by creating or dropping some stored routine,
+ the SELECT query will re-parse f1() when processing "v1"
+ and replace the outdated cached version of f1() to a new one.
+ But the old version of f1() is referenced from the m_sp member
+ of the Item_func_sp instances used in the WHERE condition.
+ We cannot destroy it. To avoid such clashes, let's remember
+ all old routines into a temporary SP cache collection
+ and process tables with a new empty temporary SP cache collection.
+ Then restore to the old SP cache collection at the end.
+ */
+ Sp_caches old_sp_caches;
+
+ old_sp_caches.sp_caches_swap(*thd);
bzero(&tmp_mem_root, sizeof(tmp_mem_root));
@@ -5374,6 +5397,13 @@ err:
thd->restore_backup_open_tables_state(&open_tables_state_backup);
free_root(&tmp_mem_root, 0);
+ /*
+ Now restore to the saved SP cache collection
+ and clear the temporary SP cache collection.
+ */
+ old_sp_caches.sp_caches_swap(*thd);
+ old_sp_caches.sp_caches_clear();
+
DBUG_RETURN(error);
}
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index d58dbc2b0d6..9414735fa4e 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -8100,6 +8100,8 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
{
/* New column definitions are added here */
List<Create_field> new_create_list;
+ /* System-invisible fields must be added last */
+ List<Create_field> new_create_tail;
/* New key definitions are added here */
List<Key> new_key_list;
List_iterator<Alter_drop> drop_it(alter_info->drop_list);
@@ -8325,7 +8327,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
dropped_sys_vers_fields|= field->flags;
drop_it.remove();
}
- else
+ else if (field->invisible < INVISIBLE_SYSTEM)
{
/*
This field was not dropped and not changed, add it to the list
@@ -8350,6 +8352,12 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
alter_it.remove();
}
}
+ else
+ {
+ DBUG_ASSERT(field->invisible == INVISIBLE_SYSTEM);
+ def= new (thd->mem_root) Create_field(thd, field, field);
+ new_create_tail.push_back(def, thd->mem_root);
+ }
}
dropped_sys_vers_fields &= VERS_SYSTEM_FIELD;
if ((dropped_sys_vers_fields ||
@@ -8482,6 +8490,9 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
alter_it.remove();
}
}
+
+ new_create_list.append(&new_create_tail);
+
if (unlikely(alter_info->alter_list.elements))
{
my_error(ER_BAD_FIELD_ERROR, MYF(0),
diff --git a/sql/sql_type.cc b/sql/sql_type.cc
index e0a6169df3d..28fd2418e3b 100644
--- a/sql/sql_type.cc
+++ b/sql/sql_type.cc
@@ -2057,7 +2057,6 @@ Type_handler_decimal_result::make_num_distinct_aggregator_field(
const Item *item)
const
{
- DBUG_ASSERT(item->decimals <= DECIMAL_MAX_SCALE);
return new (mem_root)
Field_new_decimal(NULL, item->max_length,
(uchar *) (item->maybe_null ? "" : 0),
diff --git a/sql/sql_window.cc b/sql/sql_window.cc
index 876ddef8f65..bf36b592d96 100644
--- a/sql/sql_window.cc
+++ b/sql/sql_window.cc
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2016, 2017 MariaDB
+ Copyright (c) 2016, 2022 MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -424,16 +424,49 @@ ORDER *st_select_lex::find_common_window_func_partition_fields(THD *thd)
#define CMP_GT 2 // Greater then
static
-int compare_order_elements(ORDER *ord1, ORDER *ord2)
+int compare_order_elements(ORDER *ord1, int weight1,
+ ORDER *ord2, int weight2)
{
if (*ord1->item == *ord2->item && ord1->direction == ord2->direction)
return CMP_EQ;
Item *item1= (*ord1->item)->real_item();
Item *item2= (*ord2->item)->real_item();
- DBUG_ASSERT(item1->type() == Item::FIELD_ITEM &&
- item2->type() == Item::FIELD_ITEM);
- int cmp= ((Item_field *) item1)->field->field_index -
- ((Item_field *) item2)->field->field_index;
+
+ bool item1_field= (item1->type() == Item::FIELD_ITEM);
+ bool item2_field= (item2->type() == Item::FIELD_ITEM);
+
+ ptrdiff_t cmp;
+ if (item1_field && item2_field)
+ {
+ DBUG_ASSERT(((Item_field *) item1)->field->table ==
+ ((Item_field *) item2)->field->table);
+ cmp= ((Item_field *) item1)->field->field_index -
+ ((Item_field *) item2)->field->field_index;
+ }
+ else if (item1_field && !item2_field)
+ return CMP_LT;
+ else if (!item1_field && item2_field)
+ return CMP_LT;
+ else
+ {
+ /*
+ Ok, item1_field==NULL and item2_field==NULL.
+ We're not able to compare Item expressions. Order them according to
+ their passed "weight" (which comes from Window_spec::win_spec_number):
+ */
+ if (weight1 != weight2)
+ cmp= weight1 - weight2;
+ else
+ {
+ /*
+ The weight is the same. That is, the elements come from the same
+ window specification... This shouldn't happen.
+ */
+ DBUG_ASSERT(0);
+ cmp= item1 - item2;
+ }
+ }
+
if (cmp == 0)
{
if (ord1->direction == ord2->direction)
@@ -446,7 +479,9 @@ int compare_order_elements(ORDER *ord1, ORDER *ord2)
static
int compare_order_lists(SQL_I_List<ORDER> *part_list1,
- SQL_I_List<ORDER> *part_list2)
+ int spec_number1,
+ SQL_I_List<ORDER> *part_list2,
+ int spec_number2)
{
if (part_list1 == part_list2)
return CMP_EQ;
@@ -471,7 +506,8 @@ int compare_order_lists(SQL_I_List<ORDER> *part_list1,
if (!elem1 || !elem2)
break;
- if ((cmp= compare_order_elements(elem1, elem2)))
+ if ((cmp= compare_order_elements(elem1, spec_number1,
+ elem2, spec_number2)))
return cmp;
}
if (elem1)
@@ -566,7 +602,9 @@ int compare_window_spec_joined_lists(Window_spec *win_spec1,
win_spec1->join_partition_and_order_lists();
win_spec2->join_partition_and_order_lists();
int cmp= compare_order_lists(win_spec1->partition_list,
- win_spec2->partition_list);
+ win_spec1->win_spec_number,
+ win_spec2->partition_list,
+ win_spec2->win_spec_number);
win_spec1->disjoin_partition_and_order_lists();
win_spec2->disjoin_partition_and_order_lists();
return cmp;
@@ -584,7 +622,9 @@ int compare_window_funcs_by_window_specs(Item_window_func *win_func1,
if (win_spec1 == win_spec2)
return CMP_EQ;
cmp= compare_order_lists(win_spec1->partition_list,
- win_spec2->partition_list);
+ win_spec1->win_spec_number,
+ win_spec2->partition_list,
+ win_spec2->win_spec_number);
if (cmp == CMP_EQ)
{
/*
@@ -603,7 +643,9 @@ int compare_window_funcs_by_window_specs(Item_window_func *win_func1,
}
cmp= compare_order_lists(win_spec1->order_list,
- win_spec2->order_list);
+ win_spec1->win_spec_number,
+ win_spec2->order_list,
+ win_spec2->win_spec_number);
if (cmp != CMP_EQ)
return cmp;
@@ -700,7 +742,9 @@ void order_window_funcs_by_window_specs(List<Item_window_func> *win_func_list)
int cmp;
if (win_spec_prev->partition_list == win_spec_curr->partition_list)
cmp= compare_order_lists(win_spec_prev->order_list,
- win_spec_curr->order_list);
+ win_spec_prev->win_spec_number,
+ win_spec_curr->order_list,
+ win_spec_curr->win_spec_number);
else
cmp= compare_window_spec_joined_lists(win_spec_prev, win_spec_curr);
if (!(CMP_LT_C <= cmp && cmp <= CMP_GT_C))
diff --git a/sql/sql_window.h b/sql/sql_window.h
index 5e76a33dcd0..66ea8c7dd4d 100644
--- a/sql/sql_window.h
+++ b/sql/sql_window.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2016, 2017 MariaDB
+ Copyright (c) 2016, 2022 MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -120,10 +120,15 @@ class Window_spec : public Sql_alloc
Window_spec *referenced_win_spec;
- Window_spec(LEX_CSTRING *win_ref,
- SQL_I_List<ORDER> *part_list,
- SQL_I_List<ORDER> *ord_list,
- Window_frame *win_frame)
+ /*
+ Window_spec objects are numbered by the number of their appearance in the
+ query. This is used by compare_order_elements() to provide a predictable
+ ordering of PARTITION/ORDER BY clauses.
+ */
+ int win_spec_number;
+
+ Window_spec(LEX_CSTRING *win_ref, SQL_I_List<ORDER> *part_list,
+ SQL_I_List<ORDER> *ord_list, Window_frame *win_frame)
: window_names_are_checked(false), window_ref(win_ref),
partition_list(part_list), save_partition_list(NULL),
order_list(ord_list), save_order_list(NULL),
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index cb0d8fff50a..e2e554f6d82 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
- Copyright (c) 2010, 2021, MariaDB
+ Copyright (c) 2010, 2022, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -834,7 +834,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
/*
We should not introduce any further shift/reduce conflicts.
*/
-%expect 68
+%expect 72
/*
Comments for TOKENS.
@@ -947,6 +947,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token FIRST_VALUE_SYM /* SQL-2011 */
%token FLOAT_NUM
%token FLOAT_SYM /* SQL-2003-R */
+%token FORCE_LOOKAHEAD /* INTERNAL never returned by the lexer */
%token FOREIGN /* SQL-2003-R */
%token FOR_SYM /* SQL-2003-R */
%token FOR_SYSTEM_TIME_SYM /* INTERNAL */
@@ -3057,6 +3058,9 @@ sequence_def:
}
;
+/* this rule is used to force look-ahead in the parser */
+force_lookahead: {} | FORCE_LOOKAHEAD {} ;
+
server_def:
SERVER_SYM opt_if_not_exists ident_or_text
{
@@ -3258,7 +3262,7 @@ ev_sql_stmt:
lex->sphead->set_body_start(thd, lip->get_cpp_ptr());
}
- sp_proc_stmt
+ sp_proc_stmt force_lookahead
{
/* return back to the original memory root ASAP */
if (Lex->sp_body_finalize_event(thd))
@@ -18062,8 +18066,8 @@ trigger_tail:
lex->sphead->set_body_start(thd, lip->get_cpp_tok_start());
}
- sp_proc_stmt /* $19 */
- { /* $20 */
+ sp_proc_stmt /* $19 */ force_lookahead /* $20 */
+ { /* $21 */
LEX *lex= Lex;
lex->sql_command= SQLCOM_CREATE_TRIGGER;
@@ -18113,7 +18117,7 @@ sf_c_chistics_and_body:
lex->sphead->set_c_chistics(lex->sp_chistics);
lex->sphead->set_body_start(thd, YYLIP->get_cpp_tok_start());
}
- sp_proc_stmt_in_returns_clause
+ sp_proc_stmt_in_returns_clause force_lookahead
{
if (unlikely(Lex->sp_body_finalize_function(thd)))
MYSQL_YYABORT;
@@ -18135,7 +18139,7 @@ sp_tail:
Lex->sphead->set_c_chistics(Lex->sp_chistics);
Lex->sphead->set_body_start(thd, YYLIP->get_cpp_tok_start());
}
- sp_proc_stmt
+ sp_proc_stmt force_lookahead
{
if (unlikely(Lex->sp_body_finalize_procedure(thd)))
MYSQL_YYABORT;
diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy
index 2b22d585a94..c079598a169 100644
--- a/sql/sql_yacc_ora.yy
+++ b/sql/sql_yacc_ora.yy
@@ -310,7 +310,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
/*
We should not introduce any further shift/reduce conflicts.
*/
-%expect 70
+%expect 73
/*
Comments for TOKENS.
@@ -423,6 +423,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token FIRST_VALUE_SYM /* SQL-2011 */
%token FLOAT_NUM
%token FLOAT_SYM /* SQL-2003-R */
+%token FORCE_LOOKAHEAD /* INTERNAL never returned by the lexer */
%token FOREIGN /* SQL-2003-R */
%token FOR_SYM /* SQL-2003-R */
%token FOR_SYSTEM_TIME_SYM /* INTERNAL */
@@ -2832,6 +2833,9 @@ sequence_def:
}
;
+/* this rule is used to force look-ahead in the parser */
+force_lookahead: {} | FORCE_LOOKAHEAD {} ;
+
server_def:
SERVER_SYM opt_if_not_exists ident_or_text
{
@@ -3033,7 +3037,7 @@ ev_sql_stmt:
lex->sphead->set_body_start(thd, lip->get_cpp_ptr());
}
- sp_proc_stmt
+ sp_proc_stmt force_lookahead
{
/* return back to the original memory root ASAP */
if (Lex->sp_body_finalize_event(thd))
@@ -18286,8 +18290,8 @@ trigger_tail:
lex->sphead->set_body_start(thd, lip->get_cpp_tok_start());
}
- sp_proc_stmt /* $19 */
- { /* $20 */
+ sp_proc_stmt /* $19 */ force_lookahead /* $20 */
+ { /* $21 */
LEX *lex= Lex;
lex->sql_command= SQLCOM_CREATE_TRIGGER;
@@ -18336,7 +18340,7 @@ sf_c_chistics_and_body_standalone:
lex->sphead->set_body_start(thd, YYLIP->get_cpp_tok_start());
}
sp_tail_is
- sp_body
+ sp_body force_lookahead
{
if (unlikely(Lex->sp_body_finalize_function(thd)))
MYSQL_YYABORT;
diff --git a/sql/table.cc b/sql/table.cc
index 6aa2dc872ad..00b498fdd77 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -50,17 +50,6 @@
#define MYSQL57_GENERATED_FIELD 128
#define MYSQL57_GCOL_HEADER_SIZE 4
-class Table_arena: public Query_arena
-{
-public:
- Table_arena(MEM_ROOT *mem_root, enum enum_state state_arg) :
- Query_arena(mem_root, state_arg){}
- virtual Type type() const
- {
- return TABLE_ARENA;
- }
-};
-
struct extra2_fields
{
LEX_CUSTRING version;
@@ -1139,8 +1128,8 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table,
We need to use CONVENTIONAL_EXECUTION here to ensure that
any new items created by fix_fields() are not reverted.
*/
- table->expr_arena= new (alloc_root(mem_root, sizeof(Table_arena)))
- Table_arena(mem_root,
+ table->expr_arena= new (alloc_root(mem_root, sizeof(Query_arena)))
+ Query_arena(mem_root,
Query_arena::STMT_CONVENTIONAL_EXECUTION);
if (!table->expr_arena)
DBUG_RETURN(1);
@@ -3352,8 +3341,7 @@ class Vcol_expr_context
bool inited;
THD *thd;
TABLE *table;
- LEX *old_lex;
- LEX lex;
+ Query_arena backup_arena;
table_map old_map;
Security_context *save_security_ctx;
sql_mode_t save_sql_mode;
@@ -3363,7 +3351,6 @@ public:
inited(false),
thd(_thd),
table(_table),
- old_lex(thd->lex),
old_map(table->map),
save_security_ctx(thd->security_ctx),
save_sql_mode(thd->variables.sql_mode) {}
@@ -3375,18 +3362,6 @@ public:
bool Vcol_expr_context::init()
{
- /*
- As this is vcol expression we must narrow down name resolution to
- single table.
- */
- if (init_lex_with_single_table(thd, table, &lex))
- {
- my_error(ER_OUT_OF_RESOURCES, MYF(0));
- table->map= old_map;
- return true;
- }
-
- lex.sql_command= old_lex->sql_command;
thd->variables.sql_mode= 0;
TABLE_LIST const *tl= table->pos_in_table_list;
@@ -3395,6 +3370,8 @@ bool Vcol_expr_context::init()
if (table->pos_in_table_list->security_ctx)
thd->security_ctx= tl->security_ctx;
+ thd->set_n_backup_active_arena(table->expr_arena, &backup_arena);
+
inited= true;
return false;
}
@@ -3403,9 +3380,9 @@ Vcol_expr_context::~Vcol_expr_context()
{
if (!inited)
return;
- end_lex_with_single_table(thd, table, old_lex);
table->map= old_map;
thd->security_ctx= save_security_ctx;
+ thd->restore_active_arena(table->expr_arena, &backup_arena);
thd->variables.sql_mode= save_sql_mode;
}
@@ -3756,6 +3733,7 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
outparam->s= share;
outparam->db_stat= db_stat;
outparam->write_row_record= NULL;
+ outparam->status= STATUS_NO_RECORD;
if (share->incompatible_version &&
!(ha_open_flags & (HA_OPEN_FOR_ALTER | HA_OPEN_FOR_REPAIR)))
@@ -6642,7 +6620,7 @@ Item *Field_iterator_view::create_item(THD *thd)
Item *create_view_field(THD *thd, TABLE_LIST *view, Item **field_ref,
LEX_CSTRING *name)
{
- bool save_wrapper= thd->lex->first_select_lex()->no_wrap_view_item;
+ bool save_wrapper= thd->lex->current_select->no_wrap_view_item;
Item *field= *field_ref;
DBUG_ENTER("create_view_field");
diff --git a/sql/tztime.cc b/sql/tztime.cc
index 80035a5b906..7319084c28b 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -2747,9 +2747,9 @@ main(int argc, char **argv)
sql_log_bin and wsrep_on to avoid Galera replicating below
TRUNCATE TABLE clauses. This will allow user to set different
time zones to nodes in Galera cluster. */
- printf("set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');\n"
- "prepare set_wsrep_write_binlog from @prep1;\n"
- "set @toggle=0; execute set_wsrep_write_binlog using @toggle;\n"
+ printf("set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION WSREP_ON=OFF', 'do 0');\n"
+ "SET SESSION SQL_LOG_BIN=0;\n"
+ "execute immediate @prep1;\n"
"%s%s", trunc_tables, lock_tables);
else
// Alter time zone tables to InnoDB if wsrep_on is enabled
diff --git a/storage/connect/tabrest.cpp b/storage/connect/tabrest.cpp
index c66d8d76f3d..7e8b51714fb 100644
--- a/storage/connect/tabrest.cpp
+++ b/storage/connect/tabrest.cpp
@@ -112,7 +112,11 @@ int Xcurl(PGLOBAL g, PCSZ Http, PCSZ Uri, PCSZ filename)
} // endif f
- pID = vfork();
+#ifdef HAVE_VFORK
+ pID = vfork();
+#else
+ pID = fork();
+#endif
sprintf(fn, "-o%s", filename);
if (pID == 0) {
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc
index dd08b3e6b63..12666bdf18b 100644
--- a/storage/innobase/btr/btr0btr.cc
+++ b/storage/innobase/btr/btr0btr.cc
@@ -2,7 +2,7 @@
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2014, 2021, MariaDB Corporation.
+Copyright (c) 2014, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -2758,8 +2758,8 @@ btr_insert_into_right_sibling(
max_size = page_get_max_insert_size_after_reorganize(next_page, 1);
/* Extends gap lock for the next page */
- if (!dict_table_is_locking_disabled(cursor->index->table)) {
- lock_update_split_left(next_block, block);
+ if (is_leaf && !dict_table_is_locking_disabled(cursor->index->table)) {
+ lock_update_node_pointer(block, next_block);
}
rec = page_cur_tuple_insert(
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index 864311a0abf..eee8ff0af4a 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2020, MariaDB Corporation.
+Copyright (c) 2013, 2022, MariaDB Corporation.
Copyright (c) 2013, 2014, Fusion-io
This program is free software; you can redistribute it and/or modify it under
@@ -1134,15 +1134,10 @@ buf_flush_page(
/* For table residing in temporary tablespace sync is done
using IO_FIX and so before scheduling for flush ensure that
page is not fixed. */
- flush = FALSE;
+ return FALSE;
} else {
rw_lock = &reinterpret_cast<buf_block_t*>(bpage)->lock;
- if (flush_type != BUF_FLUSH_LIST) {
- flush = rw_lock_sx_lock_nowait(rw_lock, BUF_IO_WRITE);
- } else {
- /* Will SX lock later */
- flush = TRUE;
- }
+ flush = rw_lock_sx_lock_nowait(rw_lock, BUF_IO_WRITE);
}
if (flush) {
@@ -1164,22 +1159,6 @@ buf_flush_page(
buf_pool_mutex_exit(buf_pool);
- if (flush_type == BUF_FLUSH_LIST
- && is_uncompressed
- && !rw_lock_sx_lock_nowait(rw_lock, BUF_IO_WRITE)) {
-
- if (!fsp_is_system_temporary(bpage->id.space())) {
- /* avoiding deadlock possibility involves
- doublewrite buffer, should flush it, because
- it might hold the another block->lock. */
- buf_dblwr_flush_buffered_writes();
- } else {
- buf_dblwr_sync_datafiles();
- }
-
- rw_lock_sx_lock_gen(rw_lock, BUF_IO_WRITE);
- }
-
/* If there is an observer that want to know if the asynchronous
flushing was sent then notify it.
Note: we set flush observer to a page with x-latch, so we can
diff --git a/storage/innobase/gis/gis0rtree.cc b/storage/innobase/gis/gis0rtree.cc
index 77dd6f7ae27..b7f8e924431 100644
--- a/storage/innobase/gis/gis0rtree.cc
+++ b/storage/innobase/gis/gis0rtree.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2018, 2021, MariaDB Corporation.
+Copyright (c) 2019, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -376,6 +376,7 @@ rtr_update_mbr_field(
if (!rtr_update_mbr_field_in_place(index, rec,
offsets, mbr, mtr)) {
+ mem_heap_free(heap);
return(false);
}
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 972c2a0731a..151e104db78 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -16611,8 +16611,8 @@ ha_innobase::get_auto_increment(
(3) It is restricted only for insert operations. */
- if (increment > 1 && thd_sql_command(m_user_thd) != SQLCOM_ALTER_TABLE
- && autoinc < col_max_value) {
+ if (increment > 1 && increment <= ~autoinc && autoinc < col_max_value
+ && thd_sql_command(m_user_thd) != SQLCOM_ALTER_TABLE) {
ulonglong prev_auto_inc = autoinc;
diff --git a/storage/innobase/include/dict0types.h b/storage/innobase/include/dict0types.h
index d0da45ab218..76ffef236a1 100644
--- a/storage/innobase/include/dict0types.h
+++ b/storage/innobase/include/dict0types.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -71,7 +71,7 @@ enum dict_err_ignore_t {
DICT_ERR_IGNORE_INDEX_ROOT = 2, /*!< ignore error if index root
page is FIL_NULL or incorrect value */
DICT_ERR_IGNORE_CORRUPT = 4, /*!< skip corrupted indexes */
- DICT_ERR_IGNORE_RECOVER_LOCK = 8,
+ DICT_ERR_IGNORE_RECOVER_LOCK = 8 | DICT_ERR_IGNORE_FK_NOKEY,
/*!< Used when recovering table locks
for resurrected transactions.
Silently load a missing
diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h
index 9c3f5d57f01..c7fb219a7d5 100644
--- a/storage/innobase/include/lock0lock.h
+++ b/storage/innobase/include/lock0lock.h
@@ -1,7 +1,7 @@
/*****************************************************************************
-Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2020, MariaDB Corporation.
+Copyright (c) 1996, 2022, Oracle and/or its affiliates.
+Copyright (c) 2017, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -151,6 +151,40 @@ lock_update_copy_and_discard(
which copied */
const buf_block_t* block); /*!< in: index page;
NOT the root! */
+/** Update gap locks between the last record of the left_block and the
+first record of the right_block when a record is about to be inserted
+at the start of the right_block, even though it should "naturally" be
+inserted as the last record of the left_block according to the
+current node pointer in the parent page.
+
+That is, we assume that the lowest common ancestor of the left_block
+and right_block routes the key of the new record to the left_block,
+but a heuristic which tries to avoid overflowing left_block has chosen
+to insert the record into right_block instead. Said ancestor performs
+this routing by comparing the key of the record to a "split point" -
+all records greater or equal to than the split point (node pointer)
+are in right_block, and smaller ones in left_block.
+The split point may be smaller than the smallest key in right_block.
+
+The gap between the last record on the left_block and the first record
+on the right_block is represented as a gap lock attached to the supremum
+pseudo-record of left_block, and a gap lock attached to the new first
+record of right_block.
+
+Thus, inserting the new record, and subsequently adjusting the node
+pointers in parent pages to values smaller or equal to the new
+records' key, will mean that gap will be sliced at a different place
+("moved to the left"): fragment of the 1st gap will now become treated
+as 2nd. Therefore, we must copy any GRANTED locks from 1st gap to the
+2nd gap. Any WAITING locks must be of INSERT_INTENTION type (as no
+other GAP locks ever wait for anything) and can stay at 1st gap, as
+their only purpose is to notify the requester they can retry
+insertion, and there's no correctness requirement to avoid waking them
+up too soon.
+@param left_block left page
+@param right_block right page */
+void lock_update_node_pointer(const buf_block_t *left_block,
+ const buf_block_t *right_block);
/*************************************************************//**
Updates the lock table when a page is split to the left. */
void
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index 9949ebded8e..01a31b41662 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
-Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2014, 2021, MariaDB Corporation.
+Copyright (c) 1996, 2022, Oracle and/or its affiliates.
+Copyright (c) 2014, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -3041,6 +3041,17 @@ lock_update_split_right(
lock_mutex_exit();
}
+void lock_update_node_pointer(const buf_block_t *left_block,
+ const buf_block_t *right_block)
+{
+ const ulint h= lock_get_min_heap_no(right_block);
+
+ lock_mutex_enter();
+ lock_rec_inherit_to_gap(right_block, left_block,
+ h, PAGE_HEAP_NO_SUPREMUM);
+ lock_mutex_exit();
+}
+
/*************************************************************//**
Updates the lock table when a page is merged to the right. */
void
@@ -5034,25 +5045,25 @@ loop:
holding a space->latch. */
if (!sync_check_find(SYNC_FSP))
for (i = nth_bit; i < lock_rec_get_n_bits(lock); i++) {
-
- if (i == PAGE_HEAP_NO_SUPREMUM
- || lock_rec_get_nth_bit(lock, i)) {
+ bool locked = lock_rec_get_nth_bit(lock, i);
+ if (locked || i == PAGE_HEAP_NO_SUPREMUM) {
rec = page_find_rec_with_heap_no(block->frame, i);
ut_a(rec);
- ut_ad(!lock_rec_get_nth_bit(lock, i)
- || page_rec_is_leaf(rec));
- offsets = rec_get_offsets(rec, lock->index, offsets,
- lock->index->n_core_fields,
- ULINT_UNDEFINED, &heap);
+ ut_ad(!locked || page_rec_is_leaf(rec));
/* If this thread is holding the file space
latch (fil_space_t::latch), the following
check WILL break the latching order and may
cause a deadlock of threads. */
- lock_rec_queue_validate(
- TRUE, block, rec, lock->index, offsets);
+ if (locked) {
+ offsets = rec_get_offsets(rec, lock->index,
+ offsets, lock->index->n_core_fields,
+ ULINT_UNDEFINED, &heap);
+ lock_rec_queue_validate(TRUE, block, rec,
+ lock->index, offsets);
+ }
nth_bit = i + 1;
@@ -5145,13 +5156,6 @@ lock_rec_block_validate(
BUF_GET_POSSIBLY_FREED,
__FILE__, __LINE__, &mtr, &err);
- if (err != DB_SUCCESS) {
- ib::error() << "Lock rec block validate failed for tablespace "
- << space->name
- << " space_id " << space_id
- << " page_no " << page_no << " err " << err;
- }
-
if (block) {
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc
index a1f5e55d8f4..bfe0334bde7 100644
--- a/storage/innobase/row/row0ins.cc
+++ b/storage/innobase/row/row0ins.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, 2021, MariaDB Corporation.
+Copyright (c) 2016, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -2954,8 +2954,12 @@ row_ins_sec_index_entry_low(
rtr_init_rtr_info(&rtr_info, false, &cursor,
index, false);
rtr_info_update_btr(&cursor, &rtr_info);
- mtr_start(&mtr);
- index->set_modified(mtr);
+ mtr.start();
+ if (index->table->is_temporary()) {
+ mtr.set_log_mode(MTR_LOG_NO_REDO);
+ } else {
+ index->set_modified(mtr);
+ }
search_mode &= ulint(~BTR_MODIFY_LEAF);
search_mode |= BTR_MODIFY_TREE;
err = btr_cur_search_to_nth_level(
@@ -3200,9 +3204,6 @@ row_ins_clust_index_entry(
#endif /* WITH_WSREP */
const ulint orig_n_fields = entry->n_fields;
- /* Try first optimistic descent to the B-tree */
- log_free_check();
-
/* For intermediate table during copy alter table,
skip the undo log and record lock checking for
insertion operation.
diff --git a/tests/mysql_client_fw.c b/tests/mysql_client_fw.c
index 8a6d38d9e30..e8d628e7b52 100644
--- a/tests/mysql_client_fw.c
+++ b/tests/mysql_client_fw.c
@@ -101,6 +101,7 @@ DBUG_PRINT("test", ("name: %s", str)); \
fprintf(stdout, "%u of (%u/%u): %s", test_count++, iter_count, \
opt_count, str); \
fprintf(stdout, " \n#####################################\n"); \
+ fflush(stdout); \
}
#define myheader_r(str) \
@@ -110,6 +111,7 @@ DBUG_PRINT("test", ("name: %s", str)); \
fprintf(stdout, "\n\n#####################################\n"); \
fprintf(stdout, "%s", str); \
fprintf(stdout, " \n#####################################\n"); \
+ fflush(stdout); \
}
static void print_error(const char *msg);
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 48fb71dfcec..d4e4f0c84a5 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -20226,6 +20226,7 @@ static void test_proxy_header_tcp(const char *ipaddr, int port)
// normalize IPv4-mapped IPv6 addresses, e.g ::ffff:127.0.0.2 to 127.0.0.2
const char *normalized_addr= strncmp(ipaddr, "::ffff:", 7)?ipaddr : ipaddr + 7;
+ myheader("test_proxy_header_tcp");
memset(&v2_header, 0, sizeof(v2_header));
sprintf(text_header,"PROXY %s %s %s %d 3306\r\n",family == AF_INET?"TCP4":"TCP6", ipaddr, ipaddr, port);
@@ -20304,6 +20305,7 @@ static void test_proxy_header_localhost()
MYSQL_RES *result;
MYSQL_ROW row;
int rc;
+ myheader("test_proxy_header_localhost");
memset(&v2_header, 0, sizeof(v2_header));
memcpy(v2_header.sig, "\x0D\x0A\x0D\x0A\x00\x0D\x0A\x51\x55\x49\x54\x0A", 12);
@@ -20336,6 +20338,7 @@ static void test_proxy_header_ignore()
int rc;
MYSQL *m = mysql_client_init(NULL);
v2_proxy_header v2_header;
+ myheader("test_ps_params_in_ctes");
DIE_UNLESS(m != NULL);
mysql_optionsv(m, MARIADB_OPT_PROXY_HEADER, "PROXY UNKNOWN\r\n",15);
DIE_UNLESS(mysql_real_connect(m, opt_host, "root", "", NULL, opt_port, opt_unix_socket, 0) == m);
@@ -20366,6 +20369,7 @@ static void test_proxy_header_ignore()
static void test_proxy_header()
{
+ myheader("test_proxy_header");
test_proxy_header_tcp("192.0.2.1",3333);
test_proxy_header_tcp("2001:db8:85a3::8a2e:370:7334",2222);
test_proxy_header_tcp("::ffff:192.0.2.1",2222);
@@ -20385,6 +20389,7 @@ static void test_bulk_autoinc()
int i, id[]= {2, 3, 777}, count= sizeof(id)/sizeof(id[0]);
MYSQL_RES *result;
+ myheader("test_bulk_autoinc");
rc= mysql_query(mysql, "DROP TABLE IF EXISTS ai_field_value");
myquery(rc);
rc= mysql_query(mysql, "CREATE TABLE ai_field_value (id int not null primary key auto_increment)");
@@ -20438,6 +20443,7 @@ static void test_bulk_delete()
int i, id[]= {1, 2, 4}, count= sizeof(id)/sizeof(id[0]);
MYSQL_RES *result;
+ myheader("test_bulk_delete");
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
myquery(rc);
rc= mysql_query(mysql, "CREATE TABLE t1 (id int not null primary key)");
@@ -20500,6 +20506,7 @@ static void test_bulk_replace()
count= sizeof(id)/sizeof(id[0]);
MYSQL_RES *result;
+ myheader("test_bulk_replace");
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
myquery(rc);
rc= mysql_query(mysql, "CREATE TABLE t1 (id int not null primary key, active int)");
@@ -20558,6 +20565,7 @@ static void test_ps_params_in_ctes()
int int_data[1];
MYSQL_STMT *stmt;
+ myheader("test_ps_params_in_ctes");
rc= mysql_query(mysql, "create table t1(a int, b int, key(a))");
myquery(rc);