Merge commit '10.4' into 10.5

This commit is contained in:
Oleksandr Byelkin 2023-07-20 11:54:52 +02:00
commit f52954ef42
310 changed files with 5817 additions and 7012 deletions

1
.gitignore vendored
View file

@ -7,6 +7,7 @@
*.rpm
.*.swp
*.ninja
.ccls-cache/
.ninja_*
*.mri
*.mri.tpl

View file

@ -27,6 +27,7 @@ stages:
- build
- test
- Salsa-CI
- sast
default:
# Base image for builds and tests unless otherwise defined
@ -206,7 +207,7 @@ fedora-sanitizer:
- builddir/_CPack_Packages/Linux/RPM/SPECS/
parallel:
matrix:
- SANITIZER: [-DWITH_ASAN=YES, -DWITH_TSAN=YES, -DWITH_UBSAN=YES, -DWITH_MSAN=YES]
- SANITIZER: [-DWITH_ASAN=YES, -DWITH_TSAN=YES, -DWITH_UBSAN=YES]
centos8:
stage: build
@ -298,6 +299,7 @@ centos7:
main.mysqldump : Field separator argument is not what is expected; check the manual when executing 'SELECT INTO OUTFILE'
main.flush_logs_not_windows : query 'flush logs' succeeded - should have failed with error ER_CANT_CREATE_FILE (1004)
main.mysql_upgrade_noengine : upgrade output order does not match the expected
main.func_math : MDEV-20966 - Wrong error code
" > skiplist
- ./mtr --suite=main --force --parallel=auto --xml-report=$CI_PROJECT_DIR/junit.xml --skip-test-list=skiplist $RESTART_POLICY
@ -370,22 +372,6 @@ mysql-test-run-ubsan:
junit:
- junit.xml
mysql-test-run-msan:
stage: test
variables:
RESTART_POLICY: "--force-restart"
dependencies:
- "fedora-sanitizer: [-DWITH_MSAN=YES]"
needs:
- "fedora-sanitizer: [-DWITH_MSAN=YES]"
<<: *mysql-test-run-def
allow_failure: true
artifacts:
when: always # Also show results when tests fail
reports:
junit:
- junit.xml
rpmlint:
stage: test
dependencies:
@ -440,52 +426,70 @@ fedora install:
- installed-database.sql
- upgraded-database.sql
fedora upgrade:
stage: test
dependencies:
- fedora
needs:
- fedora
cppcheck:
stage: sast
needs: []
variables:
GIT_STRATEGY: fetch
GIT_SUBMODULE_STRATEGY: normal
script:
- dnf install -y mariadb-server
# Fedora does not support running services in Docker (like Debian packages do) so start it manually
- /usr/libexec/mariadb-check-socket
- /usr/libexec/mariadb-prepare-db-dir
- sudo -u mysql /usr/libexec/mariadbd --basedir=/usr & sleep 10
# Dump database contents in installed state
- mariadb-dump --all-databases --all-tablespaces --triggers --routines --events --skip-extended-insert > old-installed-database.sql
- /usr/libexec/mariadb-check-upgrade
# Dump database contents in upgraded state
- mariadb-dump --all-databases --all-tablespaces --triggers --routines --events --skip-extended-insert > old-upgraded-database.sql
- mariadb --skip-column-names -e "SELECT @@version, @@version_comment" # Show version
# @TODO: Upgrade from Fedora 33 MariaDB 10.4 to MariaDB.org latest does not work
# so do this manual step to remove conflicts until packaging is fixed
- yum remove -y mariadb-server-utils mariadb-gssapi-server mariadb-cracklib-password-check mariadb-backup mariadb-connector-c-config
- rm -f rpm/*debuginfo* # Not relevant in this test
- yum install -y rpm/*.rpm
# nothing provides galera-4 on Fedora, so this step fails if built with wsrep
- mysql -e "SHUTDOWN;"
- /usr/bin/mariadb-install-db # This step should not do anything on upgrades, just exit
- sudo -u mysql /usr/sbin/mariadbd & sleep 10
# Dump database contents in installed state
- mariadb-dump --all-databases --all-tablespaces --triggers --routines --events --skip-extended-insert > new-installed-database.sql || true
# The step above fails on: mariadb-dump: Couldn't execute 'show events': Cannot proceed, because event scheduler is disabled (1577)
# @TODO: Since we did a manual start, we also need to run upgrade manually
- /usr/bin/mariadb-upgrade
# Dump database contents in upgraded state
- mariadb-dump --all-databases --all-tablespaces --triggers --routines --events --skip-extended-insert > new-upgraded-database.sql
- |
mariadb --skip-column-names -e "SELECT @@version, @@version_comment" | tee /tmp/version
grep $MARIADB_MAJOR_VERSION /tmp/version || echo "MariaDB didn't upgrade properly"
- mariadb --table -e "SELECT * FROM mysql.global_priv; SHOW CREATE USER root@localhost; SHOW CREATE USER 'mariadb.sys'@localhost"
- mariadb --table -e "SELECT * FROM mysql.plugin; SHOW PLUGINS"
- yum install -y cppcheck diffutils
# --template: use a single-line template
# --force: check large directories without warning
# -i<directory>: ignore this directory when scanning
# -j: run multiple cppcheck threads
# Use newline to escape colon in yaml
- >
cppcheck --template="{file}:{line}: {severity}: {message}" --force
client dbug extra include libmariadb libmysqld libservices mysql-test mysys mysys_ssl pcre plugin
strings tests unittest vio wsrep-lib sql sql-common storage
-istorage/mroonga -istorage/tokudb -istorage/spider -istorage/rocksdb -iextra/ -ilibmariadb/ -istorage/columnstore
--output-file=cppcheck.txt -j $(nproc)
# Parallel jobs may output findings in an nondeterministic order. Sort to match ignorelist.
- cat cppcheck.txt | sort > cppcheck_sorted.txt
# Remove line numbers for diff
- sed 's/:[^:]*:/:/' cppcheck_sorted.txt > cppcheck_sorted_no_line_numbers.txt
# Only print new issues not found in ignore list
- echo "Problems found in ignore list that were not discovered by cppcheck (may have been fixed)."
- diff --changed-group-format='%>' --unchanged-group-format='' cppcheck_sorted_no_line_numbers.txt tests/code_quality/cppcheck_ignorelist.txt || true
- echo "Problems found by cppcheck that were not in ignore list."
- diff --changed-group-format='%<' --unchanged-group-format='' cppcheck_sorted_no_line_numbers.txt tests/code_quality/cppcheck_ignorelist.txt > lines_not_ignored.txt || true
- cat lines_not_ignored.txt && test ! -s lines_not_ignored.txt
artifacts:
when: always
paths:
- old-installed-database.sql
- old-upgraded-database.sql
- new-installed-database.sql
- new-upgraded-database.sql
- cppcheck_sorted.txt
flawfinder:
stage: sast
needs: []
variables:
GIT_STRATEGY: fetch
GIT_SUBMODULE_STRATEGY: normal
script:
- yum install -y python3 python3-pip jq diffutils git
- pip install flawfinder
- flawfinder --falsepositive --quiet --html . > flawfinder-all-vulnerabilities.html
- cat flawfinder-all-vulnerabilities.html | grep "Hits ="
- flawfinder --falsepositive --quiet --minlevel=5 --sarif . > flawfinder-output.json
# FlawFinder's --sarif output will display all vulnerabilities despite having --minlevel=5 specified.
# Therefore, we postprocess the results with jq and filter out findings where the vulnerability level is less than 5.
# Also in the SARIF output format, the vulnerabilities are ranked as 0.2/0.4/0.6/0.8/1.0 which correspond to the --minlevel=1/2/3/4/5 of FlawFinder.
# Additionally, we sort the results because individual findings are consistent across different runs, but their ordering may not be.
# Vulnerabilities can also be ignored in-line (/* Flawfinder: ignore */), but this option was chosen as to not clutter the codebase.
- jq 'del(.runs[] | .tool | .driver | .rules) | del(.runs[] | .results[] | select(.rank < 1)) | del(.runs[] | .results[] | .locations[] | .physicalLocation | .region | .startLine) | .runs[0].results|=sort_by(.fingerprints)' flawfinder-output.json > flawfinder-min-level5.json
# Diff against known vulnerabilities, but ignore the line number.
- echo "Problems found in ignore list that were not discovered by flawfinder (may have been fixed)."
- diff --changed-group-format='%>' --unchanged-group-format='' flawfinder-min-level5.json tests/code_quality/flawfinder_ignorelist.json || true
- echo "Problems found by flawfinder that were not in ignore list."
- diff --changed-group-format='%<' --unchanged-group-format='' flawfinder-min-level5.json tests/code_quality/flawfinder_ignorelist.json > lines_not_ignored.txt || true
- cat lines_not_ignored.txt && test ! -s lines_not_ignored.txt
artifacts:
when: always
paths:
- flawfinder-all-vulnerabilities.html
- flawfinder-min-level5.json
# Once all RPM builds and tests have passed, also run the DEB builds and tests
# @NOTE: This is likely to work well only on salsa.debian.org as the Gitlab.com
# runners are too small for everything this stage does.

View file

@ -27,8 +27,6 @@ IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
"None" "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
ENDIF()
PROJECT(MySQL)
# Remove the following comment if you don't want to have striped binaries
# in RPM's:
@ -50,6 +48,8 @@ IF(POLICY CMP0069)
CMAKE_POLICY(SET CMP0069 NEW)
ENDIF()
PROJECT(MySQL)
MESSAGE(STATUS "Running cmake version ${CMAKE_VERSION}")
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}

View file

@ -1963,7 +1963,7 @@ static int get_options(int argc, char **argv)
current_db= my_strdup(PSI_NOT_INSTRUMENTED, *argv, MYF(MY_WME));
}
if (tty_password)
opt_password= get_tty_password(NullS);
opt_password= my_get_tty_password(NullS);
if (debug_info_flag)
my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
if (debug_check_flag)
@ -4671,7 +4671,7 @@ char *mysql_authentication_dialog_ask(MYSQL *mysql, int type,
if (type == 2) /* password */
{
s= get_tty_password("");
s= my_get_tty_password("");
strnmov(buf, s, buf_len);
buf[buf_len-1]= 0;
my_free(s);

View file

@ -1436,7 +1436,7 @@ int main(int argc, char **argv)
if (tty_password)
{
opt_password= get_tty_password(NullS);
opt_password= my_get_tty_password(NullS);
/* add password to defaults file */
add_one_option_cnf_file(&ds_args, "password", opt_password);
}

View file

@ -343,7 +343,7 @@ int main(int argc,char *argv[])
}
commands = temp_argv;
if (tty_password)
opt_password = get_tty_password(NullS);
opt_password = my_get_tty_password(NullS);
(void) signal(SIGINT,endprog); /* Here if abort */
(void) signal(SIGTERM,endprog); /* Here if abort */
@ -1132,8 +1132,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
else if (argc == 1)
{
/* prompt for password */
typed_password= get_tty_password("New password: ");
verified= get_tty_password("Confirm new password: ");
typed_password= my_get_tty_password("New password: ");
verified= my_get_tty_password("Confirm new password: ");
if (strcmp(typed_password, verified) != 0)
{
my_printf_error(0,"Passwords don't match",MYF(ME_BELL));

View file

@ -2039,7 +2039,7 @@ get_one_option(const struct my_option *opt, const char *argument, const char *)
break;
}
if (tty_password)
pass= get_tty_password(NullS);
pass= my_get_tty_password(NullS);
return 0;
}

View file

@ -464,7 +464,7 @@ static int get_options(int *argc, char ***argv)
DBUG_RETURN(1);
}
if (tty_password)
opt_password = get_tty_password(NullS);
opt_password = my_get_tty_password(NullS);
if (debug_info_flag)
my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
if (debug_check_flag)

View file

@ -1275,7 +1275,7 @@ static int get_options(int *argc, char ***argv)
return EX_USAGE;
}
if (tty_password)
opt_password=get_tty_password(NullS);
opt_password=my_get_tty_password(NullS);
return(0);
} /* get_options */

View file

@ -304,7 +304,7 @@ static int get_options(int *argc, char ***argv)
current_db= *((*argv)++);
(*argc)--;
if (tty_password)
opt_password=get_tty_password(NullS);
opt_password=my_get_tty_password(NullS);
return(0);
}

View file

@ -357,7 +357,7 @@ get_options(int *argc,char ***argv)
exit(ho_error);
if (tty_password)
opt_password=get_tty_password(NullS);
opt_password=my_get_tty_password(NullS);
if (opt_count)
{
/*

View file

@ -1528,7 +1528,7 @@ get_options(int *argc,char ***argv)
}
if (tty_password)
opt_password= get_tty_password(NullS);
opt_password= my_get_tty_password(NullS);
DBUG_RETURN(0);
}

View file

@ -7322,7 +7322,7 @@ int parse_args(int argc, char **argv)
if (argc == 1)
opt_db= *argv;
if (tty_password)
opt_pass= get_tty_password(NullS); /* purify tested */
opt_pass= my_get_tty_password(NullS); /* purify tested */
if (debug_info_flag)
my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
if (debug_check_flag)
@ -8998,6 +8998,8 @@ int util_query(MYSQL* org_mysql, const char* query){
org_mysql->unix_socket);
cur_con->util_mysql= mysql;
if (mysql->charset != org_mysql->charset)
mysql_set_character_set(mysql, org_mysql->charset->csname);
}
}
else

View file

@ -10,7 +10,7 @@ FUNCTION (CHECK_AWS_SDK RETVAL REASON)
SKIP_AWS_SDK("AWS_SDK_EXTERNAL_PROJECT is not ON")
ENDIF()
IF(NOT NOT_FOR_DISTRIBUTION)
SKIP_AWS_SDK("AWS SDK has Apache 2.0 License which is not complatible with GPLv2. Set -DNOT_FOR_DISTRIBUTION=ON if you need it")
SKIP_AWS_SDK("AWS SDK has Apache 2.0 License which is not compatible with GPLv2. Set -DNOT_FOR_DISTRIBUTION=ON if you need it")
ENDIF()
# Check compiler support
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU")

View file

