mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge remote-tracking branch 'origin/10.3' into 10.4
This commit is contained in:
11
.gitignore
vendored
11
.gitignore
vendored
@ -127,6 +127,7 @@ scripts/mytop
|
||||
scripts/wsrep_sst_common
|
||||
scripts/wsrep_sst_mysqldump
|
||||
scripts/wsrep_sst_rsync
|
||||
scripts/wsrep_sst_rsync_wan
|
||||
scripts/wsrep_sst_mariabackup
|
||||
scripts/wsrep_sst_xtrabackup
|
||||
scripts/wsrep_sst_xtrabackup-v2
|
||||
@ -166,9 +167,9 @@ sql/mysql_tzinfo_to_sql
|
||||
sql/mysqld
|
||||
sql/sql_builtin.cc
|
||||
sql/sql_yacc.cc
|
||||
sql/sql_yacc.h
|
||||
sql/sql_yacc.hh
|
||||
sql/sql_yacc_ora.cc
|
||||
sql/sql_yacc_ora.h
|
||||
sql/sql_yacc_ora.hh
|
||||
storage/heap/hp_test1
|
||||
storage/heap/hp_test2
|
||||
storage/maria/aria_chk
|
||||
@ -498,6 +499,12 @@ UpgradeLog*.htm
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# macOS garbage
|
||||
.DS_Store
|
||||
|
||||
# QtCreator && CodeBlocks
|
||||
*.cbp
|
||||
|
||||
compile_commands.json
|
||||
.clang-format
|
||||
.kscope/
|
||||
|
@ -1,48 +1,50 @@
|
||||
#!/bin/sh
|
||||
set -v -x
|
||||
|
||||
# Exclude modules from build not directly affecting the current
|
||||
# test suites found in $MYSQL_TEST_SUITES, to conserve job time
|
||||
# as well as disk usage
|
||||
|
||||
function exclude_modules() {
|
||||
# excludes for all
|
||||
CMAKE_OPT="${CMAKE_OPT} -DPLUGIN_TOKUDB=NO -DPLUGIN_MROONGA=NO -DPLUGIN_SPIDER=NO -DPLUGIN_OQGRAPH=NO -DPLUGIN_PERFSCHEMA=NO -DPLUGIN_SPHINX=NO"
|
||||
# exclude storage engines not being tested in current job
|
||||
if [[ ! "${MYSQL_TEST_SUITES}" =~ "archive" ]]; then
|
||||
CMAKE_OPT="${CMAKE_OPT} -DPLUGIN_ARCHIVE=NO"
|
||||
fi
|
||||
if [[ ! "${MYSQL_TEST_SUITES}" =~ "rocksdb" ]]; then
|
||||
CMAKE_OPT="${CMAKE_OPT} -DPLUGIN_ROCKSDB=NO"
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ "${TRAVIS_OS_NAME}" == 'linux' ]]; then
|
||||
if [[ "${CXX}" == 'clang++' ]]; then
|
||||
CMAKE_OPT="-DWITHOUT_TOKUDB_STORAGE_ENGINE=ON -DWITHOUT_MROONGA_STORAGE_ENGINE=ON"
|
||||
#CMAKE_OPT="${CMAKE_OPT} -DWITH_ASAN=ON"
|
||||
if which ccache ; then
|
||||
CMAKE_OPT="${CMAKE_OPT} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
|
||||
fi
|
||||
case ${GCC_VERSION} in
|
||||
5) CXX=clang++-4.0 ;;
|
||||
6) CXX=clang++-5.0 ;;
|
||||
esac
|
||||
export CXX CC=${CXX/++/}
|
||||
elif [[ "${CXX}" == 'g++' ]]; then
|
||||
CMAKE_OPT=""
|
||||
if [[ "${MYSQL_TEST_SUITES}" == 'rpl' ]]; then
|
||||
CMAKE_OPT="${CMAKE_OPT} -DWITHOUT_TOKUDB_STORAGE_ENGINE=TRUE"
|
||||
CMAKE_OPT="${CMAKE_OPT} -DWITHOUT_MROONGA_STORAGE_ENGINE=TRUE"
|
||||
fi
|
||||
export CXX=g++-${GCC_VERSION}
|
||||
export CC=gcc-${GCC_VERSION}
|
||||
fi
|
||||
if [[ ${GCC_VERSION} == 6 ]]; then
|
||||
wget http://mirrors.kernel.org/ubuntu/pool/universe/p/percona-xtradb-cluster-galera-2.x/percona-xtradb-cluster-galera-2.x_165-0ubuntu1_amd64.deb ;
|
||||
ar vx percona-xtradb-cluster-galera-2.x_165-0ubuntu1_amd64.deb
|
||||
tar -xJvf data.tar.xz
|
||||
export WSREP_PROVIDER=$PWD/usr/lib/libgalera_smm.so
|
||||
MYSQL_TEST_SUITES="${MYSQL_TEST_SUITES},wsrep"
|
||||
#elif [[ ${GCC_VERSION} != 5 ]]; then
|
||||
#CMAKE_OPT="${CMAKE_OPT} -DWITH_ASAN=ON"
|
||||
fi
|
||||
else
|
||||
# osx_image based tests
|
||||
CMAKE_OPT="-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl"
|
||||
#CMAKE_OPT="${CMAKE_OPT} -DWITH_ASAN=ON"
|
||||
TEST_CASE_TIMEOUT=2
|
||||
exclude_modules;
|
||||
if which ccache ; then
|
||||
CMAKE_OPT="${CMAKE_OPT} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
|
||||
ccache --max-size=1200M
|
||||
fi
|
||||
if [[ "${MYSQL_TEST_SUITES}" == 'rpl' ]]; then
|
||||
CMAKE_OPT="${CMAKE_OPT} -DWITHOUT_TOKUDB_STORAGE_ENGINE=ON"
|
||||
if [[ "${CXX}" == 'clang++' ]]; then
|
||||
export CXX CC=${CXX/++/}
|
||||
elif [[ "${CXX}" == 'g++' ]]; then
|
||||
export CXX=g++-${CC_VERSION}
|
||||
export CC=gcc-${CC_VERSION}
|
||||
fi
|
||||
CMAKE_OPT="${CMAKE_OPT} -DWITHOUT_MROONGA_STORAGE_ENGINE=ON"
|
||||
if [[ "${TYPE}" == "Debug" ]]; then
|
||||
CMAKE_OPT="${CMAKE_OPT} -DWITHOUT_TOKUDB_STORAGE_ENGINE=ON"
|
||||
if [[ ${CC_VERSION} == 6 ]]; then
|
||||
wget http://mirrors.kernel.org/ubuntu/pool/universe/p/percona-xtradb-cluster-galera-2.x/percona-xtradb-cluster-galera-2.x_165-0ubuntu1_amd64.deb ;
|
||||
ar vx percona-xtradb-cluster-galera-2.x_165-0ubuntu1_amd64.deb
|
||||
tar -xJvf data.tar.xz
|
||||
export WSREP_PROVIDER=$PWD/usr/lib/libgalera_smm.so
|
||||
MYSQL_TEST_SUITES="${MYSQL_TEST_SUITES},wsrep"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "${TRAVIS_OS_NAME}" == 'osx' ]]; then
|
||||
TEST_CASE_TIMEOUT=20
|
||||
exclude_modules;
|
||||
CMAKE_OPT="${CMAKE_OPT} -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl"
|
||||
if which ccache ; then
|
||||
CMAKE_OPT="${CMAKE_OPT} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
60
.travis.yml
60
.travis.yml
@ -17,17 +17,20 @@ compiler:
|
||||
- clang
|
||||
|
||||
cache:
|
||||
timeout: 300
|
||||
apt: true
|
||||
ccache: true # Does not currently work for clang builds: https://github.com/travis-ci/travis-ci/issues/6201
|
||||
ccache: true
|
||||
directories:
|
||||
- /usr/local/Cellar # Fails do to permission error: https://github.com/travis-ci/travis-ci/issues/8092
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- GCC_VERSION=4.8 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rpl
|
||||
- GCC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main,archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts
|
||||
- GCC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption,rocksdb
|
||||
- GCC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,perfschema,plugins,multi_source,roles
|
||||
- CC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main
|
||||
- CC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts
|
||||
- CC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rpl
|
||||
- CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption
|
||||
- CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rocksdb
|
||||
- CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,perfschema,plugins,multi_source,roles
|
||||
|
||||
matrix:
|
||||
exclude:
|
||||
@ -81,39 +84,44 @@ matrix:
|
||||
# https://github.com/travis-ci/travis-ci/issues/7062 - /run/shm isn't writable or executable
|
||||
# in trusty containers
|
||||
- export MTR_MEM=/tmp
|
||||
- env DEB_BUILD_OPTIONS="parallel=6" debian/autobake-deb.sh;
|
||||
- env DEB_BUILD_OPTIONS="parallel=4" debian/autobake-deb.sh;
|
||||
- ccache --show-stats
|
||||
# Until OSX becomes a bit more stable: MDEV-12435
|
||||
# Until OSX becomes a bit more stable: MDEV-12435 MDEV-16213
|
||||
allow_failures:
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: GCC_VERSION=4.8 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rpl
|
||||
env: CC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rpl
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: GCC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main,archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts
|
||||
env: CC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: GCC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption,rocksdb
|
||||
env: CC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: GCC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,perfschema,plugins,multi_source,roles
|
||||
env: CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rocksdb
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,perfschema,plugins,multi_source,roles
|
||||
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-4.0
|
||||
- sourceline: 'deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-5.0 main'
|
||||
- sourceline: 'deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-6.0 main'
|
||||
packages: # make sure these include all compilers and all build dependencies (see list above)
|
||||
- gcc-5
|
||||
- g++-5
|
||||
- gcc-6
|
||||
- g++-6
|
||||
- clang-4.0
|
||||
- llvm-4.0-dev
|
||||
- clang-5.0
|
||||
- llvm-5.0-dev
|
||||
- libasan0
|
||||
- clang-6.0
|
||||
- llvm-6.0-dev
|
||||
- bison
|
||||
- chrpath
|
||||
- cmake
|
||||
@ -152,25 +160,29 @@ before_install:
|
||||
brew link ccache;
|
||||
fi
|
||||
|
||||
script:
|
||||
before_script:
|
||||
- df -h
|
||||
- ccache --version
|
||||
# Clang:
|
||||
# mroonga just generates too many warnings with clang and travis stops the job
|
||||
# tokudb has fatal warnings
|
||||
- ccache --show-stats
|
||||
|
||||
script:
|
||||
# following modules are disabled after sourcing .travis.compiler.sh:
|
||||
# clang disabled: mroonga just generates too many warnings with clang and travis stops the job
|
||||
# cland disabled: tokudb has fatal warnings
|
||||
# gcc/rpl: tokudb and mroonga
|
||||
- source .travis.compiler.sh
|
||||
- cmake .
|
||||
-DCMAKE_BUILD_TYPE=${TYPE}
|
||||
${CMAKE_OPT}
|
||||
-DWITH_SSL=system -DWITH_ZLIB=system -DPLUGIN_AWS_KEY_MANAGEMENT=DYNAMIC -DAWS_SDK_EXTERNAL_PROJECT=ON
|
||||
- make -j 6
|
||||
-DWITH_SSL=system -DWITH_ZLIB=system
|
||||
- make -j 4
|
||||
- cd mysql-test
|
||||
# With ASAN --thread-stack=400K to account for overhead
|
||||
# Test timeout needs to be 10(minutes) or less due to travis out timeout
|
||||
- ./mtr --force --max-test-fail=20 --parallel=6 --testcase-timeout=2
|
||||
- travis_wait 30 ./mtr --force --max-test-fail=20 --parallel=4 --testcase-timeout=${TEST_CASE_TIMEOUT}
|
||||
--suite=${MYSQL_TEST_SUITES}
|
||||
--skip-test-list=unstable-tests
|
||||
--skip-test=binlog.binlog_unsafe
|
||||
- ccache --show-stats
|
||||
- df -h
|
||||
|
||||
notifications:
|
||||
irc:
|
||||
|
@ -297,7 +297,7 @@ ELSE()
|
||||
ENDIF()
|
||||
SET(DEFAULT_CHARSET_HOME "${DEFAULT_MYSQL_HOME}")
|
||||
SET(PLUGINDIR "${DEFAULT_MYSQL_HOME}/${INSTALL_PLUGINDIR}")
|
||||
IF(INSTALL_SYSCONFDIR AND NOT DEFAULT_SYSCONFDIR)
|
||||
IF(INSTALL_SYSCONFDIR AND NOT DEFAULT_SYSCONFDIR AND NOT DEB)
|
||||
SET(DEFAULT_SYSCONFDIR "${INSTALL_SYSCONFDIR}")
|
||||
ENDIF()
|
||||
|
||||
@ -398,6 +398,7 @@ IF(NOT WITHOUT_SERVER)
|
||||
IF(WITH_EMBEDDED_SERVER)
|
||||
ADD_SUBDIRECTORY(libmysqld)
|
||||
ADD_SUBDIRECTORY(libmysqld/examples)
|
||||
ADD_SUBDIRECTORY(unittest/embedded)
|
||||
ENDIF(WITH_EMBEDDED_SERVER)
|
||||
|
||||
IF(WITH_WSREP)
|
||||
|
10
README.md
10
README.md
@ -1,3 +1,8 @@
|
||||
Code status:
|
||||
------------
|
||||
|
||||
* [](https://travis-ci.org/MariaDB/server) travis-ci.org (10.3 branch)
|
||||
|
||||
## MariaDB: drop-in replacement for MySQL
|
||||
|
||||
MariaDB is designed as a drop-in replacement of MySQL(R) with more
|
||||
@ -68,8 +73,3 @@ The code for MariaDB, including all revision history, can be found at:
|
||||
https://github.com/MariaDB/server
|
||||
|
||||
***************************************************************************
|
||||
|
||||
Code status:
|
||||
------------
|
||||
|
||||
* [](https://travis-ci.org/MariaDB/server) travis-ci.org (10.2 branch)
|
||||
|
2
VERSION
2
VERSION
@ -1,4 +1,4 @@
|
||||
MYSQL_VERSION_MAJOR=10
|
||||
MYSQL_VERSION_MINOR=3
|
||||
MYSQL_VERSION_PATCH=8
|
||||
MYSQL_VERSION_PATCH=9
|
||||
SERVER_MATURITY=stable
|
||||
|
@ -5090,6 +5090,14 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
|
||||
if (opt_xml)
|
||||
print_xml_tag(md_result_file, "", "\n", "database", "name=", db, NullS);
|
||||
|
||||
|
||||
/* obtain dump of routines (procs/functions) */
|
||||
if (opt_routines && mysql_get_server_version(mysql) >= 50009)
|
||||
{
|
||||
DBUG_PRINT("info", ("Dumping routines for database %s", db));
|
||||
dump_routines_for_db(db);
|
||||
}
|
||||
|
||||
if (opt_single_transaction && mysql_get_server_version(mysql) >= 50500)
|
||||
{
|
||||
verbose_msg("-- Setting savepoint...\n");
|
||||
@ -5099,7 +5107,6 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Dump each selected table */
|
||||
for (pos= dump_tables; pos < end; pos++)
|
||||
{
|
||||
@ -5161,12 +5168,6 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
|
||||
DBUG_PRINT("info", ("Dumping events for database %s", db));
|
||||
dump_events_for_db(db);
|
||||
}
|
||||
/* obtain dump of routines (procs/functions) */
|
||||
if (opt_routines && mysql_get_server_version(mysql) >= 50009)
|
||||
{
|
||||
DBUG_PRINT("info", ("Dumping routines for database %s", db));
|
||||
dump_routines_for_db(db);
|
||||
}
|
||||
free_root(&glob_root, MYF(0));
|
||||
if (opt_xml)
|
||||
{
|
||||
|
@ -850,7 +850,7 @@ build_table_string(void)
|
||||
|
||||
if (auto_generate_sql_guid_primary)
|
||||
{
|
||||
dynstr_append(&table_string, "id varchar(32) primary key");
|
||||
dynstr_append(&table_string, "id varchar(36) primary key");
|
||||
|
||||
if (num_int_cols || num_char_cols || auto_generate_sql_guid_primary)
|
||||
dynstr_append(&table_string, ",");
|
||||
@ -865,7 +865,7 @@ build_table_string(void)
|
||||
if (count) /* Except for the first pass we add a comma */
|
||||
dynstr_append(&table_string, ",");
|
||||
|
||||
if (snprintf(buf, HUGE_STRING_LENGTH, "id%d varchar(32) unique key", count)
|
||||
if (snprintf(buf, HUGE_STRING_LENGTH, "id%d varchar(36) unique key", count)
|
||||
> HUGE_STRING_LENGTH)
|
||||
{
|
||||
fprintf(stderr, "Memory Allocation error in create table\n");
|
||||
|
@ -125,7 +125,8 @@ static my_bool view_protocol= 0, view_protocol_enabled= 0;
|
||||
static my_bool cursor_protocol= 0, cursor_protocol_enabled= 0;
|
||||
static my_bool parsing_disabled= 0;
|
||||
static my_bool display_result_vertically= FALSE, display_result_lower= FALSE,
|
||||
display_metadata= FALSE, display_result_sorted= FALSE;
|
||||
display_metadata= FALSE, display_result_sorted= FALSE,
|
||||
display_session_track_info= FALSE;
|
||||
static my_bool disable_query_log= 0, disable_result_log= 0;
|
||||
static my_bool disable_connect_log= 0;
|
||||
static my_bool disable_warnings= 0, disable_column_names= 0;
|
||||
@ -153,6 +154,7 @@ static struct property prop_list[] = {
|
||||
{ &abort_on_error, 0, 1, 0, "$ENABLED_ABORT_ON_ERROR" },
|
||||
{ &disable_connect_log, 0, 1, 1, "$ENABLED_CONNECT_LOG" },
|
||||
{ &disable_info, 0, 1, 1, "$ENABLED_INFO" },
|
||||
{ &display_session_track_info, 0, 1, 1, "$ENABLED_STATE_CHANGE_INFO" },
|
||||
{ &display_metadata, 0, 0, 0, "$ENABLED_METADATA" },
|
||||
{ &ps_protocol_enabled, 0, 0, 0, "$ENABLED_PS_PROTOCOL" },
|
||||
{ &disable_query_log, 0, 0, 1, "$ENABLED_QUERY_LOG" },
|
||||
@ -166,6 +168,7 @@ enum enum_prop {
|
||||
P_ABORT= 0,
|
||||
P_CONNECT,
|
||||
P_INFO,
|
||||
P_SESSION_TRACK,
|
||||
P_META,
|
||||
P_PS,
|
||||
P_QUERY,
|
||||
@ -362,6 +365,7 @@ enum enum_commands {
|
||||
Q_WAIT_FOR_SLAVE_TO_STOP,
|
||||
Q_ENABLE_WARNINGS, Q_DISABLE_WARNINGS,
|
||||
Q_ENABLE_INFO, Q_DISABLE_INFO,
|
||||
Q_ENABLE_SESSION_TRACK_INFO, Q_DISABLE_SESSION_TRACK_INFO,
|
||||
Q_ENABLE_METADATA, Q_DISABLE_METADATA,
|
||||
Q_ENABLE_COLUMN_NAMES, Q_DISABLE_COLUMN_NAMES,
|
||||
Q_EXEC, Q_DELIMITER,
|
||||
@ -384,6 +388,7 @@ enum enum_commands {
|
||||
Q_RESULT_FORMAT_VERSION,
|
||||
Q_MOVE_FILE, Q_REMOVE_FILES_WILDCARD, Q_SEND_EVAL,
|
||||
Q_ENABLE_PREPARE_WARNINGS, Q_DISABLE_PREPARE_WARNINGS,
|
||||
Q_RESET_CONNECTION,
|
||||
Q_UNKNOWN, /* Unknown command. */
|
||||
Q_COMMENT, /* Comments, ignored. */
|
||||
Q_COMMENT_WITH_COMMAND,
|
||||
@ -435,6 +440,8 @@ const char *command_names[]=
|
||||
"disable_warnings",
|
||||
"enable_info",
|
||||
"disable_info",
|
||||
"enable_session_track_info",
|
||||
"disable_session_track_info",
|
||||
"enable_metadata",
|
||||
"disable_metadata",
|
||||
"enable_column_names",
|
||||
@ -491,6 +498,7 @@ const char *command_names[]=
|
||||
"send_eval",
|
||||
"enable_prepare_warnings",
|
||||
"disable_prepare_warnings",
|
||||
"reset_connection",
|
||||
|
||||
0
|
||||
};
|
||||
@ -6532,6 +6540,34 @@ void do_delimiter(struct st_command* command)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
do_reset_connection
|
||||
|
||||
DESCRIPTION
|
||||
Reset the current session.
|
||||
*/
|
||||
|
||||
static void do_reset_connection()
|
||||
{
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
MYSQL *mysql = cur_con->mysql;
|
||||
|
||||
DBUG_ENTER("do_reset_connection");
|
||||
if (mysql_reset_connection(mysql))
|
||||
die("reset connection failed: %s", mysql_error(mysql));
|
||||
if (cur_con->stmt)
|
||||
{
|
||||
mysql_stmt_close(cur_con->stmt);
|
||||
cur_con->stmt= NULL;
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
#else
|
||||
die("reset connection failed: unsupported by embedded server client library");
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
my_bool match_delimiter(int c, const char *delim, size_t length)
|
||||
{
|
||||
uint i;
|
||||
@ -7787,6 +7823,70 @@ void append_info(DYNAMIC_STRING *ds, ulonglong affected_rows,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@brief Append state change information (received through Ok packet) to the output.
|
||||
|
||||
@param [in,out] ds Dynamic string to hold the content to be printed.
|
||||
@param [in] mysql Connection handle.
|
||||
*/
|
||||
|
||||
static void append_session_track_info(DYNAMIC_STRING *ds, MYSQL *mysql)
|
||||
{
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
for (unsigned int type= SESSION_TRACK_BEGIN; type <= SESSION_TRACK_END; type++)
|
||||
{
|
||||
const char *data;
|
||||
size_t data_length;
|
||||
|
||||
if (!mysql_session_track_get_first(mysql,
|
||||
(enum_session_state_type) type,
|
||||
&data, &data_length))
|
||||
{
|
||||
dynstr_append(ds, "-- ");
|
||||
switch (type)
|
||||
{
|
||||
case SESSION_TRACK_SYSTEM_VARIABLES:
|
||||
dynstr_append(ds, "Tracker : SESSION_TRACK_SYSTEM_VARIABLES\n");
|
||||
break;
|
||||
case SESSION_TRACK_SCHEMA:
|
||||
dynstr_append(ds, "Tracker : SESSION_TRACK_SCHEMA\n");
|
||||
break;
|
||||
case SESSION_TRACK_STATE_CHANGE:
|
||||
dynstr_append(ds, "Tracker : SESSION_TRACK_STATE_CHANGE\n");
|
||||
break;
|
||||
case SESSION_TRACK_GTIDS:
|
||||
dynstr_append(ds, "Tracker : SESSION_TRACK_GTIDS\n");
|
||||
break;
|
||||
case SESSION_TRACK_TRANSACTION_CHARACTERISTICS:
|
||||
dynstr_append(ds, "Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS\n");
|
||||
break;
|
||||
case SESSION_TRACK_TRANSACTION_TYPE:
|
||||
dynstr_append(ds, "Tracker : SESSION_TRACK_TRANSACTION_TYPE\n");
|
||||
break;
|
||||
default:
|
||||
DBUG_ASSERT(0);
|
||||
dynstr_append(ds, "\n");
|
||||
}
|
||||
|
||||
|
||||
dynstr_append(ds, "-- ");
|
||||
dynstr_append_mem(ds, data, data_length);
|
||||
}
|
||||
else
|
||||
continue;
|
||||
while (!mysql_session_track_get_next(mysql,
|
||||
(enum_session_state_type) type,
|
||||
&data, &data_length))
|
||||
{
|
||||
dynstr_append(ds, "\n-- ");
|
||||
dynstr_append_mem(ds, data, data_length);
|
||||
}
|
||||
dynstr_append(ds, "\n\n");
|
||||
}
|
||||
#endif /* EMBEDDED_LIBRARY */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Display the table headings with the names tab separated
|
||||
*/
|
||||
@ -7967,6 +8067,9 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
|
||||
if (!disable_info)
|
||||
append_info(ds, mysql_affected_rows(mysql), mysql_info(mysql));
|
||||
|
||||
if (display_session_track_info)
|
||||
append_session_track_info(ds, mysql);
|
||||
|
||||
/*
|
||||
Add all warnings to the result. We can't do this if we are in
|
||||
the middle of processing results from multi-statement, because
|
||||
@ -8382,6 +8485,10 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
|
||||
if (!disable_info)
|
||||
append_info(ds, mysql_stmt_affected_rows(stmt), mysql_info(mysql));
|
||||
|
||||
if (display_session_track_info)
|
||||
append_session_track_info(ds, mysql);
|
||||
|
||||
|
||||
if (!disable_warnings)
|
||||
{
|
||||
/* Get the warnings from execute */
|
||||
@ -8777,6 +8884,7 @@ void init_re(void)
|
||||
"[[:space:]]*SELECT[[:space:]]|"
|
||||
"[[:space:]]*CREATE[[:space:]]+TABLE[[:space:]]|"
|
||||
"[[:space:]]*DO[[:space:]]|"
|
||||
"[[:space:]]*HANDLER[[:space:]]+.*[[:space:]]+READ[[:space:]]|"
|
||||
"[[:space:]]*SET[[:space:]]+OPTION[[:space:]]|"
|
||||
"[[:space:]]*DELETE[[:space:]]+MULTI[[:space:]]|"
|
||||
"[[:space:]]*UPDATE[[:space:]]+MULTI[[:space:]]|"
|
||||
@ -9362,6 +9470,12 @@ int main(int argc, char **argv)
|
||||
case Q_DISABLE_INFO:
|
||||
set_property(command, P_INFO, 1);
|
||||
break;
|
||||
case Q_ENABLE_SESSION_TRACK_INFO:
|
||||
set_property(command, P_SESSION_TRACK, 1);
|
||||
break;
|
||||
case Q_DISABLE_SESSION_TRACK_INFO:
|
||||
set_property(command, P_SESSION_TRACK, 0);
|
||||
break;
|
||||
case Q_ENABLE_METADATA:
|
||||
set_property(command, P_META, 1);
|
||||
break;
|
||||
@ -9572,6 +9686,9 @@ int main(int argc, char **argv)
|
||||
case Q_PING:
|
||||
handle_command_error(command, mysql_ping(cur_con->mysql), -1);
|
||||
break;
|
||||
case Q_RESET_CONNECTION:
|
||||
do_reset_connection();
|
||||
break;
|
||||
case Q_SEND_SHUTDOWN:
|
||||
handle_command_error(command,
|
||||
mysql_shutdown(cur_con->mysql,
|
||||
|
@ -1,106 +0,0 @@
|
||||
# Copyright (c) 2009 Sun Microsystems, Inc.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
|
||||
# On Solaris, /opt/csw often contains a newer bison
|
||||
IF(NOT BISON_EXECUTABLE AND EXISTS /opt/csw/bin/bison)
|
||||
SET(BISON_EXECUTABLE /opt/csw/bin/bison)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
IF(WIN32)
|
||||
SET(BISON_PATH_HINTS
|
||||
HINTS
|
||||
C:/gnuwin32/bin
|
||||
C:/cygwin64/bin
|
||||
C:/cygwin/bin)
|
||||
ENDIF()
|
||||
FIND_PROGRAM(BISON_EXECUTABLE bison
|
||||
${BISON_PATH_HINTS}
|
||||
DOC "path to the bison executable")
|
||||
MARK_AS_ADVANCED(BISON_EXECUTABLE "")
|
||||
IF(NOT BISON_EXECUTABLE)
|
||||
MESSAGE("Warning: Bison executable not found in PATH")
|
||||
ELSEIF(BISON_EXECUTABLE AND NOT BISON_USABLE)
|
||||
# Check version as well
|
||||
EXEC_PROGRAM(${BISON_EXECUTABLE} ARGS --version OUTPUT_VARIABLE BISON_VERSION_STR)
|
||||
# Get first line in case it's multiline
|
||||
STRING(REGEX REPLACE "([^\n]+).*" "\\1" FIRST_LINE "${BISON_VERSION_STR}")
|
||||
# get version information
|
||||
STRING(REGEX REPLACE ".* ([0-9]+)\\.([0-9]+)" "\\1" BISON_VERSION_MAJOR "${FIRST_LINE}")
|
||||
STRING(REGEX REPLACE ".* ([0-9]+)\\.([0-9]+)" "\\2" BISON_VERSION_MINOR "${FIRST_LINE}")
|
||||
IF (BISON_VERSION_MAJOR LESS 2)
|
||||
MESSAGE("Warning: bison version is old. please update to version 2")
|
||||
ELSE()
|
||||
SET(BISON_USABLE 1 CACHE INTERNAL "Bison version 2 or higher")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Use bison to generate C++ and header file
|
||||
MACRO (RUN_BISON input_yy output_cc output_h name_prefix)
|
||||
IF(BISON_TOO_OLD)
|
||||
IF(EXISTS ${output_cc} AND EXISTS ${output_h})
|
||||
SET(BISON_USABLE FALSE)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
IF(BISON_USABLE)
|
||||
# Workaround for VS regenerating output even
|
||||
# when outputs are up-to-date. At least, fix output timestamp
|
||||
# after build so that files that depend on generated header are
|
||||
# not rebuilt.
|
||||
IF(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
FIND_PROGRAM(TOUCH_EXECUTABLE touch DOC "Path to touch executable"
|
||||
PATHS "C:/Program Files/Git/usr/bin"
|
||||
"C:/Program Files (x86)/Git/usr/bin")
|
||||
IF(TOUCH_EXECUTABLE)
|
||||
SET(VS_FIX_OUTPUT_TIMESTAMPS
|
||||
COMMAND ${TOUCH_EXECUTABLE} -r ${input_yy} ${output_cc}
|
||||
COMMAND ${TOUCH_EXECUTABLE} -r ${input_yy} ${output_h})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${output_cc}
|
||||
${output_h}
|
||||
COMMAND ${BISON_EXECUTABLE} -y -p ${name_prefix}
|
||||
--output=${output_cc}
|
||||
--defines=${output_h}
|
||||
${input_yy}
|
||||
${VS_FIX_OUTPUT_TIMESTAMPS}
|
||||
DEPENDS ${input_yy}
|
||||
)
|
||||
ELSE()
|
||||
# Bison is missing or not usable, e.g too old
|
||||
IF(EXISTS ${output_cc} AND EXISTS ${output_h})
|
||||
IF(${input_yy} IS_NEWER_THAN ${output_cc} OR ${input_yy} IS_NEWER_THAN ${output_h})
|
||||
# Possibly timestamps are messed up in source distribution.
|
||||
MESSAGE("Warning: no usable bison found, ${input_yy} will not be rebuilt.")
|
||||
ENDIF()
|
||||
ELSE()
|
||||
# Output files are missing, bail out.
|
||||
SET(ERRMSG
|
||||
"Bison (GNU parser generator) is required to build MySQL."
|
||||
"Please install bison."
|
||||
)
|
||||
IF(WIN32)
|
||||
SET(ERRMSG ${ERRMSG}
|
||||
"You can download bison from http://gnuwin32.sourceforge.net/packages/bison.htm "
|
||||
"Choose 'Complete package, except sources' installation. We recommend to "
|
||||
"install bison into a directory without spaces, e.g C:\\GnuWin32.")
|
||||
ENDIF()
|
||||
MESSAGE(FATAL_ERROR ${ERRMSG})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
@ -171,6 +171,7 @@ SET(INSTALL_SYSTEMD_TMPFILESDIR_RPM "/usr/lib/tmpfiles.d")
|
||||
SET(INSTALL_BINDIR_DEB "bin")
|
||||
SET(INSTALL_SBINDIR_DEB "sbin")
|
||||
SET(INSTALL_SCRIPTDIR_DEB "bin")
|
||||
SET(INSTALL_SYSCONFDIR_DEB "/etc")
|
||||
SET(INSTALL_SYSCONF2DIR_DEB "/etc/mysql/conf.d")
|
||||
#
|
||||
SET(INSTALL_LIBDIR_DEB "lib")
|
||||
|
@ -67,8 +67,8 @@ IF(NOT GIT_EXECUTABLE)
|
||||
# Save bison output first.
|
||||
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.cc
|
||||
${CMAKE_BINARY_DIR}/sql_yacc.cc COPYONLY)
|
||||
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.h
|
||||
${CMAKE_BINARY_DIR}/sql_yacc.h COPYONLY)
|
||||
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.hh
|
||||
${CMAKE_BINARY_DIR}/sql_yacc.hh COPYONLY)
|
||||
|
||||
IF(CMAKE_GENERATOR MATCHES "Makefiles")
|
||||
# make clean
|
||||
@ -81,10 +81,10 @@ IF(NOT GIT_EXECUTABLE)
|
||||
# Restore bison output
|
||||
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql_yacc.cc
|
||||
${CMAKE_BINARY_DIR}/sql/sql_yacc.cc COPYONLY)
|
||||
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql_yacc.h
|
||||
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql_yacc.hh
|
||||
${CMAKE_BINARY_DIR}/sql/sql_yacc.h COPYONLY)
|
||||
FILE(REMOVE ${CMAKE_BINARY_DIR}/sql_yacc.cc)
|
||||
FILE(REMOVE ${CMAKE_BINARY_DIR}/sql_yacc.h)
|
||||
FILE(REMOVE ${CMAKE_BINARY_DIR}/sql_yacc.hh)
|
||||
ENDIF()
|
||||
|
||||
EXECUTE_PROCESS(
|
||||
@ -102,10 +102,15 @@ IF(NOT GIT_EXECUTABLE)
|
||||
ENDIF()
|
||||
|
||||
# Copy bison output
|
||||
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.h
|
||||
${PACKAGE_DIR}/sql/sql_yacc.h COPYONLY)
|
||||
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.hh
|
||||
${PACKAGE_DIR}/sql/sql_yacc.hh COPYONLY)
|
||||
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.cc
|
||||
${PACKAGE_DIR}/sql/sql_yacc.cc COPYONLY)
|
||||
# Copy bison output
|
||||
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc_ora.hh
|
||||
${PACKAGE_DIR}/sql/sql_yacc_ora.hh COPYONLY)
|
||||
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc_ora.cc
|
||||
${PACKAGE_DIR}/sql/sql_yacc_orac.cc COPYONLY)
|
||||
|
||||
# Add documentation, if user has specified where to find them
|
||||
IF(MYSQL_DOCS_LOCATION)
|
||||
|
41
debian/autobake-deb.sh
vendored
41
debian/autobake-deb.sh
vendored
@ -26,9 +26,15 @@ then
|
||||
sed 's|DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test|DINSTALL_MYSQLTESTDIR=false|' -i debian/rules
|
||||
|
||||
# Also skip building RocksDB and TokuDB to save even more time and disk space
|
||||
sed 's|-DDEB|-DWITHOUT_TOKUDB_STORAGE_ENGINE=true -DWITHOUT_MROONGA_STORAGE_ENGINE=true -DWITHOUT_ROCKSDB_STORAGE_ENGINE=true -DDEB|' -i debian/rules
|
||||
sed 's|-DDEB|-DPLUGIN_TOKUDB=NO -DPLUGIN_MROONGA=NO -DPLUGIN_ROCKSDB=NO -DPLUGIN_SPIDER=NO -DPLUGIN_OQGRAPH=NO -DPLUGIN_PERFSCHEMA=NO -DPLUGIN_SPHINX=NO -WITH_EMBEDDED_SERVER=OFF -DDEB|' -i debian/rules
|
||||
fi
|
||||
|
||||
# Convert gcc version to numberical value. Format is Mmmpp where M is Major
|
||||
# version, mm is minor version and p is patch.
|
||||
# -dumpfullversion & -dumpversion to make it uniform across old and new (>=7)
|
||||
GCCVERSION=$(gcc -dumpfullversion -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' \
|
||||
-e 's/\.\([0-9]\)/0\1/g' \
|
||||
-e 's/^[0-9]\{3,4\}$/&00/')
|
||||
|
||||
# Look up distro-version specific stuff
|
||||
#
|
||||
@ -36,19 +42,12 @@ fi
|
||||
# Debian policy and targeting Debian Sid. Then case-by-case run in autobake-deb.sh
|
||||
# tests for backwards compatibility and strip away parts on older builders.
|
||||
|
||||
# If iproute2 is not available (before Debian Jessie and Ubuntu Trusty)
|
||||
# fall back to the old iproute package.
|
||||
if ! apt-cache madison iproute2 | grep 'iproute2 *|' >/dev/null 2>&1
|
||||
then
|
||||
sed 's/iproute2/iproute/' -i debian/control
|
||||
fi
|
||||
|
||||
# If libcrack2 (>= 2.9.0) is not available (before Debian Jessie and Ubuntu Trusty)
|
||||
# clean away the cracklib stanzas so the package can build without them.
|
||||
if ! apt-cache madison libcrack2-dev | grep 'libcrack2-dev *| *2\.9' >/dev/null 2>&1
|
||||
then
|
||||
sed '/libcrack2-dev/d' -i debian/control
|
||||
sed '/Package: mariadb-plugin-cracklib/,+11d' -i debian/control
|
||||
sed '/Package: mariadb-plugin-cracklib/,+9d' -i debian/control
|
||||
fi
|
||||
|
||||
# If libpcre3-dev (>= 2:8.35-3.2~) is not available (before Debian Jessie or Ubuntu Wily)
|
||||
@ -85,19 +84,12 @@ fi
|
||||
# Debian Jessie and older and on Ubuntu Xenial and older with the following error message:
|
||||
# /usr/bin/ld.bfd.real: /tmp/ccOIwjFo.ltrans0.ltrans.o: relocation R_X86_64_PC32 against symbol
|
||||
# `toku_product_name_strings' can not be used when making a shared object; recompile with -fPIC
|
||||
# Therefore we need to disable PIE on those releases using debhelper as proxy for detection.
|
||||
if ! apt-cache madison debhelper | grep 'debhelper *| *1[0-9]\.' >/dev/null 2>&1
|
||||
# Therefore we need to disable PIE on those releases using gcc as proxy for detection.
|
||||
if [[ $GCCVERSION -lt 60000 ]]
|
||||
then
|
||||
sed 's/hardening=+all$/hardening=+all,-pie/' -i debian/rules
|
||||
fi
|
||||
|
||||
|
||||
# Convert gcc version to numberical value. Format is Mmmpp where M is Major
|
||||
# version, mm is minor version and p is patch.
|
||||
# -dumpfullversion & -dumpversion to make it uniform across old and new (>=7)
|
||||
GCCVERSION=$(gcc -dumpfullversion -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' \
|
||||
-e 's/\.\([0-9]\)/0\1/g' \
|
||||
-e 's/^[0-9]\{3,4\}$/&00/')
|
||||
# Don't build rocksdb package if gcc version is less than 4.8 or we are running on
|
||||
# x86 32 bit.
|
||||
if [[ $GCCVERSION -lt 40800 ]] || [[ $(arch) =~ i[346]86 ]] || [[ $TRAVIS ]]
|
||||
@ -120,8 +112,7 @@ Breaks: mariadb-aws-key-management-10.1,
|
||||
mariadb-aws-key-management-10.2
|
||||
Replaces: mariadb-aws-key-management-10.1,
|
||||
mariadb-aws-key-management-10.2
|
||||
Depends: libcurl3,
|
||||
mariadb-server-10.3,
|
||||
Depends: mariadb-server-10.3,
|
||||
\${misc:Depends},
|
||||
\${shlibs:Depends}
|
||||
Description: Amazon Web Service Key Management Service Plugin for MariaDB
|
||||
@ -129,13 +120,19 @@ Description: Amazon Web Service Key Management Service Plugin for MariaDB
|
||||
Services Key Management Service for managing encryption keys used for MariaDB
|
||||
data-at-rest encryption.
|
||||
EOF
|
||||
|
||||
sed -i -e "/-DPLUGIN_AWS_KEY_MANAGEMENT=NO/d" debian/rules
|
||||
fi
|
||||
|
||||
# Mroonga, TokuDB never built on Travis CI anyway, see build flags above
|
||||
if [[ $TRAVIS ]]
|
||||
then
|
||||
sed -i -e "/Package: mariadb-plugin-tokudb/,+17d" debian/control
|
||||
sed -i -e "/Package: mariadb-plugin-mroonga/,+16d" debian/control
|
||||
sed -i -e "/Package: mariadb-plugin-tokudb/,+19d" debian/control
|
||||
sed -i -e "/Package: mariadb-plugin-mroonga/,+17d" debian/control
|
||||
sed -i -e "/Package: mariadb-plugin-spider/,+18d" debian/control
|
||||
sed -i -e "/Package: mariadb-plugin-oqgraph/,+16d" debian/control
|
||||
sed -i -e "/usr\/lib\/mysql\/plugin\/ha_sphinx.so/d" debian/mariadb-server-10.3.install
|
||||
sed -i -e "/Package: libmariadbd-dev/,+19d" debian/control
|
||||
fi
|
||||
|
||||
# Adjust changelog, add new version
|
||||
|
6
debian/control
vendored
6
debian/control
vendored
@ -423,7 +423,7 @@ Pre-Depends: adduser (>= 3.40),
|
||||
mariadb-common (>= ${source:Version})
|
||||
Depends: galera-3 (>=25.3),
|
||||
gawk,
|
||||
iproute2,
|
||||
iproute | iproute2,
|
||||
libdbi-perl,
|
||||
lsb-base (>= 3.0-10),
|
||||
lsof,
|
||||
@ -569,6 +569,7 @@ Description: OQGraph storage engine for MariaDB
|
||||
Package: mariadb-plugin-tokudb
|
||||
Architecture: amd64
|
||||
Depends: mariadb-server-10.3 (= ${binary:Version}),
|
||||
libjemalloc1 (>= 3.0.0~),
|
||||
${misc:Depends},
|
||||
${shlibs:Depends}
|
||||
Breaks: mariadb-server-10.0,
|
||||
@ -704,9 +705,6 @@ Depends: libcrack2 (>= 2.9.0),
|
||||
Description: CrackLib Password Validation Plugin for MariaDB
|
||||
This password validation plugin uses cracklib to allow only
|
||||
sufficiently secure (as defined by cracklib) user passwords in MariaDB.
|
||||
.
|
||||
Plese refer to the MariaDB Knowledge Base on more information on
|
||||
how to use this tool.
|
||||
|
||||
Package: mariadb-test
|
||||
Architecture: any
|
||||
|
1
debian/mariadb-plugin-tokudb.install
vendored
1
debian/mariadb-plugin-tokudb.install
vendored
@ -1,4 +1,5 @@
|
||||
etc/mysql/conf.d/tokudb.cnf etc/mysql/mariadb.conf.d
|
||||
etc/systemd/system/mariadb.service.d/tokudb.conf
|
||||
usr/bin/tokuft_logprint
|
||||
usr/bin/tokuftdump
|
||||
usr/lib/mysql/plugin/ha_tokudb.so
|
||||
|
19
debian/mariadb-server-10.3.postinst
vendored
19
debian/mariadb-server-10.3.postinst
vendored
@ -50,14 +50,14 @@ EOF
|
||||
return $retval
|
||||
}
|
||||
|
||||
# This is necessary because mysql_install_db removes the pid file in /var/run
|
||||
# and because changed configuration options should take effect immediately.
|
||||
# In case the server wasn't running at all it should be ok if the stop
|
||||
# script fails. I can't tell at this point because of the cleaned /var/run.
|
||||
set +e; invoke stop; set -e
|
||||
|
||||
case "$1" in
|
||||
configure)
|
||||
# This is needed because mysql_install_db removes the pid file in /var/run
|
||||
# and because changed configuration options should take effect immediately.
|
||||
# In case the server wasn't running at all it should be ok if the stop
|
||||
# script fails. I can't tell at this point because of the cleaned /var/run.
|
||||
set +e; invoke stop; set -e
|
||||
|
||||
mysql_statedir=/usr/share/mysql
|
||||
mysql_datadir=/var/lib/mysql
|
||||
mysql_logdir=/var/log/mysql
|
||||
@ -242,6 +242,13 @@ EOF
|
||||
abort-upgrade|abort-remove|abort-configure)
|
||||
;;
|
||||
|
||||
triggered)
|
||||
if [ -x "$(command -v systemctl)" ]; then
|
||||
systemctl daemon-reload
|
||||
fi
|
||||
invoke restart
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "postinst called with unknown argument '$1'" 1>&2
|
||||
exit 1
|
||||
|
2
debian/mariadb-server-10.3.triggers
vendored
Normal file
2
debian/mariadb-server-10.3.triggers
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
interest-noawait /etc/mysql
|
||||
interest-noawait /etc/systemd/system/mariadb.service.d
|
1
debian/rules
vendored
1
debian/rules
vendored
@ -88,6 +88,7 @@ endif
|
||||
-DINSTALL_LIBDIR=lib/$(DEB_HOST_MULTIARCH) \
|
||||
-DINSTALL_PLUGINDIR=lib/mysql/plugin \
|
||||
-DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test \
|
||||
-DPLUGIN_AWS_KEY_MANAGEMENT=NO \
|
||||
-DDEB=$(DEB_VENDOR) ..'
|
||||
|
||||
# This is needed, otherwise 'make test' will run before binaries have been built
|
||||
|
@ -58,6 +58,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "backup_mysql.h"
|
||||
#include <btr0btr.h>
|
||||
|
||||
#define ROCKSDB_BACKUP_DIR "#rocksdb"
|
||||
|
||||
/* list of files to sync for --rsync mode */
|
||||
static std::set<std::string> rsync_list;
|
||||
/* locations of tablespaces read from .isl files */
|
||||
@ -66,6 +68,21 @@ static std::map<std::string, std::string> tablespace_locations;
|
||||
/* Whether LOCK BINLOG FOR BACKUP has been issued during backup */
|
||||
bool binlog_locked;
|
||||
|
||||
static void rocksdb_create_checkpoint();
|
||||
static bool has_rocksdb_plugin();
|
||||
static void copy_or_move_dir(const char *from, const char *to, bool copy, bool allow_hardlinks);
|
||||
static void rocksdb_backup_checkpoint();
|
||||
static void rocksdb_copy_back();
|
||||
|
||||
static bool is_abs_path(const char *path)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return path[0] && path[1] == ':' && (path[2] == '/' || path[2] == '\\');
|
||||
#else
|
||||
return path[0] == '/';
|
||||
#endif
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
Struct represents file or directory. */
|
||||
struct datadir_node_t {
|
||||
@ -1138,7 +1155,8 @@ bool
|
||||
copy_or_move_file(const char *src_file_path,
|
||||
const char *dst_file_path,
|
||||
const char *dst_dir,
|
||||
uint thread_n)
|
||||
uint thread_n,
|
||||
bool copy = xtrabackup_copy_back)
|
||||
{
|
||||
ds_ctxt_t *datasink = ds_data; /* copy to datadir by default */
|
||||
char filedir[FN_REFLEN];
|
||||
@ -1186,7 +1204,7 @@ copy_or_move_file(const char *src_file_path,
|
||||
free(link_filepath);
|
||||
}
|
||||
|
||||
ret = (xtrabackup_copy_back ?
|
||||
ret = (copy ?
|
||||
copy_file(datasink, src_file_path, dst_file_path, thread_n) :
|
||||
move_file(datasink, src_file_path, dst_file_path,
|
||||
dst_dir, thread_n));
|
||||
@ -1203,6 +1221,7 @@ cleanup:
|
||||
|
||||
|
||||
|
||||
static
|
||||
bool
|
||||
backup_files(const char *from, bool prep_mode)
|
||||
{
|
||||
@ -1370,6 +1389,10 @@ bool backup_start()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (has_rocksdb_plugin()) {
|
||||
rocksdb_create_checkpoint();
|
||||
}
|
||||
|
||||
// There is no need to stop slave thread before coping non-Innodb data when
|
||||
// --no-lock option is used because --no-lock option requires that no DDL or
|
||||
// DML to non-transaction tables can occur.
|
||||
@ -1455,6 +1478,10 @@ bool backup_finish()
|
||||
}
|
||||
}
|
||||
|
||||
if (has_rocksdb_plugin()) {
|
||||
rocksdb_backup_checkpoint();
|
||||
}
|
||||
|
||||
msg_ts("Backup created in directory '%s'\n", xtrabackup_target_dir);
|
||||
if (mysql_binlog_position != NULL) {
|
||||
msg("MySQL binlog position: %s\n", mysql_binlog_position);
|
||||
@ -1770,6 +1797,16 @@ copy_back()
|
||||
int i_tmp;
|
||||
bool is_ibdata_file;
|
||||
|
||||
if (strstr(node.filepath,"/" ROCKSDB_BACKUP_DIR "/")
|
||||
#ifdef _WIN32
|
||||
|| strstr(node.filepath,"\\" ROCKSDB_BACKUP_DIR "\\")
|
||||
#endif
|
||||
)
|
||||
{
|
||||
// copied at later step
|
||||
continue;
|
||||
}
|
||||
|
||||
/* create empty directories */
|
||||
if (node.is_empty_dir) {
|
||||
char path[FN_REFLEN];
|
||||
@ -1854,6 +1891,8 @@ copy_back()
|
||||
}
|
||||
}
|
||||
|
||||
rocksdb_copy_back();
|
||||
|
||||
cleanup:
|
||||
if (it != NULL) {
|
||||
datadir_iter_free(it);
|
||||
@ -2030,3 +2069,234 @@ static bool backup_files_from_datadir(const char *dir_path)
|
||||
os_file_closedir(dir);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int rocksdb_remove_checkpoint_directory()
|
||||
{
|
||||
xb_mysql_query(mysql_connection, "set global rocksdb_remove_mariabackup_checkpoint=ON", false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool has_rocksdb_plugin()
|
||||
{
|
||||
static bool first_time = true;
|
||||
static bool has_plugin= false;
|
||||
if (!first_time || !xb_backup_rocksdb)
|
||||
return has_plugin;
|
||||
|
||||
const char *query = "SELECT COUNT(*) FROM information_schema.plugins WHERE plugin_name='rocksdb'";
|
||||
MYSQL_RES* result = xb_mysql_query(mysql_connection, query, true);
|
||||
MYSQL_ROW row = mysql_fetch_row(result);
|
||||
if (row)
|
||||
has_plugin = !strcmp(row[0], "1");
|
||||
mysql_free_result(result);
|
||||
first_time = false;
|
||||
return has_plugin;
|
||||
}
|
||||
|
||||
static char *trim_trailing_dir_sep(char *path)
|
||||
{
|
||||
size_t path_len = strlen(path);
|
||||
while (path_len)
|
||||
{
|
||||
char c = path[path_len - 1];
|
||||
if (c == '/' IF_WIN(|| c == '\\', ))
|
||||
path_len--;
|
||||
else
|
||||
break;
|
||||
}
|
||||
path[path_len] = 0;
|
||||
return path;
|
||||
}
|
||||
|
||||
/*
|
||||
Create a file hardlink.
|
||||
@return true on success, false on error.
|
||||
*/
|
||||
static bool make_hardlink(const char *from_path, const char *to_path)
|
||||
{
|
||||
DBUG_EXECUTE_IF("no_hardlinks", return false;);
|
||||
char to_path_full[FN_REFLEN];
|
||||
if (!is_abs_path(to_path))
|
||||
{
|
||||
fn_format(to_path_full, to_path, ds_data->root, "", MYF(MY_RELATIVE_PATH));
|
||||
}
|
||||
else
|
||||
{
|
||||
strncpy(to_path_full, to_path, sizeof(to_path_full));
|
||||
}
|
||||
#ifdef _WIN32
|
||||
return CreateHardLink(to_path_full, from_path, NULL);
|
||||
#else
|
||||
return !link(from_path, to_path_full);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
Copies or moves a directory (non-recursively so far).
|
||||
Helper function used to backup rocksdb checkpoint, or copy-back the
|
||||
rocksdb files.
|
||||
|
||||
Has optimization that allows to use hardlinks when possible
|
||||
(source and destination are directories on the same device)
|
||||
*/
|
||||
static void copy_or_move_dir(const char *from, const char *to, bool do_copy, bool allow_hardlinks)
|
||||
{
|
||||
datadir_node_t node;
|
||||
datadir_node_init(&node);
|
||||
datadir_iter_t *it = datadir_iter_new(from, false);
|
||||
|
||||
while (datadir_iter_next(it, &node))
|
||||
{
|
||||
char to_path[FN_REFLEN];
|
||||
const char *from_path = node.filepath;
|
||||
snprintf(to_path, sizeof(to_path), "%s/%s", to, base_name(from_path));
|
||||
bool rc = false;
|
||||
if (do_copy && allow_hardlinks)
|
||||
{
|
||||
rc = make_hardlink(from_path, to_path);
|
||||
if (rc)
|
||||
{
|
||||
msg_ts("[%02u] Creating hardlink from %s to %s\n",
|
||||
1, from_path, to_path);
|
||||
}
|
||||
else
|
||||
{
|
||||
allow_hardlinks = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!rc)
|
||||
{
|
||||
rc = (do_copy ?
|
||||
copy_file(ds_data, from_path, to_path, 1) :
|
||||
move_file(ds_data, from_path, node.filepath_rel,
|
||||
to, 1));
|
||||
}
|
||||
if (!rc)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
datadir_iter_free(it);
|
||||
datadir_node_free(&node);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
Obtain user level lock , to protect the checkpoint directory of the server
|
||||
from being user/overwritten by different backup processes, if backups are
|
||||
running in parallel.
|
||||
|
||||
This lock will be acquired before rocksdb checkpoint is created, held
|
||||
while all files from it are being copied to their final backup destination,
|
||||
and finally released after the checkpoint is removed.
|
||||
*/
|
||||
static void rocksdb_lock_checkpoint()
|
||||
{
|
||||
msg_ts("Obtaining rocksdb checkpoint lock.\n");
|
||||
MYSQL_RES *res =
|
||||
xb_mysql_query(mysql_connection, "SELECT GET_LOCK('mariabackup_rocksdb_checkpoint',3600)", true, true);
|
||||
|
||||
MYSQL_ROW r = mysql_fetch_row(res);
|
||||
if (r && r[0] && strcmp(r[0], "1"))
|
||||
{
|
||||
msg_ts("Could not obtain rocksdb checkpont lock\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
static void rocksdb_unlock_checkpoint()
|
||||
{
|
||||
xb_mysql_query(mysql_connection,
|
||||
"SELECT RELEASE_LOCK('mariabackup_rocksdb_checkpoint')", false, true);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Create temporary checkpoint in $rocksdb_datadir/mariabackup-checkpoint
|
||||
directory.
|
||||
A (user-level) lock named 'mariabackup_rocksdb_checkpoint' will also be
|
||||
acquired be this function.
|
||||
*/
|
||||
#define MARIADB_CHECKPOINT_DIR "mariabackup-checkpoint"
|
||||
static char rocksdb_checkpoint_dir[FN_REFLEN];
|
||||
|
||||
static void rocksdb_create_checkpoint()
|
||||
{
|
||||
MYSQL_RES *result = xb_mysql_query(mysql_connection, "SELECT @@rocksdb_datadir,@@datadir", true, true);
|
||||
MYSQL_ROW row = mysql_fetch_row(result);
|
||||
|
||||
DBUG_ASSERT(row && row[0] && row[1]);
|
||||
|
||||
char *rocksdbdir = row[0];
|
||||
char *datadir = row[1];
|
||||
|
||||
if (is_abs_path(rocksdbdir))
|
||||
{
|
||||
snprintf(rocksdb_checkpoint_dir, sizeof(rocksdb_checkpoint_dir),
|
||||
"%s/" MARIADB_CHECKPOINT_DIR, trim_trailing_dir_sep(rocksdbdir));
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(rocksdb_checkpoint_dir, sizeof(rocksdb_checkpoint_dir),
|
||||
"%s/%s/" MARIADB_CHECKPOINT_DIR, trim_trailing_dir_sep(datadir),
|
||||
trim_dotslash(rocksdbdir));
|
||||
}
|
||||
mysql_free_result(result);
|
||||
|
||||
#ifdef _WIN32
|
||||
for (char *p = rocksdb_checkpoint_dir; *p; p++)
|
||||
if (*p == '\\') *p = '/';
|
||||
#endif
|
||||
|
||||
rocksdb_lock_checkpoint();
|
||||
|
||||
if (!access(rocksdb_checkpoint_dir, 0))
|
||||
{
|
||||
msg_ts("Removing rocksdb checkpoint from previous backup attempt.\n");
|
||||
rocksdb_remove_checkpoint_directory();
|
||||
}
|
||||
|
||||
char query[FN_REFLEN + 32];
|
||||
snprintf(query, sizeof(query), "SET GLOBAL rocksdb_create_checkpoint='%s'", rocksdb_checkpoint_dir);
|
||||
xb_mysql_query(mysql_connection, query, false, true);
|
||||
}
|
||||
|
||||
/*
|
||||
Copy files from rocksdb temporary checkpoint to final destination.
|
||||
remove temp.checkpoint directory (in server's datadir)
|
||||
and release user level lock acquired inside rocksdb_create_checkpoint().
|
||||
*/
|
||||
static void rocksdb_backup_checkpoint()
|
||||
{
|
||||
msg_ts("Backing up rocksdb files.\n");
|
||||
char rocksdb_backup_dir[FN_REFLEN];
|
||||
snprintf(rocksdb_backup_dir, sizeof(rocksdb_backup_dir), "%s/" ROCKSDB_BACKUP_DIR , xtrabackup_target_dir);
|
||||
bool backup_to_directory = xtrabackup_backup && xtrabackup_stream_fmt == XB_STREAM_FMT_NONE;
|
||||
if (backup_to_directory)
|
||||
{
|
||||
if (my_mkdir(rocksdb_backup_dir, 0777, MYF(0))){
|
||||
msg_ts("Can't create rocksdb backup directory %s\n", rocksdb_backup_dir);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
copy_or_move_dir(rocksdb_checkpoint_dir, ROCKSDB_BACKUP_DIR, true, backup_to_directory);
|
||||
rocksdb_remove_checkpoint_directory();
|
||||
rocksdb_unlock_checkpoint();
|
||||
}
|
||||
|
||||
/*
|
||||
Copies #rocksdb directory to the $rockdb_data_dir, on copy-back
|
||||
*/
|
||||
static void rocksdb_copy_back() {
|
||||
if (access(ROCKSDB_BACKUP_DIR, 0))
|
||||
return;
|
||||
char rocksdb_home_dir[FN_REFLEN];
|
||||
if (xb_rocksdb_datadir && is_abs_path(xb_rocksdb_datadir)) {
|
||||
strncpy(rocksdb_home_dir, xb_rocksdb_datadir, sizeof(rocksdb_home_dir));
|
||||
} else {
|
||||
snprintf(rocksdb_home_dir, sizeof(rocksdb_home_dir), "%s/%s", mysql_data_home,
|
||||
xb_rocksdb_datadir?trim_dotslash(xb_rocksdb_datadir): ROCKSDB_BACKUP_DIR);
|
||||
}
|
||||
mkdirp(rocksdb_home_dir, 0777, MYF(0));
|
||||
copy_or_move_dir(ROCKSDB_BACKUP_DIR, rocksdb_home_dir, xtrabackup_copy_back, xtrabackup_copy_back);
|
||||
}
|
||||
|
@ -187,6 +187,7 @@ xb_mysql_query(MYSQL *connection, const char *query, bool use_result,
|
||||
|
||||
if (!use_result) {
|
||||
mysql_free_result(mysql_result);
|
||||
mysql_result = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1784,12 +1785,17 @@ mdl_lock_table(ulint space_id)
|
||||
MYSQL_RES *mysql_result = xb_mysql_query(mdl_con, oss.str().c_str(), true, true);
|
||||
|
||||
while (MYSQL_ROW row = mysql_fetch_row(mysql_result)) {
|
||||
|
||||
DBUG_EXECUTE_IF("rename_during_mdl_lock_table",
|
||||
if (strcmp(row[0], "test/t1") == 0)
|
||||
xb_mysql_query(mysql_connection, "RENAME TABLE test.t1 to test.t2", false, true
|
||||
););
|
||||
|
||||
std::string full_table_name = ut_get_name(0,row[0]);
|
||||
std::ostringstream lock_query;
|
||||
lock_query << "SELECT 1 FROM " << full_table_name << " LIMIT 0";
|
||||
|
||||
msg_ts("Locking MDL for %s\n", full_table_name.c_str());
|
||||
xb_mysql_query(mdl_con, lock_query.str().c_str(), false, false);
|
||||
xb_mysql_query(mdl_con, lock_query.str().c_str(), false, true);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&mdl_lock_con_mutex);
|
||||
|
@ -109,6 +109,7 @@ int sys_var_init();
|
||||
char xtrabackup_real_target_dir[FN_REFLEN] = "./xtrabackup_backupfiles/";
|
||||
char *xtrabackup_target_dir= xtrabackup_real_target_dir;
|
||||
static my_bool xtrabackup_version;
|
||||
static my_bool verbose;
|
||||
my_bool xtrabackup_backup;
|
||||
my_bool xtrabackup_prepare;
|
||||
my_bool xtrabackup_copy_back;
|
||||
@ -146,6 +147,8 @@ char *xtrabackup_tmpdir;
|
||||
char *xtrabackup_tables;
|
||||
char *xtrabackup_tables_file;
|
||||
char *xtrabackup_tables_exclude;
|
||||
char *xb_rocksdb_datadir;
|
||||
my_bool xb_backup_rocksdb = 1;
|
||||
|
||||
typedef std::list<regex_t> regex_list_t;
|
||||
static regex_list_t regex_include_list;
|
||||
@ -172,7 +175,6 @@ typedef struct xb_filter_entry_struct xb_filter_entry_t;
|
||||
lsn_t checkpoint_lsn_start;
|
||||
lsn_t checkpoint_no_start;
|
||||
static lsn_t log_copy_scanned_lsn;
|
||||
static bool log_copying;
|
||||
static bool log_copying_running;
|
||||
static bool io_watching_thread_running;
|
||||
|
||||
@ -202,9 +204,9 @@ my_bool opt_ssl_verify_server_cert;
|
||||
/* === metadata of backup === */
|
||||
#define XTRABACKUP_METADATA_FILENAME "xtrabackup_checkpoints"
|
||||
char metadata_type[30] = ""; /*[full-backuped|log-applied|incremental]*/
|
||||
lsn_t metadata_from_lsn;
|
||||
static lsn_t metadata_from_lsn;
|
||||
lsn_t metadata_to_lsn;
|
||||
lsn_t metadata_last_lsn;
|
||||
static lsn_t metadata_last_lsn;
|
||||
|
||||
static ds_file_t* dst_log_file;
|
||||
|
||||
@ -684,11 +686,16 @@ enum options_xtrabackup
|
||||
OPT_XTRA_TABLES_EXCLUDE,
|
||||
OPT_XTRA_DATABASES_EXCLUDE,
|
||||
OPT_PROTOCOL,
|
||||
OPT_LOCK_DDL_PER_TABLE
|
||||
OPT_LOCK_DDL_PER_TABLE,
|
||||
OPT_ROCKSDB_DATADIR,
|
||||
OPT_BACKUP_ROCKSDB
|
||||
};
|
||||
|
||||
struct my_option xb_client_options[] =
|
||||
{
|
||||
{"verbose", 'V', "display verbose output",
|
||||
(G_PTR*) &verbose, (G_PTR*) &verbose, 0, GET_BOOL, NO_ARG,
|
||||
FALSE, 0, 0, 0, 0, 0},
|
||||
{"version", 'v', "print xtrabackup version information",
|
||||
(G_PTR *) &xtrabackup_version, (G_PTR *) &xtrabackup_version, 0, GET_BOOL,
|
||||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
@ -1183,7 +1190,7 @@ struct my_option xb_server_options[] =
|
||||
"The algorithm InnoDB uses for page checksumming. [CRC32, STRICT_CRC32, "
|
||||
"INNODB, STRICT_INNODB, NONE, STRICT_NONE]", &srv_checksum_algorithm,
|
||||
&srv_checksum_algorithm, &innodb_checksum_algorithm_typelib, GET_ENUM,
|
||||
REQUIRED_ARG, SRV_CHECKSUM_ALGORITHM_INNODB, 0, 0, 0, 0, 0},
|
||||
REQUIRED_ARG, SRV_CHECKSUM_ALGORITHM_CRC32, 0, 0, 0, 0, 0},
|
||||
|
||||
{"innodb_undo_directory", OPT_INNODB_UNDO_DIRECTORY,
|
||||
"Directory where undo tablespace files live, this path can be absolute.",
|
||||
@ -1228,6 +1235,17 @@ struct my_option xb_server_options[] =
|
||||
(uchar*) &opt_lock_ddl_per_table, (uchar*) &opt_lock_ddl_per_table, 0,
|
||||
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
|
||||
{"rocksdb-datadir", OPT_ROCKSDB_DATADIR, "RocksDB data directory."
|
||||
"This option is only used with --copy-back or --move-back option",
|
||||
&xb_rocksdb_datadir, &xb_rocksdb_datadir,
|
||||
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
|
||||
|
||||
{ "rocksdb-backup", OPT_BACKUP_ROCKSDB, "Backup rocksdb data, if rocksdb plugin is installed."
|
||||
"Used only with --backup option. Can be useful for partial backups, to exclude all rocksdb data",
|
||||
&xb_backup_rocksdb, &xb_backup_rocksdb,
|
||||
0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 },
|
||||
|
||||
|
||||
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
@ -1735,7 +1753,7 @@ static bool innodb_init_param()
|
||||
srv_max_n_open_files = ULINT_UNDEFINED - 5;
|
||||
srv_innodb_status = (ibool) innobase_create_status_file;
|
||||
|
||||
srv_print_verbose_log = 1;
|
||||
srv_print_verbose_log = verbose ? 2 : 1;
|
||||
|
||||
/* Store the default charset-collation number of this MySQL
|
||||
installation */
|
||||
@ -2442,25 +2460,13 @@ skip:
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
/** How to copy a redo log segment in backup */
|
||||
enum copy_logfile {
|
||||
/** Initial copying: copy at least one block */
|
||||
COPY_FIRST,
|
||||
/** Tracking while copying data files */
|
||||
COPY_ONLINE,
|
||||
/** Final copying: copy until the end of the log */
|
||||
COPY_LAST
|
||||
};
|
||||
|
||||
/** Copy redo log blocks to the data sink.
|
||||
@param[in] copy how to copy the log
|
||||
@param[in] start_lsn buffer start LSN
|
||||
@param[in] end_lsn buffer end LSN
|
||||
@return last scanned LSN (equals to last copied LSN if copy=COPY_LAST)
|
||||
@param start_lsn buffer start LSN
|
||||
@param end_lsn buffer end LSN
|
||||
@param last whether we are copying the final part of the log
|
||||
@return last scanned LSN
|
||||
@retval 0 on failure */
|
||||
static
|
||||
lsn_t
|
||||
xtrabackup_copy_log(copy_logfile copy, lsn_t start_lsn, lsn_t end_lsn)
|
||||
static lsn_t xtrabackup_copy_log(lsn_t start_lsn, lsn_t end_lsn, bool last)
|
||||
{
|
||||
lsn_t scanned_lsn = start_lsn;
|
||||
const byte* log_block = log_sys.buf;
|
||||
@ -2475,6 +2481,9 @@ xtrabackup_copy_log(copy_logfile copy, lsn_t start_lsn, lsn_t end_lsn)
|
||||
&& scanned_checkpoint - checkpoint >= 0x80000000UL) {
|
||||
/* Garbage from a log buffer flush which was made
|
||||
before the most recent database recovery */
|
||||
msg("mariabackup: checkpoint wrap: "
|
||||
LSN_PF ",%zx,%zx\n",
|
||||
scanned_lsn, scanned_checkpoint, checkpoint);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2495,6 +2504,8 @@ xtrabackup_copy_log(copy_logfile copy, lsn_t start_lsn, lsn_t end_lsn)
|
||||
>= OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_SIZE
|
||||
|| data_len <= LOG_BLOCK_HDR_SIZE) {
|
||||
/* We got a garbage block (abrupt end of the log). */
|
||||
msg("mariabackup: garbage block: " LSN_PF ",%zu\n",
|
||||
scanned_lsn, data_len);
|
||||
break;
|
||||
} else {
|
||||
/* We got a partial block (abrupt end of the log). */
|
||||
@ -2514,7 +2525,7 @@ xtrabackup_copy_log(copy_logfile copy, lsn_t start_lsn, lsn_t end_lsn)
|
||||
|
||||
log_sys.log.scanned_lsn = scanned_lsn;
|
||||
|
||||
end_lsn = copy == COPY_LAST
|
||||
end_lsn = last
|
||||
? ut_uint64_align_up(scanned_lsn, OS_FILE_LOG_BLOCK_SIZE)
|
||||
: scanned_lsn & ~lsn_t(OS_FILE_LOG_BLOCK_SIZE - 1);
|
||||
|
||||
@ -2534,10 +2545,9 @@ xtrabackup_copy_log(copy_logfile copy, lsn_t start_lsn, lsn_t end_lsn)
|
||||
}
|
||||
|
||||
/** Copy redo log until the current end of the log is reached
|
||||
@param copy how to copy the log
|
||||
@param last whether we are copying the final part of the log
|
||||
@return whether the operation failed */
|
||||
static bool
|
||||
xtrabackup_copy_logfile(copy_logfile copy)
|
||||
static bool xtrabackup_copy_logfile(bool last = false)
|
||||
{
|
||||
ut_a(dst_log_file != NULL);
|
||||
ut_ad(recv_sys != NULL);
|
||||
@ -2550,32 +2560,28 @@ xtrabackup_copy_logfile(copy_logfile copy)
|
||||
|
||||
start_lsn = ut_uint64_align_down(log_copy_scanned_lsn,
|
||||
OS_FILE_LOG_BLOCK_SIZE);
|
||||
/* When copying the first or last part of the log, retry a few
|
||||
times to ensure that all log up to the last checkpoint will be
|
||||
read. */
|
||||
do {
|
||||
end_lsn = start_lsn + RECV_SCAN_SIZE;
|
||||
|
||||
xtrabackup_io_throttling();
|
||||
|
||||
log_mutex_enter();
|
||||
|
||||
lsn_t lsn= start_lsn;
|
||||
for(int retries= 0; retries < 100; retries++) {
|
||||
if (log_sys.log.read_log_seg(&lsn, end_lsn)) {
|
||||
for (int retries= 0; retries < 100; retries++) {
|
||||
if (log_sys.log.read_log_seg(&lsn, end_lsn)
|
||||
|| lsn != start_lsn) {
|
||||
break;
|
||||
}
|
||||
msg("Retrying read of a redo log block");
|
||||
msg("Retrying read of log at LSN=" LSN_PF "\n", lsn);
|
||||
my_sleep(1000);
|
||||
}
|
||||
|
||||
start_lsn = xtrabackup_copy_log(copy, start_lsn, lsn);
|
||||
start_lsn = (lsn == start_lsn)
|
||||
? 0 : xtrabackup_copy_log(start_lsn, lsn, last);
|
||||
|
||||
log_mutex_exit();
|
||||
|
||||
if (!start_lsn) {
|
||||
ds_close(dst_log_file);
|
||||
dst_log_file = NULL;
|
||||
msg("mariabackup: Error: xtrabackup_copy_logfile()"
|
||||
" failed.\n");
|
||||
return(true);
|
||||
@ -2601,12 +2607,23 @@ static os_thread_ret_t DECLARE_THREAD(log_copying_thread)(void*)
|
||||
*/
|
||||
my_thread_init();
|
||||
|
||||
do {
|
||||
for (;;) {
|
||||
os_event_reset(log_copying_stop);
|
||||
os_event_wait_time_low(log_copying_stop,
|
||||
xtrabackup_log_copy_interval * 1000ULL,
|
||||
0);
|
||||
} while (log_copying && xtrabackup_copy_logfile(COPY_ONLINE));
|
||||
if (xtrabackup_copy_logfile()) {
|
||||
break;
|
||||
}
|
||||
|
||||
log_mutex_enter();
|
||||
bool completed = metadata_to_lsn
|
||||
&& metadata_to_lsn < log_copy_scanned_lsn;
|
||||
log_mutex_exit();
|
||||
if (completed) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
log_copying_running = false;
|
||||
my_thread_end();
|
||||
@ -2621,7 +2638,7 @@ static os_thread_ret_t DECLARE_THREAD(io_watching_thread)(void*)
|
||||
/* currently, for --backup only */
|
||||
ut_a(xtrabackup_backup);
|
||||
|
||||
while (log_copying) {
|
||||
while (log_copying_running && !metadata_to_lsn) {
|
||||
os_thread_sleep(1000000); /*1 sec*/
|
||||
io_ticket = xtrabackup_throttle;
|
||||
os_event_set(wait_throttle);
|
||||
@ -3638,16 +3655,16 @@ end:
|
||||
|
||||
static void stop_backup_threads()
|
||||
{
|
||||
log_copying = false;
|
||||
|
||||
if (log_copying_stop) {
|
||||
if (log_copying_stop && log_copying_running) {
|
||||
os_event_set(log_copying_stop);
|
||||
msg("mariabackup: Stopping log copying thread.\n");
|
||||
fputs("mariabackup: Stopping log copying thread", stderr);
|
||||
fflush(stderr);
|
||||
while (log_copying_running) {
|
||||
msg(".");
|
||||
putc('.', stderr);
|
||||
fflush(stderr);
|
||||
os_thread_sleep(200000); /*0.2 sec*/
|
||||
}
|
||||
msg("\n");
|
||||
putc('\n', stderr);
|
||||
os_event_destroy(log_copying_stop);
|
||||
}
|
||||
|
||||
@ -3662,10 +3679,10 @@ static void stop_backup_threads()
|
||||
|
||||
/** Implement the core of --backup
|
||||
@return whether the operation succeeded */
|
||||
static
|
||||
bool
|
||||
xtrabackup_backup_low()
|
||||
static bool xtrabackup_backup_low()
|
||||
{
|
||||
ut_ad(!metadata_to_lsn);
|
||||
|
||||
/* read the latest checkpoint lsn */
|
||||
{
|
||||
ulint max_cp_field;
|
||||
@ -3674,13 +3691,15 @@ xtrabackup_backup_low()
|
||||
|
||||
if (recv_find_max_checkpoint(&max_cp_field) == DB_SUCCESS
|
||||
&& log_sys.log.format != 0) {
|
||||
if (max_cp_field == LOG_CHECKPOINT_1) {
|
||||
log_header_read(max_cp_field);
|
||||
}
|
||||
metadata_to_lsn = mach_read_from_8(
|
||||
log_sys.checkpoint_buf + LOG_CHECKPOINT_LSN);
|
||||
msg("mariabackup: The latest check point"
|
||||
" (for incremental): '" LSN_PF "'\n",
|
||||
metadata_to_lsn);
|
||||
} else {
|
||||
metadata_to_lsn = 0;
|
||||
msg("mariabackup: Error: recv_find_max_checkpoint() failed.\n");
|
||||
}
|
||||
log_mutex_exit();
|
||||
@ -3688,11 +3707,13 @@ xtrabackup_backup_low()
|
||||
|
||||
stop_backup_threads();
|
||||
|
||||
if (!dst_log_file || xtrabackup_copy_logfile(COPY_LAST)) {
|
||||
if (metadata_to_lsn && xtrabackup_copy_logfile(true)) {
|
||||
ds_close(dst_log_file);
|
||||
dst_log_file = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ds_close(dst_log_file)) {
|
||||
if (ds_close(dst_log_file) || !metadata_to_lsn) {
|
||||
dst_log_file = NULL;
|
||||
return false;
|
||||
}
|
||||
@ -3771,6 +3792,7 @@ xtrabackup_backup_func()
|
||||
srv_read_only_mode = TRUE;
|
||||
|
||||
srv_operation = SRV_OPERATION_BACKUP;
|
||||
metadata_to_lsn = 0;
|
||||
|
||||
if (xb_close_files)
|
||||
msg("mariabackup: warning: close-files specified. Use it "
|
||||
@ -3781,7 +3803,12 @@ xtrabackup_backup_func()
|
||||
/* initialize components */
|
||||
if(innodb_init_param()) {
|
||||
fail:
|
||||
metadata_to_lsn = log_copying_running;
|
||||
stop_backup_threads();
|
||||
if (dst_log_file) {
|
||||
ds_close(dst_log_file);
|
||||
dst_log_file = NULL;
|
||||
}
|
||||
if (fil_system.is_initialised()) {
|
||||
innodb_shutdown();
|
||||
}
|
||||
@ -3996,9 +4023,7 @@ reread_log_header:
|
||||
goto log_write_fail;
|
||||
}
|
||||
|
||||
/* start flag */
|
||||
log_copying = TRUE;
|
||||
|
||||
log_copying_running = true;
|
||||
/* start io throttle */
|
||||
if(xtrabackup_throttle) {
|
||||
os_thread_id_t io_watching_thread_id;
|
||||
@ -4016,6 +4041,8 @@ reread_log_header:
|
||||
if (err != DB_SUCCESS) {
|
||||
msg("mariabackup: error: xb_load_tablespaces() failed with"
|
||||
" error %s.\n", ut_strerr(err));
|
||||
fail_before_log_copying_thread_start:
|
||||
log_copying_running = false;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@ -4023,11 +4050,10 @@ reread_log_header:
|
||||
log_copy_scanned_lsn = checkpoint_lsn_start;
|
||||
recv_sys->recovered_lsn = log_copy_scanned_lsn;
|
||||
|
||||
if (xtrabackup_copy_logfile(COPY_FIRST))
|
||||
goto fail;
|
||||
if (xtrabackup_copy_logfile())
|
||||
goto fail_before_log_copying_thread_start;
|
||||
|
||||
log_copying_stop = os_event_create(0);
|
||||
log_copying_running = true;
|
||||
os_thread_create(log_copying_thread, NULL, &log_copying_thread_id);
|
||||
|
||||
/* FLUSH CHANGED_PAGE_BITMAPS call */
|
||||
|
@ -44,6 +44,9 @@ extern char *xtrabackup_incremental_basedir;
|
||||
extern char *innobase_data_home_dir;
|
||||
extern char *innobase_buffer_pool_filename;
|
||||
extern char *xb_plugin_dir;
|
||||
extern char *xb_rocksdb_datadir;
|
||||
extern my_bool xb_backup_rocksdb;
|
||||
|
||||
extern uint opt_protocol;
|
||||
extern ds_ctxt_t *ds_meta;
|
||||
extern ds_ctxt_t *ds_data;
|
||||
@ -56,9 +59,7 @@ extern xb_page_bitmap *changed_page_bitmap;
|
||||
extern char *xtrabackup_incremental;
|
||||
extern my_bool xtrabackup_incremental_force_scan;
|
||||
|
||||
extern lsn_t metadata_from_lsn;
|
||||
extern lsn_t metadata_to_lsn;
|
||||
extern lsn_t metadata_last_lsn;
|
||||
|
||||
extern xb_stream_fmt_t xtrabackup_stream_fmt;
|
||||
extern ibool xtrabackup_stream;
|
||||
|
@ -619,6 +619,8 @@ typedef SOCKET_SIZE_TYPE size_socket;
|
||||
#endif
|
||||
#ifndef SOCK_CLOEXEC
|
||||
#define SOCK_CLOEXEC 0
|
||||
#else
|
||||
#define HAVE_SOCK_CLOEXEC
|
||||
#endif
|
||||
|
||||
/* additional file share flags for win32 */
|
||||
|
@ -561,6 +561,12 @@ inline_mysql_socket_socket
|
||||
(key, (const my_socket*)&mysql_socket.fd, NULL, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* SOCK_CLOEXEC isn't always a number - can't preprocessor compare */
|
||||
#if defined(HAVE_FCNTL) && defined(FD_CLOEXEC) && !defined(HAVE_SOCK_CLOEXEC)
|
||||
(void) fcntl(mysql_socket.fd, F_SETFD, FD_CLOEXEC);
|
||||
#endif
|
||||
|
||||
return mysql_socket;
|
||||
}
|
||||
|
||||
|
@ -179,6 +179,7 @@ enum enum_indicator_type
|
||||
#define BINCMP_FLAG 131072U /* Intern: Used by sql_yacc */
|
||||
#define GET_FIXED_FIELDS_FLAG (1U << 18) /* Used to get fields in item tree */
|
||||
#define FIELD_IN_PART_FUNC_FLAG (1U << 19)/* Field part of partition func */
|
||||
#define PART_INDIRECT_KEY_FLAG (1U << 20)
|
||||
|
||||
/**
|
||||
Intern: Field in TABLE object for new version of altered table,
|
||||
|
@ -27,7 +27,7 @@
|
||||
#define HAVE_OPENSSL11 1
|
||||
#define SSL_LIBRARY OpenSSL_version(OPENSSL_VERSION)
|
||||
#define ERR_remove_state(X) ERR_clear_error()
|
||||
#define EVP_CIPHER_CTX_SIZE 168
|
||||
#define EVP_CIPHER_CTX_SIZE 176
|
||||
#define EVP_MD_CTX_SIZE 48
|
||||
#undef EVP_MD_CTX_init
|
||||
#define EVP_MD_CTX_init(X) do { bzero((X), EVP_MD_CTX_SIZE); EVP_MD_CTX_reset(X); } while(0)
|
||||
@ -77,6 +77,10 @@
|
||||
#define X509_get0_notAfter(X) X509_get_notAfter(X)
|
||||
#endif
|
||||
|
||||
#ifndef TLS1_3_VERSION
|
||||
#define SSL_CTX_set_ciphersuites(X,Y) 0
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
Submodule libmariadb updated: a12a0b8362...ebf5db6cd0
@ -28,9 +28,9 @@ ${SSL_INTERNAL_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
SET(GEN_SOURCES
|
||||
${CMAKE_BINARY_DIR}/sql/sql_yacc.h
|
||||
${CMAKE_BINARY_DIR}/sql/sql_yacc.hh
|
||||
${CMAKE_BINARY_DIR}/sql/sql_yacc.cc
|
||||
${CMAKE_BINARY_DIR}/sql/sql_yacc_ora.h
|
||||
${CMAKE_BINARY_DIR}/sql/sql_yacc_ora.hh
|
||||
${CMAKE_BINARY_DIR}/sql/sql_yacc_ora.cc
|
||||
${CMAKE_BINARY_DIR}/sql/lex_hash.h
|
||||
)
|
||||
|
@ -55,6 +55,9 @@ extern "C" void unireg_clear(int exit_code)
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
static my_bool mysql_embedded_init= 0;
|
||||
|
||||
/*
|
||||
Wrapper error handler for embedded server to call client/server error
|
||||
handler based on whether thread is in client/server context
|
||||
@ -518,6 +521,8 @@ int init_embedded_server(int argc, char **argv, char **groups)
|
||||
const char *fake_groups[] = { "server", "embedded", 0 };
|
||||
my_bool acl_error;
|
||||
|
||||
DBUG_ASSERT(mysql_embedded_init == 0);
|
||||
|
||||
if (my_thread_init())
|
||||
return 1;
|
||||
|
||||
@ -637,15 +642,20 @@ int init_embedded_server(int argc, char **argv, char **groups)
|
||||
}
|
||||
|
||||
execute_ddl_log_recovery();
|
||||
mysql_embedded_init= 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void end_embedded_server()
|
||||
{
|
||||
my_free(copy_arguments_ptr);
|
||||
copy_arguments_ptr=0;
|
||||
clean_up(0);
|
||||
clean_up_mutexes();
|
||||
if (mysql_embedded_init)
|
||||
{
|
||||
my_free(copy_arguments_ptr);
|
||||
copy_arguments_ptr=0;
|
||||
clean_up(0);
|
||||
clean_up_mutexes();
|
||||
mysql_embedded_init= 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
29
mysql-test/include/autoinc_mdev15353.inc
Normal file
29
mysql-test/include/autoinc_mdev15353.inc
Normal file
@ -0,0 +1,29 @@
|
||||
DELIMITER $$;
|
||||
CREATE PROCEDURE autoinc_mdev15353_one(engine VARCHAR(64), t VARCHAR(64))
|
||||
BEGIN
|
||||
DECLARE query TEXT DEFAULT 'CREATE TABLE t1 ('
|
||||
' id TTT NOT NULL AUTO_INCREMENT,'
|
||||
' name CHAR(30) NOT NULL,'
|
||||
' PRIMARY KEY (id)) ENGINE=EEE';
|
||||
EXECUTE IMMEDIATE REPLACE(REPLACE(query,'TTT', t), 'EEE', engine);
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 (name) VALUES ('dog');
|
||||
SELECT * FROM t1;
|
||||
UPDATE t1 SET id=-1 WHERE id=1;
|
||||
SELECT * FROM t1;
|
||||
INSERT INTO t1 (name) VALUES ('cat');
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
CALL autoinc_mdev15353_one(@engine, 'tinyint');
|
||||
CALL autoinc_mdev15353_one(@engine, 'smallint');
|
||||
CALL autoinc_mdev15353_one(@engine, 'mediumint');
|
||||
CALL autoinc_mdev15353_one(@engine, 'int');
|
||||
CALL autoinc_mdev15353_one(@engine, 'bigint');
|
||||
CALL autoinc_mdev15353_one(@engine, 'float');
|
||||
CALL autoinc_mdev15353_one(@engine, 'double');
|
||||
|
||||
DROP PROCEDURE autoinc_mdev15353_one;
|
@ -11,7 +11,7 @@ let $counter= 5000;
|
||||
let $mysql_errno= 9999;
|
||||
while ($mysql_errno)
|
||||
{
|
||||
--error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2013
|
||||
--error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,ER_LOCK_WAIT_TIMEOUT,2002,2006,2013
|
||||
show status;
|
||||
|
||||
dec $counter;
|
||||
|
@ -2235,6 +2235,29 @@ t1 CREATE TABLE `t1` (
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-14668 ADD PRIMARY KEY IF NOT EXISTS on composite key
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
`ID` BIGINT(20) NOT NULL,
|
||||
`RANK` MEDIUMINT(4) NOT NULL,
|
||||
`CHECK_POINT` BIGINT(20) NOT NULL,
|
||||
UNIQUE INDEX `HORIZON_UIDX01` (`ID`, `RANK`)
|
||||
) ENGINE=InnoDB;
|
||||
ALTER TABLE t1 ADD PRIMARY KEY IF NOT EXISTS (`ID`, `CHECK_POINT`);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`ID` bigint(20) NOT NULL,
|
||||
`RANK` mediumint(4) NOT NULL,
|
||||
`CHECK_POINT` bigint(20) NOT NULL,
|
||||
PRIMARY KEY (`ID`,`CHECK_POINT`),
|
||||
UNIQUE KEY `HORIZON_UIDX01` (`ID`,`RANK`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
ALTER TABLE t1 ADD PRIMARY KEY IF NOT EXISTS (`ID`, `CHECK_POINT`);
|
||||
Warnings:
|
||||
Note 1061 Multiple primary key defined
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 10.0 tests
|
||||
#
|
||||
#
|
||||
@ -2380,5 +2403,16 @@ t1 CREATE TABLE `t1` (
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-11071: Assertion `thd->transaction.stmt.is_empty()' failed
|
||||
# in Locked_tables_list::unlock_locked_tables
|
||||
#
|
||||
CREATE TABLE t1 (d DATETIME DEFAULT CURRENT_TIMESTAMP, i INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 (i) VALUES (1),(1);
|
||||
LOCK TABLE t1 WRITE;
|
||||
ALTER TABLE t1 ADD UNIQUE(i);
|
||||
ERROR 23000: Duplicate entry '1' for key 'i'
|
||||
UNLOCK TABLES;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
|
@ -1834,6 +1834,21 @@ ALTER TABLE t1 DROP INDEX IF EXISTS fk, DROP COLUMN IF EXISTS c;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-14668 ADD PRIMARY KEY IF NOT EXISTS on composite key
|
||||
--echo #
|
||||
CREATE TABLE t1 (
|
||||
`ID` BIGINT(20) NOT NULL,
|
||||
`RANK` MEDIUMINT(4) NOT NULL,
|
||||
`CHECK_POINT` BIGINT(20) NOT NULL,
|
||||
UNIQUE INDEX `HORIZON_UIDX01` (`ID`, `RANK`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
ALTER TABLE t1 ADD PRIMARY KEY IF NOT EXISTS (`ID`, `CHECK_POINT`);
|
||||
SHOW CREATE TABLE t1;
|
||||
ALTER TABLE t1 ADD PRIMARY KEY IF NOT EXISTS (`ID`, `CHECK_POINT`);
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.0 tests
|
||||
--echo #
|
||||
@ -1937,6 +1952,22 @@ alter table t1 change b new_b int not null, add column b char(1), add constraint
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-11071: Assertion `thd->transaction.stmt.is_empty()' failed
|
||||
--echo # in Locked_tables_list::unlock_locked_tables
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (d DATETIME DEFAULT CURRENT_TIMESTAMP, i INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 (i) VALUES (1),(1);
|
||||
LOCK TABLE t1 WRITE;
|
||||
--error ER_DUP_ENTRY
|
||||
ALTER TABLE t1 ADD UNIQUE(i);
|
||||
|
||||
# Cleanup
|
||||
UNLOCK TABLES;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
||||
|
@ -306,7 +306,7 @@ ANALYZE
|
||||
"r_rows": 10,
|
||||
"r_total_time_ms": "REPLACED",
|
||||
"filtered": 100,
|
||||
"r_filtered": 1,
|
||||
"r_filtered": 100,
|
||||
"attached_condition": "t0.a is not null"
|
||||
}
|
||||
}
|
||||
|
@ -537,3 +537,155 @@ pk
|
||||
-5
|
||||
1
|
||||
drop table t1;
|
||||
#
|
||||
# End of 5.3 tests
|
||||
#
|
||||
#
|
||||
# MDEV-16534 PPC64: Unexpected error with a negative values into auto-increment columns in HEAP, MyISAM, ARIA
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
id TINYINT NOT NULL AUTO_INCREMENT,
|
||||
name CHAR(30) NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=MyISAM;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`id` tinyint(4) NOT NULL AUTO_INCREMENT,
|
||||
`name` char(30) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 (name) VALUES ('dog');
|
||||
UPDATE t1 SET id=-1 WHERE id=1;
|
||||
INSERT INTO t1 (name) VALUES ('cat');
|
||||
SELECT * FROM t1;
|
||||
id name
|
||||
-1 dog
|
||||
2 cat
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 5.5 tests
|
||||
#
|
||||
#
|
||||
# MDEV-15352 AUTO_INCREMENT breaks after updating a column value to a negative number
|
||||
#
|
||||
SET @engine='MyISAM';
|
||||
CREATE PROCEDURE autoinc_mdev15353_one(engine VARCHAR(64), t VARCHAR(64))
|
||||
BEGIN
|
||||
DECLARE query TEXT DEFAULT 'CREATE TABLE t1 ('
|
||||
' id TTT NOT NULL AUTO_INCREMENT,'
|
||||
' name CHAR(30) NOT NULL,'
|
||||
' PRIMARY KEY (id)) ENGINE=EEE';
|
||||
EXECUTE IMMEDIATE REPLACE(REPLACE(query,'TTT', t), 'EEE', engine);
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 (name) VALUES ('dog');
|
||||
SELECT * FROM t1;
|
||||
UPDATE t1 SET id=-1 WHERE id=1;
|
||||
SELECT * FROM t1;
|
||||
INSERT INTO t1 (name) VALUES ('cat');
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
END;
|
||||
$$
|
||||
CALL autoinc_mdev15353_one(@engine, 'tinyint');
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`id` tinyint(4) NOT NULL AUTO_INCREMENT,
|
||||
`name` char(30) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
id name
|
||||
1 dog
|
||||
id name
|
||||
-1 dog
|
||||
id name
|
||||
-1 dog
|
||||
2 cat
|
||||
CALL autoinc_mdev15353_one(@engine, 'smallint');
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`id` smallint(6) NOT NULL AUTO_INCREMENT,
|
||||
`name` char(30) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
id name
|
||||
1 dog
|
||||
id name
|
||||
-1 dog
|
||||
id name
|
||||
-1 dog
|
||||
2 cat
|
||||
CALL autoinc_mdev15353_one(@engine, 'mediumint');
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`id` mediumint(9) NOT NULL AUTO_INCREMENT,
|
||||
`name` char(30) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
id name
|
||||
1 dog
|
||||
id name
|
||||
-1 dog
|
||||
id name
|
||||
-1 dog
|
||||
2 cat
|
||||
CALL autoinc_mdev15353_one(@engine, 'int');
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` char(30) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
id name
|
||||
1 dog
|
||||
id name
|
||||
-1 dog
|
||||
id name
|
||||
-1 dog
|
||||
2 cat
|
||||
CALL autoinc_mdev15353_one(@engine, 'bigint');
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`name` char(30) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
id name
|
||||
1 dog
|
||||
id name
|
||||
-1 dog
|
||||
id name
|
||||
-1 dog
|
||||
2 cat
|
||||
CALL autoinc_mdev15353_one(@engine, 'float');
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`id` float NOT NULL AUTO_INCREMENT,
|
||||
`name` char(30) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
id name
|
||||
1 dog
|
||||
id name
|
||||
-1 dog
|
||||
id name
|
||||
-1 dog
|
||||
2 cat
|
||||
CALL autoinc_mdev15353_one(@engine, 'double');
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`id` double NOT NULL AUTO_INCREMENT,
|
||||
`name` char(30) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
id name
|
||||
1 dog
|
||||
id name
|
||||
-1 dog
|
||||
id name
|
||||
-1 dog
|
||||
2 cat
|
||||
DROP PROCEDURE autoinc_mdev15353_one;
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
|
@ -397,3 +397,39 @@ insert into t1 values(null);
|
||||
select last_insert_id();
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 5.3 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-16534 PPC64: Unexpected error with a negative values into auto-increment columns in HEAP, MyISAM, ARIA
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (
|
||||
id TINYINT NOT NULL AUTO_INCREMENT,
|
||||
name CHAR(30) NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=MyISAM;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 (name) VALUES ('dog');
|
||||
UPDATE t1 SET id=-1 WHERE id=1;
|
||||
INSERT INTO t1 (name) VALUES ('cat');
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 5.5 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-15352 AUTO_INCREMENT breaks after updating a column value to a negative number
|
||||
--echo #
|
||||
|
||||
SET @engine='MyISAM';
|
||||
--source include/autoinc_mdev15353.inc
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
||||
|
||||
|
@ -1478,3 +1478,37 @@ select 2 as f;
|
||||
f
|
||||
2
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-16473: query with CTE when no database is set
|
||||
#
|
||||
create database db_mdev_16473;
|
||||
use db_mdev_16473;
|
||||
drop database db_mdev_16473;
|
||||
# Now no default database is set
|
||||
select database();
|
||||
database()
|
||||
NULL
|
||||
with cte as (select 1 as a) select * from cte;
|
||||
a
|
||||
1
|
||||
create database db_mdev_16473;
|
||||
create table db_mdev_16473.t1 (a int);
|
||||
insert into db_mdev_16473.t1 values (2), (7), (3), (1);
|
||||
with cte as (select * from db_mdev_16473.t1) select * from cte;
|
||||
a
|
||||
2
|
||||
7
|
||||
3
|
||||
1
|
||||
with cte as (select * from db_mdev_16473.t1)
|
||||
select * from cte, t1 as t where cte.a=t.a;
|
||||
ERROR 3D000: No database selected
|
||||
with cte as (select * from db_mdev_16473.t1)
|
||||
select * from cte, db_mdev_16473.t1 as t where cte.a=t.a;
|
||||
a a
|
||||
2 2
|
||||
7 7
|
||||
3 3
|
||||
1 1
|
||||
drop database db_mdev_16473;
|
||||
use test;
|
||||
|
@ -1029,4 +1029,31 @@ with cte as
|
||||
select 2 as f;
|
||||
|
||||
drop table t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-16473: query with CTE when no database is set
|
||||
--echo #
|
||||
|
||||
create database db_mdev_16473;
|
||||
use db_mdev_16473;
|
||||
drop database db_mdev_16473;
|
||||
|
||||
--echo # Now no default database is set
|
||||
select database();
|
||||
|
||||
with cte as (select 1 as a) select * from cte;
|
||||
|
||||
create database db_mdev_16473;
|
||||
create table db_mdev_16473.t1 (a int);
|
||||
insert into db_mdev_16473.t1 values (2), (7), (3), (1);
|
||||
with cte as (select * from db_mdev_16473.t1) select * from cte;
|
||||
|
||||
--error ER_NO_DB_ERROR
|
||||
with cte as (select * from db_mdev_16473.t1)
|
||||
select * from cte, t1 as t where cte.a=t.a;
|
||||
with cte as (select * from db_mdev_16473.t1)
|
||||
select * from cte, db_mdev_16473.t1 as t where cte.a=t.a;
|
||||
|
||||
drop database db_mdev_16473;
|
||||
|
||||
use test;
|
||||
|
@ -13206,6 +13206,341 @@ a
|
||||
2
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-16386: pushing condition into the HAVING clause when ambiguous
|
||||
# fields warning appears
|
||||
#
|
||||
CREATE TABLE t1 (a INT, b INT);
|
||||
INSERT INTO t1 VALUES (1,2),(2,3),(3,4);
|
||||
SELECT * FROM
|
||||
(
|
||||
SELECT t1.b AS a
|
||||
FROM t1
|
||||
GROUP BY t1.a
|
||||
) dt
|
||||
WHERE (dt.a=2);
|
||||
a
|
||||
2
|
||||
EXPLAIN FORMAT=JSON SELECT * FROM
|
||||
(
|
||||
SELECT t1.b AS a
|
||||
FROM t1
|
||||
GROUP BY t1.a
|
||||
) dt
|
||||
WHERE (dt.a=2);
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "<derived2>",
|
||||
"access_type": "ALL",
|
||||
"rows": 3,
|
||||
"filtered": 100,
|
||||
"attached_condition": "dt.a = 2",
|
||||
"materialized": {
|
||||
"query_block": {
|
||||
"select_id": 2,
|
||||
"having_condition": "a = 2",
|
||||
"filesort": {
|
||||
"sort_key": "t1.a",
|
||||
"temporary_table": {
|
||||
"table": {
|
||||
"table_name": "t1",
|
||||
"access_type": "ALL",
|
||||
"rows": 3,
|
||||
"filtered": 100
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SELECT * FROM
|
||||
(
|
||||
SELECT t1.b AS a
|
||||
FROM t1
|
||||
GROUP BY t1.a
|
||||
HAVING (t1.a<3)
|
||||
) dt
|
||||
WHERE (dt.a>1);
|
||||
a
|
||||
2
|
||||
3
|
||||
EXPLAIN FORMAT=JSON SELECT * FROM
|
||||
(
|
||||
SELECT t1.b AS a
|
||||
FROM t1
|
||||
GROUP BY t1.a
|
||||
HAVING (t1.a<3)
|
||||
) dt
|
||||
WHERE (dt.a>1);
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "<derived2>",
|
||||
"access_type": "ALL",
|
||||
"rows": 3,
|
||||
"filtered": 100,
|
||||
"attached_condition": "dt.a > 1",
|
||||
"materialized": {
|
||||
"query_block": {
|
||||
"select_id": 2,
|
||||
"having_condition": "t1.a < 3 and a > 1",
|
||||
"filesort": {
|
||||
"sort_key": "t1.a",
|
||||
"temporary_table": {
|
||||
"table": {
|
||||
"table_name": "t1",
|
||||
"access_type": "ALL",
|
||||
"rows": 3,
|
||||
"filtered": 100
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SELECT * FROM
|
||||
(
|
||||
SELECT 'ab' AS a
|
||||
FROM t1
|
||||
GROUP BY t1.a
|
||||
) dt
|
||||
WHERE (dt.a='ab');
|
||||
a
|
||||
ab
|
||||
ab
|
||||
ab
|
||||
EXPLAIN FORMAT=JSON SELECT * FROM
|
||||
(
|
||||
SELECT 'ab' AS a
|
||||
FROM t1
|
||||
GROUP BY t1.a
|
||||
) dt
|
||||
WHERE (dt.a='ab');
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "<derived2>",
|
||||
"access_type": "ALL",
|
||||
"rows": 3,
|
||||
"filtered": 100,
|
||||
"attached_condition": "dt.a = 'ab'",
|
||||
"materialized": {
|
||||
"query_block": {
|
||||
"select_id": 2,
|
||||
"filesort": {
|
||||
"sort_key": "t1.a",
|
||||
"temporary_table": {
|
||||
"table": {
|
||||
"table_name": "t1",
|
||||
"access_type": "ALL",
|
||||
"rows": 3,
|
||||
"filtered": 100
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SELECT * FROM
|
||||
(
|
||||
SELECT 1 AS a
|
||||
FROM t1
|
||||
GROUP BY t1.a
|
||||
) dt
|
||||
WHERE (dt.a=1);
|
||||
a
|
||||
1
|
||||
1
|
||||
1
|
||||
EXPLAIN FORMAT=JSON SELECT * FROM
|
||||
(
|
||||
SELECT 1 AS a
|
||||
FROM t1
|
||||
GROUP BY t1.a
|
||||
) dt
|
||||
WHERE (dt.a=1);
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "<derived2>",
|
||||
"access_type": "ALL",
|
||||
"rows": 3,
|
||||
"filtered": 100,
|
||||
"attached_condition": "dt.a = 1",
|
||||
"materialized": {
|
||||
"query_block": {
|
||||
"select_id": 2,
|
||||
"filesort": {
|
||||
"sort_key": "t1.a",
|
||||
"temporary_table": {
|
||||
"table": {
|
||||
"table_name": "t1",
|
||||
"access_type": "ALL",
|
||||
"rows": 3,
|
||||
"filtered": 100
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-16517: pushdown condition with the IN predicate defined
|
||||
# with non-constant values
|
||||
#
|
||||
CREATE TABLE t1 (a INT, b INT);
|
||||
INSERT INTO t1 VALUES (1,2),(1,3);
|
||||
SELECT * FROM
|
||||
(
|
||||
SELECT t1.a
|
||||
FROM t1
|
||||
WHERE 1 IN (0,t1.a)
|
||||
GROUP BY t1.a
|
||||
) AS dt1
|
||||
JOIN
|
||||
(
|
||||
SELECT t1.a
|
||||
FROM t1
|
||||
WHERE 1 IN (0,t1.a)
|
||||
) AS dt2
|
||||
ON dt1.a = dt2.a;
|
||||
a a
|
||||
1 1
|
||||
1 1
|
||||
EXPLAIN FORMAT=JSON SELECT * FROM
|
||||
(
|
||||
SELECT t1.a
|
||||
FROM t1
|
||||
WHERE 1 IN (0,t1.a)
|
||||
GROUP BY t1.a
|
||||
) AS dt1
|
||||
JOIN
|
||||
(
|
||||
SELECT t1.a
|
||||
FROM t1
|
||||
WHERE 1 IN (0,t1.a)
|
||||
) AS dt2
|
||||
ON dt1.a = dt2.a;
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "<derived2>",
|
||||
"access_type": "ALL",
|
||||
"rows": 2,
|
||||
"filtered": 100,
|
||||
"attached_condition": "1 in (0,dt1.a)",
|
||||
"materialized": {
|
||||
"query_block": {
|
||||
"select_id": 2,
|
||||
"filesort": {
|
||||
"sort_key": "t1.a",
|
||||
"temporary_table": {
|
||||
"table": {
|
||||
"table_name": "t1",
|
||||
"access_type": "ALL",
|
||||
"rows": 2,
|
||||
"filtered": 100,
|
||||
"attached_condition": "1 in (0,t1.a) and 1 in (0,t1.a)"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"block-nl-join": {
|
||||
"table": {
|
||||
"table_name": "t1",
|
||||
"access_type": "ALL",
|
||||
"rows": 2,
|
||||
"filtered": 100
|
||||
},
|
||||
"buffer_type": "flat",
|
||||
"buffer_size": "256Kb",
|
||||
"join_type": "BNL",
|
||||
"attached_condition": "t1.a = dt1.a"
|
||||
}
|
||||
}
|
||||
}
|
||||
SELECT * FROM
|
||||
(
|
||||
SELECT t1.a,MAX(t1.b)
|
||||
FROM t1
|
||||
GROUP BY t1.a
|
||||
) AS dt, t1
|
||||
WHERE dt.a=t1.a AND dt.a IN (1,t1.a);
|
||||
a MAX(t1.b) a b
|
||||
1 3 1 2
|
||||
1 3 1 3
|
||||
EXPLAIN FORMAT=JSON SELECT * FROM
|
||||
(
|
||||
SELECT t1.a,MAX(t1.b)
|
||||
FROM t1
|
||||
GROUP BY t1.a
|
||||
) AS dt, t1
|
||||
WHERE dt.a=t1.a AND dt.a IN (1,t1.a);
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "<derived2>",
|
||||
"access_type": "ALL",
|
||||
"rows": 2,
|
||||
"filtered": 100,
|
||||
"attached_condition": "dt.a in (1,dt.a)",
|
||||
"materialized": {
|
||||
"query_block": {
|
||||
"select_id": 2,
|
||||
"filesort": {
|
||||
"sort_key": "t1.a",
|
||||
"temporary_table": {
|
||||
"table": {
|
||||
"table_name": "t1",
|
||||
"access_type": "ALL",
|
||||
"rows": 2,
|
||||
"filtered": 100,
|
||||
"attached_condition": "t1.a in (1,t1.a)"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"block-nl-join": {
|
||||
"table": {
|
||||
"table_name": "t1",
|
||||
"access_type": "ALL",
|
||||
"rows": 2,
|
||||
"filtered": 100
|
||||
},
|
||||
"buffer_type": "flat",
|
||||
"buffer_size": "256Kb",
|
||||
"join_type": "BNL",
|
||||
"attached_condition": "t1.a = dt.a"
|
||||
}
|
||||
}
|
||||
}
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-10855: Pushdown into derived with window functions
|
||||
#
|
||||
set @save_optimizer_switch= @@optimizer_switch;
|
||||
|
@ -2176,7 +2176,7 @@ CREATE TABLE t2 (x INT, y INT, z INT);
|
||||
INSERT INTO t1 VALUES (1,1,66,1), (1,1,56,2), (3,2,42,3);
|
||||
INSERT INTO t2 VALUES (1,1,66), (1,12,32);
|
||||
|
||||
LET $query=
|
||||
let $query=
|
||||
SELECT *
|
||||
FROM t2,
|
||||
(
|
||||
@ -2187,11 +2187,11 @@ FROM t2,
|
||||
) AS v1
|
||||
WHERE (v1.a=1) AND (v1.b=v1.a) AND
|
||||
(v1.a=t2.x) AND (v1.max_c>30);
|
||||
EVAL $query;
|
||||
EVAL EXPLAIN $query;
|
||||
EVAL EXPLAIN FORMAT=JSON $query;
|
||||
eval $query;
|
||||
eval EXPLAIN $query;
|
||||
eval EXPLAIN FORMAT=JSON $query;
|
||||
|
||||
LET $query=
|
||||
let $query=
|
||||
SELECT *
|
||||
FROM t2,
|
||||
(
|
||||
@ -2202,9 +2202,9 @@ FROM t2,
|
||||
) AS v1
|
||||
WHERE (v1.a=1) AND (v1.b=v1.a) AND (v1.b=v1.d) AND
|
||||
(v1.a=t2.x) AND (v1.max_c>30);
|
||||
EVAL $query;
|
||||
EVAL EXPLAIN $query;
|
||||
EVAL EXPLAIN FORMAT=JSON $query;
|
||||
eval $query;
|
||||
eval EXPLAIN $query;
|
||||
eval EXPLAIN FORMAT=JSON $query;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
@ -2230,7 +2230,7 @@ CREATE TABLE t2 (e INT, f INT, g INT);
|
||||
INSERT INTO t1 VALUES (1,14),(2,13),(1,19),(2,32),(3,24);
|
||||
INSERT INTO t2 VALUES (1,19,2),(3,24,1),(1,12,2),(3,11,3),(2,32,1);
|
||||
|
||||
LET $query=
|
||||
let $query=
|
||||
SELECT * FROM t1
|
||||
WHERE (t1.a,t1.b) IN
|
||||
(
|
||||
@ -2244,11 +2244,11 @@ WHERE (t1.a,t1.b) IN
|
||||
WHERE d_tab.e>1
|
||||
)
|
||||
;
|
||||
EVAL $query;
|
||||
EVAL EXPLAIN $query;
|
||||
EVAL EXPLAIN FORMAT=JSON $query;
|
||||
eval $query;
|
||||
eval EXPLAIN $query;
|
||||
eval EXPLAIN FORMAT=JSON $query;
|
||||
|
||||
LET $query=
|
||||
let $query=
|
||||
SELECT * FROM t1
|
||||
WHERE (t1.a,t1.b) IN
|
||||
(
|
||||
@ -2262,11 +2262,11 @@ WHERE (t1.a,t1.b) IN
|
||||
WHERE d_tab.max_f<25
|
||||
)
|
||||
;
|
||||
EVAL $query;
|
||||
EVAL EXPLAIN $query;
|
||||
EVAL EXPLAIN FORMAT=JSON $query;
|
||||
eval $query;
|
||||
eval EXPLAIN $query;
|
||||
eval EXPLAIN FORMAT=JSON $query;
|
||||
|
||||
LET $query=
|
||||
let $query=
|
||||
SELECT * FROM t1
|
||||
WHERE (t1.a,t1.b) IN
|
||||
(
|
||||
@ -2280,11 +2280,11 @@ WHERE (t1.a,t1.b) IN
|
||||
GROUP BY d_tab.g
|
||||
)
|
||||
;
|
||||
EVAL $query;
|
||||
EVAL EXPLAIN $query;
|
||||
EVAL EXPLAIN FORMAT=JSON $query;
|
||||
eval $query;
|
||||
eval EXPLAIN $query;
|
||||
eval EXPLAIN FORMAT=JSON $query;
|
||||
|
||||
LET $query=
|
||||
let $query=
|
||||
SELECT * FROM t1
|
||||
WHERE (t1.a,t1.b) IN
|
||||
(
|
||||
@ -2298,9 +2298,9 @@ WHERE (t1.a,t1.b) IN
|
||||
GROUP BY d_tab.g
|
||||
)
|
||||
;
|
||||
EVAL $query;
|
||||
EVAL EXPLAIN $query;
|
||||
EVAL EXPLAIN FORMAT=JSON $query;
|
||||
eval $query;
|
||||
eval EXPLAIN $query;
|
||||
eval EXPLAIN FORMAT=JSON $query;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
@ -2320,6 +2320,100 @@ WHERE (a>0 AND a<2 OR a IN (2,3)) AND
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-16386: pushing condition into the HAVING clause when ambiguous
|
||||
--echo # fields warning appears
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a INT, b INT);
|
||||
|
||||
INSERT INTO t1 VALUES (1,2),(2,3),(3,4);
|
||||
|
||||
let $query=
|
||||
SELECT * FROM
|
||||
(
|
||||
SELECT t1.b AS a
|
||||
FROM t1
|
||||
GROUP BY t1.a
|
||||
) dt
|
||||
WHERE (dt.a=2);
|
||||
eval $query;
|
||||
eval EXPLAIN FORMAT=JSON $query;
|
||||
|
||||
let $query=
|
||||
SELECT * FROM
|
||||
(
|
||||
SELECT t1.b AS a
|
||||
FROM t1
|
||||
GROUP BY t1.a
|
||||
HAVING (t1.a<3)
|
||||
) dt
|
||||
WHERE (dt.a>1);
|
||||
eval $query;
|
||||
eval EXPLAIN FORMAT=JSON $query;
|
||||
|
||||
let $query=
|
||||
SELECT * FROM
|
||||
(
|
||||
SELECT 'ab' AS a
|
||||
FROM t1
|
||||
GROUP BY t1.a
|
||||
) dt
|
||||
WHERE (dt.a='ab');
|
||||
eval $query;
|
||||
eval EXPLAIN FORMAT=JSON $query;
|
||||
|
||||
let $query=
|
||||
SELECT * FROM
|
||||
(
|
||||
SELECT 1 AS a
|
||||
FROM t1
|
||||
GROUP BY t1.a
|
||||
) dt
|
||||
WHERE (dt.a=1);
|
||||
eval $query;
|
||||
eval EXPLAIN FORMAT=JSON $query;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-16517: pushdown condition with the IN predicate defined
|
||||
--echo # with non-constant values
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a INT, b INT);
|
||||
INSERT INTO t1 VALUES (1,2),(1,3);
|
||||
|
||||
let $query=
|
||||
SELECT * FROM
|
||||
(
|
||||
SELECT t1.a
|
||||
FROM t1
|
||||
WHERE 1 IN (0,t1.a)
|
||||
GROUP BY t1.a
|
||||
) AS dt1
|
||||
JOIN
|
||||
(
|
||||
SELECT t1.a
|
||||
FROM t1
|
||||
WHERE 1 IN (0,t1.a)
|
||||
) AS dt2
|
||||
ON dt1.a = dt2.a;
|
||||
eval $query;
|
||||
eval EXPLAIN FORMAT=JSON $query;
|
||||
|
||||
let $query=
|
||||
SELECT * FROM
|
||||
(
|
||||
SELECT t1.a,MAX(t1.b)
|
||||
FROM t1
|
||||
GROUP BY t1.a
|
||||
) AS dt, t1
|
||||
WHERE dt.a=t1.a AND dt.a IN (1,t1.a);
|
||||
eval $query;
|
||||
eval EXPLAIN FORMAT=JSON $query;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Start of 10.3 tests
|
||||
|
||||
--echo #
|
||||
|
@ -2977,5 +2977,45 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
Warnings:
|
||||
Note 1003 /* select#1 */ select straight_join `test`.`t1`.`c1` AS `c1` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`c1`,<exists>(/* select#3 */ select `test`.`t2`.`c2` from `test`.`t2` where <cache>(`test`.`t1`.`c1`) = `test`.`t2`.`c2`))
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# Bug mdev-16420: materialized view that renames columns
|
||||
# in inner part of outer join
|
||||
#
|
||||
CREATE TABLE t1 (id int, PRIMARY KEY (id));
|
||||
INSERT INTO t1 VALUES (2), (3), (7), (1);
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
CREATE VIEW v2 AS SELECT v1.id AS order_pk FROM v1 GROUP BY v1.id;
|
||||
CREATE VIEW v3 AS
|
||||
SELECT t.id AS order_pk FROM (SELECT * FROM t1) AS t GROUP BY t.id;
|
||||
SELECT * FROM t1 LEFT JOIN v2 ON t1.id=v2.order_pk;
|
||||
id order_pk
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
7 7
|
||||
EXPLAIN EXTENDED
|
||||
SELECT * FROM t1 LEFT JOIN v2 ON t1.id=v2.order_pk;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
|
||||
1 PRIMARY <derived2> ref key0 key0 5 test.t1.id 2 100.00
|
||||
2 DERIVED t1 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index; Using filesort
|
||||
Warnings:
|
||||
Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`v2`.`order_pk` AS `order_pk` from `test`.`t1` left join `test`.`v2` on(`v2`.`order_pk` = `test`.`t1`.`id`) where 1
|
||||
SELECT * FROM t1 LEFT JOIN v3 ON t1.id=v3.order_pk;
|
||||
id order_pk
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
7 7
|
||||
EXPLAIN EXTENDED
|
||||
SELECT * FROM t1 LEFT JOIN v3 ON t1.id=v3.order_pk;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
|
||||
1 PRIMARY <derived2> ref key0 key0 5 test.t1.id 2 100.00
|
||||
2 DERIVED t1 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index; Using filesort
|
||||
Warnings:
|
||||
Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`v3`.`order_pk` AS `order_pk` from `test`.`t1` left join `test`.`v3` on(`v3`.`order_pk` = `test`.`t1`.`id`) where 1
|
||||
DROP VIEW v1,v2,v3;
|
||||
DROP TABLE t1;
|
||||
set optimizer_switch=@exit_optimizer_switch;
|
||||
set join_cache_level=@exit_join_cache_level;
|
||||
|
@ -1949,6 +1949,30 @@ eval EXPLAIN EXTENDED $q;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo #
|
||||
--echo # Bug mdev-16420: materialized view that renames columns
|
||||
--echo # in inner part of outer join
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (id int, PRIMARY KEY (id));
|
||||
INSERT INTO t1 VALUES (2), (3), (7), (1);
|
||||
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
CREATE VIEW v2 AS SELECT v1.id AS order_pk FROM v1 GROUP BY v1.id;
|
||||
CREATE VIEW v3 AS
|
||||
SELECT t.id AS order_pk FROM (SELECT * FROM t1) AS t GROUP BY t.id;
|
||||
|
||||
SELECT * FROM t1 LEFT JOIN v2 ON t1.id=v2.order_pk;
|
||||
EXPLAIN EXTENDED
|
||||
SELECT * FROM t1 LEFT JOIN v2 ON t1.id=v2.order_pk;
|
||||
|
||||
SELECT * FROM t1 LEFT JOIN v3 ON t1.id=v3.order_pk;
|
||||
EXPLAIN EXTENDED
|
||||
SELECT * FROM t1 LEFT JOIN v3 ON t1.id=v3.order_pk;
|
||||
|
||||
DROP VIEW v1,v2,v3;
|
||||
DROP TABLE t1;
|
||||
|
||||
# The following command must be the last one the file
|
||||
set optimizer_switch=@exit_optimizer_switch;
|
||||
set join_cache_level=@exit_join_cache_level;
|
||||
|
@ -739,6 +739,14 @@ drop table t1;
|
||||
select json_extract('{"test":8.437e-5}','$.test');
|
||||
json_extract('{"test":8.437e-5}','$.test')
|
||||
8.437e-5
|
||||
select json_value('{"b":true}','$.b')=1;
|
||||
json_value('{"b":true}','$.b')=1
|
||||
1
|
||||
CREATE TABLE t1 (c VARCHAR(8));
|
||||
INSERT INTO t1 VALUES ('foo'),('bar');
|
||||
SELECT * FROM t1 WHERE c IN (JSON_EXTRACT('{"a":"b"}', '$.*'));
|
||||
c
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
|
@ -397,6 +397,21 @@ drop table t1;
|
||||
|
||||
select json_extract('{"test":8.437e-5}','$.test');
|
||||
|
||||
#
|
||||
# MDEV-15905 select json_value('{"b":true}','$.b')=1 --> false with
|
||||
# "Truncated incorrect DOUBLE value: 'true'"
|
||||
#
|
||||
select json_value('{"b":true}','$.b')=1;
|
||||
|
||||
#
|
||||
# MDEV-16209 JSON_EXTRACT in query crashes server.
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (c VARCHAR(8));
|
||||
INSERT INTO t1 VALUES ('foo'),('bar');
|
||||
SELECT * FROM t1 WHERE c IN (JSON_EXTRACT('{"a":"b"}', '$.*'));
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
||||
|
@ -1563,6 +1563,26 @@ def INET_ATON("255.255.255.255.255.255.255.255") 8 21 20 Y 32928 0 63
|
||||
INET_ATON("255.255.255.255.255.255.255.255")
|
||||
18446744073709551615
|
||||
#
|
||||
# MDEV-8049 name_const() is not consistent about its signess
|
||||
#
|
||||
SELECT 18446744073709551615 AS c1, name_const('a',18446744073709551615) AS c2;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def c1 8 20 20 N 32929 0 63
|
||||
def c2 8 20 20 Y 32928 0 63
|
||||
c1 c2
|
||||
18446744073709551615 18446744073709551615
|
||||
CREATE TABLE t1 AS SELECT 18446744073709551615 AS c1, name_const('a',18446744073709551615) AS c2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` bigint(20) unsigned NOT NULL,
|
||||
`c2` bigint(20) unsigned DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
18446744073709551615 18446744073709551615
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 10.3 tests
|
||||
#
|
||||
#
|
||||
|
@ -1204,6 +1204,20 @@ SELECT INET_ATON("255.255.255.255.255.255.255.255");
|
||||
--enable_ps_protocol
|
||||
--disable_metadata
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-8049 name_const() is not consistent about its signess
|
||||
--echo #
|
||||
|
||||
--enable_metadata
|
||||
--disable_ps_protocol
|
||||
SELECT 18446744073709551615 AS c1, name_const('a',18446744073709551615) AS c2;
|
||||
--enable_ps_protocol
|
||||
--disable_metadata
|
||||
|
||||
CREATE TABLE t1 AS SELECT 18446744073709551615 AS c1, name_const('a',18446744073709551615) AS c2;
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
--echo #
|
||||
--echo # End of 10.3 tests
|
||||
--echo #
|
||||
|
@ -206,3 +206,22 @@ time(f1)
|
||||
21:00:00.000000
|
||||
21:00:01.000000
|
||||
drop table t1;
|
||||
#
|
||||
# Start of 10.3 tests
|
||||
#
|
||||
#
|
||||
# MDEV-10182 Bad value when inserting COALESCE(CURRENT_TIMESTAMP) into a DECIMAL column
|
||||
#
|
||||
SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30.000000');
|
||||
CREATE TABLE t1 (a DECIMAL(30,0));
|
||||
INSERT INTO t1 VALUES (CURRENT_TIMESTAMP(6));
|
||||
INSERT INTO t1 VALUES (COALESCE(CURRENT_TIMESTAMP(6)));
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
20010101102030
|
||||
20010101102030
|
||||
DROP TABLE t1;
|
||||
SET timestamp=DEFAULT;
|
||||
#
|
||||
# End of 10.3 tests
|
||||
#
|
||||
|
@ -106,3 +106,24 @@ alter table t1 modify f1 varchar(100);
|
||||
select time(f1) from t1;
|
||||
select time(f1) from t1 union all select time(f1 + interval 1 second) from t1;
|
||||
drop table t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.3 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-10182 Bad value when inserting COALESCE(CURRENT_TIMESTAMP) into a DECIMAL column
|
||||
--echo #
|
||||
|
||||
SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30.000000');
|
||||
CREATE TABLE t1 (a DECIMAL(30,0));
|
||||
INSERT INTO t1 VALUES (CURRENT_TIMESTAMP(6));
|
||||
INSERT INTO t1 VALUES (COALESCE(CURRENT_TIMESTAMP(6)));
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
SET timestamp=DEFAULT;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.3 tests
|
||||
--echo #
|
||||
|
@ -469,7 +469,6 @@ Note 1105 DBUG: [0,0] handler=int
|
||||
Note 1105 DBUG: [0,1] handler=geometry
|
||||
Note 1105 DBUG: [0,2] handler=int
|
||||
Error 4078 Illegal parameter data types int and geometry for operation 'in'
|
||||
Note 1105 DBUG: types_compatible=yes bisect=yes
|
||||
SELECT (1,(0,0)) IN ((1,(POINT(1,1),0)),(0,(0,0)));
|
||||
ERROR HY000: Illegal parameter data types int and geometry for operation 'in'
|
||||
SHOW WARNINGS;
|
||||
@ -490,7 +489,6 @@ Note 1105 DBUG: [0,0] handler=int
|
||||
Note 1105 DBUG: [0,1] handler=geometry
|
||||
Note 1105 DBUG: [0,2] handler=int
|
||||
Error 4078 Illegal parameter data types int and geometry for operation 'in'
|
||||
Note 1105 DBUG: types_compatible=yes bisect=yes
|
||||
SET SESSION debug_dbug="-d,Predicant_to_list_comparator";
|
||||
SET SESSION debug_dbug="-d,Item_func_in";
|
||||
SET SESSION debug_dbug="-d,cmp_item";
|
||||
|
@ -1451,6 +1451,7 @@ CURRENT_USER()
|
||||
root@localhost
|
||||
SET PASSWORD FOR CURRENT_USER() = PASSWORD("admin");
|
||||
SET PASSWORD FOR CURRENT_USER() = PASSWORD("");
|
||||
update mysql.user set plugin='';
|
||||
|
||||
# Bug#57952
|
||||
|
||||
|
@ -1265,6 +1265,9 @@ SELECT CURRENT_USER();
|
||||
SET PASSWORD FOR CURRENT_USER() = PASSWORD("admin");
|
||||
SET PASSWORD FOR CURRENT_USER() = PASSWORD("");
|
||||
|
||||
#cleanup after MDEV-16238
|
||||
update mysql.user set plugin='';
|
||||
|
||||
#
|
||||
# Bug#57952: privilege change is not taken into account by EXECUTE.
|
||||
#
|
||||
|
@ -372,8 +372,8 @@ mysqltest_1@127.0.0.1
|
||||
set password = password('changed');
|
||||
disconnect b12302;
|
||||
connection default;
|
||||
select host, length(password) from mysql.user where user like 'mysqltest\_1';
|
||||
host length(password)
|
||||
select host, length(authentication_string) from mysql.user where user like 'mysqltest\_1';
|
||||
host length(authentication_string)
|
||||
127.0.0.1 41
|
||||
revoke all on mysqltest_1.* from mysqltest_1@'127.0.0.1';
|
||||
delete from mysql.user where user like 'mysqltest\_1';
|
||||
@ -387,8 +387,8 @@ mysqltest_1@127.0.0.0/255.0.0.0
|
||||
set password = password('changed');
|
||||
disconnect b12302_2;
|
||||
connection default;
|
||||
select host, length(password) from mysql.user where user like 'mysqltest\_1';
|
||||
host length(password)
|
||||
select host, length(authentication_string) from mysql.user where user like 'mysqltest\_1';
|
||||
host length(authentication_string)
|
||||
127.0.0.0/255.0.0.0 41
|
||||
revoke all on mysqltest_1.* from mysqltest_1@'127.0.0.0/255.0.0.0';
|
||||
delete from mysql.user where user like 'mysqltest\_1';
|
||||
|
@ -385,7 +385,7 @@ select current_user();
|
||||
set password = password('changed');
|
||||
disconnect b12302;
|
||||
connection default;
|
||||
select host, length(password) from mysql.user where user like 'mysqltest\_1';
|
||||
select host, length(authentication_string) from mysql.user where user like 'mysqltest\_1';
|
||||
revoke all on mysqltest_1.* from mysqltest_1@'127.0.0.1';
|
||||
delete from mysql.user where user like 'mysqltest\_1';
|
||||
flush privileges;
|
||||
@ -396,7 +396,7 @@ select current_user();
|
||||
set password = password('changed');
|
||||
disconnect b12302_2;
|
||||
connection default;
|
||||
select host, length(password) from mysql.user where user like 'mysqltest\_1';
|
||||
select host, length(authentication_string) from mysql.user where user like 'mysqltest\_1';
|
||||
revoke all on mysqltest_1.* from mysqltest_1@'127.0.0.0/255.0.0.0';
|
||||
delete from mysql.user where user like 'mysqltest\_1';
|
||||
flush privileges;
|
||||
|
@ -711,6 +711,23 @@ a ct
|
||||
set sql_mode=@save_sql_mode;
|
||||
drop table t1;
|
||||
#
|
||||
# mdev-16235: impossible HAVING in query without aggregation
|
||||
#
|
||||
explain extended
|
||||
select * from mysql.help_topic where example = 'foo' having description is null;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
|
||||
Warnings:
|
||||
Note 1003 select `mysql`.`help_topic`.`help_topic_id` AS `help_topic_id`,`mysql`.`help_topic`.`name` AS `name`,`mysql`.`help_topic`.`help_category_id` AS `help_category_id`,`mysql`.`help_topic`.`description` AS `description`,`mysql`.`help_topic`.`example` AS `example`,`mysql`.`help_topic`.`url` AS `url` from `mysql`.`help_topic` where `mysql`.`help_topic`.`example` = 'foo' having 0
|
||||
select * from mysql.help_topic where example = 'foo' having description is null;
|
||||
help_topic_id name help_category_id description example url
|
||||
#
|
||||
# End of 5. tests
|
||||
#
|
||||
#
|
||||
# Start of 10.0 tests
|
||||
#
|
||||
#
|
||||
# Bug mdev-5160: two-way join with HAVING over the second table
|
||||
#
|
||||
CREATE TABLE t1 (c1 varchar(6)) ENGINE=MyISAM;
|
||||
|
@ -745,6 +745,23 @@ set sql_mode=@save_sql_mode;
|
||||
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # mdev-16235: impossible HAVING in query without aggregation
|
||||
--echo #
|
||||
|
||||
explain extended
|
||||
select * from mysql.help_topic where example = 'foo' having description is null;
|
||||
|
||||
select * from mysql.help_topic where example = 'foo' having description is null;
|
||||
|
||||
--echo #
|
||||
--echo # End of 5. tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.0 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # Bug mdev-5160: two-way join with HAVING over the second table
|
||||
--echo #
|
||||
|
@ -1489,7 +1489,7 @@ USE test;
|
||||
End of 5.0 tests.
|
||||
select * from information_schema.engines WHERE ENGINE="MyISAM";
|
||||
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
||||
MyISAM DEFAULT MyISAM storage engine NO NO NO
|
||||
MyISAM DEFAULT Non-transactional engine with good performance and small data footprint NO NO NO
|
||||
grant select on *.* to user3148@localhost;
|
||||
connect con3148,localhost,user3148,,test;
|
||||
connection con3148;
|
||||
|
@ -146,3 +146,19 @@ a
|
||||
16
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
#
|
||||
# mdev-16235: SELECT over a table with LIMIT 0
|
||||
#
|
||||
EXPLAIN
|
||||
SELECT * FROM mysql.slow_log WHERE sql_text != 'foo' LIMIT 0;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Zero limit
|
||||
SELECT * FROM mysql.slow_log WHERE sql_text != 'foo' LIMIT 0;
|
||||
start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected
|
||||
EXPLAIN
|
||||
SELECT * FROM mysql.help_topic WHERE help_category_id != example LIMIT 0;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Zero limit
|
||||
SELECT * FROM mysql.help_topic WHERE help_category_id != example LIMIT 0;
|
||||
help_topic_id name help_category_id description example url
|
||||
End of 5.5 tests
|
||||
|
@ -115,3 +115,17 @@ SELECT a FROM t1 ORDER BY a LIMIT 2 OFFSET 14;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
||||
--echo #
|
||||
--echo # mdev-16235: SELECT over a table with LIMIT 0
|
||||
--echo #
|
||||
|
||||
EXPLAIN
|
||||
SELECT * FROM mysql.slow_log WHERE sql_text != 'foo' LIMIT 0;
|
||||
SELECT * FROM mysql.slow_log WHERE sql_text != 'foo' LIMIT 0;
|
||||
|
||||
EXPLAIN
|
||||
SELECT * FROM mysql.help_topic WHERE help_category_id != example LIMIT 0;
|
||||
SELECT * FROM mysql.help_topic WHERE help_category_id != example LIMIT 0;
|
||||
|
||||
--echo End of 5.5 tests
|
||||
|
@ -406,7 +406,7 @@ LOCK TABLE t1 WRITE;
|
||||
HANDLER t1 OPEN;
|
||||
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
|
||||
HANDLER t1 READ FIRST;
|
||||
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
|
||||
Got one of the listed errors
|
||||
HANDLER t1 CLOSE;
|
||||
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
|
||||
UNLOCK TABLES;
|
||||
|
@ -474,7 +474,7 @@ LOCK TABLE t1 WRITE;
|
||||
--echo # HANDLER commands are not allowed in LOCK TABLES mode
|
||||
--error ER_LOCK_OR_ACTIVE_TRANSACTION
|
||||
HANDLER t1 OPEN;
|
||||
--error ER_LOCK_OR_ACTIVE_TRANSACTION
|
||||
--error ER_LOCK_OR_ACTIVE_TRANSACTION,ER_UNKNOWN_TABLE
|
||||
HANDLER t1 READ FIRST;
|
||||
--error ER_LOCK_OR_ACTIVE_TRANSACTION
|
||||
HANDLER t1 CLOSE;
|
||||
|
@ -181,3 +181,6 @@ ERROR 70100: Query execution was interrupted (max_statement_time exceeded)
|
||||
set max_statement_time = 0;
|
||||
drop procedure pr;
|
||||
drop table t1;
|
||||
SET max_statement_time= 1;
|
||||
CREATE TABLE t ENGINE=InnoDB SELECT * FROM seq_1_to_50000;
|
||||
ERROR 70100: Query execution was interrupted (max_statement_time exceeded)
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
--source include/not_embedded.inc
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_sequence.inc
|
||||
--source include/not_valgrind.inc
|
||||
|
||||
--echo
|
||||
@ -226,3 +227,10 @@ call pr();
|
||||
set max_statement_time = 0;
|
||||
drop procedure pr;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# MDEV-16615 ASAN SEGV in handler::print_error or server crash after error upon CREATE TABLE
|
||||
#
|
||||
SET max_statement_time= 1;
|
||||
--error ER_STATEMENT_TIMEOUT
|
||||
CREATE TABLE t ENGINE=InnoDB SELECT * FROM seq_1_to_50000;
|
||||
|
@ -5608,6 +5608,21 @@ DROP DATABASE db1;
|
||||
DROP DATABASE db2;
|
||||
FOUND 1 /Database: mysql/ in bug11505.sql
|
||||
#
|
||||
# MDEV-15021: Fix the order in which routines are called
|
||||
#
|
||||
use test;
|
||||
CREATE FUNCTION f() RETURNS INT RETURN 1;
|
||||
CREATE VIEW v1 AS SELECT f();
|
||||
# Running mysqldump -uroot test --routines --tables v1 > **vardir**/test.dmp
|
||||
DROP VIEW v1;
|
||||
DROP FUNCTION f;
|
||||
# Running mysql -uroot test < **vardir**/test.dmp
|
||||
#
|
||||
# Cleanup after succesful import.
|
||||
#
|
||||
DROP VIEW v1;
|
||||
DROP FUNCTION f;
|
||||
#
|
||||
# Test for --add-drop-trigger
|
||||
#
|
||||
use test;
|
||||
|
@ -2644,6 +2644,28 @@ let SEARCH_PATTERN=Database: mysql;
|
||||
exec $MYSQL_DUMP mysql func > $SEARCH_FILE;
|
||||
source include/search_pattern_in_file.inc;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-15021: Fix the order in which routines are called
|
||||
--echo #
|
||||
use test;
|
||||
CREATE FUNCTION f() RETURNS INT RETURN 1;
|
||||
CREATE VIEW v1 AS SELECT f();
|
||||
|
||||
--echo # Running mysqldump -uroot test --routines --tables v1 > **vardir**/test.dmp
|
||||
--exec $MYSQL_DUMP -uroot test --routines --tables v1 > $MYSQLTEST_VARDIR/test.dmp
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP FUNCTION f;
|
||||
|
||||
--echo # Running mysql -uroot test < **vardir**/test.dmp
|
||||
--exec $MYSQL -uroot test < $MYSQLTEST_VARDIR/test.dmp
|
||||
|
||||
--echo #
|
||||
--echo # Cleanup after succesful import.
|
||||
--echo #
|
||||
DROP VIEW v1;
|
||||
DROP FUNCTION f;
|
||||
|
||||
--echo #
|
||||
--echo # Test for --add-drop-trigger
|
||||
--echo #
|
||||
|
@ -255,3 +255,6 @@ Benchmark
|
||||
# MDEV-4684 - Enhancement request: --init-command support for mysqlslap
|
||||
#
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug MDEV-15789 (Upstream: #80329): MYSQLSLAP OPTIONS --AUTO-GENERATE-SQL-GUID-PRIMARY and --AUTO-GENERATE-SQL-SECONDARY-INDEXES DONT WORK
|
||||
#
|
||||
|
@ -80,3 +80,11 @@ DROP DATABASE bug58090;
|
||||
|
||||
--exec $MYSQL_SLAP --create-schema=test --init-command="CREATE TABLE t1(a INT)" --silent --concurrency=1 --iterations=1
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug MDEV-15789 (Upstream: #80329): MYSQLSLAP OPTIONS --AUTO-GENERATE-SQL-GUID-PRIMARY and --AUTO-GENERATE-SQL-SECONDARY-INDEXES DONT WORK
|
||||
--echo #
|
||||
|
||||
--exec $MYSQL_SLAP --concurrency=1 --silent --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-guid-primary --create-schema=slap
|
||||
|
||||
--exec $MYSQL_SLAP --concurrency=1 --silent --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-secondary-indexes=1 --create-schema=slap
|
||||
|
31
mysql-test/main/mysqltest_tracking_info.result
Normal file
31
mysql-test/main/mysqltest_tracking_info.result
Normal file
@ -0,0 +1,31 @@
|
||||
SELECT @@session.character_set_connection;
|
||||
@@session.character_set_connection
|
||||
latin1
|
||||
SET @@session.session_track_system_variables='character_set_connection';
|
||||
# tracking info on
|
||||
SET NAMES 'utf8';
|
||||
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
|
||||
-- character_set_connection
|
||||
-- utf8
|
||||
|
||||
SET NAMES 'big5';
|
||||
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
|
||||
-- character_set_connection
|
||||
-- big5
|
||||
|
||||
# tracking info on once
|
||||
SET NAMES 'utf8';
|
||||
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
|
||||
-- character_set_connection
|
||||
-- utf8
|
||||
|
||||
SET NAMES 'big5';
|
||||
# tracking info on
|
||||
SET NAMES 'utf8';
|
||||
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
|
||||
-- character_set_connection
|
||||
-- utf8
|
||||
|
||||
# tracking info off once
|
||||
SET NAMES 'big5';
|
||||
SET @@session.session_track_system_variables= default;
|
25
mysql-test/main/mysqltest_tracking_info.test
Normal file
25
mysql-test/main/mysqltest_tracking_info.test
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
--source include/no_protocol.inc
|
||||
--source include/not_embedded.inc
|
||||
|
||||
SELECT @@session.character_set_connection;
|
||||
SET @@session.session_track_system_variables='character_set_connection';
|
||||
|
||||
--echo # tracking info on
|
||||
--enable_session_track_info
|
||||
SET NAMES 'utf8';
|
||||
SET NAMES 'big5';
|
||||
--disable_session_track_info
|
||||
--echo # tracking info on once
|
||||
--enable_session_track_info ONCE
|
||||
SET NAMES 'utf8';
|
||||
SET NAMES 'big5';
|
||||
--echo # tracking info on
|
||||
--enable_session_track_info
|
||||
SET NAMES 'utf8';
|
||||
--echo # tracking info off once
|
||||
--disable_session_track_info ONCE
|
||||
SET NAMES 'big5';
|
||||
--disable_session_track_info
|
||||
|
||||
SET @@session.session_track_system_variables= default;
|
@ -767,7 +767,29 @@ NULL
|
||||
DROP TABLE t1, t2;
|
||||
End of 5.0 tests
|
||||
#
|
||||
# Start of 10.3 tests
|
||||
# End of 10.0 tests
|
||||
#
|
||||
#
|
||||
# MDEV-16190 Server crashes in Item_null_result::field_type on SELECT with time field, ROLLUP and HAVING
|
||||
#
|
||||
CREATE TABLE t1 (t TIME) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES ('12:12:12');
|
||||
SELECT t, COUNT(*) FROM t1 GROUP BY t WITH ROLLUP HAVING t > '00:00:00';
|
||||
t COUNT(*)
|
||||
12:12:12 1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (t TIME) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES ('12:12:12'),('12:12:13');
|
||||
SELECT t, COUNT(*) FROM t1 GROUP BY t WITH ROLLUP HAVING t > '00:00:00';
|
||||
t COUNT(*)
|
||||
12:12:12 1
|
||||
12:12:13 1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 10.1 tests
|
||||
#
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
#
|
||||
# MDEV-12886 Different default for INT and BIGINT column in a VIEW for a SELECT with ROLLUP
|
||||
|
@ -406,7 +406,29 @@ DROP TABLE t1, t2;
|
||||
--echo End of 5.0 tests
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.3 tests
|
||||
--echo # End of 10.0 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-16190 Server crashes in Item_null_result::field_type on SELECT with time field, ROLLUP and HAVING
|
||||
--echo #
|
||||
CREATE TABLE t1 (t TIME) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES ('12:12:12');
|
||||
SELECT t, COUNT(*) FROM t1 GROUP BY t WITH ROLLUP HAVING t > '00:00:00';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (t TIME) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES ('12:12:12'),('12:12:13');
|
||||
SELECT t, COUNT(*) FROM t1 GROUP BY t WITH ROLLUP HAVING t > '00:00:00';
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.1 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
@ -462,5 +484,4 @@ SELECT NULLIF( CAST( 'foo' AS DATE ), NULL & 'bar' ) AS f FROM t1 GROUP BY f WIT
|
||||
--enable_warnings
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo # End of 10.3 Tests
|
||||
|
@ -59,7 +59,7 @@ partition p2 values less than ('2020-10-19'));
|
||||
insert t1 values (0, '2000-01-02', 0);
|
||||
insert t1 values (1, '2020-01-02', 10);
|
||||
alter table t1 add check (b in (0, 1));
|
||||
ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`#sql-temporary`
|
||||
ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
|
||||
alter table t1 add check (b in (0, 10));
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
@ -84,7 +84,7 @@ partition p2 values less than ('2020-10-19'));
|
||||
insert t1 values (0, '2000-01-02', 0);
|
||||
insert t1 values (1, '2020-01-02', 10);
|
||||
alter table t1 add check (b in (0, 1));
|
||||
ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`#sql-temporary`
|
||||
ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
|
||||
alter table t1 add check (b in (0, 10));
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
|
@ -4368,7 +4368,46 @@ LINE3 3
|
||||
drop table t1;
|
||||
# End of 5.5 tests
|
||||
#
|
||||
# Start of 10.2 tests
|
||||
# End of 10.0 tests
|
||||
#
|
||||
#
|
||||
# MDEV-12060 Crash in EXECUTE IMMEDIATE with an expression returning a GRANT command
|
||||
# (the 10.1 part)
|
||||
#
|
||||
CREATE PROCEDURE p2 ()
|
||||
BEGIN
|
||||
SET STATEMENT join_cache_level=CAST(CONCAT(_utf8'6',_latin1'') AS INT) FOR PREPARE stmt FROM 'SELECT 1';
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
END;
|
||||
/
|
||||
CALL p2();
|
||||
1
|
||||
1
|
||||
DROP PROCEDURE p2;
|
||||
BEGIN NOT ATOMIC
|
||||
SET STATEMENT join_cache_level=CAST(CONCAT(_utf8'6',_latin1'') AS INT) FOR PREPARE stmt FROM 'SELECT 1';
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
END;
|
||||
/
|
||||
1
|
||||
1
|
||||
BEGIN NOT ATOMIC
|
||||
SET STATEMENT join_cache_level=CAST(CONCAT(_utf8'6',_latin1'') AS INT) FOR PREPARE stmt FROM 'SELECT 1';
|
||||
DEALLOCATE PREPARE stmt;
|
||||
END;
|
||||
/
|
||||
BEGIN NOT ATOMIC
|
||||
PREPARE stmt FROM 'SELECT 1';
|
||||
SET STATEMENT join_cache_level=CAST(CONCAT(_utf8'6',_latin1'') AS INT) FOR EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
END;
|
||||
/
|
||||
1
|
||||
1
|
||||
#
|
||||
# End of 10.1 tests
|
||||
#
|
||||
#
|
||||
# MDEV-10709 Expressions as parameters to Dynamic SQL
|
||||
@ -4921,9 +4960,6 @@ DROP TABLE t1;
|
||||
# End of MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions
|
||||
#
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
#
|
||||
# MDEV-11360 Dynamic SQL: DEFAULT as a bind parameter
|
||||
#
|
||||
CREATE TABLE t1 (a INT DEFAULT 10, b INT DEFAULT NULL);
|
||||
@ -5251,3 +5287,39 @@ execute stmt;
|
||||
execute stmt;
|
||||
execute stmt;
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-12060 Crash in EXECUTE IMMEDIATE with an expression returning a GRANT command
|
||||
#
|
||||
CREATE ROLE testrole;
|
||||
CREATE OR REPLACE PROCEDURE p1()
|
||||
BEGIN
|
||||
END;
|
||||
/
|
||||
CREATE PROCEDURE p2 (wgrp VARCHAR(10))
|
||||
BEGIN
|
||||
EXECUTE IMMEDIATE concat('GRANT EXECUTE ON PROCEDURE p1 TO ',wgrp);
|
||||
END;
|
||||
/
|
||||
CALL p2('testrole');
|
||||
DROP PROCEDURE p2;
|
||||
CREATE PROCEDURE p2 ()
|
||||
BEGIN
|
||||
EXECUTE IMMEDIATE concat(_utf8'GRANT EXECUTE ON PROCEDURE p1 TO ',_latin1'testrole');
|
||||
END;
|
||||
/
|
||||
CALL p2();
|
||||
DROP PROCEDURE p2;
|
||||
CREATE PROCEDURE p2 ()
|
||||
BEGIN
|
||||
PREPARE stmt FROM concat(_utf8'GRANT EXECUTE ON PROCEDURE p1 TO ',_latin1' testrole');
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
END;
|
||||
/
|
||||
CALL p2();
|
||||
DROP PROCEDURE p2;
|
||||
DROP PROCEDURE p1;
|
||||
DROP ROLE testrole;
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
|
@ -3875,7 +3875,58 @@ drop table t1;
|
||||
--echo # End of 5.5 tests
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.2 tests
|
||||
--echo # End of 10.0 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-12060 Crash in EXECUTE IMMEDIATE with an expression returning a GRANT command
|
||||
--echo # (the 10.1 part)
|
||||
--echo #
|
||||
|
||||
DELIMITER /;
|
||||
CREATE PROCEDURE p2 ()
|
||||
BEGIN
|
||||
SET STATEMENT join_cache_level=CAST(CONCAT(_utf8'6',_latin1'') AS INT) FOR PREPARE stmt FROM 'SELECT 1';
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
END;
|
||||
/
|
||||
DELIMITER ;/
|
||||
CALL p2();
|
||||
DROP PROCEDURE p2;
|
||||
|
||||
|
||||
DELIMITER /;
|
||||
BEGIN NOT ATOMIC
|
||||
SET STATEMENT join_cache_level=CAST(CONCAT(_utf8'6',_latin1'') AS INT) FOR PREPARE stmt FROM 'SELECT 1';
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
END;
|
||||
/
|
||||
DELIMITER ;/
|
||||
|
||||
|
||||
DELIMITER /;
|
||||
BEGIN NOT ATOMIC
|
||||
SET STATEMENT join_cache_level=CAST(CONCAT(_utf8'6',_latin1'') AS INT) FOR PREPARE stmt FROM 'SELECT 1';
|
||||
DEALLOCATE PREPARE stmt;
|
||||
END;
|
||||
/
|
||||
DELIMITER ;/
|
||||
|
||||
|
||||
DELIMITER /;
|
||||
BEGIN NOT ATOMIC
|
||||
PREPARE stmt FROM 'SELECT 1';
|
||||
SET STATEMENT join_cache_level=CAST(CONCAT(_utf8'6',_latin1'') AS INT) FOR EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
END;
|
||||
/
|
||||
DELIMITER ;/
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.1 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
@ -4386,9 +4437,6 @@ DROP TABLE t1;
|
||||
--echo # End of MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
||||
|
||||
|
||||
--echo #
|
||||
@ -4687,3 +4735,55 @@ execute stmt;
|
||||
execute stmt;
|
||||
execute stmt;
|
||||
drop table t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-12060 Crash in EXECUTE IMMEDIATE with an expression returning a GRANT command
|
||||
--echo #
|
||||
|
||||
CREATE ROLE testrole;
|
||||
DELIMITER /;
|
||||
CREATE OR REPLACE PROCEDURE p1()
|
||||
BEGIN
|
||||
END;
|
||||
/
|
||||
DELIMITER ;/
|
||||
|
||||
DELIMITER /;
|
||||
CREATE PROCEDURE p2 (wgrp VARCHAR(10))
|
||||
BEGIN
|
||||
EXECUTE IMMEDIATE concat('GRANT EXECUTE ON PROCEDURE p1 TO ',wgrp);
|
||||
END;
|
||||
/
|
||||
DELIMITER ;/
|
||||
CALL p2('testrole');
|
||||
DROP PROCEDURE p2;
|
||||
|
||||
DELIMITER /;
|
||||
CREATE PROCEDURE p2 ()
|
||||
BEGIN
|
||||
EXECUTE IMMEDIATE concat(_utf8'GRANT EXECUTE ON PROCEDURE p1 TO ',_latin1'testrole');
|
||||
END;
|
||||
/
|
||||
DELIMITER ;/
|
||||
CALL p2();
|
||||
DROP PROCEDURE p2;
|
||||
|
||||
DELIMITER /;
|
||||
CREATE PROCEDURE p2 ()
|
||||
BEGIN
|
||||
PREPARE stmt FROM concat(_utf8'GRANT EXECUTE ON PROCEDURE p1 TO ',_latin1' testrole');
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
END;
|
||||
/
|
||||
DELIMITER ;/
|
||||
CALL p2();
|
||||
DROP PROCEDURE p2;
|
||||
|
||||
DROP PROCEDURE p1;
|
||||
DROP ROLE testrole;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
||||
|
@ -237,14 +237,6 @@ a a
|
||||
5 10
|
||||
DROP TABLE temp1, temp2;
|
||||
|
||||
# MDEV-14185 CREATE TEMPORARY TABLE AS SELECT causes error 1290 with read_only and InnoDB.
|
||||
|
||||
CREATE TEMPORARY TABLE temp1 ENGINE=INNODB AS SELECT a FROM t1;
|
||||
SELECT * FROM temp1;
|
||||
a
|
||||
1
|
||||
DROP TABLE temp1;
|
||||
|
||||
# Disconnect and cleanup
|
||||
|
||||
disconnect con1;
|
||||
|
@ -240,15 +240,6 @@ UPDATE temp1,temp2 SET temp1.a = 5, temp2.a = 10;
|
||||
SELECT * FROM temp1, temp2;
|
||||
DROP TABLE temp1, temp2;
|
||||
|
||||
--echo
|
||||
--echo # MDEV-14185 CREATE TEMPORARY TABLE AS SELECT causes error 1290 with read_only and InnoDB.
|
||||
--echo
|
||||
|
||||
CREATE TEMPORARY TABLE temp1 ENGINE=INNODB AS SELECT a FROM t1;
|
||||
SELECT * FROM temp1;
|
||||
DROP TABLE temp1;
|
||||
|
||||
|
||||
--echo
|
||||
--echo # Disconnect and cleanup
|
||||
--echo
|
||||
|
7
mysql-test/main/reset_connection.result
Normal file
7
mysql-test/main/reset_connection.result
Normal file
@ -0,0 +1,7 @@
|
||||
FLUSH STATUS;
|
||||
SHOW local STATUS LIKE 'com_select';
|
||||
Variable_name Value
|
||||
Com_select 10
|
||||
SHOW local STATUS LIKE 'com_select';
|
||||
Variable_name Value
|
||||
Com_select 0
|
25
mysql-test/main/reset_connection.test
Normal file
25
mysql-test/main/reset_connection.test
Normal file
@ -0,0 +1,25 @@
|
||||
--source include/not_embedded.inc
|
||||
|
||||
FLUSH STATUS;
|
||||
|
||||
--disable_result_log
|
||||
--disable_query_log
|
||||
|
||||
let $i = 10;
|
||||
begin;
|
||||
while ($i)
|
||||
{
|
||||
dec $i;
|
||||
SELECT 1;
|
||||
}
|
||||
commit;
|
||||
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
|
||||
SHOW local STATUS LIKE 'com_select';
|
||||
|
||||
--reset_connection
|
||||
|
||||
SHOW local STATUS LIKE 'com_select';
|
||||
|
@ -356,13 +356,13 @@ and o_orderkey = l_orderkey
|
||||
group by c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice
|
||||
order by o_totalprice desc, o_orderdate;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 6005 0.00 Using temporary; Using filesort
|
||||
1 PRIMARY orders eq_ref PRIMARY,i_o_custkey PRIMARY 4 <subquery2>.l_orderkey 1 100.00 Using where
|
||||
1 PRIMARY orders ALL PRIMARY,i_o_custkey NULL NULL NULL 1500 100.00 Using where; Using temporary; Using filesort
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 dbt3_s001.orders.o_orderkey 1 100.00
|
||||
1 PRIMARY customer eq_ref PRIMARY PRIMARY 4 dbt3_s001.orders.o_custkey 1 100.00
|
||||
1 PRIMARY lineitem ref PRIMARY,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 <subquery2>.l_orderkey 4 100.00
|
||||
1 PRIMARY lineitem ref PRIMARY,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey_quantity 4 dbt3_s001.orders.o_orderkey 4 100.00 Using index
|
||||
2 MATERIALIZED lineitem index NULL i_l_orderkey_quantity 13 NULL 6005 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 /* select#1 */ select `dbt3_s001`.`customer`.`c_name` AS `c_name`,`dbt3_s001`.`customer`.`c_custkey` AS `c_custkey`,`dbt3_s001`.`orders`.`o_orderkey` AS `o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE` AS `o_orderdate`,`dbt3_s001`.`orders`.`o_totalprice` AS `o_totalprice`,sum(`dbt3_s001`.`lineitem`.`l_quantity`) AS `sum(l_quantity)` from <materialize> (/* select#2 */ select `dbt3_s001`.`lineitem`.`l_orderkey` from `dbt3_s001`.`lineitem` group by `dbt3_s001`.`lineitem`.`l_orderkey` having sum(`dbt3_s001`.`lineitem`.`l_quantity`) > 250) join `dbt3_s001`.`customer` join `dbt3_s001`.`orders` join `dbt3_s001`.`lineitem` where `dbt3_s001`.`customer`.`c_custkey` = `dbt3_s001`.`orders`.`o_custkey` and `dbt3_s001`.`orders`.`o_orderkey` = `<subquery2>`.`l_orderkey` and `dbt3_s001`.`lineitem`.`l_orderkey` = `<subquery2>`.`l_orderkey` group by `dbt3_s001`.`customer`.`c_name`,`dbt3_s001`.`customer`.`c_custkey`,`dbt3_s001`.`orders`.`o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE`,`dbt3_s001`.`orders`.`o_totalprice` order by `dbt3_s001`.`orders`.`o_totalprice` desc,`dbt3_s001`.`orders`.`o_orderDATE`
|
||||
Note 1003 /* select#1 */ select `dbt3_s001`.`customer`.`c_name` AS `c_name`,`dbt3_s001`.`customer`.`c_custkey` AS `c_custkey`,`dbt3_s001`.`orders`.`o_orderkey` AS `o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE` AS `o_orderdate`,`dbt3_s001`.`orders`.`o_totalprice` AS `o_totalprice`,sum(`dbt3_s001`.`lineitem`.`l_quantity`) AS `sum(l_quantity)` from <materialize> (/* select#2 */ select `dbt3_s001`.`lineitem`.`l_orderkey` from `dbt3_s001`.`lineitem` group by `dbt3_s001`.`lineitem`.`l_orderkey` having sum(`dbt3_s001`.`lineitem`.`l_quantity`) > 250) join `dbt3_s001`.`customer` join `dbt3_s001`.`orders` join `dbt3_s001`.`lineitem` where `dbt3_s001`.`customer`.`c_custkey` = `dbt3_s001`.`orders`.`o_custkey` and `<subquery2>`.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey` and `dbt3_s001`.`lineitem`.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey` group by `dbt3_s001`.`customer`.`c_name`,`dbt3_s001`.`customer`.`c_custkey`,`dbt3_s001`.`orders`.`o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE`,`dbt3_s001`.`orders`.`o_totalprice` order by `dbt3_s001`.`orders`.`o_totalprice` desc,`dbt3_s001`.`orders`.`o_orderDATE`
|
||||
select
|
||||
c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, sum(l_quantity)
|
||||
from customer, orders, lineitem
|
||||
@ -1530,6 +1530,68 @@ t
|
||||
10:00:00
|
||||
11:00:00
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-16374: filtered shows 0 for materilization scan for a semi join, which makes optimizer
|
||||
# always pick materialization scan over materialization lookup
|
||||
#
|
||||
create table t0(a int);
|
||||
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
create table t1 (a int, b int);
|
||||
insert into t1 values (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),
|
||||
(11,11),(12,12),(13,13),(14,14),(15,15);
|
||||
set @@optimizer_use_condition_selectivity=2;
|
||||
explain extended select * from t1 where a in (select max(a) from t1 group by b);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 16 100.00 Using where
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 test.t1.a 1 100.00
|
||||
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 16 100.00 Using temporary
|
||||
Warnings:
|
||||
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from <materialize> (/* select#2 */ select max(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`b`) join `test`.`t1` where `<subquery2>`.`max(a)` = `test`.`t1`.`a`
|
||||
select * from t1 where a in (select max(a) from t1 group by b);
|
||||
a b
|
||||
0 0
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
4 4
|
||||
5 5
|
||||
6 6
|
||||
7 7
|
||||
8 8
|
||||
9 9
|
||||
10 10
|
||||
11 11
|
||||
12 12
|
||||
13 13
|
||||
14 14
|
||||
15 15
|
||||
set @@optimizer_use_condition_selectivity=1;
|
||||
explain extended select * from t1 where a in (select max(a) from t1 group by b);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 16 100.00 Using where
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 test.t1.a 1 100.00
|
||||
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 16 100.00 Using temporary
|
||||
Warnings:
|
||||
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from <materialize> (/* select#2 */ select max(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`b`) join `test`.`t1` where `<subquery2>`.`max(a)` = `test`.`t1`.`a`
|
||||
select * from t1 where a in (select max(a) from t1 group by b);
|
||||
a b
|
||||
0 0
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
4 4
|
||||
5 5
|
||||
6 6
|
||||
7 7
|
||||
8 8
|
||||
9 9
|
||||
10 10
|
||||
11 11
|
||||
12 12
|
||||
13 13
|
||||
14 14
|
||||
15 15
|
||||
drop table t1,t0;
|
||||
set histogram_size=@save_histogram_size;
|
||||
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
|
||||
set use_stat_tables=@save_use_stat_tables;
|
||||
|
@ -1045,6 +1045,24 @@ SELECT * FROM (SELECT t FROM t1 WHERE d IS NULL) sq;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-16374: filtered shows 0 for materilization scan for a semi join, which makes optimizer
|
||||
--echo # always pick materialization scan over materialization lookup
|
||||
--echo #
|
||||
|
||||
create table t0(a int);
|
||||
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
create table t1 (a int, b int);
|
||||
insert into t1 values (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),
|
||||
(11,11),(12,12),(13,13),(14,14),(15,15);
|
||||
set @@optimizer_use_condition_selectivity=2;
|
||||
explain extended select * from t1 where a in (select max(a) from t1 group by b);
|
||||
select * from t1 where a in (select max(a) from t1 group by b);
|
||||
set @@optimizer_use_condition_selectivity=1;
|
||||
explain extended select * from t1 where a in (select max(a) from t1 group by b);
|
||||
select * from t1 where a in (select max(a) from t1 group by b);
|
||||
drop table t1,t0;
|
||||
|
||||
set histogram_size=@save_histogram_size;
|
||||
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
|
||||
set use_stat_tables=@save_use_stat_tables;
|
||||
|
@ -359,13 +359,13 @@ and o_orderkey = l_orderkey
|
||||
group by c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice
|
||||
order by o_totalprice desc, o_orderdate;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 6005 0.00 Using temporary; Using filesort
|
||||
1 PRIMARY orders eq_ref PRIMARY,i_o_custkey PRIMARY 4 <subquery2>.l_orderkey 1 100.00 Using where
|
||||
1 PRIMARY orders ALL PRIMARY,i_o_custkey NULL NULL NULL 1500 100.00 Using where; Using temporary; Using filesort
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 dbt3_s001.orders.o_orderkey 1 100.00
|
||||
1 PRIMARY customer eq_ref PRIMARY PRIMARY 4 dbt3_s001.orders.o_custkey 1 100.00
|
||||
1 PRIMARY lineitem ref PRIMARY,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 <subquery2>.l_orderkey 4 100.00
|
||||
1 PRIMARY lineitem ref PRIMARY,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey_quantity 4 dbt3_s001.orders.o_orderkey 4 100.00 Using index
|
||||
2 MATERIALIZED lineitem index NULL PRIMARY 8 NULL 6005 100.00
|
||||
Warnings:
|
||||
Note 1003 /* select#1 */ select `dbt3_s001`.`customer`.`c_name` AS `c_name`,`dbt3_s001`.`customer`.`c_custkey` AS `c_custkey`,`dbt3_s001`.`orders`.`o_orderkey` AS `o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE` AS `o_orderdate`,`dbt3_s001`.`orders`.`o_totalprice` AS `o_totalprice`,sum(`dbt3_s001`.`lineitem`.`l_quantity`) AS `sum(l_quantity)` from <materialize> (/* select#2 */ select `dbt3_s001`.`lineitem`.`l_orderkey` from `dbt3_s001`.`lineitem` group by `dbt3_s001`.`lineitem`.`l_orderkey` having sum(`dbt3_s001`.`lineitem`.`l_quantity`) > 250) join `dbt3_s001`.`customer` join `dbt3_s001`.`orders` join `dbt3_s001`.`lineitem` where `dbt3_s001`.`customer`.`c_custkey` = `dbt3_s001`.`orders`.`o_custkey` and `dbt3_s001`.`orders`.`o_orderkey` = `<subquery2>`.`l_orderkey` and `dbt3_s001`.`lineitem`.`l_orderkey` = `<subquery2>`.`l_orderkey` group by `dbt3_s001`.`customer`.`c_name`,`dbt3_s001`.`customer`.`c_custkey`,`dbt3_s001`.`orders`.`o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE`,`dbt3_s001`.`orders`.`o_totalprice` order by `dbt3_s001`.`orders`.`o_totalprice` desc,`dbt3_s001`.`orders`.`o_orderDATE`
|
||||
Note 1003 /* select#1 */ select `dbt3_s001`.`customer`.`c_name` AS `c_name`,`dbt3_s001`.`customer`.`c_custkey` AS `c_custkey`,`dbt3_s001`.`orders`.`o_orderkey` AS `o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE` AS `o_orderdate`,`dbt3_s001`.`orders`.`o_totalprice` AS `o_totalprice`,sum(`dbt3_s001`.`lineitem`.`l_quantity`) AS `sum(l_quantity)` from <materialize> (/* select#2 */ select `dbt3_s001`.`lineitem`.`l_orderkey` from `dbt3_s001`.`lineitem` group by `dbt3_s001`.`lineitem`.`l_orderkey` having sum(`dbt3_s001`.`lineitem`.`l_quantity`) > 250) join `dbt3_s001`.`customer` join `dbt3_s001`.`orders` join `dbt3_s001`.`lineitem` where `dbt3_s001`.`customer`.`c_custkey` = `dbt3_s001`.`orders`.`o_custkey` and `<subquery2>`.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey` and `dbt3_s001`.`lineitem`.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey` group by `dbt3_s001`.`customer`.`c_name`,`dbt3_s001`.`customer`.`c_custkey`,`dbt3_s001`.`orders`.`o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE`,`dbt3_s001`.`orders`.`o_totalprice` order by `dbt3_s001`.`orders`.`o_totalprice` desc,`dbt3_s001`.`orders`.`o_orderDATE`
|
||||
select
|
||||
c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, sum(l_quantity)
|
||||
from customer, orders, lineitem
|
||||
@ -1150,6 +1150,7 @@ alter table t1 change column a a int;
|
||||
analyze table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status Engine-independent statistics collected
|
||||
test.t1 analyze Note Data truncated for column 'avg_frequency' at row 1
|
||||
test.t1 analyze status OK
|
||||
flush table t1;
|
||||
explain extended select * from t1 where a between 5 and 7;
|
||||
@ -1540,6 +1541,68 @@ t
|
||||
10:00:00
|
||||
11:00:00
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-16374: filtered shows 0 for materilization scan for a semi join, which makes optimizer
|
||||
# always pick materialization scan over materialization lookup
|
||||
#
|
||||
create table t0(a int);
|
||||
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
create table t1 (a int, b int);
|
||||
insert into t1 values (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),
|
||||
(11,11),(12,12),(13,13),(14,14),(15,15);
|
||||
set @@optimizer_use_condition_selectivity=2;
|
||||
explain extended select * from t1 where a in (select max(a) from t1 group by b);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 16 100.00 Using where
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 test.t1.a 1 100.00
|
||||
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 16 100.00 Using temporary
|
||||
Warnings:
|
||||
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from <materialize> (/* select#2 */ select max(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`b`) join `test`.`t1` where `<subquery2>`.`max(a)` = `test`.`t1`.`a`
|
||||
select * from t1 where a in (select max(a) from t1 group by b);
|
||||
a b
|
||||
0 0
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
4 4
|
||||
5 5
|
||||
6 6
|
||||
7 7
|
||||
8 8
|
||||
9 9
|
||||
10 10
|
||||
11 11
|
||||
12 12
|
||||
13 13
|
||||
14 14
|
||||
15 15
|
||||
set @@optimizer_use_condition_selectivity=1;
|
||||
explain extended select * from t1 where a in (select max(a) from t1 group by b);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 16 100.00 Using where
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 test.t1.a 1 100.00
|
||||
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 16 100.00 Using temporary
|
||||
Warnings:
|
||||
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from <materialize> (/* select#2 */ select max(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`b`) join `test`.`t1` where `<subquery2>`.`max(a)` = `test`.`t1`.`a`
|
||||
select * from t1 where a in (select max(a) from t1 group by b);
|
||||
a b
|
||||
0 0
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
4 4
|
||||
5 5
|
||||
6 6
|
||||
7 7
|
||||
8 8
|
||||
9 9
|
||||
10 10
|
||||
11 11
|
||||
12 12
|
||||
13 13
|
||||
14 14
|
||||
15 15
|
||||
drop table t1,t0;
|
||||
set histogram_size=@save_histogram_size;
|
||||
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
|
||||
set use_stat_tables=@save_use_stat_tables;
|
||||
|
34
mysql-test/main/session_tracker_last_gtid.result
Normal file
34
mysql-test/main/session_tracker_last_gtid.result
Normal file
@ -0,0 +1,34 @@
|
||||
#
|
||||
# MDEV-15477: SESSION_SYSVARS_TRACKER does not track last_gtid
|
||||
#
|
||||
SET gtid_seq_no=1000;
|
||||
SET @@session.session_track_system_variables='last_gtid';
|
||||
create table t1 (a int) engine=innodb;
|
||||
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
|
||||
-- last_gtid
|
||||
-- 0-1-1000
|
||||
|
||||
select @@last_gtid;
|
||||
@@last_gtid
|
||||
0-1-1000
|
||||
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
|
||||
-- last_gtid
|
||||
-- 0-1-1000
|
||||
|
||||
insert into t1 values (1);
|
||||
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
|
||||
-- last_gtid
|
||||
-- 0-1-1001
|
||||
|
||||
select @@last_gtid;
|
||||
@@last_gtid
|
||||
0-1-1001
|
||||
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
|
||||
-- last_gtid
|
||||
-- 0-1-1001
|
||||
|
||||
drop table t1;
|
||||
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
|
||||
-- last_gtid
|
||||
-- 0-1-1002
|
||||
|
19
mysql-test/main/session_tracker_last_gtid.test
Normal file
19
mysql-test/main/session_tracker_last_gtid.test
Normal file
@ -0,0 +1,19 @@
|
||||
--source include/not_embedded.inc
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_binlog_format_statement.inc
|
||||
|
||||
--enable_session_track_info
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-15477: SESSION_SYSVARS_TRACKER does not track last_gtid
|
||||
--echo #
|
||||
|
||||
SET gtid_seq_no=1000;
|
||||
SET @@session.session_track_system_variables='last_gtid';
|
||||
create table t1 (a int) engine=innodb;
|
||||
select @@last_gtid;
|
||||
insert into t1 values (1);
|
||||
select @@last_gtid;
|
||||
drop table t1;
|
||||
|
||||
--disable_session_track_info
|
@ -11,10 +11,10 @@ select user, host, password, plugin, authentication_string from mysql.user where
|
||||
user host password plugin authentication_string
|
||||
natauth localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
|
||||
newpass localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
|
||||
newpassnat localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
|
||||
newpassnat localhost mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
|
||||
oldauth localhost 378b243e220ca493
|
||||
oldpass localhost 378b243e220ca493
|
||||
oldpassold localhost 378b243e220ca493
|
||||
oldpassold localhost mysql_old_password 378b243e220ca493
|
||||
connect con,localhost,natauth,test,;
|
||||
select current_user();
|
||||
current_user()
|
||||
@ -86,12 +86,12 @@ set password for oldpass@localhost = PASSWORD('test2');
|
||||
set password for oldpassold@localhost = PASSWORD('test2');
|
||||
select user, host, password, plugin, authentication_string from mysql.user where user != 'root';
|
||||
user host password plugin authentication_string
|
||||
natauth localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
|
||||
newpass localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
|
||||
newpassnat localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
|
||||
oldauth localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
|
||||
oldpass localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
|
||||
oldpassold localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
|
||||
natauth localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
|
||||
newpass localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
|
||||
newpassnat localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
|
||||
oldauth localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
|
||||
oldpass localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
|
||||
oldpassold localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
|
||||
connect con,localhost,natauth,test2,;
|
||||
select current_user();
|
||||
current_user()
|
||||
@ -158,3 +158,24 @@ connection default;
|
||||
drop user natauth@localhost, newpass@localhost, newpassnat@localhost;
|
||||
drop user oldauth@localhost, oldpass@localhost, oldpassold@localhost;
|
||||
set global secure_auth=default;
|
||||
create user foo@localhost identified with mysql_native_password;
|
||||
update mysql.user set authentication_string=password('foo'), plugin='mysql_native_password' where user='foo' and host='localhost';
|
||||
set password for 'foo'@'localhost' = password('bar');
|
||||
flush privileges;
|
||||
connect foo, localhost, foo, bar;
|
||||
select user(), current_user();
|
||||
user() current_user()
|
||||
foo@localhost foo@localhost
|
||||
show grants;
|
||||
Grants for foo@localhost
|
||||
GRANT USAGE ON *.* TO 'foo'@'localhost' IDENTIFIED BY PASSWORD '*E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB'
|
||||
disconnect foo;
|
||||
connection default;
|
||||
select user,host,password,plugin,authentication_string from mysql.user where user='foo';
|
||||
user host password plugin authentication_string
|
||||
foo localhost mysql_native_password *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB
|
||||
set password for 'foo'@'localhost' = '';
|
||||
select user,host,password,plugin,authentication_string from mysql.user where user='foo';
|
||||
user host password plugin authentication_string
|
||||
foo localhost mysql_native_password
|
||||
drop user foo@localhost;
|
@ -129,3 +129,19 @@ drop user natauth@localhost, newpass@localhost, newpassnat@localhost;
|
||||
drop user oldauth@localhost, oldpass@localhost, oldpassold@localhost;
|
||||
set global secure_auth=default;
|
||||
|
||||
#
|
||||
# MDEV-16238 root/localhost authn prioritizes authentication_string over Password
|
||||
#
|
||||
create user foo@localhost identified with mysql_native_password;
|
||||
update mysql.user set authentication_string=password('foo'), plugin='mysql_native_password' where user='foo' and host='localhost';
|
||||
set password for 'foo'@'localhost' = password('bar');
|
||||
flush privileges;
|
||||
--connect foo, localhost, foo, bar
|
||||
select user(), current_user();
|
||||
show grants;
|
||||
--disconnect foo
|
||||
--connection default
|
||||
select user,host,password,plugin,authentication_string from mysql.user where user='foo';
|
||||
set password for 'foo'@'localhost' = '';
|
||||
select user,host,password,plugin,authentication_string from mysql.user where user='foo';
|
||||
drop user foo@localhost;
|
@ -71,7 +71,7 @@ connection default;
|
||||
set password for u1 = PASSWORD('SOMETHINGELSE');
|
||||
select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
|
||||
user host password plugin authentication_string
|
||||
u1 % *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6
|
||||
u1 % mysql_native_password *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6
|
||||
#
|
||||
# Here we should use the password field, as that primes over
|
||||
# the authentication_string field.
|
||||
@ -112,7 +112,7 @@ connection default;
|
||||
# Now we remove the authentication plugin password, flush privileges and
|
||||
# try again.
|
||||
#
|
||||
update mysql.user set authentication_string = '' where user='u1';
|
||||
update mysql.user set password=authentication_string, plugin='', authentication_string='' where user='u1';
|
||||
select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
|
||||
user host password plugin authentication_string
|
||||
u1 % *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6
|
||||
@ -172,7 +172,7 @@ connection default;
|
||||
set password for u1 = '';
|
||||
select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
|
||||
user host password plugin authentication_string
|
||||
u1 %
|
||||
u1 % mysql_native_password
|
||||
#
|
||||
# Test no password connect.
|
||||
#
|
||||
|
@ -91,7 +91,7 @@ show grants;
|
||||
--echo # Now we remove the authentication plugin password, flush privileges and
|
||||
--echo # try again.
|
||||
--echo #
|
||||
update mysql.user set authentication_string = '' where user='u1';
|
||||
update mysql.user set password=authentication_string, plugin='', authentication_string='' where user='u1';
|
||||
select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
|
||||
flush privileges;
|
||||
show grants for u1;
|
||||
|
@ -1113,23 +1113,26 @@ Pos Instruction
|
||||
10 stmt 0 "SELECT rec1.a, rec1.b"
|
||||
11 cfetch cur1@1 rec1@0
|
||||
12 jump 6
|
||||
13 cursor_copy_struct cur0 rec0@1
|
||||
14 copen cur0@0
|
||||
15 cfetch cur0@0 rec0@1
|
||||
16 jump_if_not 21(21) `cur0`%FOUND
|
||||
17 set rec0.a@1["a"] 10
|
||||
18 set rec0.b@1["b"] 'b0'
|
||||
19 cfetch cur0@0 rec0@1
|
||||
20 jump 16
|
||||
21 cursor_copy_struct cur2 rec2@2
|
||||
22 copen cur2@2
|
||||
23 cfetch cur2@2 rec2@2
|
||||
24 jump_if_not 29(29) `cur2`%FOUND
|
||||
25 set rec2.a@2["a"] 10
|
||||
26 set rec2.b@2["b"] 'b0'
|
||||
27 cfetch cur2@2 rec2@2
|
||||
28 jump 24
|
||||
29 cpop 3
|
||||
13 cclose cur1@1
|
||||
14 cursor_copy_struct cur0 rec0@1
|
||||
15 copen cur0@0
|
||||
16 cfetch cur0@0 rec0@1
|
||||
17 jump_if_not 22(22) `cur0`%FOUND
|
||||
18 set rec0.a@1["a"] 10
|
||||
19 set rec0.b@1["b"] 'b0'
|
||||
20 cfetch cur0@0 rec0@1
|
||||
21 jump 17
|
||||
22 cclose cur0@0
|
||||
23 cursor_copy_struct cur2 rec2@2
|
||||
24 copen cur2@2
|
||||
25 cfetch cur2@2 rec2@2
|
||||
26 jump_if_not 31(31) `cur2`%FOUND
|
||||
27 set rec2.a@2["a"] 10
|
||||
28 set rec2.b@2["b"] 'b0'
|
||||
29 cfetch cur2@2 rec2@2
|
||||
30 jump 26
|
||||
31 cclose cur2@2
|
||||
32 cpop 3
|
||||
DROP PROCEDURE p1;
|
||||
# Nested explicit cursor FOR loops
|
||||
CREATE PROCEDURE p1()
|
||||
@ -1164,14 +1167,14 @@ Pos Instruction
|
||||
1 cursor_copy_struct cur0 rec0@0
|
||||
2 copen cur0@0
|
||||
3 cfetch cur0@0 rec0@0
|
||||
4 jump_if_not 29(29) `cur0`%FOUND
|
||||
4 jump_if_not 31(31) `cur0`%FOUND
|
||||
5 cpush cur1@1
|
||||
6 set rec0.a@0["a"] 11
|
||||
7 set rec0.b@0["b"] 'b0'
|
||||
8 cursor_copy_struct cur1 rec1@1
|
||||
9 copen cur1@1
|
||||
10 cfetch cur1@1 rec1@1
|
||||
11 jump_if_not 26(26) `cur1`%FOUND
|
||||
11 jump_if_not 27(27) `cur1`%FOUND
|
||||
12 set rec1.a@1["a"] 11
|
||||
13 set rec1.b@1["b"] 'b1'
|
||||
14 cpush cur2@2
|
||||
@ -1183,13 +1186,16 @@ Pos Instruction
|
||||
20 set rec2.b@2["b"] 'b2'
|
||||
21 cfetch cur2@2 rec2@2
|
||||
22 jump 18
|
||||
23 cpop 1
|
||||
24 cfetch cur1@1 rec1@1
|
||||
25 jump 11
|
||||
26 cpop 1
|
||||
27 cfetch cur0@0 rec0@0
|
||||
28 jump 4
|
||||
29 cpop 1
|
||||
23 cclose cur2@2
|
||||
24 cpop 1
|
||||
25 cfetch cur1@1 rec1@1
|
||||
26 jump 11
|
||||
27 cclose cur1@1
|
||||
28 cpop 1
|
||||
29 cfetch cur0@0 rec0@0
|
||||
30 jump 4
|
||||
31 cclose cur0@0
|
||||
32 cpop 1
|
||||
DROP PROCEDURE p1;
|
||||
# Implicit cursor FOR loops
|
||||
CREATE PROCEDURE p1()
|
||||
|
43
mysql-test/main/sp-condition-handler.result
Normal file
43
mysql-test/main/sp-condition-handler.result
Normal file
@ -0,0 +1,43 @@
|
||||
#
|
||||
# Start of 10.3 tests
|
||||
#
|
||||
#
|
||||
# MDEV-16595 SP with a CONTINUE HANDLER inside a loop wastes THD memory aggressively
|
||||
#
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE mem_used_old BIGINT UNSIGNED DEFAULT
|
||||
(SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS
|
||||
WHERE VARIABLE_NAME='MEMORY_USED');
|
||||
DECLARE i INT DEFAULT 1;
|
||||
WHILE i <= 1000
|
||||
DO
|
||||
BEGIN
|
||||
DECLARE msg TEXT;
|
||||
DECLARE mem_used_cur BIGINT UNSIGNED DEFAULT
|
||||
(SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS
|
||||
WHERE VARIABLE_NAME='MEMORY_USED');
|
||||
DECLARE CONTINUE HANDLER FOR SQLSTATE '23000' SET @x=1;
|
||||
DECLARE CONTINUE HANDLER FOR SQLSTATE '23001' SET @x=1;
|
||||
DECLARE CONTINUE HANDLER FOR SQLSTATE '23002' SET @x=1;
|
||||
DECLARE CONTINUE HANDLER FOR SQLSTATE '23003' SET @x=1;
|
||||
DECLARE CONTINUE HANDLER FOR SQLSTATE '23004' SET @x=1;
|
||||
DECLARE CONTINUE HANDLER FOR SQLSTATE '23005' SET @x=1;
|
||||
DECLARE CONTINUE HANDLER FOR SQLSTATE '23006' SET @x=1;
|
||||
DECLARE CONTINUE HANDLER FOR SQLSTATE '23007' SET @x=1;
|
||||
DECLARE CONTINUE HANDLER FOR SQLSTATE '23008' SET @x=1;
|
||||
IF (mem_used_cur >= mem_used_old * 1.1) THEN
|
||||
SHOW STATUS LIKE 'Memory_used';
|
||||
SET msg=CONCAT('Memory leak detected: i=', i, ' mem_used_old=',mem_used_old,' mem_used_cur=', mem_used_cur);
|
||||
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT=msg;
|
||||
END IF;
|
||||
END;
|
||||
SET i=i+1;
|
||||
END WHILE;
|
||||
END;
|
||||
$$
|
||||
CALL p1;
|
||||
DROP PROCEDURE p1;
|
||||
#
|
||||
# End of 10.3 tests
|
||||
#
|
50
mysql-test/main/sp-condition-handler.test
Normal file
50
mysql-test/main/sp-condition-handler.test
Normal file
@ -0,0 +1,50 @@
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.3 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-16595 SP with a CONTINUE HANDLER inside a loop wastes THD memory aggressively
|
||||
--echo #
|
||||
|
||||
DELIMITER $$;
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE mem_used_old BIGINT UNSIGNED DEFAULT
|
||||
(SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS
|
||||
WHERE VARIABLE_NAME='MEMORY_USED');
|
||||
DECLARE i INT DEFAULT 1;
|
||||
WHILE i <= 1000
|
||||
DO
|
||||
BEGIN
|
||||
DECLARE msg TEXT;
|
||||
DECLARE mem_used_cur BIGINT UNSIGNED DEFAULT
|
||||
(SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS
|
||||
WHERE VARIABLE_NAME='MEMORY_USED');
|
||||
DECLARE CONTINUE HANDLER FOR SQLSTATE '23000' SET @x=1;
|
||||
DECLARE CONTINUE HANDLER FOR SQLSTATE '23001' SET @x=1;
|
||||
DECLARE CONTINUE HANDLER FOR SQLSTATE '23002' SET @x=1;
|
||||
DECLARE CONTINUE HANDLER FOR SQLSTATE '23003' SET @x=1;
|
||||
DECLARE CONTINUE HANDLER FOR SQLSTATE '23004' SET @x=1;
|
||||
DECLARE CONTINUE HANDLER FOR SQLSTATE '23005' SET @x=1;
|
||||
DECLARE CONTINUE HANDLER FOR SQLSTATE '23006' SET @x=1;
|
||||
DECLARE CONTINUE HANDLER FOR SQLSTATE '23007' SET @x=1;
|
||||
DECLARE CONTINUE HANDLER FOR SQLSTATE '23008' SET @x=1;
|
||||
IF (mem_used_cur >= mem_used_old * 1.1) THEN
|
||||
SHOW STATUS LIKE 'Memory_used';
|
||||
SET msg=CONCAT('Memory leak detected: i=', i, ' mem_used_old=',mem_used_old,' mem_used_cur=', mem_used_cur);
|
||||
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT=msg;
|
||||
END IF;
|
||||
END;
|
||||
SET i=i+1;
|
||||
END WHILE;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
CALL p1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.3 tests
|
||||
--echo #
|
@ -611,3 +611,105 @@ a b
|
||||
a b
|
||||
2 b2
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-15941 Explicit cursor FOR loop does not close the cursor
|
||||
#
|
||||
BEGIN NOT ATOMIC
|
||||
DECLARE v INT;
|
||||
DECLARE cur CURSOR FOR SELECT 1 AS a FROM DUAL;
|
||||
FOR rec IN cur
|
||||
DO
|
||||
SELECT rec.a;
|
||||
END FOR;
|
||||
FETCH cur INTO v;
|
||||
END;
|
||||
$$
|
||||
rec.a
|
||||
1
|
||||
ERROR 24000: Cursor is not open
|
||||
BEGIN NOT ATOMIC
|
||||
DECLARE v INT;
|
||||
DECLARE cur CURSOR FOR SELECT 1 AS a FROM DUAL;
|
||||
label:
|
||||
FOR rec IN cur
|
||||
DO
|
||||
SELECT rec.a;
|
||||
END FOR;
|
||||
FETCH cur INTO v;
|
||||
END;
|
||||
$$
|
||||
rec.a
|
||||
1
|
||||
ERROR 24000: Cursor is not open
|
||||
BEGIN NOT ATOMIC
|
||||
DECLARE cur CURSOR FOR SELECT 1 AS a FROM DUAL;
|
||||
OPEN cur;
|
||||
FOR rec IN cur DO
|
||||
SELECT rec.a;
|
||||
END FOR;
|
||||
END;
|
||||
$$
|
||||
ERROR 24000: Cursor is already open
|
||||
BEGIN NOT ATOMIC
|
||||
DECLARE cur CURSOR FOR SELECT 1 AS a FROM DUAL;
|
||||
FOR rec IN cur
|
||||
DO
|
||||
SELECT rec.a;
|
||||
END FOR;
|
||||
FOR rec IN cur
|
||||
DO
|
||||
SELECT rec.a;
|
||||
END FOR;
|
||||
END;
|
||||
$$
|
||||
rec.a
|
||||
1
|
||||
rec.a
|
||||
1
|
||||
BEGIN NOT ATOMIC
|
||||
DECLARE cur CURSOR FOR SELECT 1 AS a FROM DUAL;
|
||||
label1:
|
||||
FOR rec IN cur
|
||||
DO
|
||||
SELECT rec.a;
|
||||
END FOR;
|
||||
label2:
|
||||
FOR rec IN cur
|
||||
DO
|
||||
SELECT rec.a;
|
||||
END FOR;
|
||||
END;
|
||||
$$
|
||||
rec.a
|
||||
1
|
||||
rec.a
|
||||
1
|
||||
#
|
||||
# MDEV-16584 SP with a cursor inside a loop wastes THD memory aggressively
|
||||
#
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE mem_used_old BIGINT UNSIGNED DEFAULT
|
||||
(SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS
|
||||
WHERE VARIABLE_NAME='MEMORY_USED');
|
||||
DECLARE i INT DEFAULT 1;
|
||||
WHILE i <= 5000
|
||||
DO
|
||||
BEGIN
|
||||
DECLARE msg TEXT;
|
||||
DECLARE mem_used_cur BIGINT UNSIGNED DEFAULT
|
||||
(SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS
|
||||
WHERE VARIABLE_NAME='MEMORY_USED');
|
||||
DECLARE cur CURSOR FOR SELECT 1 FROM DUAL;
|
||||
IF (mem_used_cur >= mem_used_old * 2) THEN
|
||||
SHOW STATUS LIKE 'Memory_used';
|
||||
SET msg=CONCAT('Memory leak detected: i=', i, ' mem_used_old=',mem_used_old,' mem_used_cur=', mem_used_cur);
|
||||
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT=msg;
|
||||
END IF;
|
||||
END;
|
||||
SET i=i+1;
|
||||
END WHILE;
|
||||
END;
|
||||
$$
|
||||
CALL p1;
|
||||
DROP PROCEDURE p1;
|
||||
|
@ -607,3 +607,119 @@ END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-15941 Explicit cursor FOR loop does not close the cursor
|
||||
--echo #
|
||||
|
||||
DELIMITER $$;
|
||||
--error ER_SP_CURSOR_NOT_OPEN
|
||||
BEGIN NOT ATOMIC
|
||||
DECLARE v INT;
|
||||
DECLARE cur CURSOR FOR SELECT 1 AS a FROM DUAL;
|
||||
FOR rec IN cur
|
||||
DO
|
||||
SELECT rec.a;
|
||||
END FOR;
|
||||
FETCH cur INTO v;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
|
||||
DELIMITER $$;
|
||||
--error ER_SP_CURSOR_NOT_OPEN
|
||||
BEGIN NOT ATOMIC
|
||||
DECLARE v INT;
|
||||
DECLARE cur CURSOR FOR SELECT 1 AS a FROM DUAL;
|
||||
label:
|
||||
FOR rec IN cur
|
||||
DO
|
||||
SELECT rec.a;
|
||||
END FOR;
|
||||
FETCH cur INTO v;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
|
||||
DELIMITER $$;
|
||||
--error ER_SP_CURSOR_ALREADY_OPEN
|
||||
BEGIN NOT ATOMIC
|
||||
DECLARE cur CURSOR FOR SELECT 1 AS a FROM DUAL;
|
||||
OPEN cur;
|
||||
FOR rec IN cur DO
|
||||
SELECT rec.a;
|
||||
END FOR;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
|
||||
DELIMITER $$;
|
||||
BEGIN NOT ATOMIC
|
||||
DECLARE cur CURSOR FOR SELECT 1 AS a FROM DUAL;
|
||||
FOR rec IN cur
|
||||
DO
|
||||
SELECT rec.a;
|
||||
END FOR;
|
||||
FOR rec IN cur
|
||||
DO
|
||||
SELECT rec.a;
|
||||
END FOR;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
|
||||
DELIMITER $$;
|
||||
BEGIN NOT ATOMIC
|
||||
DECLARE cur CURSOR FOR SELECT 1 AS a FROM DUAL;
|
||||
label1:
|
||||
FOR rec IN cur
|
||||
DO
|
||||
SELECT rec.a;
|
||||
END FOR;
|
||||
label2:
|
||||
FOR rec IN cur
|
||||
DO
|
||||
SELECT rec.a;
|
||||
END FOR;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-16584 SP with a cursor inside a loop wastes THD memory aggressively
|
||||
--echo #
|
||||
|
||||
DELIMITER $$;
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE mem_used_old BIGINT UNSIGNED DEFAULT
|
||||
(SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS
|
||||
WHERE VARIABLE_NAME='MEMORY_USED');
|
||||
DECLARE i INT DEFAULT 1;
|
||||
WHILE i <= 5000
|
||||
DO
|
||||
BEGIN
|
||||
DECLARE msg TEXT;
|
||||
DECLARE mem_used_cur BIGINT UNSIGNED DEFAULT
|
||||
(SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS
|
||||
WHERE VARIABLE_NAME='MEMORY_USED');
|
||||
DECLARE cur CURSOR FOR SELECT 1 FROM DUAL;
|
||||
IF (mem_used_cur >= mem_used_old * 2) THEN
|
||||
SHOW STATUS LIKE 'Memory_used';
|
||||
SET msg=CONCAT('Memory leak detected: i=', i, ' mem_used_old=',mem_used_old,' mem_used_cur=', mem_used_cur);
|
||||
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT=msg;
|
||||
END IF;
|
||||
END;
|
||||
SET i=i+1;
|
||||
END WHILE;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
CALL p1;
|
||||
DROP PROCEDURE p1;
|
||||
|
@ -755,6 +755,7 @@ GRANT EXECUTE ON PROCEDURE `test`.`sp1` TO 'root'@'localhost'
|
||||
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
|
||||
drop procedure sp1;
|
||||
set password='';
|
||||
update mysql.user set plugin='';
|
||||
#
|
||||
# MDEV-13396 Unexpected "alter routine comand defined" during CREATE OR REPLACE PROCEDURE
|
||||
#
|
||||
|
@ -1023,6 +1023,8 @@ grant execute on procedure sp1 to current_user() identified by 'barfoo';
|
||||
show grants;
|
||||
drop procedure sp1;
|
||||
set password='';
|
||||
#cleanup after MDEV-16238
|
||||
update mysql.user set plugin='';
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-13396 Unexpected "alter routine comand defined" during CREATE OR REPLACE PROCEDURE
|
||||
|
@ -8356,6 +8356,34 @@ CREATE PROCEDURE foo ( IN i INT UNSIGNED ) BEGIN END;
|
||||
CALL foo( LAST_INSERT_ID() );
|
||||
DROP PROCEDURE foo;
|
||||
#
|
||||
# MDEV-15870 Using aggregate and window function in unexpected places can crash the server
|
||||
#
|
||||
CREATE PROCEDURE p1 (a TEXT) BEGIN END;
|
||||
CALL p1(RANK() OVER (ORDER BY 1));
|
||||
ERROR HY000: Window function is allowed only in SELECT list and ORDER BY clause
|
||||
CALL p1(ROW_NUMBER() OVER ());
|
||||
ERROR HY000: Window function is allowed only in SELECT list and ORDER BY clause
|
||||
CALL p1(SUM(1));
|
||||
ERROR HY000: Invalid use of group function
|
||||
DROP PROCEDURE p1;
|
||||
#
|
||||
# MDEV-16311 Server crash when using a NAME_CONST() with a CURSOR
|
||||
#
|
||||
SET sql_mode=STRICT_ALL_TABLES;
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (10);
|
||||
BEGIN NOT ATOMIC
|
||||
DECLARE a INT;
|
||||
DECLARE c CURSOR FOR SELECT NAME_CONST('x','y') FROM t1;
|
||||
OPEN c;
|
||||
FETCH c INTO a;
|
||||
CLOSE c;
|
||||
END;
|
||||
$$
|
||||
ERROR 22007: Incorrect integer value: 'y' for column 'a' at row 1
|
||||
DROP TABLE t1;
|
||||
SET sql_mode=DEFAULT;
|
||||
#
|
||||
# Start of 10.3 tests
|
||||
#
|
||||
#
|
||||
|
@ -9868,6 +9868,41 @@ CREATE PROCEDURE foo ( IN i INT UNSIGNED ) BEGIN END;
|
||||
CALL foo( LAST_INSERT_ID() );
|
||||
DROP PROCEDURE foo;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-15870 Using aggregate and window function in unexpected places can crash the server
|
||||
--echo #
|
||||
|
||||
CREATE PROCEDURE p1 (a TEXT) BEGIN END;
|
||||
--error ER_WRONG_PLACEMENT_OF_WINDOW_FUNCTION
|
||||
CALL p1(RANK() OVER (ORDER BY 1));
|
||||
--error ER_WRONG_PLACEMENT_OF_WINDOW_FUNCTION
|
||||
CALL p1(ROW_NUMBER() OVER ());
|
||||
--error ER_INVALID_GROUP_FUNC_USE
|
||||
CALL p1(SUM(1));
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-16311 Server crash when using a NAME_CONST() with a CURSOR
|
||||
--echo #
|
||||
|
||||
SET sql_mode=STRICT_ALL_TABLES;
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (10);
|
||||
DELIMITER $$;
|
||||
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
||||
BEGIN NOT ATOMIC
|
||||
DECLARE a INT;
|
||||
DECLARE c CURSOR FOR SELECT NAME_CONST('x','y') FROM t1;
|
||||
OPEN c;
|
||||
FETCH c INTO a;
|
||||
CLOSE c;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
DROP TABLE t1;
|
||||
SET sql_mode=DEFAULT;
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.3 tests
|
||||
--echo #
|
||||
|
@ -780,3 +780,27 @@ END;
|
||||
SET sql_mode=DEFAULT;
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
SELECT 1+1;
|
||||
syntax error;
|
||||
END;
|
||||
$$
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'error;
|
||||
END' at line 4
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
#
|
||||
# Start of 10.3 tests
|
||||
#
|
||||
#
|
||||
# MDEV-16471 mysqldump throws "Variable 'sql_mode' can't be set to the value of 'NULL' (1231)"
|
||||
#
|
||||
SET sql_mode='ORACLE,EMPTY_STRING_IS_NULL';
|
||||
SELECT @@sql_mode;
|
||||
@@sql_mode
|
||||
PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER,EMPTY_STRING_IS_NULL,SIMULTANEOUS_ASSIGNMENT
|
||||
SELECT '' AS empty;
|
||||
empty
|
||||
NULL
|
||||
SET sql_mode='';
|
||||
SELECT @@sql_mode;
|
||||
|
@ -554,3 +554,26 @@ BEGIN
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.3 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-16471 mysqldump throws "Variable 'sql_mode' can't be set to the value of 'NULL' (1231)"
|
||||
--echo #
|
||||
|
||||
SET sql_mode='ORACLE,EMPTY_STRING_IS_NULL';
|
||||
SELECT @@sql_mode;
|
||||
SELECT '' AS empty;
|
||||
SET sql_mode='';
|
||||
SELECT @@sql_mode;
|
||||
SET sql_mode=DEFAULT;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.3 tests
|
||||
--echo #
|
||||
|
@ -1086,6 +1086,9 @@ test t2 idx4 3 1.1304
|
||||
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS() INDEXES ALL;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t2 analyze status Engine-independent statistics collected
|
||||
test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
|
||||
test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
|
||||
test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
|
||||
test.t2 analyze status OK
|
||||
SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
|
||||
db_name table_name index_name prefix_arity avg_frequency
|
||||
@ -1146,6 +1149,11 @@ test t2 idx4 4 1.0000
|
||||
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS ALL INDEXES ALL;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t2 analyze status Engine-independent statistics collected
|
||||
test.t2 analyze Note Data truncated for column 'avg_length' at row 1
|
||||
test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
|
||||
test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
|
||||
test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
|
||||
test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
|
||||
test.t2 analyze status OK
|
||||
SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
|
||||
db_name table_name index_name prefix_arity avg_frequency
|
||||
@ -1171,6 +1179,8 @@ test t2 idx3 1 8.5000
|
||||
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS() INDEXES ALL;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t2 analyze status Engine-independent statistics collected
|
||||
test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
|
||||
test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
|
||||
test.t2 analyze status OK
|
||||
SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
|
||||
db_name table_name index_name prefix_arity avg_frequency
|
||||
@ -1682,6 +1692,27 @@ set use_stat_tables=@save_use_stat_tables;
|
||||
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
|
||||
drop table t1,t2;
|
||||
#
|
||||
# MDEV-16507: statistics for temporary tables should not be used
|
||||
#
|
||||
SET
|
||||
@save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
|
||||
SET @@use_stat_tables = preferably ;
|
||||
SET @@optimizer_use_condition_selectivity = 4;
|
||||
CREATE TABLE t1 (
|
||||
TIMESTAMP TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
ON UPDATE CURRENT_TIMESTAMP
|
||||
);
|
||||
SET @had_t1_table= @@warning_count != 0;
|
||||
CREATE TEMPORARY TABLE tmp_t1 LIKE t1;
|
||||
INSERT INTO tmp_t1 VALUES (now());
|
||||
INSERT INTO t1 SELECT * FROM tmp_t1 WHERE @had_t1_table=0;
|
||||
DROP TABLE t1;
|
||||
SET
|
||||
use_stat_tables=@save_use_stat_tables;
|
||||
SET
|
||||
optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
|
||||
# End of 10.0 tests
|
||||
#
|
||||
# MDEV-9590: Always print "Engine-independent statistic" warnings and
|
||||
# might be filtering columns unintentionally from engines
|
||||
#
|
||||
|
@ -818,6 +818,32 @@ set use_stat_tables=@save_use_stat_tables;
|
||||
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
|
||||
drop table t1,t2;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-16507: statistics for temporary tables should not be used
|
||||
--echo #
|
||||
|
||||
SET
|
||||
@save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
|
||||
SET @@use_stat_tables = preferably ;
|
||||
SET @@optimizer_use_condition_selectivity = 4;
|
||||
|
||||
CREATE TABLE t1 (
|
||||
TIMESTAMP TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
ON UPDATE CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
SET @had_t1_table= @@warning_count != 0;
|
||||
CREATE TEMPORARY TABLE tmp_t1 LIKE t1;
|
||||
INSERT INTO tmp_t1 VALUES (now());
|
||||
INSERT INTO t1 SELECT * FROM tmp_t1 WHERE @had_t1_table=0;
|
||||
DROP TABLE t1;
|
||||
|
||||
SET
|
||||
use_stat_tables=@save_use_stat_tables;
|
||||
SET
|
||||
optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
|
||||
--echo # End of 10.0 tests
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-9590: Always print "Engine-independent statistic" warnings and
|
||||
--echo # might be filtering columns unintentionally from engines
|
||||
|
@ -334,7 +334,7 @@ SELECT * FROM t1
|
||||
WHERE (f1) IN (SELECT f1 FROM t2)
|
||||
LIMIT 0;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Zero limit
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
|
||||
SELECT * FROM t1
|
||||
WHERE (f1) IN (SELECT f1 FROM t2)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user