@ -72,7 +72,7 @@ It was originally forked from Percona XtraBackup 2.3.8.")
# Packages with default description
SET(CPACK_RPM_client_PACKAGE_SUMMARY "MariaDB database client binaries")
SET(CPACK_RPM_client_PACKAGE_DESCRIPTION "${CPACK_RPM_PACKAGE_DESCRIPTION}")
SET(CPACK_RPM_common_PACKAGE_SUMMARY "MariaDB database common files (e.g. /etc/mysql/conf.d/mariadb.cnf)")
SET(CPACK_RPM_common_PACKAGE_SUMMARY "MariaDB database common configuration files (e.g. /etc/mysql/conf.d/mariadb.cnf)")
SET(CPACK_RPM_common_PACKAGE_DESCRIPTION "${CPACK_RPM_PACKAGE_DESCRIPTION}")
SET(CPACK_RPM_compat_PACKAGE_SUMMARY "MariaDB database client library MySQL compat package")
SET(CPACK_RPM_compat_PACKAGE_DESCRIPTION "${CPACK_RPM_PACKAGE_DESCRIPTION}")
@ -107,6 +107,8 @@ SET(CPACK_RPM_SPEC_MORE_DEFINE "
%define restart_flag_dir %{_localstatedir}/lib/rpm-state/mariadb
%define restart_flag %{restart_flag_dir}/need-restart
%define pretrans %{nil}
%{?filter_setup:
%filter_provides_in \\\\.\\\\(test\\\\|result\\\\|h\\\\|cc\\\\|c\\\\|inc\\\\|opt\\\\|ic\\\\|cnf\\\\|rdiff\\\\|cpp\\\\)$
%filter_requires_in \\\\.\\\\(test\\\\|result\\\\|h\\\\|cc\\\\|c\\\\|inc\\\\|opt\\\\|ic\\\\|cnf\\\\|rdiff\\\\|cpp\\\\)$

51
debian/control vendored
View file

@ -72,9 +72,9 @@ Description: MariaDB database development files
language in the world. The main goals of MariaDB are speed, robustness and
ease of use.
.
This package includes development libraries and header files. To allow sources
This package includes development libraries and header files to allow sources
expecting the MariaDB Connector/C to build. Sources that expect the MySQL
Client libraries should use files from the libmariadb-dev-compat package.
client libraries should use files from the libmariadb-dev-compat package.
Package: libmariadb-dev-compat
Architecture: any
@ -216,18 +216,18 @@ Breaks: libmariadb-dev (<< ${source:Version}),
Replaces: libmariadb-dev (<< ${source:Version}),
libmariadbclient-dev (<< ${source:Version}),
libmysqld-dev
Description: MariaDB embedded database, development files
Description: MariaDB embedded database, development files package
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
language in the world. The main goals of MariaDB are speed, robustness and
ease of use.
.
This package includes the embedded server library development and header files.
This package includes the MariaDB embedded server library development and header files.
Package: mysql-common
Architecture: all
Depends: ${misc:Depends}
Description: MariaDB database common files (e.g. /etc/mysql/my.cnf)
Description: MariaDB client common configuration files package (e.g. /etc/mysql/my.cnf)
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
language in the world. The main goals of MariaDB are speed, robustness and
@ -241,7 +241,7 @@ Architecture: all
Depends: mysql-common (>= 5.6.25),
${misc:Depends}
Multi-Arch: foreign
Description: MariaDB common configuration files
Description: MariaDB database common files (e.g. /etc/mysql/mariadb.conf.d/)
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
language in the world. The main goals of MariaDB are speed, robustness and
@ -578,7 +578,7 @@ Package: mariadb-server
Architecture: all
Depends: mariadb-server-10.5 (>= ${source:Version}),
${misc:Depends}
Description: MariaDB database server (metapackage depending on the latest version)
Description: MariaDB database server binaries (metapackage depending on the latest version)
This is an empty package that depends on the current "best" version of
mariadb-server (currently mariadb-server-10.5), as determined by the MariaDB
maintainers. Install this package if in doubt about which MariaDB
@ -594,11 +594,16 @@ Package: mariadb-client
Architecture: all
Depends: mariadb-client-10.5 (>= ${source:Version}),
${misc:Depends}
Description: MariaDB database client (metapackage depending on the latest version)
Description: MariaDB database client binaries (metapackage depending on the latest version)
This is an empty package that depends on the current "best" version of
mariadb-client (currently mariadb-client-10.5), as determined by the MariaDB
maintainers. Install this package if in doubt about which MariaDB version
you want, as this is the one considered to be in the best shape.
.
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
language in the world. The main goals of MariaDB are speed, robustness and
ease of use.
Package: mariadb-backup
Architecture: any
@ -610,8 +615,8 @@ Depends: mariadb-client-core-10.5 (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends}
Description: Backup tool for MariaDB server
This backup tool is guaranteed to be compatible with MariaDB.
Based on Xtrabackup, but improved to work with MariaDB.
Based on Xtrabackup, but improved to work with MariaDB server.
This backup tool is guaranteed to be compatible with MariaDB server.
.
Please refer to the MariaDB Knowledge Base on more information on
how to use this tool.
@ -632,11 +637,11 @@ Replaces: mariadb-connect-engine-10.1,
mariadb-connect-engine-10.2,
mariadb-connect-engine-10.3,
mariadb-connect-engine-10.4
Description: Connect storage engine for MariaDB
Description: Connect storage engine for MariaDB server
Connect engine supports a number of file formats (dbf, xml, txt, bin, etc),
connections to ODBC tables and remote MySQL tables, as well as a number of
other interesting features.
This package contains the Connect plugin for MariaDB.
This package contains the Connect plugin for MariaDB server.
Package: mariadb-plugin-s3
Architecture: any
@ -663,10 +668,10 @@ Replaces: mariadb-rocksdb-engine-10.2,
mariadb-rocksdb-engine-10.3,
mariadb-rocksdb-engine-10.4
Recommends: python3-mysqldb
Description: RocksDB storage engine for MariaDB
Description: RocksDB storage engine for MariaDB server
The RocksDB storage engine is a high performance storage engine, aimed
at maximising storage efficiency while maintaining InnoDB-like performance.
This package contains the RocksDB plugin for MariaDB.
This package contains the RocksDB plugin for MariaDB server.
Package: mariadb-plugin-oqgraph
Architecture: any
@ -682,10 +687,10 @@ Replaces: mariadb-oqgraph-engine-10.1,
mariadb-oqgraph-engine-10.2,
mariadb-oqgraph-engine-10.3,
mariadb-oqgraph-engine-10.4
Description: OQGraph storage engine for MariaDB
Description: OQGraph storage engine for MariaDB server
The OQGraph engine is a computation engine plugin for handling hierarchies
(trees) and graphs (friend-of-a-friend, etc) cleanly through standard SQL.
This package contains the OQGraph plugin for MariaDB.
This package contains the OQGraph plugin for MariaDB server.
Package: mariadb-plugin-mroonga
Architecture: any-alpha any-amd64 any-arm any-arm64 any-i386 any-ia64 any-mips64el any-mips64r6el any-mipsel any-mipsr6el any-nios2 any-powerpcel any-ppc64el any-sh3 any-sh4 any-tilegx
@ -702,10 +707,10 @@ Replaces: mariadb-server-10.0,
mariadb-server-10.2,
mariadb-server-10.3,
mariadb-server-10.4
Description: Mroonga storage engine for MariaDB
Description: Mroonga storage engine for MariaDB server
Mroonga (formerly named Groonga Storage Engine) is a storage engine that
provides fast CJK-ready full text searching using column store.
This package contains the Mroonga plugin for MariaDB.
This package contains the Mroonga plugin for MariaDB server.
Package: mariadb-plugin-spider
Architecture: any
@ -722,9 +727,9 @@ Replaces: mariadb-server-10.0,
mariadb-server-10.2,
mariadb-server-10.3,
mariadb-server-10.4
Description: Spider storage engine for MariaDB
Description: Spider storage engine for MariaDB server
The Spider storage engine with built-in sharding features. It supports
partitioning and xa transactions, and allows tables of different MariaDB
partitioning and xa transactions, and allows tables of different MariaDB server
instances to be handled as if they were on the same instance. It refers to one
possible implementation of ISO/IEC 9075-9:2008 SQL/MED.
@ -775,11 +780,11 @@ Depends: libcrack2 (>= 2.9.0),
mariadb-server-10.5,
${misc:Depends},
${shlibs:Depends}
Description: CrackLib Password Validation Plugin for MariaDB
Description: CrackLib Password Validation Plugin for MariaDB server
This password validation plugin uses cracklib to allow only
sufficiently secure (as defined by cracklib) user passwords in MariaDB.
sufficiently secure (as defined by cracklib) user passwords in MariaDB server.
.
Install and configure this to enforce stronger passwords for MariaDB users.
Install and configure this to enforce stronger passwords for MariaDB server users.
Package: mariadb-test
Architecture: any

View file

@ -79,4 +79,5 @@
{ "HA_ERR_ABORTED_BY_USER", HA_ERR_ABORTED_BY_USER, "" },
{ "HA_ERR_DISK_FULL", HA_ERR_DISK_FULL, "" },
{ "HA_ERR_INCOMPATIBLE_DEFINITION", HA_ERR_INCOMPATIBLE_DEFINITION, "" },
{ "HA_ERR_NO_ENCRYPTION", HA_ERR_NO_ENCRYPTION, "" },
{ "HA_ERR_COMMIT_ERROR", HA_ERR_COMMIT_ERROR, "" },

View file

@ -35,6 +35,7 @@ typedef struct st_json_string_t
const uchar *c_str; /* Current position in JSON string */
const uchar *str_end; /* The end on the string. */
my_wc_t c_next; /* UNICODE of the last read character */
int c_next_len; /* character lenght of the last read character. */
int error; /* error code. */
CHARSET_INFO *cs; /* Character set of the JSON string. */
@ -48,7 +49,7 @@ void json_string_set_cs(json_string_t *s, CHARSET_INFO *i_cs);
void json_string_set_str(json_string_t *s,
const uchar *str, const uchar *end);
#define json_next_char(j) \
(j)->wc((j)->cs, &(j)->c_next, (j)->c_str, (j)->str_end)
((j)->c_next_len= (j)->wc((j)->cs, &(j)->c_next, (j)->c_str, (j)->str_end))
#define json_eos(j) ((j)->c_str >= (j)->str_end)
/*
read_string_const_chr() reads the next character of the string constant

View file

@ -48,6 +48,7 @@
#define HA_OPEN_NO_PSI_CALL 1024U /* Don't call/connect PSI */
#define HA_OPEN_MERGE_TABLE 2048U
#define HA_OPEN_FOR_CREATE 4096U
#define HA_OPEN_FOR_DROP (1U << 13) /* Open part of drop */
/*
Allow opening even if table is incompatible as this is for ALTER TABLE which
@ -520,14 +521,15 @@ enum ha_base_keytype {
#define HA_ERR_DISK_FULL 189
#define HA_ERR_INCOMPATIBLE_DEFINITION 190
#define HA_ERR_FTS_TOO_MANY_WORDS_IN_PHRASE 191 /* Too many words in a phrase */
#define HA_ERR_DECRYPTION_FAILED 192 /* Table encrypted but decypt failed */
#define HA_ERR_DECRYPTION_FAILED 192 /* Table encrypted but decrypt failed */
#define HA_ERR_FK_DEPTH_EXCEEDED 193 /* FK cascade depth exceeded */
#define HA_ERR_TABLESPACE_MISSING 194 /* Missing Tablespace */
#define HA_ERR_SEQUENCE_INVALID_DATA 195
#define HA_ERR_SEQUENCE_RUN_OUT 196
#define HA_ERR_COMMIT_ERROR 197
#define HA_ERR_PARTITION_LIST 198
#define HA_ERR_LAST 198 /* Copy of last error nr * */
#define HA_ERR_NO_ENCRYPTION 199
#define HA_ERR_LAST 199 /* Copy of last error nr * */
/* Number of different errors */
#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)

View file

@ -109,7 +109,8 @@ static const char *handler_error_messages[]=
"Sequence has been run out",
"Sequence values are conflicting",
"Error during commit",
"Cannot select partitions"
"Cannot select partitions",
"Cannot initialize encryption. Check that all encryption parameters have been set"
};
#endif /* MYSYS_MY_HANDLER_ERRORS_INCLUDED */

View file

@ -1049,7 +1049,7 @@ extern void add_compiled_extra_collation(struct charset_info_st *cs);
extern size_t escape_string_for_mysql(CHARSET_INFO *charset_info,
char *to, size_t to_length,
const char *from, size_t length);
extern char *get_tty_password(const char *opt_message);
extern char *my_get_tty_password(const char *opt_message);
#ifdef _WIN32
#define BACKSLASH_MBTAIL
/* File system character set */

View file

@ -151,6 +151,7 @@ typedef unsigned long long my_ulonglong;
#define ER_WRONG_FK_OPTION_FOR_VIRTUAL_COLUMN ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN
#define ER_UNSUPPORTED_ACTION_ON_VIRTUAL_COLUMN ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN
#define ER_UNSUPPORTED_ENGINE_FOR_VIRTUAL_COLUMNS ER_UNSUPPORTED_ENGINE_FOR_GENERATED_COLUMNS
#define ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT ER_QUERY_RESULT_INCOMPLETE
typedef struct st_mysql_rows {
struct st_mysql_rows *next; /* list of rows */

View file

@ -24,8 +24,8 @@
#define HAVE_OPENSSL11 1
#define SSL_LIBRARY OpenSSL_version(OPENSSL_VERSION)
#define ERR_remove_state(X) ERR_clear_error()
#define EVP_CIPHER_CTX_SIZE 176
#define EVP_MD_CTX_SIZE 72
#define EVP_CIPHER_CTX_SIZE 200
#define EVP_MD_CTX_SIZE 80
#undef EVP_MD_CTX_init
#define EVP_MD_CTX_init(X) do { memset((X), 0, EVP_MD_CTX_SIZE); EVP_MD_CTX_reset(X); } while(0)
#undef EVP_CIPHER_CTX_init

@ -1 +1 @@
Subproject commit a3bba4639f55148c59a28a506df8a2b88e5e83ab
Subproject commit d543bed61ba9a117e95764dd1429b21c3e0579d1

View file

@ -226,3 +226,7 @@ error:
DBUG_RETURN(0);
}
char *get_tty_password(const char *opt_message)
{
return my_get_tty_password(opt_message);
}

View file

@ -76,6 +76,15 @@ INSERT INTO t1 VALUES (_BINARY'\\''
SELECT a, HEX(a) FROM t1;
DROP TABLE t1;
#
# test how strings are written into view's frm
#
disable_view_protocol;
create view v1 as select hex('à\'), hex('à\t');
select * from v1;
drop view v1;
enable_view_protocol;
# Checking that with character_set_client=binary 0x5C in 0xE05C
# is treated as escape rather than the second byte of a multi-byte character,
# even if character_set_connection is big5/cp932/gbk/sjis.
@ -109,5 +118,5 @@ SELECT HEX(a) FROM t1;
DROP TABLE t1;
--enable_view_protocol
--echo # Start of ctype_E05C.inc
--echo # End of ctype_E05C.inc

View file

@ -11,7 +11,7 @@ let $counter= 5000;
let $mysql_errno= 9999;
while ($mysql_errno)
{
--error 0,ER_ACCESS_DENIED_ERROR,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,ER_LOCK_WAIT_TIMEOUT,2002,2006,2013
--error 0,ER_ACCESS_DENIED_ERROR,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,ER_LOCK_WAIT_TIMEOUT,2002,2006,2013,HA_ERR_NO_ENCRYPTION
show status;
dec $counter;
@ -30,6 +30,10 @@ while ($mysql_errno)
{
let $mysql_errno=0;
}
if ($mysql_errno == 199)
{
let $mysql_errno=0;
}
--sleep 0.1
}
--enable_query_log

View file

@ -116,19 +116,19 @@ for my $k (sort keys %debuggers) {
my $v = $debuggers{$k};
$v = $debuggers{$k} = $debuggers{$v} if not ref $v; # resolve aliases
sub register_opt($$) {
my ($name, $msg) = @_;
$opts{"$name=s"} = \$opt_vals{$name};
$help .= wrap(sprintf(" %-23s", $name), ' 'x25, "$msg under $name\n");
sub register_opt($$$) {
my ($prefix, $name, $msg) = @_;
$opts{"$prefix$name=s"} = \$opt_vals{$prefix.$name};
$help .= wrap(sprintf(" %-23s", $prefix.$name), ' 'x25, "$msg under $name\n");
}
$v->{script} = '' unless $v->{script};
$v->{options} =~ s/(\{exe\}|$)/ {options} $&/ unless $v->{options} =~ /\{options\}/;
register_opt "$k" => "Start mariadbd";
register_opt "client-$k" => "Start mariadb-test client";
register_opt "boot-$k" => "Start bootstrap server";
register_opt "manual-$k" => "Before running test(s) let user manually start mariadbd";
register_opt "", $k, "Start mysqld";
register_opt "client-", $k, "Start mysqltest client";
register_opt "boot-", $k, "Start bootstrap server";
register_opt "manual-", "$k", "Before running test(s) let user manually start mariadbd";
}
sub subst($%) {

View file

@ -68,7 +68,7 @@ sub _cpuinfo {
}
}
$F= undef; # Close file
return $self;
return $self->{cpus};
}
@ -95,12 +95,7 @@ sub _kstat {
push(@{$self->{cpus}}, $cpuinfo);
}
# At least one cpu should have been found
# if this method worked
if ( $self->{cpus} ) {
return $self;
}
return undef;
return $self->{cpus};
}

View file

@ -470,7 +470,7 @@ t1 CREATE TABLE `t1` (
KEY `a126_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
KEY `a127_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
KEY `a128_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
flush tables;
show create table t1;
Table Create Table
@ -619,7 +619,7 @@ t1 CREATE TABLE `t1` (
KEY `a126_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
KEY `a127_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
KEY `a128_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop table t1;
create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int,
c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int);
@ -1092,7 +1092,7 @@ t1 CREATE TABLE `t1` (
KEY `a126_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
KEY `a127_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
KEY `a128_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
flush tables;
show create table t1;
Table Create Table
@ -1241,7 +1241,7 @@ t1 CREATE TABLE `t1` (
KEY `a126_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
KEY `a127_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
KEY `a128_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
alter table t1 add key
a129_long_123456789_123456789_123456789_123456789_123456789_1234 (
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16);

View file

@ -1214,6 +1214,8 @@ generation name
2 Grandma Ann
2 Grandma Sally
2 Grandpa Ben
Warnings:
Warning 1931 Query execution was interrupted. The query exceeded max_recursive_iterations = 1. The query result may be incomplete
# query with recursive tables using key access
alter table folks add primary key (id);
explain
@ -2594,6 +2596,8 @@ select * from applied_modules;
m
m1
m2
Warnings:
Warning 1931 Query execution was interrupted. The query exceeded max_recursive_iterations = 2. The query result may be incomplete
drop table value_nodes, module_nodes, module_arguments, module_results;
#
# mdev-12519: recursive references in subqueries

View file

@ -537,15 +537,15 @@ create table t1 (a blob);
insert into t1 values (0xEE00);
select * into outfile 'test/t1.txt' from t1;
delete from t1;
select hex(load_file('MYSQLD_DATADIR/test/t1.txt'));;
hex(load_file('MYSQLD_DATADIR/test/t1.txt'))
select hex(load_file('MYSQLD_DATADIR/test/t1.txt')) as lf;
lf
5CEE5C300A
load data infile 't1.txt' into table t1;
select hex(a) from t1;
hex(a)
EE00
drop table t1;
End of 5.0 tests
# End of 5.0 tests
#
# Start of 5.5 tests
#
@ -4705,6 +4705,11 @@ a HEX(a)
\'à\ 5C27E05C
à\'\ E05C275C
DROP TABLE t1;
create view v1 as select hex('à\'), hex('à\t');
select * from v1;
hex('à\') hex('à\t')
E05C E05C74
drop view v1;
SET character_set_client=binary, character_set_results=binary;
SELECT @@character_set_client, @@character_set_connection, @@character_set_results;
@@character_set_client @@character_set_connection @@character_set_results
@ -4744,7 +4749,7 @@ HEX(a)
E05C5B
E05B
DROP TABLE t1;
# Start of ctype_E05C.inc
# End of ctype_E05C.inc
SET NAMES big5;
CREATE TABLE t1 (a ENUM('È@') CHARACTER SET big5);
SHOW CREATE TABLE t1;

View file

@ -79,18 +79,15 @@ create table t1 (a blob);
insert into t1 values (0xEE00);
select * into outfile 'test/t1.txt' from t1;
delete from t1;
#enable after fix MDEV-27871
--disable_view_protocol
let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--eval select hex(load_file('$MYSQLD_DATADIR/test/t1.txt'));
--eval select hex(load_file('$MYSQLD_DATADIR/test/t1.txt')) as lf
load data infile 't1.txt' into table t1;
select hex(a) from t1;
--remove_file $MYSQLD_DATADIR/test/t1.txt
drop table t1;
#enable_view_protocol
#
--echo End of 5.0 tests
--echo # End of 5.0 tests
--echo #

View file

@ -20413,6 +20413,11 @@ a HEX(a)
\'à\ 5C27E05C
à\'\ E05C275C
DROP TABLE t1;
create view v1 as select hex('à\'), hex('à\t');
select * from v1;
hex('à\') hex('à\t')
E05C E05C74
drop view v1;
SET character_set_client=binary, character_set_results=binary;
SELECT @@character_set_client, @@character_set_connection, @@character_set_results;
@@character_set_client @@character_set_connection @@character_set_results
@ -20452,7 +20457,7 @@ HEX(a)
E05C5B
E05B
DROP TABLE t1;
# Start of ctype_E05C.inc
# End of ctype_E05C.inc
#
# End of 10.0 tests
#

View file

@ -5053,6 +5053,11 @@ a HEX(a)
\'à\ 5C27E05C
à\'\ E05C275C
DROP TABLE t1;
create view v1 as select hex('à\'), hex('à\t');
select * from v1;
hex('à\') hex('à\t')
E05C E05C74
drop view v1;
SET character_set_client=binary, character_set_results=binary;
SELECT @@character_set_client, @@character_set_connection, @@character_set_results;
@@character_set_client @@character_set_connection @@character_set_results
@ -5092,7 +5097,7 @@ HEX(a)
E05C5B
E05B
DROP TABLE t1;
# Start of ctype_E05C.inc
# End of ctype_E05C.inc
SET NAMES utf8, character_set_connection=gbk;
#
# MDEV-13118 Wrong results with LOWER and UPPER and subquery

View file

@ -18677,6 +18677,11 @@ a HEX(a)
\'à\ 5C27E05C
à\'\ E05C275C
DROP TABLE t1;
create view v1 as select hex('à\'), hex('à\t');
select * from v1;
hex('à\') hex('à\t')
E05C E05C74
drop view v1;
SET character_set_client=binary, character_set_results=binary;
SELECT @@character_set_client, @@character_set_connection, @@character_set_results;
@@character_set_client @@character_set_connection @@character_set_results
@ -18716,7 +18721,7 @@ HEX(a)
E05C5B
E05B
DROP TABLE t1;
# Start of ctype_E05C.inc
# End of ctype_E05C.inc
#
# End of 10.0 tests
#

View file

@ -18356,7 +18356,7 @@ from
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
) as SUBQ
from t1 limit 5;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 1000
@ -18370,14 +18370,9 @@ from
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
) as SUBQ
from t1 limit 5;
a ( select concat(t3.a,'=',dt.s)
from
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
a SUBQ
1 1=804
2 1=1056
3 1=846
@ -18396,7 +18391,7 @@ from
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
) as SUBQ
from t1 limit 5;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 1000
@ -18410,14 +18405,9 @@ from
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
) as SUBQ
from t1 limit 5;
a ( select concat(t3.a,'=',dt.s)
from
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
a SUBQ
1 1=11858
2 1=11380
3 1=11588

View file

@ -3997,7 +3997,7 @@ select
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
) as SUBQ
from t1 limit 5;
eval explain $q;

View file

@ -19,20 +19,5 @@ id select_type table type possible_keys key key_len ref rows Extra
SET GLOBAL slow_query_log = @sql_tmp;
drop table t1;
#
# MDEV-31181: Server crash in subselect_uniquesubquery_engine::print
# upon EXPLAIN EXTENDED DELETE
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (pk INT PRIMARY KEY);
INSERT INTO t2 VALUES (1),(2);
EXPLAIN EXTENDED DELETE FROM t1 WHERE a IN (SELECT pk FROM t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
2 DEPENDENT SUBQUERY t2 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index
Warnings:
Note 1003 /* select#1 */ delete from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`a`))))
drop table t1, t2;
#
# End of 10.4 tests
#

View file

@ -19,21 +19,6 @@ SELECT * FROM (SELECT id FROM t1 GROUP BY id) dt WHERE 1=0;
SET GLOBAL slow_query_log = @sql_tmp;
drop table t1;
--echo #
--echo # MDEV-31181: Server crash in subselect_uniquesubquery_engine::print
--echo # upon EXPLAIN EXTENDED DELETE
--echo #
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (pk INT PRIMARY KEY);
INSERT INTO t2 VALUES (1),(2);
EXPLAIN EXTENDED DELETE FROM t1 WHERE a IN (SELECT pk FROM t2);
drop table t1, t2;
--echo #
--echo # End of 10.4 tests
--echo #

View file

@ -278,6 +278,37 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2
drop table t1,t2;
#
# MDEV-31181: EXPLAIN EXTENDED for single-table DELETE with IN predicand
#
create table t1 (a int);
insert into t1 values (3), (7), (1), (3), (4);
create table t2 (pk int primary key);
insert into t2 values (3), (5), (1);
create table t3 (a int, key(a));
insert into t3 values (7), (5), (7), (3);
explain extended delete from t1 where a in (select pk from t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 Using where
2 DEPENDENT SUBQUERY t2 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index
Warnings:
Note 1003 /* select#1 */ delete from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on PRIMARY)))
delete from t1 where a in (select pk from t2);
select * from t1;
a
7
4
explain extended delete from t1 where a in (select a from t3);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
2 DEPENDENT SUBQUERY t3 index_subquery a a 5 func 2 100.00 Using index
Warnings:
Note 1003 /* select#1 */ delete from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t3 on a)))
delete from t1 where a in (select a from t3);
select * from t1;
a
4
drop table t1,t2,t3;
#
# MDEV-31224: EXPLAIN EXTENDED for multi-table update of system table
#
CREATE TABLE t1 (a INT);

View file

@ -250,6 +250,33 @@ PREPARE stmt FROM 'EXPLAIN INSERT INTO t1 SELECT * FROM t2';
EXECUTE stmt;
drop table t1,t2;
--echo #
--echo # MDEV-31181: EXPLAIN EXTENDED for single-table DELETE with IN predicand
--echo #
create table t1 (a int);
insert into t1 values (3), (7), (1), (3), (4);
create table t2 (pk int primary key);
insert into t2 values (3), (5), (1);
create table t3 (a int, key(a));
insert into t3 values (7), (5), (7), (3);
let $q1=
delete from t1 where a in (select pk from t2);
eval explain extended $q1;
eval $q1;
select * from t1;
let $q2=
delete from t1 where a in (select a from t3);
eval explain extended $q2;
eval $q2;
select * from t1;
drop table t1,t2,t3;
--echo #
--echo # MDEV-31224: EXPLAIN EXTENDED for multi-table update of system table
--echo #

View file

@ -1043,9 +1043,6 @@ SELECT JSON_EXTRACT('{"a":null, "b":10, "c":"null"}', '$.a');
JSON_EXTRACT('{"a":null, "b":10, "c":"null"}', '$.a')
null
#
# End of 10.3 tests
#
#
# Start of 10.4 tests
#
#
@ -1455,6 +1452,13 @@ SELECT JSON_LENGTH('{"a":"b"}','$','$', 'foo');
ERROR 42000: Incorrect parameter count in the call to native function 'json_length'
SELECT JSON_LENGTH();
ERROR 42000: Incorrect parameter count in the call to native function 'JSON_LENGTH'
# MDEV-23187: Assorted assertion failures in json_find_path with certain collations
SET @old_collation_connection= @@COLLATION_CONNECTION;
SET COLLATION_CONNECTION= ucs2_unicode_ci;
SELECT JSON_VALUE('["foo"]', '$**[0]') AS f;
f
foo
SET @@COLLATION_CONNECTION= @old_collation_connection;
#
# End of 10.4 tests
#

View file

@ -665,11 +665,6 @@ SELECT 1 + JSON_VALUE('{"nulltest": null}', '$.nulltest');
SELECT NULL;
SELECT JSON_EXTRACT('{"a":null, "b":10, "c":"null"}', '$.a');
--echo #
--echo # End of 10.3 tests
--echo #
--echo #
--echo # Start of 10.4 tests
--echo #
@ -926,6 +921,16 @@ SELECT JSON_LENGTH('{"a":"b"}','$','$', 'foo');
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
SELECT JSON_LENGTH();
--echo # MDEV-23187: Assorted assertion failures in json_find_path with certain collations
SET @old_collation_connection= @@COLLATION_CONNECTION;
SET COLLATION_CONNECTION= ucs2_unicode_ci;
SELECT JSON_VALUE('["foo"]', '$**[0]') AS f;
SET @@COLLATION_CONNECTION= @old_collation_connection;
--echo #
--echo # End of 10.4 tests
--echo #

View file

@ -972,7 +972,8 @@ SELECT 9223372036854775808 DIV 1;
SELECT 9223372036854775808 DIV -1;
ERROR 22003: BIGINT UNSIGNED value is out of range in '9223372036854775808 DIV -1'
SELECT -9223372036854775808 DIV 1;
ERROR 22003: BIGINT value is out of range in '-9223372036854775808 DIV 1'
-9223372036854775808 DIV 1
-9223372036854775808
SELECT -9223372036854775808 DIV -1;
ERROR 22003: BIGINT value is out of range in '-9223372036854775808 DIV -1'
SELECT 9223372036854775808 MOD 1;
@ -3546,6 +3547,32 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1,t2;
#
# MDEV-30932 UBSAN: negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in Item_func_mul::int_op and Item_func_round::int_op
#
SELECT (1 DIV(-1/POW(807,14))*1);
ERROR 22003: BIGINT value is out of range in '1 DIV (-1 / pow(807,14))'
DO((-9223372036854775808)*(1));
SELECT (-9223372036854775808)*(1);
(-9223372036854775808)*(1)
-9223372036854775808
SELECT (GET_FORMAT(TIME,'JIS'))DIV(POW(-40,65)DIV(1)*2);
ERROR 22003: BIGINT value is out of range in 'pow(-40,65) DIV 1'
SELECT -9223372036854775808 MOD 9223372036854775810;
-9223372036854775808 MOD 9223372036854775810
-9223372036854775808
CREATE TABLE t1 (c INT);
INSERT INTO t1 VALUES(TRUNCATE(0,-1.e+30));
DROP TABLE t1;
SELECT TRUNCATE(0, -9223372036854775808);
TRUNCATE(0, -9223372036854775808)
0
SELECT GET_FORMAT(TIME,'JIS') DIV ATAN (TRUNCATE (0,'2000000000000000' DIV SIN(1500)*NOW(5)));
GET_FORMAT(TIME,'JIS') DIV ATAN (TRUNCATE (0,'2000000000000000' DIV SIN(1500)*NOW(5)))
NULL
SELECT (GET_FORMAT(TIME,'JIS') DIV ATAN (TRUNCATE (0,'2000000000000000' DIV SIN(1500)*NOW(5))/ROUND(-1)))DIV(-1-LOG2(1))-(-1*POWER(-1,0));
(GET_FORMAT(TIME,'JIS') DIV ATAN (TRUNCATE (0,'2000000000000000' DIV SIN(1500)*NOW(5))/ROUND(-1)))DIV(-1-LOG2(1))-(-1*POWER(-1,0))
NULL
#
# End of 10.4 tests
#
#

View file

@ -710,7 +710,6 @@ DROP TABLE t1;
SELECT 9223372036854775808 DIV 1;
--error ER_DATA_OUT_OF_RANGE
SELECT 9223372036854775808 DIV -1;
--error ER_DATA_OUT_OF_RANGE
SELECT -9223372036854775808 DIV 1;
--error ER_DATA_OUT_OF_RANGE
SELECT -9223372036854775808 DIV -1;
@ -1867,6 +1866,32 @@ SELECT * FROM t2;
SHOW CREATE TABLE t2;
DROP TABLE t1,t2;
--echo #
--echo # MDEV-30932 UBSAN: negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in Item_func_mul::int_op and Item_func_round::int_op
--echo #
--error ER_DATA_OUT_OF_RANGE
SELECT (1 DIV(-1/POW(807,14))*1);
DO((-9223372036854775808)*(1));
SELECT (-9223372036854775808)*(1);
--error ER_DATA_OUT_OF_RANGE
SELECT (GET_FORMAT(TIME,'JIS'))DIV(POW(-40,65)DIV(1)*2);
SELECT -9223372036854775808 MOD 9223372036854775810;
CREATE TABLE t1 (c INT);
INSERT INTO t1 VALUES(TRUNCATE(0,-1.e+30));
DROP TABLE t1;
SELECT TRUNCATE(0, -9223372036854775808);
--disable_warnings
SELECT GET_FORMAT(TIME,'JIS') DIV ATAN (TRUNCATE (0,'2000000000000000' DIV SIN(1500)*NOW(5)));
SELECT (GET_FORMAT(TIME,'JIS') DIV ATAN (TRUNCATE (0,'2000000000000000' DIV SIN(1500)*NOW(5))/ROUND(-1)))DIV(-1-LOG2(1))-(-1*POWER(-1,0));
--enable_warnings
--echo #
--echo # End of 10.4 tests
--echo #

View file

@ -4028,6 +4028,119 @@ drop table t1;
# End of 10.1 tests
#
#
# MDEV-6768 Wrong result with agregate with join with no resultset
#
create table t1
(
PARENT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
PARENT_FIELD VARCHAR(10),
PRIMARY KEY (PARENT_ID)
) engine=innodb;
create table t2
(
CHILD_ID INT NOT NULL AUTO_INCREMENT,
PARENT_ID INT NOT NULL,
CHILD_FIELD varchar(10),
PRIMARY KEY (CHILD_ID)
)engine=innodb;
INSERT INTO t1 (PARENT_FIELD)
SELECT 'AAAA';
INSERT INTO t2 (PARENT_ID, CHILD_FIELD)
SELECT 1, 'BBBB';
explain select
t1.PARENT_ID,
min(CHILD_FIELD)
from t1 straight_join t2
where t1.PARENT_ID = 1
and t1.PARENT_ID = t2.PARENT_ID
and t2.CHILD_FIELD = "ZZZZ";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where
select
t1.PARENT_ID,
min(CHILD_FIELD)
from t1 straight_join t2
where t1.PARENT_ID = 1
and t1.PARENT_ID = t2.PARENT_ID
and t2.CHILD_FIELD = "ZZZZ";
PARENT_ID min(CHILD_FIELD)
NULL NULL
select
1,
min(CHILD_FIELD)
from t1 straight_join t2
where t1.PARENT_ID = 1
and t1.PARENT_ID = t2.PARENT_ID
and t2.CHILD_FIELD = "ZZZZ";
1 min(CHILD_FIELD)
1 NULL
select
IFNULL(t1.PARENT_ID,1),
min(CHILD_FIELD)
from t1 straight_join t2
where t1.PARENT_ID = 1
and t1.PARENT_ID = t2.PARENT_ID
and t2.CHILD_FIELD = "ZZZZ";
IFNULL(t1.PARENT_ID,1) min(CHILD_FIELD)
1 NULL
# Check that things works with MyISAM (which has different explain)
alter table t1 engine=myisam;
alter table t2 engine=myisam;
explain select
t1.PARENT_ID,
min(CHILD_FIELD)
from t1 straight_join t2
where t1.PARENT_ID = 1
and t1.PARENT_ID = t2.PARENT_ID
and t2.CHILD_FIELD = "ZZZZ";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
select
t1.PARENT_ID,
min(CHILD_FIELD)
from t1 straight_join t2
where t1.PARENT_ID = 1
and t1.PARENT_ID = t2.PARENT_ID
and t2.CHILD_FIELD = "ZZZZ";
PARENT_ID min(CHILD_FIELD)
NULL NULL
drop table t1,t2;
# Check that things works if sub queries are re-executed
create table t1 (a int primary key, b int);
create table t2 (a int primary key, b int);
create table t3 (a int primary key, b int);
insert into t1 values (1,1),(2,2),(3,3);
insert into t2 values (1,1),(2,2),(3,3);
insert into t3 values (1,1),(3,3);
explain
select *,
(select
CONCAT('t2:', IFNULL(t2.a, 't2a-null'), ';',
'min_t3_b:', IFNULL(min(t3.b), 't3b-null'))
from t2,t3
where t2.a=1 and t1.b = t3.a) as s1
from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
2 DEPENDENT SUBQUERY t2 const PRIMARY PRIMARY 4 const 1 Using index
2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1
select *,
(select
CONCAT('t2:', IFNULL(t2.a, 't2a-null'), ';',
'min_t3_b:', IFNULL(min(t3.b), 't3b-null'))
from t2,t3
where t2.a=1 and t1.b = t3.a) as s1
from t1;
a b s1
1 1 t2:1;min_t3_b:1
2 2 t2:t2a-null;min_t3_b:t3b-null
3 3 t2:1;min_t3_b:3
drop table t1,t2,t3;
#
# End of 10.4 tests
#
#
# MDEV-27442 Wrong result upon query with DISTINCT and EXISTS subquery
#
CREATE TABLE t1 (a int, b int, KEY b (b,a)) ENGINE=MyISAM;

View file

@ -1692,6 +1692,120 @@ drop table t1;
--echo # End of 10.1 tests
--echo #
--echo #
--echo # MDEV-6768 Wrong result with agregate with join with no resultset
--echo #
create table t1
(
PARENT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
PARENT_FIELD VARCHAR(10),
PRIMARY KEY (PARENT_ID)
) engine=innodb;
create table t2
(
CHILD_ID INT NOT NULL AUTO_INCREMENT,
PARENT_ID INT NOT NULL,
CHILD_FIELD varchar(10),
PRIMARY KEY (CHILD_ID)
)engine=innodb;
INSERT INTO t1 (PARENT_FIELD)
SELECT 'AAAA';
INSERT INTO t2 (PARENT_ID, CHILD_FIELD)
SELECT 1, 'BBBB';
explain select
t1.PARENT_ID,
min(CHILD_FIELD)
from t1 straight_join t2
where t1.PARENT_ID = 1
and t1.PARENT_ID = t2.PARENT_ID
and t2.CHILD_FIELD = "ZZZZ";
select
t1.PARENT_ID,
min(CHILD_FIELD)
from t1 straight_join t2
where t1.PARENT_ID = 1
and t1.PARENT_ID = t2.PARENT_ID
and t2.CHILD_FIELD = "ZZZZ";
select
1,
min(CHILD_FIELD)
from t1 straight_join t2
where t1.PARENT_ID = 1
and t1.PARENT_ID = t2.PARENT_ID
and t2.CHILD_FIELD = "ZZZZ";
select
IFNULL(t1.PARENT_ID,1),
min(CHILD_FIELD)
from t1 straight_join t2
where t1.PARENT_ID = 1
and t1.PARENT_ID = t2.PARENT_ID
and t2.CHILD_FIELD = "ZZZZ";
--echo # Check that things works with MyISAM (which has different explain)
alter table t1 engine=myisam;
alter table t2 engine=myisam;
explain select
t1.PARENT_ID,
min(CHILD_FIELD)
from t1 straight_join t2
where t1.PARENT_ID = 1
and t1.PARENT_ID = t2.PARENT_ID
and t2.CHILD_FIELD = "ZZZZ";
select
t1.PARENT_ID,
min(CHILD_FIELD)
from t1 straight_join t2
where t1.PARENT_ID = 1
and t1.PARENT_ID = t2.PARENT_ID
and t2.CHILD_FIELD = "ZZZZ";
drop table t1,t2;
--echo # Check that things works if sub queries are re-executed
create table t1 (a int primary key, b int);
create table t2 (a int primary key, b int);
create table t3 (a int primary key, b int);
insert into t1 values (1,1),(2,2),(3,3);
insert into t2 values (1,1),(2,2),(3,3);
insert into t3 values (1,1),(3,3);
explain
select *,
(select
CONCAT('t2:', IFNULL(t2.a, 't2a-null'), ';',
'min_t3_b:', IFNULL(min(t3.b), 't3b-null'))
from t2,t3
where t2.a=1 and t1.b = t3.a) as s1
from t1;
select *,
(select
CONCAT('t2:', IFNULL(t2.a, 't2a-null'), ';',
'min_t3_b:', IFNULL(min(t3.b), 't3b-null'))
from t2,t3
where t2.a=1 and t1.b = t3.a) as s1
from t1;
drop table t1,t2,t3;
--echo #
--echo # End of 10.4 tests
--echo #
--echo #
--echo # MDEV-27442 Wrong result upon query with DISTINCT and EXISTS subquery
--echo #

View file

@ -308,6 +308,28 @@ NULL bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
NULL aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
NULL aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
drop table t1,t2;
#
# MDEV-30143: Segfault on select query using index for group-by and filesort
#
CREATE TABLE t1 (a varchar(35), b varchar(4)) ENGINE=InnoDB;
INSERT INTO t1 VALUES
('Albania','AXA'),('Australia','AUS'),('American Samoa','AMSA'),('Bahamas','BS');
CREATE TABLE t2 (a varchar(4), b varchar(50), PRIMARY KEY (b,a), KEY (a)) ENGINE=InnoDB;
INSERT INTO t2 VALUES
('BERM','African Methodist Episcopal'),('AUS','Anglican'),('BERM','Anglican'),('BS','Anglican'),('BS','Baptist'),('BS','Methodist');
EXPLAIN SELECT t1.a
FROM (SELECT a FROM t2 GROUP BY a ORDER BY COUNT(DISTINCT b) LIMIT 1) dt
JOIN t1 ON dt.a=t1.b;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL # Using where
1 PRIMARY <derived2> ref key0 key0 6 test.t1.b #
2 DERIVED t2 range a a 58 NULL # Using index for group-by; Using temporary; Using filesort
SELECT t1.a
FROM (SELECT a FROM t2 GROUP BY a ORDER BY COUNT(DISTINCT b) LIMIT 1) dt
JOIN t1 ON dt.a=t1.b;
a
Australia
DROP TABLES t1, t2;
set global innodb_stats_persistent= @innodb_stats_persistent_save;
set global innodb_stats_persistent_sample_pages=
@innodb_stats_persistent_sample_pages_save;

View file

@ -251,7 +251,28 @@ insert into t2 values (1,repeat("a",1000)),(2,repeat("a",1000)),(3,repeat("b",10
SELECT GROUP_CONCAT(t1.language_id SEPARATOR ',') AS `translation_resources`, `d`.`serialized_c` FROM t2 AS `d` LEFT JOIN t1 ON `d`.`voter_id` = t1.`voter_id` GROUP BY `d`.`voter_id` ORDER BY 10-d.voter_id+RAND()*0;
drop table t1,t2;
--echo #
--echo # MDEV-30143: Segfault on select query using index for group-by and filesort
--echo #
CREATE TABLE t1 (a varchar(35), b varchar(4)) ENGINE=InnoDB;
INSERT INTO t1 VALUES
('Albania','AXA'),('Australia','AUS'),('American Samoa','AMSA'),('Bahamas','BS');
CREATE TABLE t2 (a varchar(4), b varchar(50), PRIMARY KEY (b,a), KEY (a)) ENGINE=InnoDB;
INSERT INTO t2 VALUES
('BERM','African Methodist Episcopal'),('AUS','Anglican'),('BERM','Anglican'),('BS','Anglican'),('BS','Baptist'),('BS','Methodist');
let query=
SELECT t1.a
FROM (SELECT a FROM t2 GROUP BY a ORDER BY COUNT(DISTINCT b) LIMIT 1) dt
JOIN t1 ON dt.a=t1.b;
--replace_column 9 #
eval EXPLAIN $query;
eval $query;
DROP TABLES t1, t2;
set global innodb_stats_persistent= @innodb_stats_persistent_save;
set global innodb_stats_persistent_sample_pages=
@innodb_stats_persistent_sample_pages_save;

View file

@ -2228,7 +2228,7 @@ SCHEMA_NAME
SELECT * FROM INFORMATION_SCHEMA.`COLUMNS` LIMIT ROWS EXAMINED 10;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT IS_GENERATED GENERATION_EXPRESSION
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least ### rows, which exceeds LIMIT ROWS EXAMINED (10). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 10. The query result may be incomplete
#
# MDEV-24179: AAssertion `m_status == DA_ERROR || m_status == DA_OK ||
# m_status == DA_OK_BULK' failed in Diagnostics_area::message()

View file

@ -3781,9 +3781,9 @@ id1 num3 text1 id4 id3 dummy
228808822 6 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC 826928662 935693782 0
228808822 18 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC 826928662 935693782 0
228808822 1 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC 826928662 935693782 0
228808822 3 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC 826928662 935693782 0
228808822 17 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC 826928662 935693782 0
228808822 50 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC 826928662 935693782 0
228808822 3 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC 826928662 935693782 0
228808822 4 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC 826928662 935693782 0
228808822 89 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC 2381969632 2482416112 0
228808822 19 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC 2381969632 2482416112 0
@ -5655,13 +5655,13 @@ EXPLAIN
SELECT * FROM t1, t2 LEFT JOIN t3 ON t2.b=t3.b WHERE t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
1 SIMPLE t2 ALL NULL NULL NULL NULL 12 Using where
1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (incremental, BNL join)
SELECT * FROM t1, t2 LEFT JOIN t3 ON t2.b=t3.b WHERE t1.a=t2.a;
a a b b c
3 3 32 32 302
3 3 30 30 300
3 3 31 NULL NULL
3 3 32 32 302
set join_buffer_space_limit=@save_join_buffer_space_limit;
set join_buffer_size=@save_join_buffer_size;
set join_cache_level=@save_join_cache_level;
@ -6233,3 +6233,26 @@ set @@optimizer_switch=@save_optimizer_switch;
set global innodb_stats_persistent= @innodb_stats_persistent_save;
set global innodb_stats_persistent_sample_pages=
@innodb_stats_persistent_sample_pages_save;
#
# MDEV-31226 Server crash or assertion failure with row size close to
# join_buffer_size
#
set @org_optimizer_switch=@@optimizer_switch;
set @org_join_buffer_size=@@join_buffer_size;
CREATE TABLE t (f VARCHAR(16384)) ENGINE=MyISAM CHARACTER SET utf8;
INSERT INTO t VALUES (REPEAT('a',16384)),(REPEAT('b',16384));
SET OPTIMIZER_SWITCH = 'optimize_join_buffer_size=off';
SET JOIN_BUFFER_SIZE = 16384;
explain SELECT length(concat(t1.f,t2.f)) FROM t t1, t t2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
1 SIMPLE t2 ALL NULL NULL NULL NULL 2
SELECT length(concat(t1.f,t2.f)) FROM t t1, t t2;
length(concat(t1.f,t2.f))
32768
32768
32768
32768
DROP TABLE t;
set @@optimizer_switch=@org_optimizer_switch;
set @@join_buffer_size=@org_join_buffer_size;

View file

@ -4207,3 +4207,20 @@ set @@optimizer_switch=@save_optimizer_switch;
set global innodb_stats_persistent= @innodb_stats_persistent_save;
set global innodb_stats_persistent_sample_pages=
@innodb_stats_persistent_sample_pages_save;
--echo #
--echo # MDEV-31226 Server crash or assertion failure with row size close to
--echo # join_buffer_size
--echo #
set @org_optimizer_switch=@@optimizer_switch;
set @org_join_buffer_size=@@join_buffer_size;
CREATE TABLE t (f VARCHAR(16384)) ENGINE=MyISAM CHARACTER SET utf8;
INSERT INTO t VALUES (REPEAT('a',16384)),(REPEAT('b',16384));
SET OPTIMIZER_SWITCH = 'optimize_join_buffer_size=off';
SET JOIN_BUFFER_SIZE = 16384;
explain SELECT length(concat(t1.f,t2.f)) FROM t t1, t t2;
SELECT length(concat(t1.f,t2.f)) FROM t t1, t t2;
DROP TABLE t;
set @@optimizer_switch=@org_optimizer_switch;
set @@join_buffer_size=@org_join_buffer_size;

View file

@ -0,0 +1,27 @@
#
# MDEV-28217 Incorrect Join Execution When Controlling Join Buffer Size
#
CREATE TABLE t1 (i int PRIMARY KEY)engine=innodb;
INSERT INTO t1 VALUES (1332945389);
CREATE TABLE t2 (i int PRIMARY KEY)engine=innodb;
INSERT INTO t2 VALUES (1180244875), (1951338178);
SET SESSION join_buffer_size= X;
Warnings:
Warning X Truncated incorrect join_buffer_size value: 'X'
SET SESSION join_cache_level = 4;
SET optimizer_switch='optimize_join_buffer_size=on';
SELECT t2.i FROM t2 LEFT JOIN t1 ON t1.i = t2.i WHERE t1.i;
i
SET optimizer_switch='optimize_join_buffer_size=off';
SELECT t1.i,t2.i FROM t2 LEFT JOIN t1 ON t1.i = t2.i WHERE t1.i;
ERROR HYX: Could not create a join buffer. Please check and adjust the value of the variables 'JOIN_BUFFER_SIZE (X)' and 'JOIN_BUFFER_SPACE_LIMIT (X)'
SET SESSION join_buffer_size= 10000000;
SELECT t1.i,t2.i FROM t2 LEFT JOIN t1 ON t1.i = t2.i WHERE t1.i;
i i
SET SESSION optimizer_switch= default;
SET SESSION join_buffer_size= default;
SET SESSION join_cache_level= default;
drop table t1,t2;
#
# End of 10.4 tests
#

View file

@ -0,0 +1,36 @@
#
# Tests that should be in join_cache but cannot be run with ASAN
--source include/have_64bit.inc
--source include/not_asan.inc
--source include/have_innodb.inc
--echo #
--echo # MDEV-28217 Incorrect Join Execution When Controlling Join Buffer Size
--echo #
# This test tries to allocate a too big bufffer, for which ASAN gives an error
CREATE TABLE t1 (i int PRIMARY KEY)engine=innodb;
INSERT INTO t1 VALUES (1332945389);
CREATE TABLE t2 (i int PRIMARY KEY)engine=innodb;
INSERT INTO t2 VALUES (1180244875), (1951338178);
--replace_regex /[0-9][0-9]+/X/
SET SESSION join_buffer_size= 5250229460064350213;
SET SESSION join_cache_level = 4;
SET optimizer_switch='optimize_join_buffer_size=on';
SELECT t2.i FROM t2 LEFT JOIN t1 ON t1.i = t2.i WHERE t1.i;
SET optimizer_switch='optimize_join_buffer_size=off';
--replace_regex /[0-9][0-9]+/X/
--error ER_OUTOFMEMORY
SELECT t1.i,t2.i FROM t2 LEFT JOIN t1 ON t1.i = t2.i WHERE t1.i;
SET SESSION join_buffer_size= 10000000;
SELECT t1.i,t2.i FROM t2 LEFT JOIN t1 ON t1.i = t2.i WHERE t1.i;
SET SESSION optimizer_switch= default;
SET SESSION join_buffer_size= default;
SET SESSION join_cache_level= default;
drop table t1,t2;
--echo #
--echo # End of 10.4 tests
--echo #

View file

@ -2,6 +2,8 @@
drop table if exists t0,t1,t2,t3;
--enable_warnings
--source include/have_innodb.inc
--echo #
--echo # BUG#38049 incorrect rows estimations with references from preceding table
--echo #

View file

@ -22,7 +22,7 @@ select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 2;
c1 c2
bb bb
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (2). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 2. The query result may be incomplete
explain
select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 4;
id select_type table type possible_keys key key_len ref rows Extra
@ -32,7 +32,7 @@ select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 4;
c1 c2
bb bb
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 5 rows, which exceeds LIMIT ROWS EXAMINED (4). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 4. The query result may be incomplete
Blocked nested loops join, empty result set because of blocking
set @@join_cache_level=1;
explain
@ -44,7 +44,7 @@ select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 6;
c1 c2
bb bb
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 7 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 6. The query result may be incomplete
explain
select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 6;
id select_type table type possible_keys key key_len ref rows Extra
@ -55,7 +55,7 @@ c1 c2
bb bb
cc cc
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 7 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 6. The query result may be incomplete
set @@join_cache_level=6;
explain
select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 3;
@ -65,7 +65,7 @@ id select_type table type possible_keys key key_len ref rows Extra
select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 3;
c1 c2
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 4 rows, which exceeds LIMIT ROWS EXAMINED (3). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 3. The query result may be incomplete
explain
select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 6;
id select_type table type possible_keys key key_len ref rows Extra
@ -76,7 +76,7 @@ c1 c2
bb bb
cc cc
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 7 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 6. The query result may be incomplete
Mix LIMIT ROWS EXAMINED with LIMIT
set @@join_cache_level=0;
explain
@ -125,7 +125,7 @@ id select_type table type possible_keys key key_len ref rows Extra
select * from t0, t1 where c0 = 'bb' and c1 > c0 LIMIT ROWS EXAMINED 0;
c0 c1
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 2 rows, which exceeds LIMIT ROWS EXAMINED (0). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 0. The query result may be incomplete
set @@join_cache_level = @save_join_cache_level;
drop table t0;
=========================================================================
@ -139,7 +139,7 @@ execute st1 using @l;
c1 c2
bb bb
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (2). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 2. The query result may be incomplete
deallocate prepare st1;
User variable (not supported for LIMIT in MariaDB 5.3/MySQL 5.1)
select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED @l;
@ -153,7 +153,7 @@ call test_limit_rows(3);
c1 c2
bb bb
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 4 rows, which exceeds LIMIT ROWS EXAMINED (3). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 3. The query result may be incomplete
drop procedure test_limit_rows;
set @@join_cache_level = @save_join_cache_level;
=========================================================================
@ -165,14 +165,14 @@ UNION
c1 c2
bb bb
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 8 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 6. The query result may be incomplete
(select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 0)
UNION
(select * from t1, t2 where c1 < c2 LIMIT ROWS EXAMINED 6);
c1 c2
bb bb
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 8 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 6. The query result may be incomplete
select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 0
UNION
select * from t1, t2 where c1 < c2 LIMIT ROWS EXAMINED 6;
@ -185,7 +185,7 @@ LIMIT ROWS EXAMINED 6;
c1 c2
bb bb
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 8 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 6. The query result may be incomplete
(select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 0)
UNION
(select * from t1, t2 where c1 < c2 LIMIT ROWS EXAMINED 0)
@ -193,7 +193,7 @@ LIMIT 1 ROWS EXAMINED 6;
c1 c2
bb bb
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 8 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 6. The query result may be incomplete
(select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 0)
UNION
(select * from t1, t2 where c1 < c2 LIMIT ROWS EXAMINED 0)
@ -202,7 +202,7 @@ c1 c2
bb bb
cc cc
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 12 rows, which exceeds LIMIT ROWS EXAMINED (10). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 10. The query result may be incomplete
=========================================================================
Subqueries (with several LIMIT ROWS EXAMINED clauses)
=========================================================================
@ -219,7 +219,7 @@ where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 11);
c1
bb
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 12 rows, which exceeds LIMIT ROWS EXAMINED (11). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 11. The query result may be incomplete
explain
select * from t1
where c1 IN (select * from t2 where c2 > ' ')
@ -234,7 +234,7 @@ LIMIT ROWS EXAMINED 11;
c1
bb
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 12 rows, which exceeds LIMIT ROWS EXAMINED (11). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 11. The query result may be incomplete
explain
select * from t1
where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0)
@ -249,7 +249,7 @@ LIMIT ROWS EXAMINED 11;
c1
bb
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 12 rows, which exceeds LIMIT ROWS EXAMINED (11). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 11. The query result may be incomplete
explain
select * from t1i
where c1 IN (select * from t2i where c2 > ' ')
@ -264,7 +264,7 @@ c1
bb
cc
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 7 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 6. The query result may be incomplete
Subqueries with IN-TO-EXISTS
set @@optimizer_switch='semijoin=off,in_to_exists=on,materialization=off';
explain
@ -278,7 +278,7 @@ where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 4);
c1
bb
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 5 rows, which exceeds LIMIT ROWS EXAMINED (4). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 4. The query result may be incomplete
explain
select * from t1
where c1 IN (select * from t2 where c2 > ' ')
@ -292,7 +292,7 @@ LIMIT ROWS EXAMINED 4;
c1
bb
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 5 rows, which exceeds LIMIT ROWS EXAMINED (4). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 4. The query result may be incomplete
explain
select * from t1
where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0)
@ -306,7 +306,7 @@ LIMIT ROWS EXAMINED 4;
c1
bb
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 5 rows, which exceeds LIMIT ROWS EXAMINED (4). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 4. The query result may be incomplete
explain
select * from t1i
where c1 IN (select * from t2i where c2 > ' ')
@ -320,7 +320,7 @@ LIMIT ROWS EXAMINED 9;
c1
bb
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 12 rows, which exceeds LIMIT ROWS EXAMINED (9). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 9. The query result may be incomplete
Same as above, without subquery cache
set @@optimizer_switch='subquery_cache=off';
select * from t1
@ -328,28 +328,28 @@ where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 2);
c1
bb
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (2). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 2. The query result may be incomplete
select * from t1
where c1 IN (select * from t2 where c2 > ' ')
LIMIT ROWS EXAMINED 2;
c1
bb
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (2). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 2. The query result may be incomplete
select * from t1
where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0)
LIMIT ROWS EXAMINED 2;
c1
bb
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (2). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 2. The query result may be incomplete
select * from t1i
where c1 IN (select * from t2i where c2 > ' ')
LIMIT ROWS EXAMINED 5;
c1
bb
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 7 rows, which exceeds LIMIT ROWS EXAMINED (5). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 5. The query result may be incomplete
Subqueries with materialization
set @@optimizer_switch='semijoin=off,in_to_exists=off,materialization=on,subquery_cache=on';
explain
@ -363,7 +363,7 @@ where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 13);
c1
bb
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 14 rows, which exceeds LIMIT ROWS EXAMINED (13). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 13. The query result may be incomplete
explain
select * from t1
where c1 IN (select * from t2 where c2 > ' ') LIMIT ROWS EXAMINED 13;
@ -375,7 +375,7 @@ where c1 IN (select * from t2 where c2 > ' ') LIMIT ROWS EXAMINED 13;
c1
bb
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 14 rows, which exceeds LIMIT ROWS EXAMINED (13). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 13. The query result may be incomplete
explain
select * from t1
where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0)
@ -389,7 +389,7 @@ LIMIT ROWS EXAMINED 13;
c1
bb
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 14 rows, which exceeds LIMIT ROWS EXAMINED (13). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 13. The query result may be incomplete
explain
select * from t1i
where c1 IN (select * from t2i where c2 > ' ') LIMIT ROWS EXAMINED 17;
@ -401,7 +401,7 @@ where c1 IN (select * from t2i where c2 > ' ') LIMIT ROWS EXAMINED 17;
c1
bb
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 18 rows, which exceeds LIMIT ROWS EXAMINED (17). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 17. The query result may be incomplete
set @@optimizer_switch='default';
=========================================================================
Views and derived tables
@ -422,18 +422,18 @@ bb
cc
dd
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 18 rows, which exceeds LIMIT ROWS EXAMINED (17). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 17. The query result may be incomplete
select * from v1 LIMIT ROWS EXAMINED 16;
c1
bb
cc
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 17 rows, which exceeds LIMIT ROWS EXAMINED (16). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 16. The query result may be incomplete
select * from v1 LIMIT ROWS EXAMINED 11;
c1
bb
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 12 rows, which exceeds LIMIT ROWS EXAMINED (11). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 11. The query result may be incomplete
drop view v1;
explain
select *
@ -451,7 +451,7 @@ LIMIT ROWS EXAMINED 11;
c1
bb
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 12 rows, which exceeds LIMIT ROWS EXAMINED (11). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 11. The query result may be incomplete
=========================================================================
Aggregation
=========================================================================
@ -474,16 +474,16 @@ id select_type table type possible_keys key key_len ref rows Extra
select c1, sum(c2) from t3 group by c1 LIMIT ROWS EXAMINED 0;
c1 sum(c2)
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 1 rows, which exceeds LIMIT ROWS EXAMINED (0). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 0. The query result may be incomplete
select c1, sum(c2) from t3 group by c1 LIMIT ROWS EXAMINED 1;
c1 sum(c2)
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (1). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 1. The query result may be incomplete
select c1, sum(c2) from t3 group by c1 LIMIT ROWS EXAMINED 20;
c1 sum(c2)
aa 3
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 21 rows, which exceeds LIMIT ROWS EXAMINED (20). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 20. The query result may be incomplete
select c1, sum(c2) from t3 group by c1 LIMIT ROWS EXAMINED 21;
c1 sum(c2)
aa 3
@ -501,16 +501,16 @@ id select_type table type possible_keys key key_len ref rows Extra
select c1, sum(c2) from t3i group by c1 LIMIT ROWS EXAMINED 0;
c1 sum(c2)
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 1 rows, which exceeds LIMIT ROWS EXAMINED (0). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 0. The query result may be incomplete
select c1, sum(c2) from t3i group by c1 LIMIT ROWS EXAMINED 1;
c1 sum(c2)
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (1). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 1. The query result may be incomplete
select c1, sum(c2) from t3i group by c1 LIMIT ROWS EXAMINED 20;
c1 sum(c2)
aa 3
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 21 rows, which exceeds LIMIT ROWS EXAMINED (20). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 20. The query result may be incomplete
select c1, sum(c2) from t3i group by c1 LIMIT ROWS EXAMINED 21;
c1 sum(c2)
aa 3
@ -523,14 +523,14 @@ id select_type table type possible_keys key key_len ref rows Extra
select min(c2) from t3 LIMIT ROWS EXAMINED 5;
min(c2)
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 6 rows, which exceeds LIMIT ROWS EXAMINED (5). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 5. The query result may be incomplete
select max(c2) from t3 LIMIT ROWS EXAMINED 6;
max(c2)
5
select max(c2) from t3 LIMIT ROWS EXAMINED 0;
max(c2)
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 1 rows, which exceeds LIMIT ROWS EXAMINED (0). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 0. The query result may be incomplete
explain
select max(c2) from t3 where c2 > 10 LIMIT ROWS EXAMINED 5;
id select_type table type possible_keys key key_len ref rows Extra
@ -538,14 +538,14 @@ id select_type table type possible_keys key key_len ref rows Extra
select max(c2) from t3 where c2 > 10 LIMIT ROWS EXAMINED 5;
max(c2)
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 6 rows, which exceeds LIMIT ROWS EXAMINED (5). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 5. The query result may be incomplete
select max(c2) from t3 where c2 > 10 LIMIT ROWS EXAMINED 6;
max(c2)
NULL
select max(c2) from t3 where c2 > 10 LIMIT ROWS EXAMINED 0;
max(c2)
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 1 rows, which exceeds LIMIT ROWS EXAMINED (0). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 0. The query result may be incomplete
explain
select count(c2) from t3 LIMIT ROWS EXAMINED 5;
id select_type table type possible_keys key key_len ref rows Extra
@ -553,14 +553,14 @@ id select_type table type possible_keys key key_len ref rows Extra
select count(c2) from t3 LIMIT ROWS EXAMINED 5;
count(c2)
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 6 rows, which exceeds LIMIT ROWS EXAMINED (5). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 5. The query result may be incomplete
select count(c2) from t3 LIMIT ROWS EXAMINED 6;
count(c2)
5
select count(c2) from t3 LIMIT ROWS EXAMINED 0;
count(c2)
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 1 rows, which exceeds LIMIT ROWS EXAMINED (0). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 0. The query result may be incomplete
explain
select count(c2) from t3 where c2 > 10 LIMIT ROWS EXAMINED 5;
id select_type table type possible_keys key key_len ref rows Extra
@ -568,7 +568,7 @@ id select_type table type possible_keys key key_len ref rows Extra
select count(c2) from t3 where c2 > 10 LIMIT ROWS EXAMINED 5;
count(c2)
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 6 rows, which exceeds LIMIT ROWS EXAMINED (5). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 5. The query result may be incomplete
select count(c2) from t3 where c2 > 10 LIMIT ROWS EXAMINED 6;
count(c2)
0
@ -579,7 +579,7 @@ id select_type table type possible_keys key key_len ref rows Extra
select sum(c2) from t3 LIMIT ROWS EXAMINED 5;
sum(c2)
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 6 rows, which exceeds LIMIT ROWS EXAMINED (5). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 5. The query result may be incomplete
select sum(c2) from t3 LIMIT ROWS EXAMINED 6;
sum(c2)
15
@ -618,7 +618,7 @@ c1 c2
aa 1
aa 2
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (2). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 2. The query result may be incomplete
explain
select c1, c2 from t3i order by c2, c1 desc LIMIT ROWS EXAMINED 2;
id select_type table type possible_keys key key_len ref rows Extra
@ -634,14 +634,14 @@ CREATE TABLE t4 (a int);
INSERT INTO t4 values (1), (2);
INSERT IGNORE INTO t4 SELECT a + 2 FROM t4 LIMIT ROWS EXAMINED 0;
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 1 rows, which exceeds LIMIT ROWS EXAMINED (0). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 0. The query result may be incomplete
select * from t4;
a
1
2
INSERT INTO t4 SELECT a + 2 FROM t4 LIMIT ROWS EXAMINED 6;
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 8 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 6. The query result may be incomplete
select * from t4;
a
1
@ -692,7 +692,7 @@ WHERE EXISTS (SELECT c FROM t3 LEFT JOIN t2 ON b = d)
HAVING field1 > 'aaa' LIMIT ROWS EXAMINED 20;
field1
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 21 rows, which exceeds LIMIT ROWS EXAMINED (20). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 20. The query result may be incomplete
EXPLAIN
SELECT DISTINCT a FROM t1, t2 HAVING a > ' ' LIMIT ROWS EXAMINED 14;
id select_type table type possible_keys key key_len ref rows Extra
@ -702,13 +702,13 @@ SELECT DISTINCT a FROM t1, t2 HAVING a > ' ' LIMIT ROWS EXAMINED 14;
a
USA
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 15 rows, which exceeds LIMIT ROWS EXAMINED (14). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 14. The query result may be incomplete
SELECT DISTINCT a FROM t1, t2 HAVING a > ' ' LIMIT ROWS EXAMINED 15;
a
USA
CAN
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 16 rows, which exceeds LIMIT ROWS EXAMINED (15). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 15. The query result may be incomplete
SELECT DISTINCT a FROM t1, t2 HAVING a > ' ' LIMIT ROWS EXAMINED 16;
a
USA
@ -753,7 +753,7 @@ GROUP BY field1, field2, field3, field4, field5
LIMIT ROWS EXAMINED 120;
field1 field2 field3 field4 field5
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 121 rows, which exceeds LIMIT ROWS EXAMINED (120). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 120. The query result may be incomplete
SHOW STATUS LIKE 'Handler_read%';
Variable_name Value
Handler_read_first 1
@ -778,8 +778,8 @@ GROUP BY field1, field2, field3, field4, field5
LIMIT ROWS EXAMINED 124;
field1 field2 field3 field4 field5
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 125 rows, which exceeds LIMIT ROWS EXAMINED (124). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query examined at least 127 rows, which exceeds LIMIT ROWS EXAMINED (124). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 124. The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 124. The query result may be incomplete
SHOW STATUS LIKE 'Handler_read%';
Variable_name Value
Handler_read_first 1
@ -822,7 +822,7 @@ WHERE b <= alias1.b OR e != alias2.c
) LIMIT ROWS EXAMINED 20;
a b c
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 25 rows, which exceeds LIMIT ROWS EXAMINED (20). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 20. The query result may be incomplete
drop table t1, t2, t3;
MDEV-174: LIMIT ROWS EXAMINED: Assertion `0' failed in net_end_statement(THD*)
@ -839,7 +839,7 @@ WHERE c = (SELECT MAX(b) FROM t2)
LIMIT ROWS EXAMINED 3;
(SELECT MAX(c) FROM t1, t2)
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 12 rows, which exceeds LIMIT ROWS EXAMINED (3). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 3. The query result may be incomplete
drop table t1, t2;
MDEV-178: LIMIT ROWS EXAMINED: Assertion `0' failed in net_end_statement(THD*) on the
@ -856,12 +856,12 @@ EXECUTE ps;
a
3
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 22 rows, which exceeds LIMIT ROWS EXAMINED (21). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 21. The query result may be incomplete
EXECUTE ps;
a
3
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 22 rows, which exceeds LIMIT ROWS EXAMINED (21). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 21. The query result may be incomplete
drop view v;
drop table t1, t2;
#
@ -876,7 +876,7 @@ INSERT INTO t1 (k,c) VALUES(0,'0'), (0,'0'),(0,'0'),(0,'0'),(0,'0'),(0,'0'),(0,'
SET @@sql_mode='STRICT_TRANS_TABLES';
INSERT INTO t1 (c) SELECT k FROM t1 LIMIT ROWS EXAMINED 2;
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (2). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 2. The query result may be incomplete
SET @@sql_mode=@old_mode;
DROP TABLE t1;
#

View file

@ -0,0 +1 @@
--lower-case-table-names=2

View file

@ -14,7 +14,7 @@ SHOW CREATE TABLE T1;
Table Create Table
T1 CREATE TABLE `T1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
RENAME TABLE T1 TO T2;
SHOW TABLES LIKE "T2";
Tables_in_test (T2)
@ -70,7 +70,7 @@ SHOW CREATE TABLE T1;
Table Create Table
T1 CREATE TABLE `T1` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
RENAME TABLE T1 TO T2;
SHOW TABLES LIKE "T2";
Tables_in_test (T2)
@ -319,18 +319,42 @@ Database (mysql_t%)
mysql_TEST
show create database mysql_test;
Database Create Database
mysql_test CREATE DATABASE `mysql_test` /*!40100 DEFAULT CHARACTER SET latin1 */
mysql_test CREATE DATABASE `mysql_test` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */
show create database mysql_TEST;
Database Create Database
mysql_TEST CREATE DATABASE `mysql_TEST` /*!40100 DEFAULT CHARACTER SET latin1 */
mysql_TEST CREATE DATABASE `mysql_TEST` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */
show create table mysql_TEST.T1;
Table Create Table
T1 CREATE TABLE `T1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
show create table mysql_test.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop database mysql_TEST;
# MDEV-30765 SHOW TABLES not working properly with
# lower_case_table_names=2
#
create database db1;
use db1;
# lowercase table name
create table `a` (a int);
# uppercase table name
create table `B` (a int);
create user 'mysqltest_1'@'localhost' identified by 'password';
grant select, show view on db1.`a` to 'mysqltest_1'@'localhost';
grant select, show view on db1.`B` to 'mysqltest_1'@'localhost';
connect conn1, localhost, mysqltest_1, password, test;
connection conn1;
use db1;
show tables;
Tables_in_db1
B
a
connection default;
disconnect conn1;
drop user 'mysqltest_1'@'localhost';
drop tables a, B;
drop database db1;

View file

@ -288,3 +288,29 @@ show create database mysql_TEST;
show create table mysql_TEST.T1;
show create table mysql_test.t1;
drop database mysql_TEST;
--echo # MDEV-30765 SHOW TABLES not working properly with
--echo # lower_case_table_names=2
--echo #
create database db1;
use db1;
--echo # lowercase table name
create table `a` (a int);
--echo # uppercase table name
create table `B` (a int);
create user 'mysqltest_1'@'localhost' identified by 'password';
grant select, show view on db1.`a` to 'mysqltest_1'@'localhost';
grant select, show view on db1.`B` to 'mysqltest_1'@'localhost';
connect (conn1, localhost, mysqltest_1, password, test);
connection conn1;
use db1;
show tables;
connection default;
disconnect conn1;
drop user 'mysqltest_1'@'localhost';
drop tables a, B;
drop database db1;

View file

@ -8479,6 +8479,55 @@ SELECT a FROM t1 WHERE (a,b) in (SELECT @c,@d);
a
DROP TABLE t1;
#
# MDEV-30964: MAX_SEL_ARG memory exhaustion is not visible in the optimizer trace
#
create table t1 (
c1 int,
c2 int,
c3 int,
c4 int,
c5 int,
c6 int,
c7 int,
c8 int,
key(c1,c2,c3,c4,c5,c6,c7,c8)
);
insert into t1 () values (),(),();
explain select *
from t1
where
(c1 in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) and c2=1) and
c3 in (1,2,3,4,5,6,7,8,9,10) and
c4 in (1,2,3,4,5,6,7,8,9,10) and
c5 in (1,2,3,4,5,6,7,8,9,10) and
c6 in (1,2,3,4);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index c1 c1 40 NULL 3 Using where; Using index
select
json_detailed(json_extract(trace, '$**.setup_range_conditions'))
from
information_schema.optimizer_trace;
json_detailed(json_extract(trace, '$**.setup_range_conditions'))
[
[
{
"enforce_sel_arg_weight_limit":
{
"index": "c1",
"old_weight": 74806,
"new_weight": 1776
}
},
{
"sel_arg_alloc_limit_hit":
{
"alloced_sel_args": 16001
}
}
]
]
drop table t1;
#
# MDEV-31085: multi-update using view with optimizer trace enabled
#
SET SESSION optimizer_trace = 'enabled=on';

View file

@ -677,6 +677,39 @@ INSERT INTO t1 VALUES (0,0);
SELECT a FROM t1 WHERE (a,b) in (SELECT @c,@d);
DROP TABLE t1;
--echo #
--echo # MDEV-30964: MAX_SEL_ARG memory exhaustion is not visible in the optimizer trace
--echo #
create table t1 (
c1 int,
c2 int,
c3 int,
c4 int,
c5 int,
c6 int,
c7 int,
c8 int,
key(c1,c2,c3,c4,c5,c6,c7,c8)
);
insert into t1 () values (),(),();
explain select *
from t1
where
(c1 in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) and c2=1) and
c3 in (1,2,3,4,5,6,7,8,9,10) and
c4 in (1,2,3,4,5,6,7,8,9,10) and
c5 in (1,2,3,4,5,6,7,8,9,10) and
c6 in (1,2,3,4);
select
json_detailed(json_extract(trace, '$**.setup_range_conditions'))
from
information_schema.optimizer_trace;
drop table t1;
--echo #
--echo # MDEV-31085: multi-update using view with optimizer trace enabled
--echo #
@ -751,6 +784,11 @@ select * from
from t10 left join t11 on t11.col1=t10.col1
group by grp_id) T on T.grp_id=t1.b;
# Not sure how MDEV-27871 is related but this test uses this reason
# all over the place:
#enable after fix MDEV-27871
--disable_view_protocol
select json_detailed(json_extract(trace, '$**.check_split_materialized')) as JS
from information_schema.optimizer_trace;
@ -763,6 +801,7 @@ select
) as JS
from information_schema.optimizer_trace;
--enable_view_protocol
drop table t1,t2,t3,t10,t11;
set optimizer_trace=DEFAULT;

View file

@ -814,3 +814,47 @@ t2 CREATE TABLE `t2` (
`text0` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1;
#
# End of 10.3 tests
#
#
# Start of 10.4 tests
#
#
# MDEV-31250 ROW variables do not get assigned from subselects
#
CREATE TABLE t1 (a INT, b TEXT);
INSERT INTO t1 VALUES (1,'b1');
BEGIN NOT ATOMIC
DECLARE r ROW TYPE OF t1;
SELECT * INTO r FROM t1 WHERE a=1;
SELECT r.a, r.b;
END;
$$
r.a r.b
1 b1
DROP TABLE t1;
CREATE TABLE t1 (a INT, b TEXT);
INSERT INTO t1 VALUES (1,'b1');
BEGIN NOT ATOMIC
DECLARE r ROW TYPE OF t1;
SET r=(SELECT * FROM t1 WHERE a=1);
SELECT r.a, r.b;
END;
$$
r.a r.b
1 b1
DROP TABLE t1;
CREATE TABLE t1 (a INT, b TEXT);
INSERT INTO t1 VALUES (1,'b1');
BEGIN NOT ATOMIC
DECLARE r ROW TYPE OF t1 DEFAULT (SELECT * FROM t1 WHERE a=1);
SELECT r.a, r.b;
END;
$$
r.a r.b
1 b1
DROP TABLE t1;
#
# End of 10.4 tests
#

View file

@ -881,3 +881,58 @@ END;
$$
DELIMITER ;$$
DROP TABLE t1;
--echo #
--echo # End of 10.3 tests
--echo #
--echo #
--echo # Start of 10.4 tests
--echo #
--echo #
--echo # MDEV-31250 ROW variables do not get assigned from subselects
--echo #
CREATE TABLE t1 (a INT, b TEXT);
INSERT INTO t1 VALUES (1,'b1');
DELIMITER $$;
BEGIN NOT ATOMIC
DECLARE r ROW TYPE OF t1;
SELECT * INTO r FROM t1 WHERE a=1;
SELECT r.a, r.b;
END;
$$
DELIMITER ;$$
DROP TABLE t1;
CREATE TABLE t1 (a INT, b TEXT);
INSERT INTO t1 VALUES (1,'b1');
DELIMITER $$;
BEGIN NOT ATOMIC
DECLARE r ROW TYPE OF t1;
SET r=(SELECT * FROM t1 WHERE a=1);
SELECT r.a, r.b;
END;
$$
DELIMITER ;$$
DROP TABLE t1;
CREATE TABLE t1 (a INT, b TEXT);
INSERT INTO t1 VALUES (1,'b1');
DELIMITER $$;
BEGIN NOT ATOMIC
DECLARE r ROW TYPE OF t1 DEFAULT (SELECT * FROM t1 WHERE a=1);
SELECT r.a, r.b;
END;
$$
DELIMITER ;$$
DROP TABLE t1;
--echo #
--echo # End of 10.4 tests
--echo #

View file

@ -2760,7 +2760,7 @@ from t2 join t1 on
('i','w') not in (select t1.v1,t4.v2 from t4,t1,t3 where t3.v2 = t1.v1) LIMIT ROWS EXAMINED 500;
1
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 3020 rows, which exceeds LIMIT ROWS EXAMINED (500). The query result may be incomplete
Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 500. The query result may be incomplete
SET join_cache_level= @save_join_cache_level;
DROP TABLE t1,t2,t3,t4;
#

View file

@ -567,7 +567,7 @@ End of 5.5 tests
#
# Check that used memory extends if we set a variable
#
set @var= repeat('a',20000);
set @var= repeat('a',30000);
1
explain select @a:=max(seq) from seq_1_to_1000000;
id select_type table type possible_keys key key_len ref rows Extra

View file

@ -493,7 +493,7 @@ DROP TABLE t1;
--disable_service_connection
# Execute twice so number stablizes a bit
let $tmp= `select memory_used from information_schema.processlist`;
set @var= repeat('a',20000);
set @var= repeat('a',30000);
let $tmp2= `select memory_used from information_schema.processlist`;
--disable_query_log
--disable_column_names

View file

@ -12,7 +12,7 @@ PSWD=''
# If these parameters are not set, then the values
# passed by the server are taken:
#
HOST="127.0.0.1"
HOST="::1"
PORT=$NODE_MYPORT_1
#
# Edit parameters below to specify SSL parameters:

View file

@ -13,14 +13,11 @@
galera_as_slave_ctas : MDEV-28378 timeout
galera_pc_recovery : MDEV-25199 cluster fails to start up
galera_sst_encrypted : MDEV-29876 Galera test failure on galera_sst_encrypted
MW-284 : MDEV-29861 Galera test case hangs
galera_binlog_checksum : MDEV-29861 Galera test case hangs
galera_var_notify_ssl_ipv6 : MDEV-29861 Galera test case hangs
galera_var_notify_cmd: MDEV-29861 Galera test case hangs
galera_var_node_address : MDEV-20485 Galera test failure
MDEV-26575 : MDEV-29878 Galera test failure on MDEV-26575
galera_bf_abort_shutdown : MDEV-29918 Assertion failure on galera_bf_abort_shutdown
galera_wan : [ERROR] WSREP: /home/buildbot/buildbot/build/gcs/src/gcs_state_msg.cpp:gcs_state_msg_get_quorum():947: Failed to establish quorum.
galera_var_ignore_apply_errors : 28: "Server did not transition to READY state"
versioning_trx_id : MDEV-18590: galera.versioning_trx_id: Test failure: mysqltest: Result content mismatch
MDEV-27713 : test is using get_lock(), which is now rejected in cluster
galera_bf_abort_group_commit : MDEV-30855 PR to remove the test exists

View file

@ -2,6 +2,9 @@ connection node_2;
connection node_1;
call mtr.add_suppression("WSREP: It may not be safe to bootstrap the cluster from this node.*");
call mtr.add_suppression("Aborting");
call mtr.add_suppression("Plugin \'wsrep\' init function returned error.");
call mtr.add_suppression("Plugin \'wsrep\' registration as a STORAGE ENGINE failed.");
call mtr.add_suppression("Failed to initialize plugins.");
connection node_2;
SET SESSION wsrep_sync_wait = 0;
Killing server ...

View file

@ -1,17 +1,14 @@
connection node_2;
connection node_1;
CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1;
CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1 NOCACHE;
CREATE TABLE t1 (Id int(11) NOT NULL, PRIMARY KEY (Id));
INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
DROP SEQUENCE Seq1_1;
CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1;
CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1 NOCACHE;
INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
DROP SEQUENCE Seq1_1;
DROP TABLE t1;
CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster.");
connection node_2;
CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster.");

View file

@ -0,0 +1,95 @@
connection node_2;
connection node_1;
# Lets first see that we can access wsrep schema tables
# Node1
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
EXPECT_0
0
SELECT COUNT(*) AS EXPECT_1 from mysql.wsrep_cluster;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_2 FROM mysql.wsrep_cluster_members;
EXPECT_2
2
connection node_2;
# Node2
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
EXPECT_0
0
SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_2 FROM mysql.wsrep_cluster_members;
EXPECT_2
2
connection node_1;
SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
SET GLOBAL wsrep_provider_options = 'pc.weight=2';
connection node_2;
# Desync and disconnect node_2
SET @@global.wsrep_desync = 1;
SET SESSION wsrep_dirty_reads=1;
SET SESSION wsrep_sync_wait=0;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
VARIABLE_VALUE
non-Primary
connection node_1;
# Waiting until node_2 is not part of cluster anymore
# Verify that we can access wsrep schema tables
# Node1
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
EXPECT_0
0
SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster_members;
EXPECT_1
1
connection node_2;
# Node2
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
EXPECT_0
0
SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_2 FROM mysql.wsrep_cluster_members;
EXPECT_2
2
connection node_2;
# Reconnect node_2 back to cluster
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
SET wsrep_dirty_reads=0;
SHOW STATUS LIKE 'wsrep_desync_count';
Variable_name Value
wsrep_desync_count 0
SET @@global.wsrep_desync = 0;
CALL mtr.add_suppression("WSREP: Protocol violation. JOIN message sender (.*) is not in state transfer \\(SYNCED\\). Message ignored.");
connection node_1;
# Wait until both nodes are back to cluster
SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=false';
SET GLOBAL wsrep_provider_options = 'pc.weight=1';
# Verify that we can access wsrep schema tables
# Node1
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
EXPECT_0
0
SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_2 FROM mysql.wsrep_cluster_members;
EXPECT_2
2
connection node_2;
# Node2
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
EXPECT_0
0
SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_2 FROM mysql.wsrep_cluster_members;
EXPECT_2
2

View file

@ -1,46 +0,0 @@
connection node_2;
connection node_1;
CREATE TABLE t1 (
f1 INT,
f2 VARCHAR(255) PRIMARY KEY
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES(1, 'abc');
connection node_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (2,'def');
connection node_2;
SET GLOBAL event_scheduler=ON;
CREATE PROCEDURE update_table()
BEGIN
SET AUTOCOMMIT=OFF;
DO GET_LOCK('local_lock', 0);
SET DEBUG_SYNC = 'innodb_row_update_for_mysql_begin SIGNAL blocked WAIT_FOR continue';
UPDATE t1 SET f2 = 'jkl' WHERE f1 != 2;
DO RELEASE_LOCK('local_lock');
END|
CREATE DEFINER=current_user
EVENT event
ON SCHEDULE AT CURRENT_TIMESTAMP
ON COMPLETION PRESERVE
ENABLE
DO CALL update_table();
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
SET DEBUG_SYNC = 'now WAIT_FOR blocked';
connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2;
SET GLOBAL debug_dbug = "+d,sync.wsrep_apply_cb";
connection node_1;
COMMIT;
connection node_2b;
SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
connection node_2a;
SET DEBUG_SYNC = 'now SIGNAL continue';
connection node_2;
SET GLOBAL event_scheduler=default;
DROP PROCEDURE update_table;
DROP EVENT event;
SET DEBUG_SYNC='reset';
SET GLOBAL debug_dbug = DEFAULT;
connection node_1;
DROP TABLE t1;

View file

@ -1,10 +1,5 @@
connection node_2;
connection node_1;
CREATE SEQUENCE seq_nocache ENGINE=InnoDB;
DROP SEQUENCE seq_nocache;
CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster.");
connection node_2;
CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster.");
connection node_1;
CREATE SEQUENCE seq NOCACHE ENGINE=InnoDB;
SELECT NEXTVAL(seq) = 1;

View file

@ -13,6 +13,7 @@ connection node_3;
SELECT @@wsrep_on;
@@wsrep_on
0
call mtr.add_suppression("Error reading packet from server: WSREP has not yet prepared node for application use (server_errno=1047)");
START SLAVE;
include/wait_for_slave_param.inc [Slave_IO_Running]
connection node_1;

View file

@ -94,7 +94,7 @@ CALL insert_1m ();;
connection node_1_insert_10m;
CALL insert_10m ();;
connection node_2;
call mtr.add_suppression("Error in Log_event::read_log_event():.*");
call mtr.add_suppression("Error in Log_event::read_log_event\(\):.*");
SET SESSION wsrep_sync_wait = 0;
Killing server ...
connection node_1;
@ -131,6 +131,9 @@ DROP PROCEDURE update_simple;
DROP PROCEDURE insert_1k;
DROP PROCEDURE insert_1m;
connection node_1;
call mtr.add_suppression("Error in Log_event::read_log_event():.*");
call mtr.add_suppression("Error in Log_event::read_log_event\(\):.*");
CALL mtr.add_suppression("conflict state 7 after post commit");
CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
connection node_2;
call mtr.add_suppression("Error in Log_event::read_log_event\(\):.*");
CALL mtr.add_suppression("Skipped GCache ring buffer recovery");

View file

@ -1,10 +1,10 @@
connection node_2;
connection node_1;
connection node_1;
connection node_2;
set global wsrep_on=OFF;
reset master;
set global wsrep_on=ON;
connection node_2;
connection node_1;
set global wsrep_on=OFF;
reset master;
set global wsrep_on=ON;

View file

@ -2,11 +2,11 @@ connection node_2;
connection node_1;
connection node_1;
connection node_2;
connection node_1;
connection node_2;
set global wsrep_on=OFF;
reset master;
set global wsrep_on=ON;
connection node_2;
connection node_1;
set global wsrep_on=OFF;
reset master;
set global wsrep_on=ON;

View file

@ -2,11 +2,11 @@ connection node_2;
connection node_1;
connection node_1;
connection node_2;
connection node_1;
connection node_2;
set global wsrep_on=OFF;
reset master;
set global wsrep_on=ON;
connection node_2;
connection node_1;
set global wsrep_on=OFF;
reset master;
set global wsrep_on=ON;

View file

@ -1,10 +1,10 @@
connection node_2;
connection node_1;
connection node_1;
connection node_2;
set global wsrep_on=OFF;
reset master;
set global wsrep_on=ON;
connection node_2;
connection node_1;
set global wsrep_on=OFF;
reset master;
set global wsrep_on=ON;

View file

@ -1,11 +1,6 @@
connection node_2;
connection node_1;
connection node_1;
CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster.");
CALL mtr.add_suppression("WSREP: CREATE TABLE isolation failure");
connection node_2;
CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster.");
connection node_1;
CREATE SEQUENCE `seq` start with 1 minvalue 1 maxvalue 1000000 increment by 0 cache 1000 nocycle ENGINE=InnoDB;
SHOW CREATE SEQUENCE seq;
Table Create Table
@ -15,14 +10,14 @@ SHOW CREATE SEQUENCE seq;
Table Create Table
seq CREATE SEQUENCE `seq` start with 1 minvalue 1 maxvalue 1000000 increment by 0 cache 1000 nocycle ENGINE=InnoDB
connection node_1;
ALTER SEQUENCE seq MAXVALUE = 10000;
ALTER SEQUENCE seq MAXVALUE = 10000 NOCACHE;
SHOW CREATE SEQUENCE seq;
Table Create Table
seq CREATE SEQUENCE `seq` start with 1 minvalue 1 maxvalue 10000 increment by 0 cache 1000 nocycle ENGINE=InnoDB
seq CREATE SEQUENCE `seq` start with 1 minvalue 1 maxvalue 10000 increment by 0 nocache nocycle ENGINE=InnoDB
connection node_2;
SHOW CREATE SEQUENCE seq;
Table Create Table
seq CREATE SEQUENCE `seq` start with 1 minvalue 1 maxvalue 10000 increment by 0 cache 1000 nocycle ENGINE=InnoDB
seq CREATE SEQUENCE `seq` start with 1 minvalue 1 maxvalue 10000 increment by 0 nocache nocycle ENGINE=InnoDB
connection node_1;
DROP SEQUENCE seq;
SHOW CREATE SEQUENCE seq;
@ -31,25 +26,26 @@ connection node_2;
SHOW CREATE SEQUENCE seq;
ERROR 42S02: Table 'test.seq' doesn't exist
connection node_1;
CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1;
CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1 NOCACHE;
select NEXT VALUE FOR Seq1_1;
NEXT VALUE FOR Seq1_1
1
alter table Seq1_1 engine=myisam;
ERROR 42000: This version of MariaDB doesn't yet support 'Galera cluster does support only InnoDB sequences'
select NEXT VALUE FOR Seq1_1;
NEXT VALUE FOR Seq1_1
1001
2
alter table Seq1_1 engine=innodb;
select NEXT VALUE FOR Seq1_1;
NEXT VALUE FOR Seq1_1
2001
3
connection node_2;
SHOW CREATE SEQUENCE Seq1_1;
Table Create Table
Seq1_1 CREATE SEQUENCE `Seq1_1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB
Seq1_1 CREATE SEQUENCE `Seq1_1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=InnoDB
select NEXT VALUE FOR Seq1_1;
NEXT VALUE FOR Seq1_1
3001
4
connection node_1;
DROP SEQUENCE Seq1_1;
connection node_1;
@ -83,27 +79,192 @@ SET SESSION autocommit=1;
DROP SEQUENCE seq1;
DROP SEQUENCE seq2;
DROP TABLE t2;
connection node_2;
SET SESSION AUTOCOMMIT=0;
SET SESSION wsrep_OSU_method='RSU';
CREATE TABLE t1(c1 VARCHAR(10));
INSERT INTO t1 (c1) VALUES('');
create temporary sequence sq1 NOCACHE engine=innodb;
create sequence sq2 NOCACHE engine=innodb;
COMMIT;
SET SESSION wsrep_OSU_method='TOI';
SHOW CREATE SEQUENCE sq1;
Table Create Table
sq1 CREATE SEQUENCE `sq1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=InnoDB
SHOW CREATE SEQUENCE sq2;
Table Create Table
sq2 CREATE SEQUENCE `sq2` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=InnoDB
connection node_2;
connection node_1;
SHOW CREATE SEQUENCE sq1;
ERROR 42S02: Table 'test.sq1' doesn't exist
SHOW CREATE SEQUENCE sq2;
ERROR 42S02: Table 'test.sq2' doesn't exist
connection node_1;
connection node_2;
SET SESSION AUTOCOMMIT=1;
DROP TABLE t1;
DROP SEQUENCE sq1;
DROP SEQUENCE sq2;
SET SESSION wsrep_OSU_method='TOI';
connection node_1;
CREATE TABLE t (f INT) engine=innodb;
LOCK TABLE t WRITE;
CREATE OR REPLACE SEQUENCE t MAXVALUE=13 INCREMENT BY 1 NOCACHE engine=innodb;
Warnings:
Warning 138 Galera cluster does not support LOCK TABLE on SEQUENCES. Lock is released.
LOCK TABLE t WRITE;
ERROR 42000: This version of MariaDB doesn't yet support 'LOCK TABLE on SEQUENCES in Galera cluster'
INSERT INTO t VALUES (0,0,1,1,1,0,0,0);
SELECT * from t;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
0 0 1 1 1 0 0 0
SELECT NEXTVAL(t);
NEXTVAL(t)
0
UNLOCK TABLES;
DROP TABLE t;
CREATE SEQUENCE t INCREMENT BY 0 NOCACHE ENGINE=INNODB;
CREATE TABLE t1(a int not null primary key default nextval(t),
b int) engine=innodb;
INSERT INTO t1(b) VALUES (1),(2),(3);
SELECT * FROM t1;
a b
1 1
3 2
5 3
connection node_2;
SELECT * FROM t1;
a b
1 1
3 2
5 3
INSERT INTO t1(b) VALUES (4),(5),(6);
SELECT * FROM t1;
a b
1 1
3 2
5 3
8 4
10 5
12 6
connection node_1;
SELECT * FROM t1;
a b
1 1
3 2
5 3
8 4
10 5
12 6
DROP TABLE t1;
DROP SEQUENCE t;
CREATE SEQUENCE t ENGINE=MYISAM;
ERROR 42000: This version of MariaDB doesn't yet support 'Galera cluster does support only InnoDB sequences'
CREATE SEQUENCE t INCREMENT BY 1 NOCACHE ENGINE=INNODB;
CREATE TABLE t1(a int not null primary key default nextval(t), b int) engine=innodb;
connection node_2;
# Wait DDL to replicate
connection node_1;
SELECT @@auto_increment_increment;
@@auto_increment_increment
2
SELECT @@auto_increment_offset;
@@auto_increment_offset
1
SET SESSION wsrep_sync_wait=0;
connection node_2;
SELECT @@auto_increment_increment;
@@auto_increment_increment
2
SELECT @@auto_increment_offset;
@@auto_increment_offset
2
SET SESSION wsrep_sync_wait=0;
connection node_1;
connection node_2;
connection node_1;
DROP SEQUENCE t;
DROP TABLE t1;
CREATE SEQUENCE t INCREMENT BY 0 NOCACHE ENGINE=INNODB;
DROP SEQUENCE t;
CREATE SEQUENCE t INCREMENT BY 1 CACHE=20 ENGINE=INNODB;
ERROR 42000: This version of MariaDB doesn't yet support 'In Galera if you use CACHE you should set INCREMENT BY 0 to behave correctly in a cluster'
CREATE SEQUENCE t INCREMENT BY 0 CACHE=20 ENGINE=INNODB;
CREATE TABLE t1(a int not null primary key default nextval(t), b int) engine=innodb;
connection node_2;
# Wait DDL to replicate
connection node_1;
SET SESSION wsrep_sync_wait=0;
connection node_2;
SET SESSION wsrep_sync_wait=0;
connection node_1;
connection node_2;
connection node_1;
DROP SEQUENCE t;
DROP TABLE t1;
CREATE SEQUENCE t INCREMENT BY 0 CACHE=20 ENGINE=INNODB;
ALTER TABLE t ENGINE=MYISAM;
ERROR 42000: This version of MariaDB doesn't yet support 'Galera cluster does support only InnoDB sequences'
ALTER SEQUENCE t INCREMENT BY 1 CACHE=10;
ERROR 42000: This version of MariaDB doesn't yet support 'In Galera if you use CACHE you should set INCREMENT BY 0 to behave correctly in a cluster'
ALTER SEQUENCE t INCREMENT BY 1 NOCACHE;
ALTER SEQUENCE t INCREMENT BY 0 NOCACHE;
ALTER SEQUENCE t INCREMENT BY 0 CACHE=10;
DROP SEQUENCE t;
CREATE SEQUENCE t INCREMENT BY 0 CACHE=20 ENGINE=INNODB;
CREATE TABLE t1(a int not null primary key default nextval(t), b int) engine=innodb;
BEGIN;
INSERT INTO t1(b) VALUES (1);
INSERT INTO t1(b) VALUES (2);
INSERT INTO t1(b) VALUES (3);
INSERT INTO t1(b) VALUES (4);
INSERT INTO t1(a,b) VALUES (2,2);
INSERT INTO t1(a,b) VALUES (3,2);
ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
ROLLBACK;
SELECT * FROM t1;
a b
SELECT NEXTVAL(t);
NEXTVAL(t)
9
connection node_2;
SELECT * FROM t1;
a b
SELECT NEXTVAL(t);
NEXTVAL(t)
2
connection node_1;
DROP TABLE t1;
DROP SEQUENCE t;
CREATE SEQUENCE t INCREMENT BY 0 CACHE=20 ENGINE=INNODB;
CREATE TABLE t1(a int not null primary key default nextval(t), b int) engine=innodb;
BEGIN;
INSERT INTO t1(b) VALUES (1);
INSERT INTO t1(b) VALUES (2);
INSERT INTO t1(b) VALUES (3);
INSERT INTO t1(b) VALUES (4);
INSERT INTO t1(a,b) VALUES (2,2);
INSERT INTO t1(a,b) VALUES (3,2);
ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
COMMIT;
SELECT * FROM t1;
a b
1 1
2 2
3 2
5 3
7 4
SELECT NEXTVAL(t);
NEXTVAL(t)
9
connection node_2;
SELECT * FROM t1;
a b
1 1
2 2
3 2
5 3
7 4
SELECT NEXTVAL(t);
NEXTVAL(t)
42
connection node_1;
DROP TABLE t1;
DROP SEQUENCE t;

View file

@ -0,0 +1,46 @@
connection node_2;
connection node_1;
connection node_2;
SET AUTOCOMMIT=0;
SET SESSION wsrep_OSU_method='RSU';
CREATE TABLE t (i int primary key, j int);
CREATE TEMPORARY SEQUENCE seq2 NOCACHE ENGINE=InnoDB;
COMMIT;
SET SESSION wsrep_OSU_method='RSU';
CREATE SEQUENCE seq1 NOCACHE ENGINE=InnoDB;
SET SESSION wsrep_OSU_method='TOI';
DROP TABLE t;
DROP SEQUENCE seq2;
DROP SEQUENCE seq1;
connection node_1;
CREATE TABLE t (i int primary key, j int) ENGINE=InnoDB;
SET AUTOCOMMIT=0;
INSERT INTO t VALUES (3,0);
CREATE TEMPORARY SEQUENCE seq1 NOCACHE ENGINE=InnoDB;
COMMIT;
INSERT INTO t VALUES (4,0);
CREATE SEQUENCE seq2 NOCACHE ENGINE=InnoDB;
commit;
connection node_2;
SELECT * FROM t;
i j
3 0
4 0
SHOW CREATE TABLE seq1;
ERROR 42S02: Table 'test.seq1' doesn't exist
SHOW CREATE TABLE seq2;
Table Create Table
seq2 CREATE TABLE `seq2` (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
`cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=InnoDB SEQUENCE=1
connection node_1;
DROP TABLE t;
DROP SEQUENCE seq1;
DROP SEQUENCE seq2;

View file

@ -3,10 +3,14 @@ connection node_1;
connection node_1;
connection node_2;
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4;
connection node_1;
connection node_2;
connection node_3;
connection node_4;
connection node_3;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1';
connection node_1;
connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4;
connection node_4;
SET SESSION wsrep_on=OFF;
CREATE TABLE t1 (f1 INTEGER);

View file

@ -0,0 +1,25 @@
connection node_2;
connection node_1;
connection node_1;
connection node_2;
connection node_2;
SET @@global.wsrep_sst_donor = NULL;
ERROR 42000: Variable 'wsrep_sst_donor' can't be set to the value of 'NULL'
SET @@global.wsrep_cluster_address='NULL';
SET SESSION wsrep_sync_wait=0;
SELECT @@wsrep_sst_donor;
@@wsrep_sst_donor
SELECT @@wsrep_cluster_address;
@@wsrep_cluster_address
NULL
SHOW STATUS LIKE 'wsrep_ready';
Variable_name Value
wsrep_ready OFF
SHOW STATUS LIKE 'wsrep_cluster_status';
Variable_name Value
wsrep_cluster_status Disconnected
call mtr.add_suppression("WSREP: .*Invalid backend URI.*");
call mtr.add_suppression("WSREP: gcs connect failed: Invalid argument");
disconnect node_2;
disconnect node_1;

View file

@ -0,0 +1,17 @@
connection node_2;
connection node_1;
INSTALL PLUGIN ARCHIVE SONAME 'ha_archive.so';
CREATE TABLE t (a CHAR(1)) ENGINE=ARCHIVE;
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` char(1) DEFAULT NULL
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
INSERT INTO t VALUES ('A');
UNINSTALL SONAME 'ha_archive';
Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown
ALTER TABLE t CHANGE COLUMN a a CHAR(2);
INSERT INTO t (a) VALUES ('AB');
ERROR 42000: Unknown storage engine 'ARCHIVE'
DROP TABLE t;

View file

@ -7,6 +7,9 @@
call mtr.add_suppression("WSREP: It may not be safe to bootstrap the cluster from this node.*");
call mtr.add_suppression("Aborting");
call mtr.add_suppression("Plugin \'wsrep\' init function returned error.");
call mtr.add_suppression("Plugin \'wsrep\' registration as a STORAGE ENGINE failed.");
call mtr.add_suppression("Failed to initialize plugins.");
--connection node_2
SET SESSION wsrep_sync_wait = 0;

View file

@ -1,23 +1,15 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1;
CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1 NOCACHE;
CREATE TABLE t1 (Id int(11) NOT NULL, PRIMARY KEY (Id));
INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
DROP SEQUENCE Seq1_1;
CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1;
CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1 NOCACHE;
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
DROP SEQUENCE Seq1_1;
DROP TABLE t1;
# Supress warning for SEQUENCES that are declared without `NOCACHE` introduced with MDEV-27862
CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster.");
--connection node_2
CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster.");

View file

@ -0,0 +1,99 @@
#
# MDEV-21479 : Galera 4 unable to query cluster state if not primary component
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--echo # Lets first see that we can access wsrep schema tables
--echo # Node1
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
SELECT COUNT(*) AS EXPECT_1 from mysql.wsrep_cluster;
SELECT COUNT(*) AS EXPECT_2 FROM mysql.wsrep_cluster_members;
--connection node_2
--echo # Node2
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster;
SELECT COUNT(*) AS EXPECT_2 FROM mysql.wsrep_cluster_members;
--connection node_1
# Make node 1 tolerate split-brain
SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
SET GLOBAL wsrep_provider_options = 'pc.weight=2';
# Desync and disconnect node 2 from the PC:
--connection node_2
--echo # Desync and disconnect node_2
SET @@global.wsrep_desync = 1;
SET SESSION wsrep_dirty_reads=1;
SET SESSION wsrep_sync_wait=0;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
# Wait until node 2 disappears from the PC:
--connection node_1
--echo # Waiting until node_2 is not part of cluster anymore
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
--echo # Verify that we can access wsrep schema tables
--echo # Node1
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster;
SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster_members;
--connection node_2
#
# Here node2 remembers old configuration even when we are non-Primary
#
--echo # Node2
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster;
SELECT COUNT(*) AS EXPECT_2 FROM mysql.wsrep_cluster_members;
# Reconnect node 2 to the PC:
--connection node_2
--echo # Reconnect node_2 back to cluster
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
SET wsrep_dirty_reads=0;
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
--source include/wait_condition.inc
# Must return 0:
SHOW STATUS LIKE 'wsrep_desync_count';
# Resync node_2, should pass:
SET @@global.wsrep_desync = 0;
--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
--source include/wait_condition.inc
CALL mtr.add_suppression("WSREP: Protocol violation. JOIN message sender (.*) is not in state transfer \\(SYNCED\\). Message ignored.");
--connection node_1
--echo # Wait until both nodes are back to cluster
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=false';
SET GLOBAL wsrep_provider_options = 'pc.weight=1';
--echo # Verify that we can access wsrep schema tables
--echo # Node1
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster;
SELECT COUNT(*) AS EXPECT_2 FROM mysql.wsrep_cluster_members;
--connection node_2
--echo # Node2
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster;
SELECT COUNT(*) AS EXPECT_2 FROM mysql.wsrep_cluster_members;

View file

@ -1,67 +0,0 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/big_test.inc
CREATE TABLE t1 (
f1 INT,
f2 VARCHAR(255) PRIMARY KEY
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES(1, 'abc');
--connection node_1
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (2,'def');
--connection node_2
SET GLOBAL event_scheduler=ON;
DELIMITER |;
CREATE PROCEDURE update_table()
BEGIN
SET AUTOCOMMIT=OFF;
DO GET_LOCK('local_lock', 0);
SET DEBUG_SYNC = 'innodb_row_update_for_mysql_begin SIGNAL blocked WAIT_FOR continue';
UPDATE t1 SET f2 = 'jkl' WHERE f1 != 2;
DO RELEASE_LOCK('local_lock');
END|
DELIMITER ;|
CREATE DEFINER=current_user
EVENT event
ON SCHEDULE AT CURRENT_TIMESTAMP
ON COMPLETION PRESERVE
ENABLE
DO CALL update_table();
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
SET DEBUG_SYNC = 'now WAIT_FOR blocked';
# Applier control thread
--connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2
SET GLOBAL debug_dbug = "+d,sync.wsrep_apply_cb";
--connection node_1
COMMIT;
# Applier control thread
--connection node_2b
SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
--connection node_2a
SET DEBUG_SYNC = 'now SIGNAL continue';
--connection node_2
SET GLOBAL event_scheduler=default;
DROP PROCEDURE update_table;
DROP EVENT event;
SET DEBUG_SYNC='reset';
SET GLOBAL debug_dbug = DEFAULT;
--connection node_1
DROP TABLE t1;

View file

@ -1,17 +1,6 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
# Report WARNING when SEQUENCE is created without `NOCACHE`
CREATE SEQUENCE seq_nocache ENGINE=InnoDB;
DROP SEQUENCE seq_nocache;
CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster.");
--connection node_2
CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster.");
# NEXTVAL
--connection node_1

View file

@ -29,6 +29,7 @@ SET global wsrep_sync_wait=0;
--connection node_3
SELECT @@wsrep_on;
--sleep 1
call mtr.add_suppression("Error reading packet from server: WSREP has not yet prepared node for application use (server_errno=1047)");
START SLAVE;
--let $slave_param= Slave_IO_Running
--let $slave_param_value= Connecting

View file

@ -1,15 +0,0 @@
!include ../galera_2nodes.cnf
# We set repl.commit_order=1 in order to disable provider commit
# ordering.
[mysqld.1]
log-bin
log-slave-updates
wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;repl.commit_order=1'
[mysqld.2]
log-bin
log-slave-updates
wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;repl.commit_order=1'

View file

@ -1,77 +0,0 @@
#
# This test uses galera_sr_bf_abort.inc to probe various BF abort points
# for SR transactions with wsrep provider commit ordering disabled.
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/galera_have_debug_sync.inc
# Control connection for manipulating sync points on node 1
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
SET SESSION wsrep_sync_wait = 0;
# SR bf abort on fragment
--let $wsrep_trx_fragment_size = 1
--echo galera_sr_bf_abort_at_commit = 0
--let $galera_sr_bf_abort_at_commit = 0
--echo after_replicate_sync
--let $galera_sr_bf_abort_sync_point = after_replicate_sync
--source ../../suite/galera_sr/t/galera_sr_bf_abort.inc
--echo local_monitor_master_enter_sync
--let $galera_sr_bf_abort_sync_point = local_monitor_master_enter_sync
--source ../../suite/galera_sr/t/galera_sr_bf_abort.inc
--echo apply_monitor_master_enter_sync
--let $galera_sr_bf_abort_sync_point = apply_monitor_master_enter_sync
--source ../../suite/galera_sr/t/galera_sr_bf_abort.inc
--echo commit_monitor_master_enter_sync
--let $galera_sr_bf_abort_sync_point = commit_monitor_master_enter_sync
--source ../../suite/galera_sr/t/galera_sr_bf_abort.inc
# SR bf abort on commit fragment
--let $wsrep_trx_fragment_size = 1
--echo galera_sr_bf_abort_at_commit = 1
--let $galera_sr_bf_abort_at_commit = 1
--echo after_replicate_sync
--let $galera_sr_bf_abort_sync_point = after_replicate_sync
--source ../../suite/galera_sr/t/galera_sr_bf_abort.inc
--echo local_monitor_master_enter_sync
--let $galera_sr_bf_abort_sync_point = local_monitor_master_enter_sync
--source ../../suite/galera_sr/t/galera_sr_bf_abort.inc
--echo apply_monitor_master_enter_sync
--let $galera_sr_bf_abort_sync_point = apply_monitor_master_enter_sync
--source ../../suite/galera_sr/t/galera_sr_bf_abort.inc
--echo commit_monitor_master_enter_sync
--let $galera_sr_bf_abort_sync_point = commit_monitor_master_enter_sync
--source suite/galera/t/galera_sr_bf_abort.inc
# Normal bf abort on commit
--let $wsrep_trx_fragment_size = 0
--echo galera_sr_bf_abort_at_commit = 1
--let $galera_sr_bf_abort_at_commit = 1
--echo after_replicate_sync
--let $galera_sr_bf_abort_sync_point = after_replicate_sync
--source ../../suite/galera_sr/t/galera_sr_bf_abort.inc
--echo local_monitor_master_enter_sync
--let $galera_sr_bf_abort_sync_point = local_monitor_master_enter_sync
--source ../../suite/galera_sr/t/galera_sr_bf_abort.inc
--echo apply_monitor_master_enter_sync
--let $galera_sr_bf_abort_sync_point = apply_monitor_master_enter_sync
--source ../../suite/galera_sr/t/galera_sr_bf_abort.inc
--echo commit_monitor_master_enter_sync
--let $galera_sr_bf_abort_sync_point = commit_monitor_master_enter_sync
--source ../../suite/galera_sr/t/galera_sr_bf_abort.inc
CALL mtr.add_suppression("WSREP: fragment replication failed: 1");

View file

@ -2,6 +2,10 @@
[mysqld.1]
wsrep-debug=1
auto_increment_offset=1
auto_increment_increment=2
[mysqld.2]
wsrep-debug=1
auto_increment_offset=2
auto_increment_increment=2

View file

@ -126,7 +126,7 @@ DELIMITER ;|
--send CALL insert_10m ();
--connection node_2
call mtr.add_suppression("Error in Log_event::read_log_event():.*");
call mtr.add_suppression("Error in Log_event::read_log_event\(\):.*");
SET SESSION wsrep_sync_wait = 0;
# Make sure that node_2 is not killed while TOIs are applied.
@ -200,8 +200,12 @@ DROP PROCEDURE insert_1k;
DROP PROCEDURE insert_1m;
--connection node_1
call mtr.add_suppression("Error in Log_event::read_log_event():.*");
call mtr.add_suppression("Error in Log_event::read_log_event\(\):.*");
CALL mtr.add_suppression("conflict state 7 after post commit");
# Warning happens when the cluster is started for the first time
CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
--connection node_2
call mtr.add_suppression("Error in Log_event::read_log_event\(\):.*");
CALL mtr.add_suppression("Skipped GCache ring buffer recovery");

View file

@ -1,11 +1,11 @@
--source include/galera_cluster.inc
--source include/force_restart.inc
--connection node_1
--connection node_2
set global wsrep_on=OFF;
reset master;
set global wsrep_on=ON;
--connection node_2
--connection node_1
set global wsrep_on=OFF;
reset master;
set global wsrep_on=ON;

View file

@ -6,11 +6,11 @@
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
--connection node_1
--connection node_2
set global wsrep_on=OFF;
reset master;
set global wsrep_on=ON;
--connection node_2
--connection node_1
set global wsrep_on=OFF;
reset master;
set global wsrep_on=ON;

View file

@ -3,7 +3,11 @@
[mysqld.1]
log-bin
log-slave-updates
auto-increment-increment=2
auto-increment-offset=1
[mysqld.2]
log-bin
log-slave-updates
auto-increment-increment=2
auto-increment-offset=2

View file

@ -5,13 +5,6 @@
# MDEV-19353 : Alter Sequence do not replicate to another nodes with in Galera Cluster
#
--connection node_1
CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster.");
CALL mtr.add_suppression("WSREP: CREATE TABLE isolation failure");
--connection node_2
CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster.");
--connection node_1
CREATE SEQUENCE `seq` start with 1 minvalue 1 maxvalue 1000000 increment by 0 cache 1000 nocycle ENGINE=InnoDB;
SHOW CREATE SEQUENCE seq;
@ -20,7 +13,7 @@ SHOW CREATE SEQUENCE seq;
SHOW CREATE SEQUENCE seq;
--connection node_1
ALTER SEQUENCE seq MAXVALUE = 10000;
ALTER SEQUENCE seq MAXVALUE = 10000 NOCACHE;
SHOW CREATE SEQUENCE seq;
--connection node_2
@ -39,8 +32,9 @@ SHOW CREATE SEQUENCE seq;
# MDEV-18848 : Galera: 10.4 node crashed with Assertion `client_state.transaction().active()` after altering SEQUENCE table's engine to myisam and back to innodb
#
--connection node_1
CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1;
CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1 NOCACHE;
select NEXT VALUE FOR Seq1_1;
--error ER_NOT_SUPPORTED_YET
alter table Seq1_1 engine=myisam;
select NEXT VALUE FOR Seq1_1;
alter table Seq1_1 engine=innodb;
@ -78,23 +72,247 @@ DROP TABLE t2;
#
# Case2
#
--connection node_2
SET SESSION AUTOCOMMIT=0;
SET SESSION wsrep_OSU_method='RSU';
CREATE TABLE t1(c1 VARCHAR(10));
INSERT INTO t1 (c1) VALUES('');
create temporary sequence sq1 NOCACHE engine=innodb;
create sequence sq2 NOCACHE engine=innodb;
COMMIT;
SET SESSION wsrep_OSU_method='TOI';
SHOW CREATE SEQUENCE sq1;
SHOW CREATE SEQUENCE sq2;
--connection node_2
--error ER_NO_SUCH_TABLE
SHOW CREATE SEQUENCE sq1;
--error ER_NO_SUCH_TABLE
SHOW CREATE SEQUENCE sq2;
--connection node_1
--error ER_NO_SUCH_TABLE
SHOW CREATE SEQUENCE sq1;
--error ER_NO_SUCH_TABLE
SHOW CREATE SEQUENCE sq2;
--connection node_2
SET SESSION AUTOCOMMIT=1;
DROP TABLE t1;
DROP SEQUENCE sq1;
DROP SEQUENCE sq2;
SET SESSION wsrep_OSU_method='TOI';
#
# MDEV-30388 Assertion `!wsrep_has_changes(thd) || (thd->lex->sql_command == SQLCOM_CREATE_TABLE
# && !thd->is_current_stmt_binlog_format_row()) ||
# thd->wsrep_cs().transaction().state() == wsrep::transaction::s_aborted' failed
#
--connection node_1
CREATE TABLE t (f INT) engine=innodb;
LOCK TABLE t WRITE;
CREATE OR REPLACE SEQUENCE t MAXVALUE=13 INCREMENT BY 1 NOCACHE engine=innodb;
--error ER_NOT_SUPPORTED_YET
LOCK TABLE t WRITE;
INSERT INTO t VALUES (0,0,1,1,1,0,0,0);
SELECT * from t;
SELECT NEXTVAL(t);
UNLOCK TABLES;
DROP TABLE t;
CREATE SEQUENCE t INCREMENT BY 0 NOCACHE ENGINE=INNODB;
CREATE TABLE t1(a int not null primary key default nextval(t),
b int) engine=innodb;
INSERT INTO t1(b) VALUES (1),(2),(3);
SELECT * FROM t1;
--connection node_2
SELECT * FROM t1;
INSERT INTO t1(b) VALUES (4),(5),(6);
SELECT * FROM t1;
--connection node_1
SELECT * FROM t1;
DROP TABLE t1;
DROP SEQUENCE t;
#
# Test Galera SEQUENCE support
#
#
# No MyISAM SEQUENCES
#
--error ER_NOT_SUPPORTED_YET
CREATE SEQUENCE t ENGINE=MYISAM;
CREATE SEQUENCE t INCREMENT BY 1 NOCACHE ENGINE=INNODB;
CREATE TABLE t1(a int not null primary key default nextval(t), b int) engine=innodb;
--connection node_2
--echo # Wait DDL to replicate
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't'
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'
--source include/wait_condition.inc
#
# Below we do not care order of INSERTs we care only that values are unique
#
--connection node_1
SELECT @@auto_increment_increment;
SELECT @@auto_increment_offset;
--let $wsrep_sync_wait_orig_1 = `SELECT @@wsrep_sync_wait`
SET SESSION wsrep_sync_wait=0;
--connection node_2
SELECT @@auto_increment_increment;
SELECT @@auto_increment_offset;
--let $wsrep_sync_wait_orig_2 = `SELECT @@wsrep_sync_wait`
SET SESSION wsrep_sync_wait=0;
--let $count = 20
--disable_query_log
while ($count)
{
--connection node_1
--error 0,ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1(b) values (1);
--connection node_2
--error 0,ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1(b) values (2);
--error 0,ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1(b) values (2);
--connection node_1
--error 0,ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1(b) values (1);
--dec $count
}
--enable_query_log
--connection node_1
--disable_query_log
--eval SET SESSION wsrep_sync_wait = $wsrep_sync_wait_orig_1
--enable_query_log
--connection node_2
--disable_query_log
--eval SET SESSION wsrep_sync_wait = $wsrep_sync_wait_orig_2
--enable_query_log
--connection node_1
DROP SEQUENCE t;
DROP TABLE t1;
CREATE SEQUENCE t INCREMENT BY 0 NOCACHE ENGINE=INNODB;
DROP SEQUENCE t;
--error ER_NOT_SUPPORTED_YET
CREATE SEQUENCE t INCREMENT BY 1 CACHE=20 ENGINE=INNODB;
CREATE SEQUENCE t INCREMENT BY 0 CACHE=20 ENGINE=INNODB;
CREATE TABLE t1(a int not null primary key default nextval(t), b int) engine=innodb;
--connection node_2
--echo # Wait DDL to replicate
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't'
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'
--source include/wait_condition.inc
#
# Below we do not care order of INSERTs we care only that values are unique
#
--connection node_1
--let $wsrep_sync_wait_orig_1 = `SELECT @@wsrep_sync_wait`
SET SESSION wsrep_sync_wait=0;
--connection node_2
--let $wsrep_sync_wait_orig_2 = `SELECT @@wsrep_sync_wait`
SET SESSION wsrep_sync_wait=0;
--let $count = 5
--disable_query_log
while ($count)
{
--connection node_1
--error 0,ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1(b) values (1),(2),(3),(4),(5),(6),(7),(8),(9);
--connection node_2
--error 0,ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1(b) values (21),(22),(23),(24),(25),(26),(27),(28),(29);
--error 0,ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1(b) values (21),(22),(23),(24),(25),(26),(27),(28),(29);
--connection node_1
--error 0,ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1(b) values (1),(2),(3),(4),(5),(6),(7),(8),(9);
--dec $count
}
--enable_query_log
--connection node_1
--disable_query_log
--eval SET SESSION wsrep_sync_wait = $wsrep_sync_wait_orig_1
--enable_query_log
--connection node_2
--disable_query_log
--eval SET SESSION wsrep_sync_wait = $wsrep_sync_wait_orig_2
--enable_query_log
--connection node_1
DROP SEQUENCE t;
DROP TABLE t1;
#
# Test ALTER table to sequence and ALTER SEQUENCE
#
CREATE SEQUENCE t INCREMENT BY 0 CACHE=20 ENGINE=INNODB;
--error ER_NOT_SUPPORTED_YET
ALTER TABLE t ENGINE=MYISAM;
--error ER_NOT_SUPPORTED_YET
ALTER SEQUENCE t INCREMENT BY 1 CACHE=10;
ALTER SEQUENCE t INCREMENT BY 1 NOCACHE;
ALTER SEQUENCE t INCREMENT BY 0 NOCACHE;
ALTER SEQUENCE t INCREMENT BY 0 CACHE=10;
DROP SEQUENCE t;
#
# Test transactions
#
CREATE SEQUENCE t INCREMENT BY 0 CACHE=20 ENGINE=INNODB;
CREATE TABLE t1(a int not null primary key default nextval(t), b int) engine=innodb;
#
# ROLLBACK TRX
#
BEGIN;
INSERT INTO t1(b) VALUES (1);
INSERT INTO t1(b) VALUES (2);
INSERT INTO t1(b) VALUES (3);
INSERT INTO t1(b) VALUES (4);
INSERT INTO t1(a,b) VALUES (2,2);
--error ER_DUP_ENTRY
INSERT INTO t1(a,b) VALUES (3,2);
ROLLBACK;
SELECT * FROM t1;
SELECT NEXTVAL(t);
--connection node_2
SELECT * FROM t1;
SELECT NEXTVAL(t);
--connection node_1
DROP TABLE t1;
DROP SEQUENCE t;
CREATE SEQUENCE t INCREMENT BY 0 CACHE=20 ENGINE=INNODB;
CREATE TABLE t1(a int not null primary key default nextval(t), b int) engine=innodb;
#
# COMMIT TRX
#
BEGIN;
INSERT INTO t1(b) VALUES (1);
INSERT INTO t1(b) VALUES (2);
INSERT INTO t1(b) VALUES (3);
INSERT INTO t1(b) VALUES (4);
INSERT INTO t1(a,b) VALUES (2,2);
--error ER_DUP_ENTRY
INSERT INTO t1(a,b) VALUES (3,2);
COMMIT;
SELECT * FROM t1;
SELECT NEXTVAL(t);
--connection node_2
SELECT * FROM t1;
SELECT NEXTVAL(t);
--connection node_1
DROP TABLE t1;
DROP SEQUENCE t;

View file

@ -5,11 +5,9 @@
[mysqld.1]
wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true'
wsrep_sync_wait=0
[mysqld.2]
wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true'
wsrep_sync_wait=0
[client]
ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem

Some files were not shown because too many files have changed in this diff Show more