mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge tag 'mariadb-10.0.33' into bb-10.0-galera
This commit is contained in:
@ -503,6 +503,12 @@ ENDIF()
|
||||
|
||||
INCLUDE(CPack)
|
||||
|
||||
IF(WIN32 AND SIGNCODE)
|
||||
# Configure post-install script for authenticode signing
|
||||
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/cmake/sign.cmake.in sign.cmake @ONLY)
|
||||
INSTALL(SCRIPT ${PROJECT_BINARY_DIR}/sign.cmake)
|
||||
ENDIF()
|
||||
|
||||
IF(NON_DISTRIBUTABLE_WARNING)
|
||||
MESSAGE(WARNING "
|
||||
You have linked MariaDB with GPLv3 libraries! You may not distribute the resulting binary. If you do, you will put yourself into a legal problem with Free Software Foundation.")
|
||||
|
@ -1067,8 +1067,7 @@ static void fix_history(String *final_command);
|
||||
|
||||
static COMMANDS *find_command(char *name);
|
||||
static COMMANDS *find_command(char cmd_name);
|
||||
static bool add_line(String &buffer, char *line, ulong line_length,
|
||||
char *in_string, bool *ml_comment, bool truncated);
|
||||
static bool add_line(String &, char *, ulong, char *, bool *, bool);
|
||||
static void remove_cntrl(String &buffer);
|
||||
static void print_table_data(MYSQL_RES *result);
|
||||
static void print_table_data_html(MYSQL_RES *result);
|
||||
@ -1080,7 +1079,7 @@ static ulong start_timer(void);
|
||||
static void end_timer(ulong start_time,char *buff);
|
||||
static void mysql_end_timer(ulong start_time,char *buff);
|
||||
static void nice_time(double sec,char *buff,bool part_second);
|
||||
extern "C" sig_handler mysql_end(int sig);
|
||||
extern "C" sig_handler mysql_end(int sig) __attribute__ ((noreturn));
|
||||
extern "C" sig_handler handle_sigint(int sig);
|
||||
#if defined(HAVE_TERMIOS_H) && defined(GWINSZ_IN_SYS_IOCTL)
|
||||
static sig_handler window_resize(int sig);
|
||||
|
@ -47,6 +47,21 @@ MACRO (RUN_BISON input_yy output_cc output_h)
|
||||
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}
|
||||
@ -54,6 +69,7 @@ MACRO (RUN_BISON input_yy output_cc output_h)
|
||||
--output=${output_cc}
|
||||
--defines=${output_h}
|
||||
${input_yy}
|
||||
${VS_FIX_OUTPUT_TIMESTAMPS}
|
||||
DEPENDS ${input_yy}
|
||||
)
|
||||
ELSE()
|
||||
|
@ -57,16 +57,7 @@ FUNCTION (INSTALL_DEBUG_SYMBOLS)
|
||||
ENDIF()
|
||||
SET(targets ${ARG_DEFAULT_ARGS})
|
||||
FOREACH(target ${targets})
|
||||
GET_TARGET_PROPERTY(type ${target} TYPE)
|
||||
GET_TARGET_PROPERTY(location ${target} LOCATION)
|
||||
STRING(REPLACE ".exe" ".pdb" pdb_location ${location})
|
||||
STRING(REPLACE ".dll" ".pdb" pdb_location ${pdb_location})
|
||||
STRING(REPLACE ".lib" ".pdb" pdb_location ${pdb_location})
|
||||
IF(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
STRING(REPLACE
|
||||
"${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}"
|
||||
pdb_location ${pdb_location})
|
||||
ENDIF()
|
||||
GET_TARGET_PROPERTY(target_type ${target} TYPE)
|
||||
|
||||
set(comp "")
|
||||
IF(ARG_COMPONENT STREQUAL "Server")
|
||||
@ -87,11 +78,9 @@ FUNCTION (INSTALL_DEBUG_SYMBOLS)
|
||||
IF(NOT comp)
|
||||
SET(comp Debuginfo_archive_only) # not in MSI
|
||||
ENDIF()
|
||||
IF(type MATCHES "STATIC")
|
||||
# PDB for static libraries might be unsupported http://public.kitware.com/Bug/view.php?id=14600
|
||||
SET(opt OPTIONAL)
|
||||
IF(NOT target_type MATCHES "STATIC")
|
||||
INSTALL(FILES $<TARGET_PDB_FILE:${target}> DESTINATION ${ARG_INSTALL_LOCATION} COMPONENT ${comp})
|
||||
ENDIF()
|
||||
INSTALL(FILES ${pdb_location} DESTINATION ${ARG_INSTALL_LOCATION} COMPONENT ${comp} ${opt})
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
ENDFUNCTION()
|
||||
@ -243,37 +232,22 @@ IF(WIN32)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
MACRO(SIGN_TARGET)
|
||||
MYSQL_PARSE_ARGUMENTS(ARG "COMPONENT" "" ${ARGN})
|
||||
SET(target ${ARG_DEFAULT_ARGS})
|
||||
IF(ARG_COMPONENT)
|
||||
SET(comp COMPONENT ${ARG_COMPONENT})
|
||||
ELSE()
|
||||
SET(comp)
|
||||
|
||||
FUNCTION(SIGN_TARGET target)
|
||||
IF(NOT SIGNCODE)
|
||||
RETURN()
|
||||
ENDIF()
|
||||
GET_TARGET_PROPERTY(target_type ${target} TYPE)
|
||||
IF(target_type AND NOT target_type MATCHES "STATIC")
|
||||
GET_TARGET_PROPERTY(target_location ${target} LOCATION)
|
||||
IF(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}"
|
||||
target_location ${target_location})
|
||||
IF((NOT target_type) OR (target_type MATCHES "STATIC"))
|
||||
RETURN()
|
||||
ENDIF()
|
||||
INSTALL(CODE
|
||||
"EXECUTE_PROCESS(COMMAND
|
||||
\"${SIGNTOOL_EXECUTABLE}\" verify /pa /q \"${target_location}\"
|
||||
RESULT_VARIABLE ERR)
|
||||
IF(NOT \${ERR} EQUAL 0)
|
||||
EXECUTE_PROCESS(COMMAND
|
||||
\"${SIGNTOOL_EXECUTABLE}\" sign ${SIGNTOOL_PARAMETERS} \"${target_location}\"
|
||||
RESULT_VARIABLE ERR)
|
||||
ENDIF()
|
||||
IF(NOT \${ERR} EQUAL 0)
|
||||
MESSAGE(FATAL_ERROR \"Error signing '${target_location}'\")
|
||||
ENDIF()
|
||||
" ${comp})
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
# Mark executable for signing by creating empty *.signme file
|
||||
# The actual signing happens in preinstall step
|
||||
# (which traverses
|
||||
ADD_CUSTOM_COMMAND(TARGET ${target} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E touch "$<TARGET_FILE:${target}>.signme"
|
||||
)
|
||||
ENDFUNCTION()
|
||||
|
||||
# Installs targets, also installs pdbs on Windows.
|
||||
#
|
||||
|
@ -115,8 +115,8 @@ IF(MSVC)
|
||||
ENDIF()
|
||||
|
||||
#TODO: update the code and remove the disabled warnings
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /wd4291 /wd4577 /we4099")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996 /we4700")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /wd4291 /wd4577 /we4099 /we4700")
|
||||
|
||||
IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
|
||||
# _WIN64 is defined by the compiler itself.
|
||||
|
@ -1,11 +1,23 @@
|
||||
INCLUDE (CheckCSourceRuns)
|
||||
|
||||
SET(WITH_PCRE "auto" CACHE STRING
|
||||
"Which pcre to use (possible values are 'bundled', 'system', or 'auto')")
|
||||
|
||||
MACRO (CHECK_PCRE)
|
||||
IF(WITH_PCRE STREQUAL "system" OR WITH_PCRE STREQUAL "auto")
|
||||
CHECK_LIBRARY_EXISTS(pcre pcre_stack_guard "" HAVE_PCRE)
|
||||
CHECK_LIBRARY_EXISTS(pcre pcre_stack_guard "" HAVE_PCRE_STACK_GUARD)
|
||||
IF(NOT CMAKE_CROSSCOMPILING)
|
||||
SET(CMAKE_REQUIRED_LIBRARIES "pcre")
|
||||
CHECK_C_SOURCE_RUNS("
|
||||
#include <pcre.h>
|
||||
int main() {
|
||||
return -pcre_exec(NULL, NULL, NULL, -999, -999, 0, NULL, 0) < 256;
|
||||
}" PCRE_STACK_SIZE_OK)
|
||||
SET(CMAKE_REQUIRED_LIBRARIES)
|
||||
ENDIF()
|
||||
IF(NOT HAVE_PCRE OR WITH_PCRE STREQUAL "bundled")
|
||||
ENDIF()
|
||||
IF(NOT HAVE_PCRE_STACK_GUARD OR NOT PCRE_STACK_SIZE_OK OR
|
||||
WITH_PCRE STREQUAL "bundled")
|
||||
IF (WITH_PCRE STREQUAL "system")
|
||||
MESSAGE(FATAL_ERROR "system pcre is not found or unusable")
|
||||
ENDIF()
|
||||
|
@ -208,7 +208,7 @@ MACRO(MYSQL_ADD_PLUGIN)
|
||||
# only server package is required to be generated.
|
||||
IF(CPACK_COMPONENTS_ALL AND
|
||||
NOT CPACK_COMPONENTS_ALL MATCHES ${ARG_COMPONENT} AND
|
||||
NOT WITH_WSREP)
|
||||
NOT WITH_WSREP AND INSTALL_SYSCONF2DIR)
|
||||
IF (ARG_STORAGE_ENGINE)
|
||||
SET(ver " = %{version}-%{release}")
|
||||
ENDIF()
|
||||
|
18
cmake/sign.cmake.in
Normal file
18
cmake/sign.cmake.in
Normal file
@ -0,0 +1,18 @@
|
||||
FILE(GLOB_RECURSE files "@CMAKE_BINARY_DIR@/*.signme")
|
||||
MESSAGE(STATUS "signing files")
|
||||
FOREACH(f ${files})
|
||||
STRING(REPLACE ".signme" "" exe_location "${f}")
|
||||
|
||||
string (REPLACE ";" " " params "@SIGNTOOL_PARAMETERS@")
|
||||
#MESSAGE("@SIGNTOOL_EXECUTABLE@" sign ${params} "${exe_location}")
|
||||
|
||||
EXECUTE_PROCESS(COMMAND
|
||||
"@SIGNTOOL_EXECUTABLE@" sign @SIGNTOOL_PARAMETERS@ "${exe_location}"
|
||||
RESULT_VARIABLE ERR)
|
||||
IF(NOT ${ERR} EQUAL 0)
|
||||
MESSAGE( "Error ${ERR} signing ${exe_location}")
|
||||
ELSE()
|
||||
FILE(REMOVE ${f})
|
||||
ENDIF()
|
||||
|
||||
ENDFOREACH()
|
@ -104,12 +104,16 @@ void cleanup_and_exit(int exit_code)
|
||||
exit(exit_code);
|
||||
}
|
||||
|
||||
static void usage(my_bool version)
|
||||
static void version()
|
||||
{
|
||||
printf("%s Ver 1.6 for %s at %s\n",my_progname,SYSTEM_TYPE,
|
||||
MACHINE_TYPE);
|
||||
if (version)
|
||||
return;
|
||||
printf("%s Ver 1.6 for %s at %s\n",my_progname,SYSTEM_TYPE, MACHINE_TYPE);
|
||||
}
|
||||
|
||||
|
||||
static void usage() __attribute__ ((noreturn));
|
||||
static void usage()
|
||||
{
|
||||
version();
|
||||
puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n");
|
||||
puts("Prints all arguments that is give to some program using the default files");
|
||||
printf("Usage: %s [OPTIONS] [groups]\n", my_progname);
|
||||
@ -133,12 +137,13 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
cleanup_and_exit(0);
|
||||
case 'I':
|
||||
case '?':
|
||||
usage(0);
|
||||
usage();
|
||||
case 'v':
|
||||
verbose++;
|
||||
break;
|
||||
case 'V':
|
||||
usage(1);
|
||||
version();
|
||||
/* fall through */
|
||||
case '#':
|
||||
DBUG_PUSH(argument ? argument : default_dbug_option);
|
||||
break;
|
||||
@ -186,7 +191,7 @@ int main(int argc, char **argv)
|
||||
nargs+= array_elements(mysqld_groups);
|
||||
|
||||
if (nargs < 2)
|
||||
usage(0);
|
||||
usage();
|
||||
|
||||
load_default_groups=(char**) my_malloc(nargs*sizeof(char*), MYF(MY_WME));
|
||||
if (!load_default_groups)
|
||||
|
@ -30,8 +30,3 @@ SET(YASSL_SOURCES src/buffer.cpp src/cert_wrapper.cpp src/crypto_wrapper.cpp sr
|
||||
ADD_CONVENIENCE_LIBRARY(yassl ${YASSL_SOURCES})
|
||||
RESTRICT_SYMBOL_EXPORTS(yassl)
|
||||
|
||||
IF(MSVC)
|
||||
INSTALL_DEBUG_TARGET(yassl DESTINATION ${INSTALL_LIBDIR}/debug)
|
||||
ENDIF()
|
||||
|
||||
|
||||
|
@ -12,6 +12,14 @@ before calling SSL_new();
|
||||
|
||||
*** end Note ***
|
||||
|
||||
yaSSL Release notes, version 2.4.4 (8/8/2017)
|
||||
This release of yaSSL fixes an interop issue. A fix for detecting cipher
|
||||
suites with non leading zeros is included as yaSSL only supports cipher
|
||||
suites with leading zeros. Thanks for the report from Security Innovation
|
||||
and Oracle.
|
||||
|
||||
Users interoping with other SSL stacks should update.
|
||||
|
||||
yaSSL Release notes, version 2.4.2 (9/22/2016)
|
||||
This release of yaSSL fixes a medium security vulnerability. A fix for
|
||||
potential AES side channel leaks is included that a local user monitoring
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
Copyright (c) 2005, 2014, Oracle and/or its affiliates.
|
||||
Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
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
|
||||
@ -34,7 +35,7 @@
|
||||
#include "rsa.h"
|
||||
|
||||
|
||||
#define YASSL_VERSION "2.4.2"
|
||||
#define YASSL_VERSION "2.4.4"
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2005, 2014, Oracle and/or its affiliates
|
||||
Copyright (c) 2005, 2017, Oracle and/or its affiliates.
|
||||
|
||||
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
|
||||
@ -1578,6 +1578,10 @@ void ServerHello::Process(input_buffer& input, SSL& ssl)
|
||||
ssl.SetError(badVersion_error);
|
||||
return;
|
||||
}
|
||||
if (cipher_suite_[0] != 0x00) {
|
||||
ssl.SetError(unknown_cipher);
|
||||
return;
|
||||
}
|
||||
ssl.set_pending(cipher_suite_[1]);
|
||||
ssl.set_random(random_, server_end);
|
||||
if (id_len_)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2005, 2014, Oracle and/or its affiliates
|
||||
Copyright (c) 2005, 2017, Oracle and/or its affiliates.
|
||||
|
||||
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
|
||||
@ -1399,12 +1399,17 @@ void SSL::matchSuite(const opaque* peer, uint length)
|
||||
// start with best, if a match we are good, Ciphers are at odd index
|
||||
// since all SSL and TLS ciphers have 0x00 first byte
|
||||
for (uint i = 1; i < secure_.get_parms().suites_size_; i += 2)
|
||||
for (uint j = 1; j < length; j+= 2)
|
||||
if (secure_.use_parms().suites_[i] == peer[j]) {
|
||||
for (uint j = 0; (j + 1) < length; j+= 2) {
|
||||
if (peer[j] != 0x00) {
|
||||
continue; // only 0x00 first byte supported
|
||||
}
|
||||
|
||||
if (secure_.use_parms().suites_[i] == peer[j + 1]) {
|
||||
secure_.use_parms().suite_[0] = 0x00;
|
||||
secure_.use_parms().suite_[1] = peer[j];
|
||||
secure_.use_parms().suite_[1] = peer[j + 1];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
SetError(match_error);
|
||||
}
|
||||
@ -2697,4 +2702,3 @@ extern "C" void yaSSL_CleanUp()
|
||||
yaSSL::sessionsInstance = 0;
|
||||
yaSSL::errorsInstance = 0;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,3 @@ SET(TAOCRYPT_SOURCES src/aes.cpp src/aestables.cpp src/algebra.cpp src/arc4.cpp
|
||||
ADD_CONVENIENCE_LIBRARY(taocrypt ${TAOCRYPT_SOURCES})
|
||||
RESTRICT_SYMBOL_EXPORTS(taocrypt)
|
||||
|
||||
IF(MSVC)
|
||||
INSTALL_DEBUG_TARGET(taocrypt DESTINATION ${INSTALL_LIBDIR}/debug)
|
||||
ENDIF()
|
||||
|
||||
|
@ -152,15 +152,6 @@ MERGE_LIBRARIES(mysqlserver STATIC ${EMBEDDED_LIBS}
|
||||
|
||||
INSTALL(FILES embedded_priv.h DESTINATION ${INSTALL_INCLUDEDIR}/private COMPONENT ${COMPONENT_MYSQLSERVER})
|
||||
|
||||
# Visual Studio users need debug static library
|
||||
IF(MSVC)
|
||||
INSTALL_DEBUG_TARGET(mysqlserver DESTINATION ${INSTALL_LIBDIR}/debug)
|
||||
ENDIF()
|
||||
|
||||
IF(UNIX)
|
||||
INSTALL_DEBUG_TARGET(mysqlserver DESTINATION ${INSTALL_LIBDIR} RENAME
|
||||
${CMAKE_STATIC_LIBRARY_PREFIX}mysqld-debug)
|
||||
ENDIF()
|
||||
|
||||
# List of exported functions in embedded (client api except client plugin or
|
||||
# async (*_start/*_cont functions)
|
||||
|
@ -1,74 +1,93 @@
|
||||
This directory contains a test suite for the MySQL daemon. To run
|
||||
the currently existing test cases, simply execute ./mysql-test-run in
|
||||
this directory. It will fire up the newly built mysqld and test it.
|
||||
This directory contains test suites for the MariaDB server. To run
|
||||
currently existing test cases, execute ./mysql-test-run in this directory.
|
||||
|
||||
Note that you do not have to have to do "make install", and you could
|
||||
actually have a co-existing MySQL installation. The tests will not
|
||||
conflict with it. To run the test suite in a source directory, you
|
||||
must do make first.
|
||||
Some tests are known to fail on some platforms or be otherwise unreliable.
|
||||
The file "unstable-tests" contains the list of such tests along with
|
||||
a comment for every test.
|
||||
To exclude them from the test run, execute
|
||||
# ./mysql-test-run --skip-test-list=unstable-tests
|
||||
|
||||
All tests must pass. If one or more of them fail on your system, please
|
||||
read the following manual section for instructions on how to report the
|
||||
problem:
|
||||
In general you do not have to have to do "make install", and you can have
|
||||
a co-existing MariaDB installation, the tests will not conflict with it.
|
||||
To run the tests in a source directory, you must do "make" first.
|
||||
|
||||
In Red Hat distributions, you should run the script as user "mysql".
|
||||
The user is created with nologin shell, so the best bet is something like
|
||||
# su -
|
||||
# cd /usr/share/mysql-test
|
||||
# su -s /bin/bash mysql -c "./mysql-test-run --skip-test-list=unstable-tests"
|
||||
|
||||
This will use the installed MariaDB executables, but will run a private
|
||||
copy of the server process (using data files within /usr/share/mysql-test),
|
||||
so you need not start the mysqld service beforehand.
|
||||
|
||||
You can omit --skip-test-list option if you want to check whether
|
||||
the listed failures occur for you.
|
||||
|
||||
To clean up afterwards, remove the created "var" subdirectory, e.g.
|
||||
# su -s /bin/bash - mysql -c "rm -rf /usr/share/mysql-test/var"
|
||||
|
||||
If one or more tests fail on your system on reasons other than listed
|
||||
in lists of unstable tests, please read the following manual section
|
||||
for instructions on how to report the problem:
|
||||
|
||||
https://mariadb.com/kb/en/reporting-bugs
|
||||
|
||||
If you want to use an already running MySQL server for specific tests,
|
||||
use the --extern option to mysql-test-run. Please note that in this mode,
|
||||
the test suite expects you to provide the names of the tests to run.
|
||||
you are expected to provide names of the tests to run.
|
||||
|
||||
For example, here is the command to run the "alias" and "analyze" tests
|
||||
with an external server:
|
||||
|
||||
mysql-test-run --extern socket=/tmp/mysql.sock alias analyze
|
||||
# mysql-test-run --extern socket=/tmp/mysql.sock alias analyze
|
||||
|
||||
To match your setup, you might also need to provide --socket, --user, and
|
||||
other relevant options.
|
||||
To match your setup, you might need to provide other relevant options.
|
||||
|
||||
With no test cases named on the command line, mysql-test-run falls back
|
||||
to the normal "non-extern" behavior. The reason for this is that some
|
||||
tests cannot run with an external server.
|
||||
With no test names on the command line, mysql-test-run will attempt
|
||||
to execute the default set of tests, which will certainly fail, because
|
||||
many tests cannot run with an external server (they need to control the
|
||||
options with which the server is started, restart the server during
|
||||
execution, etc.)
|
||||
|
||||
You can create your own test cases. To create a test case, create a new
|
||||
file in the t subdirectory using a text editor. The file should have a .test
|
||||
extension. For example:
|
||||
|
||||
xemacs t/test_case_name.test
|
||||
# xemacs t/test_case_name.test
|
||||
|
||||
In the file, put a set of SQL statements that create some tables,
|
||||
load test data, and run some queries to manipulate it.
|
||||
|
||||
We would appreciate it if you name your test tables t1, t2, t3 ... (to not
|
||||
conflict too much with existing tables).
|
||||
|
||||
Your test should begin by dropping the tables you are going to create and
|
||||
end by dropping them again. This ensures that you can run the test over
|
||||
and over again.
|
||||
|
||||
If you are using mysqltest commands (like result file names) in your
|
||||
test case, you should create the result file as follows:
|
||||
If you are using mysqltest commands in your test case, you should create
|
||||
the result file as follows:
|
||||
|
||||
mysql-test-run --record test_case_name
|
||||
# mysql-test-run --record test_case_name
|
||||
|
||||
or
|
||||
|
||||
mysqltest --record < t/test_case_name.test
|
||||
# mysqltest --record < t/test_case_name.test
|
||||
|
||||
If you only have a simple test cases consisting of SQL statements and
|
||||
comments, you can create the test case in one of the following ways:
|
||||
If you only have a simple test case consisting of SQL statements and
|
||||
comments, you can create the result file in one of the following ways:
|
||||
|
||||
mysql-test-run --record test_case_name
|
||||
# mysql-test-run --record test_case_name
|
||||
|
||||
mysql test < t/test_case_name.test > r/test_case_name.result
|
||||
# mysql test < t/test_case_name.test > r/test_case_name.result
|
||||
|
||||
mysqltest --record --database test --result-file=r/test_case_name.result < t/test_case_name.test
|
||||
# mysqltest --record --database test --result-file=r/test_case_name.result < t/test_case_name.test
|
||||
|
||||
When this is done, take a look at r/test_case_name.result
|
||||
- If the result is incorrect, you have found a bug. In this case, you should
|
||||
edit the test result to the correct results so that we can verify
|
||||
that the bug is corrected in future releases.
|
||||
When this is done, take a look at r/test_case_name.result .
|
||||
If the result is incorrect, you have found a bug. In this case, you should
|
||||
edit the test result to the correct results so that we can verify that
|
||||
the bug is corrected in future releases.
|
||||
|
||||
If you want to submit your test case you can send it
|
||||
to maria-developers@lists.launchpad.com or attach it to a bug report on
|
||||
to maria-developers@lists.launchpad.net or attach it to a bug report on
|
||||
http://mariadb.org/jira/.
|
||||
|
||||
If the test case is really big or if it contains 'not public' data,
|
||||
|
@ -11,8 +11,8 @@
|
||||
# check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and
|
||||
# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986)
|
||||
|
||||
-- source include/master-slave.inc
|
||||
source include/have_innodb.inc;
|
||||
source include/master-slave.inc;
|
||||
|
||||
--disable_query_log
|
||||
CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
|
||||
|
18
mysql-test/include/fail_start_mysqld.inc
Normal file
18
mysql-test/include/fail_start_mysqld.inc
Normal file
@ -0,0 +1,18 @@
|
||||
# ==== Usage ====
|
||||
#
|
||||
# [--let $restart_parameters= --innodb-force-recovery=0 --innodb-read-only=1]
|
||||
# [--let $mysqld_stub_cmd= $MYSQLD_LAST_CMD]
|
||||
# [--let $error_log= $MYSQLTEST_VARDIR/log/mysqld.1.err]
|
||||
# --source include/fail_restart_mysqld.inc
|
||||
|
||||
# Evaluate the default of $error_log
|
||||
if (!$error_log)
|
||||
{
|
||||
--let $error_log= $MYSQLTEST_VARDIR/log/mysqld.1.err
|
||||
}
|
||||
|
||||
--error 1
|
||||
--exec $mysqld_stub_cmd $restart_parameters >> $error_log 2>&1
|
||||
|
||||
# As the server is stopped
|
||||
--disable_reconnect
|
@ -31,7 +31,7 @@ if ($shutdown_timeout == 0)
|
||||
--exec echo "wait" > $_expect_file_name
|
||||
|
||||
# Send shutdown to the connected server and give
|
||||
# it 10 seconds to die before zapping it
|
||||
# it an opted number of seconds to die before zapping it
|
||||
shutdown_server $server_shutdown_timeout;
|
||||
|
||||
# Write file to make mysql-test-run.pl start up the server again
|
||||
|
81
mysql-test/include/search_pattern_in_file++.inc
Normal file
81
mysql-test/include/search_pattern_in_file++.inc
Normal file
@ -0,0 +1,81 @@
|
||||
# Purpose:
|
||||
# Simple search with Perl for a pattern in some file.
|
||||
#
|
||||
# The advantages compared to thinkable auxiliary constructs using the
|
||||
# mysqltest language and SQL are:
|
||||
# 1. We do not need a running MySQL server.
|
||||
# 2. SQL causes "noise" during debugging and increases the size of logs.
|
||||
# Perl code does not disturb at all.
|
||||
#
|
||||
# The environment variables SEARCH_FILE and SEARCH_PATTERN must be set
|
||||
# before sourcing this routine.
|
||||
#
|
||||
# Optionally, SEARCH_RANGE can be set to the max number of bytes of the file
|
||||
# to search. If negative, it will search that many bytes at the end of the
|
||||
# file. By default the search happens from the last CURRENT_TEST:
|
||||
# marker till the end of file (appropriate for searching error logs).
|
||||
#
|
||||
# Optionally, SEARCH_ABORT can be set to "FOUND" or "NOT FOUND" and this
|
||||
# will abort if the search result doesn't match the requested one.
|
||||
#
|
||||
# In case of
|
||||
# - SEARCH_FILE and/or SEARCH_PATTERN is not set
|
||||
# - SEARCH_FILE cannot be opened
|
||||
# the test will abort immediate.
|
||||
#
|
||||
# Typical use case (check invalid server startup options):
|
||||
# let $error_log= $MYSQLTEST_VARDIR/log/my_restart.err;
|
||||
# --error 0,1
|
||||
# --remove_file $error_log
|
||||
# let SEARCH_FILE= $error_log;
|
||||
# # Stop the server
|
||||
# let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
|
||||
# --exec echo "wait" > $restart_file
|
||||
# --shutdown_server 10
|
||||
# --source include/wait_until_disconnected.inc
|
||||
#
|
||||
# --error 1
|
||||
# --exec $MYSQLD_CMD <whatever wrong setting> > $error_log 2>&1
|
||||
# # The server restart aborts
|
||||
# let SEARCH_PATTERN= \[ERROR\] Aborting;
|
||||
# --source include/search_pattern_in_file.inc
|
||||
#
|
||||
# Created: 2011-11-11 mleich
|
||||
#
|
||||
|
||||
perl;
|
||||
use strict;
|
||||
die "SEARCH_FILE not set" unless $ENV{SEARCH_FILE};
|
||||
my @search_files= glob($ENV{SEARCH_FILE});
|
||||
my $search_pattern= $ENV{SEARCH_PATTERN} or die "SEARCH_PATTERN not set";
|
||||
my $search_range= $ENV{SEARCH_RANGE};
|
||||
my $content;
|
||||
foreach my $search_file (@search_files) {
|
||||
open(FILE, '<', $search_file) || die("Can't open file $search_file: $!");
|
||||
my $file_content;
|
||||
if ($search_range > 0) {
|
||||
read(FILE, $file_content, $search_range, 0);
|
||||
} elsif ($search_range < 0) {
|
||||
my $size= -s $search_file;
|
||||
$search_range = -$size if $size > -$search_range;
|
||||
seek(FILE, $search_range, 2);
|
||||
read(FILE, $file_content, -$search_range, 0);
|
||||
} else {
|
||||
while(<FILE>) { # error log
|
||||
if (/^CURRENT_TEST:/) {
|
||||
$content='';
|
||||
} else {
|
||||
$content.=$_;
|
||||
}
|
||||
}
|
||||
}
|
||||
close(FILE);
|
||||
$content.= $file_content;
|
||||
}
|
||||
my @matches=($content =~ m/$search_pattern/gs);
|
||||
my $res=@matches ? "FOUND " . scalar(@matches) : "NOT FOUND";
|
||||
$ENV{SEARCH_FILE} =~ s{^.*?([^/\\]+)$}{$1};
|
||||
print "$res /$search_pattern/ in $ENV{SEARCH_FILE}\n";
|
||||
die "$ENV{SEARCH_ABORT}\n"
|
||||
if $ENV{SEARCH_ABORT} && $res =~ /^$ENV{SEARCH_ABORT}/;
|
||||
EOF
|
@ -1,3 +1,17 @@
|
||||
# ==== Usage ====
|
||||
#
|
||||
# [--let $shutdown_timeout= 30]
|
||||
# [--let $allow_rpl_inited= 1]
|
||||
# --source include/shutdown_mysqld.inc
|
||||
|
||||
# The default value is empty
|
||||
--let $server_shutdown_timeout=
|
||||
|
||||
if ($shutdown_timeout)
|
||||
{
|
||||
--let $server_shutdown_timeout= $shutdown_timeout
|
||||
}
|
||||
|
||||
# This is the first half of include/restart_mysqld.inc.
|
||||
if ($rpl_inited)
|
||||
{
|
||||
@ -13,6 +27,6 @@ if ($rpl_inited)
|
||||
--exec echo "wait" > $_expect_file_name
|
||||
|
||||
# Send shutdown to the connected server
|
||||
--shutdown_server
|
||||
--shutdown_server $server_shutdown_timeout
|
||||
--source include/wait_until_disconnected.inc
|
||||
|
||||
|
@ -756,8 +756,7 @@ sub run_test_server ($$$) {
|
||||
|
||||
# Repeat test $opt_repeat number of times
|
||||
my $repeat= $result->{repeat} || 1;
|
||||
# Don't repeat if test was skipped
|
||||
if ($repeat < $opt_repeat && $result->{'result'} ne 'MTR_RES_SKIPPED')
|
||||
if ($repeat < $opt_repeat)
|
||||
{
|
||||
$result->{retries}= 0;
|
||||
$result->{rep_failures}++ if $result->{failures};
|
||||
@ -3514,14 +3513,16 @@ sub mysql_install_db {
|
||||
mtr_add_arg($args, "--bootstrap");
|
||||
mtr_add_arg($args, "--basedir=%s", $install_basedir);
|
||||
mtr_add_arg($args, "--datadir=%s", $install_datadir);
|
||||
mtr_add_arg($args, "--plugin-dir=%s", $plugindir);
|
||||
mtr_add_arg($args, "--default-storage-engine=myisam");
|
||||
mtr_add_arg($args, "--skip-plugin-$_") for @optional_plugins;
|
||||
mtr_add_arg($args, "--loose-skip-plugin-$_") for @optional_plugins;
|
||||
# starting from 10.0 bootstrap scripts require InnoDB
|
||||
mtr_add_arg($args, "--loose-innodb");
|
||||
mtr_add_arg($args, "--loose-innodb-log-file-size=5M");
|
||||
mtr_add_arg($args, "--disable-sync-frm");
|
||||
mtr_add_arg($args, "--tmpdir=%s", "$opt_vardir/tmp/");
|
||||
mtr_add_arg($args, "--core-file");
|
||||
mtr_add_arg($args, "--console");
|
||||
|
||||
if ( $opt_debug )
|
||||
{
|
||||
@ -3540,13 +3541,6 @@ sub mysql_install_db {
|
||||
mtr_add_arg($args, $extra_opt);
|
||||
}
|
||||
}
|
||||
# InnoDB options can come not only from the command line, but also
|
||||
# from option files or combinations
|
||||
foreach my $extra_opt ( @$extra_opts ) {
|
||||
if ($extra_opt =~ /--innodb/) {
|
||||
mtr_add_arg($args, $extra_opt);
|
||||
}
|
||||
}
|
||||
|
||||
# If DISABLE_GRANT_OPTIONS is defined when the server is compiled (e.g.,
|
||||
# configure --disable-grant-options), mysqld will not recognize the
|
||||
@ -3561,13 +3555,22 @@ sub mysql_install_db {
|
||||
# ----------------------------------------------------------------------
|
||||
$ENV{'MYSQLD_BOOTSTRAP_CMD'}= "$exe_mysqld_bootstrap " . join(" ", @$args);
|
||||
|
||||
|
||||
# Extra options can come not only from the command line, but also
|
||||
# from option files or combinations. We want them on a command line
|
||||
# that is executed now, because otherwise the datadir might be
|
||||
# incompatible with the test settings, but not on the general
|
||||
# $MYSQLD_BOOTSTRAP_CMD line
|
||||
foreach my $extra_opt ( @$extra_opts ) {
|
||||
mtr_add_arg($args, $extra_opt);
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Create the bootstrap.sql file
|
||||
# ----------------------------------------------------------------------
|
||||
my $bootstrap_sql_file= "$opt_vardir/tmp/bootstrap.sql";
|
||||
my $bootstrap_sql_file= "$opt_vardir/log/bootstrap.sql";
|
||||
|
||||
if (! -e $bootstrap_sql_file)
|
||||
{
|
||||
if ($opt_boot_gdb) {
|
||||
gdb_arguments(\$args, \$exe_mysqld_bootstrap, $mysqld->name(),
|
||||
$bootstrap_sql_file);
|
||||
@ -3652,6 +3655,7 @@ sub mysql_install_db {
|
||||
# Add procedures for checking server is restored after testcase
|
||||
mtr_tofile($bootstrap_sql_file,
|
||||
sql_to_bootstrap(mtr_grab_file("include/mtr_check.sql")));
|
||||
}
|
||||
|
||||
# Log bootstrap command
|
||||
my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log";
|
||||
@ -5478,6 +5482,11 @@ sub mysqld_start ($$) {
|
||||
}
|
||||
}
|
||||
|
||||
# "Dynamic" version of MYSQLD_CMD is reevaluated with each mysqld_start.
|
||||
# Use it to restart the server at testing a failing server start (e.g
|
||||
# due to incompatible options).
|
||||
$ENV{'MYSQLD_LAST_CMD'}= "$exe @$args";
|
||||
|
||||
if ( $opt_gdb || $opt_manual_gdb )
|
||||
{
|
||||
gdb_arguments(\$args, \$exe, $mysqld->name());
|
||||
@ -6226,7 +6235,7 @@ sub debugger_arguments {
|
||||
$$exe= $debugger;
|
||||
|
||||
}
|
||||
elsif ( $debugger =~ /windbg/ )
|
||||
elsif ( $debugger =~ /windbg|vsjitdebugger/ )
|
||||
{
|
||||
# windbg exe arg1 .. argn
|
||||
|
||||
|
@ -1350,6 +1350,58 @@ rename table t2 to t1;
|
||||
execute stmt1;
|
||||
deallocate prepare stmt1;
|
||||
drop table t2;
|
||||
#
|
||||
# MDEV-8960 Can't refer the same column twice in one ALTER TABLE
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) DEFAULT CHARSET=utf8;
|
||||
ALTER TABLE t1 ADD COLUMN `consultant_id` integer NOT NULL,
|
||||
ALTER COLUMN `consultant_id` DROP DEFAULT;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL,
|
||||
`consultant_id` int(11) NOT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) DEFAULT CHARSET=utf8;
|
||||
ALTER TABLE t1 ADD COLUMN `consultant_id` integer NOT NULL,
|
||||
ALTER COLUMN `consultant_id` SET DEFAULT 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL,
|
||||
`consultant_id` int(11) NOT NULL DEFAULT '2'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) DEFAULT CHARSET=utf8;
|
||||
ALTER TABLE t1 ADD COLUMN `consultant_id` integer NOT NULL DEFAULT 2,
|
||||
ALTER COLUMN `consultant_id` DROP DEFAULT;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL,
|
||||
`consultant_id` int(11) NOT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) DEFAULT CHARSET=utf8;
|
||||
ALTER TABLE t1 ADD COLUMN `consultant_id` integer NOT NULL DEFAULT 2,
|
||||
ALTER COLUMN `consultant_id` DROP DEFAULT,
|
||||
MODIFY COLUMN `consultant_id` BIGINT;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL,
|
||||
`consultant_id` bigint(20) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
id INT(11) NOT NULL,
|
||||
x_param INT(11) DEFAULT NULL,
|
||||
|
@ -220,6 +220,22 @@ a d
|
||||
3 11120436154190595086
|
||||
drop table t1, t2;
|
||||
End of 5.0 tests
|
||||
#
|
||||
# Bug#19875294 ASSERTION `SRC' FAILED IN MY_STRNXFRM_UNICODE
|
||||
# (SIG 6 -STRINGS/CTYPE-UTF8.C:5151)
|
||||
#
|
||||
set @@sql_mode='';
|
||||
CREATE TABLE t1(c1 SET('','')CHARACTER SET ucs2);
|
||||
Warnings:
|
||||
Note 1291 Column 'c1' has duplicated value '' in SET
|
||||
INSERT INTO t1 VALUES(990101.102);
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'c1' at row 1
|
||||
SELECT COALESCE(c1)FROM t1 ORDER BY 1;
|
||||
COALESCE(c1)
|
||||
|
||||
DROP TABLE t1;
|
||||
set @@sql_mode=default;
|
||||
CREATE TABLE t1(a YEAR);
|
||||
SELECT 1 FROM t1 WHERE a=1 AND CASE 1 WHEN a THEN 1 ELSE 1 END;
|
||||
1
|
||||
|
@ -106,3 +106,28 @@ count(distinct user_id)
|
||||
17
|
||||
drop table t1;
|
||||
set @@tmp_table_size = default;
|
||||
create table t1 (
|
||||
a VARCHAR(1020),
|
||||
b int
|
||||
);
|
||||
insert into t1 values
|
||||
( 0 , 1 ),
|
||||
( 1 , 2 ),
|
||||
( 2 , 3 ),
|
||||
( 3 , 4 ),
|
||||
( 4 , 5 ),
|
||||
( 5 , 6 ),
|
||||
( 6 , 7 ),
|
||||
( 7 , 8 ),
|
||||
( 8 , 9 ),
|
||||
( 9 , 10 ),
|
||||
( 0 , 11 ),
|
||||
( 1 , 12 ),
|
||||
( 2 , 13 ),
|
||||
( 3 , 14 );
|
||||
set @@tmp_table_size=1024;
|
||||
select count(distinct a) from t1;
|
||||
count(distinct a)
|
||||
10
|
||||
drop table t1;
|
||||
set @@tmp_table_size = default;
|
||||
|
@ -4944,5 +4944,23 @@ E05B
|
||||
DROP TABLE t1;
|
||||
# Start of ctype_E05C.inc
|
||||
#
|
||||
# MDEV-9886 Illegal mix of collations with a view comparing a field to a binary constant
|
||||
#
|
||||
SET NAMES latin1;
|
||||
CREATE TABLE t1 (a TEXT CHARACTER SET gbk);
|
||||
INSERT INTO t1 VALUES (0xEE5D);
|
||||
SELECT a<>0xEE5D AS a FROM t1;
|
||||
a
|
||||
0
|
||||
CREATE VIEW v1 AS SELECT a<>0xEE5D AS a FROM t1;
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (`t1`.`a` <> 0xee5d) AS `a` from `t1` latin1 latin1_swedish_ci
|
||||
SELECT * FROM v1;
|
||||
a
|
||||
0
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 10.0 tests
|
||||
#
|
||||
|
@ -7922,5 +7922,23 @@ SELECT _latin1 0x7E, _latin1 X'7E', _latin1 B'01111110';
|
||||
_latin1 0x7E _latin1 X'7E' _latin1 B'01111110'
|
||||
~ ~ ~
|
||||
#
|
||||
# MDEV-9886 Illegal mix of collations with a view comparing a field to a binary constant
|
||||
#
|
||||
SET NAMES latin1;
|
||||
CREATE TABLE t1 (a TEXT CHARACTER SET latin1);
|
||||
INSERT INTO t1 VALUES (0xC0);
|
||||
SELECT a<>0xEE5D AS a FROM t1;
|
||||
a
|
||||
1
|
||||
CREATE VIEW v1 AS SELECT a<>0xC0 AS a FROM t1;
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (`t1`.`a` <> 0xc0) AS `a` from `t1` latin1 latin1_swedish_ci
|
||||
SELECT * FROM v1;
|
||||
a
|
||||
0
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 10.0 tests
|
||||
#
|
||||
|
@ -4560,6 +4560,36 @@ NO_ENGINE_SUBSTITUTION
|
||||
SET sql_mode=DEFAULT;
|
||||
SET NAMES utf8;
|
||||
#
|
||||
# MDEV-13972 crash in Item_func_sec_to_time::get_date
|
||||
#
|
||||
SELECT SEC_TO_TIME(CONVERT(900*24*60*60 USING ucs2));
|
||||
SEC_TO_TIME(CONVERT(900*24*60*60 USING ucs2))
|
||||
838:59:59.999999
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '77760000'
|
||||
#
|
||||
# MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535
|
||||
#
|
||||
CREATE TABLE t1 (c1 VARCHAR(32766) CHARACTER SET ucs2);
|
||||
DESCRIBE t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 varchar(32766) YES NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 VARCHAR(32767) CHARACTER SET ucs2);
|
||||
Warnings:
|
||||
Note 1246 Converting column 'c1' from VARCHAR to TEXT
|
||||
DESCRIBE t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 text YES NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 VARCHAR(32768) CHARACTER SET ucs2);
|
||||
Warnings:
|
||||
Note 1246 Converting column 'c1' from VARCHAR to TEXT
|
||||
DESCRIBE t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 mediumtext YES NULL
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 5.5 tests
|
||||
#
|
||||
#
|
||||
|
@ -1672,6 +1672,21 @@ NO_ENGINE_SUBSTITUTION
|
||||
SET sql_mode=DEFAULT;
|
||||
SET NAMES utf8;
|
||||
#
|
||||
# MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535
|
||||
#
|
||||
CREATE TABLE t1 (c1 VARCHAR(16383) CHARACTER SET utf32);
|
||||
DESCRIBE t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 varchar(16383) YES NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 VARCHAR(16384) CHARACTER SET utf32);
|
||||
Warnings:
|
||||
Note 1246 Converting column 'c1' from VARCHAR to TEXT
|
||||
DESCRIBE t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 mediumtext YES NULL
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 5.5 tests
|
||||
#
|
||||
#
|
||||
|
@ -6173,6 +6173,28 @@ Warnings:
|
||||
SET sql_mode=DEFAULT;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535
|
||||
#
|
||||
CREATE TABLE t1 (c1 VARCHAR(21844) CHARACTER SET utf8);
|
||||
DESCRIBE t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 varchar(21844) YES NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 VARCHAR(21845) CHARACTER SET utf8);
|
||||
Warnings:
|
||||
Note 1246 Converting column 'c1' from VARCHAR to TEXT
|
||||
DESCRIBE t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 text YES NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 VARCHAR(21846) CHARACTER SET utf8);
|
||||
Warnings:
|
||||
Note 1246 Converting column 'c1' from VARCHAR to TEXT
|
||||
DESCRIBE t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 mediumtext YES NULL
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 5.5 tests
|
||||
#
|
||||
#
|
||||
|
@ -199,3 +199,15 @@ i
|
||||
2
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-13776: DELETE ... RETURNING with sql_mode='ONLY_FULL_GROUP_BY'
|
||||
#
|
||||
set @sql_mode_save= @@sql_mode;
|
||||
set sql_mode='ONLY_FULL_GROUP_BY';
|
||||
CREATE TABLE t1 (id INT);
|
||||
INSERT INTO t1 VALUE(1),(2),(3);
|
||||
DELETE FROM t1 WHERE id > 2 RETURNING *;
|
||||
id
|
||||
3
|
||||
set sql_mode=@sql_mode_save;
|
||||
DROP TABLE t1;
|
||||
|
@ -27,7 +27,7 @@ create table t1 (a int(256));
|
||||
ERROR 42000: Display width out of range for 'a' (max = 255)
|
||||
set sql_mode='traditional';
|
||||
create table t1 (a varchar(66000));
|
||||
ERROR 42000: Column length too big for column 'a' (max = 65535); use BLOB or TEXT instead
|
||||
ERROR 42000: Column length too big for column 'a' (max = 65532); use BLOB or TEXT instead
|
||||
set sql_mode=default;
|
||||
CREATE TABLE t1 (a INT);
|
||||
SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
|
||||
|
@ -812,6 +812,12 @@ EXECUTE s;
|
||||
1
|
||||
DROP TABLE t1;
|
||||
# End of 5.3 tests
|
||||
create table t1 (a int);
|
||||
insert t1 values (1),(2),(3);
|
||||
select * from t1 where 1 in (a, name_const('a', null));
|
||||
a
|
||||
1
|
||||
drop table t1;
|
||||
#
|
||||
# Start of 10.0 tests
|
||||
#
|
||||
|
@ -1390,3 +1390,20 @@ DROP TABLE t2;
|
||||
|
||||
# -- Done.
|
||||
|
||||
#
|
||||
# MDEV-13685 Can not replay binary log due to Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation 'concat'
|
||||
#
|
||||
SET NAMES utf8;
|
||||
SELECT COERCIBILITY(NAME_CONST('name','test'));
|
||||
COERCIBILITY(NAME_CONST('name','test'))
|
||||
2
|
||||
SELECT COERCIBILITY(NAME_CONST('name',TIME'00:00:00'));
|
||||
COERCIBILITY(NAME_CONST('name',TIME'00:00:00'))
|
||||
5
|
||||
SELECT COERCIBILITY(NAME_CONST('name',15));
|
||||
COERCIBILITY(NAME_CONST('name',15))
|
||||
5
|
||||
SELECT CONCAT(NAME_CONST('name',15),'오');
|
||||
CONCAT(NAME_CONST('name',15),'오')
|
||||
15오
|
||||
SET NAMES latin1;
|
||||
|
@ -879,32 +879,32 @@ SELECT 1 FROM dual WHERE ('Alpha,Bravo,Charlie,Delta,Echo,Foxtrot,StrataCentral,
|
||||
CAST(0xE001 AS BINARY) REGEXP @regCheck
|
||||
1
|
||||
# MDEV-12420: Testing recursion overflow
|
||||
SELECT 1 FROM dual WHERE ('Alpha,Bravo,Charlie,Delta,Echo,Foxtrot,StrataCentral,Golf,Hotel,India,Juliet,Kilo,Lima,Mike,StrataL3,November,Oscar,StrataL2,Sand,P3,P4SwitchTest,Arsys,Poppa,ExtensionMgr,Arp,Quebec,Romeo,StrataApiV2,PtReyes,Sierra,SandAcl,Arrow,Artools,BridgeTest,Tango,SandT,PAlaska,Namespace,Agent,Qos,PatchPanel,ProjectReport,Ark,Gimp,Agent,SliceAgent,Arnet,Bgp,Ale,Tommy,Central,AsicPktTestLib,Hsc,SandL3,Abuild,Pca9555,Standby,ControllerDut,CalSys,SandLib,Sb820,PointV2,BfnLib,Evpn,BfnSdk,Sflow,ManagementActive,AutoTest,GatedTest,Bgp,Sand,xinetd,BfnAgentLib,bf-utils,Hello,BfnState,Eos,Artest,Qos,Scd,ThermoMgr,Uniform,EosUtils,Eb,FanController,Central,BfnL3,BfnL2,tcp_wrappers,Victor,Environment,Route,Failover,Whiskey,Xray,Gimp,BfnFixed,Strata,SoCal,XApi,Msrp,XpProfile,tcpdump,PatchPanel,ArosTest,FhTest,Arbus,XpAcl,MacConc,XpApi,telnet,QosTest,Alpha2,BfnVlan,Stp,VxlanControllerTest,MplsAgent,Bravo2,Lanz,BfnMbb,Intf,XCtrl,Unicast,SandTunnel,L3Unicast,Ipsec,MplsTest,Rsvp,EthIntf,StageMgr,Sol,MplsUtils,Nat,Ira,P4NamespaceDut,Counters,Charlie2,Aqlc,Mlag,Power,OpenFlow,Lag,RestApi,BfdTest,strongs,Sfa,CEosUtils,Adt746,MaintenanceMode,MlagDut,EosImage,IpEth,MultiProtocol,Launcher,Max3179,Snmp,Acl,IpEthTest,PhyEee,bf-syslibs,tacc,XpL2,p4-ar-switch,p4-bf-switch,LdpTest,BfnPhy,Mirroring,Phy6,Ptp' REGEXP '^((?!\b(Strata|StrataApi|StrataApiV2)\b).)*$');
|
||||
1
|
||||
SELECT 1 FROM dual WHERE ('Alpha,Bravo,Charlie,Delta,Echo,Foxtrot,StrataCentral,Golf,Hotel,India,Juliet,Kilo,Lima,Mike,StrataL3,November,Oscar,StrataL2,Sand,P3,P4SwitchTest,Arsys,Poppa,ExtensionMgr,Arp,Quebec,Romeo,StrataApiV2,PtReyes,Sierra,SandAcl,Arrow,Artools,BridgeTest,Tango,SandT,PAlaska,Namespace,Agent,Qos,PatchPanel,ProjectReport,Ark,Gimp,Agent,SliceAgent,Arnet,Bgp,Ale,Tommy,Central,AsicPktTestLib,Hsc,SandL3,Abuild,Pca9555,Standby,ControllerDut,CalSys,SandLib,Sb820,PointV2,BfnLib,Evpn,BfnSdk,Sflow,ManagementActive,AutoTest,GatedTest,Bgp,Sand,xinetd,BfnAgentLib,bf-utils,Hello,BfnState,Eos,Artest,Qos,Scd,ThermoMgr,Uniform,EosUtils,Eb,FanController,Central,BfnL3,BfnL2,tcp_wrappers,Victor,Environment,Route,Failover,Whiskey,Xray,Gimp,BfnFixed,Strata,SoCal,XApi,Msrp,XpProfile,tcpdump,PatchPanel,ArosTest,FhTest,Arbus,XpAcl,MacConc,XpApi,telnet,QosTest,Alpha2,BfnVlan,Stp,VxlanControllerTest,MplsAgent,Bravo2,Lanz,BfnMbb,Intf,XCtrl,Unicast,SandTunnel,L3Unicast,Ipsec,MplsTest,Rsvp,EthIntf,StageMgr,Sol,MplsUtils,Nat,Ira,P4NamespaceDut,Counters,Charlie2,Aqlc,Mlag,Power,OpenFlow,Lag,RestApi,BfdTest,strongs,Sfa,CEosUtils,Adt746,MaintenanceMode,MlagDut,EosImage,IpEth,MultiProtocol,Launcher,Max3179,Snmp,Acl,IpEthTest,PhyEee,bf-syslibs,tacc,XpL2,p4-ar-switch,p4-bf-switch,LdpTest,BfnPhy,Mirroring,Phy6,Ptp' REGEXP '^((?!\b(Strata|StrataApi|StrataApiV2)\b).)*$');
|
||||
1
|
||||
Warnings:
|
||||
Warning 1139 Got error 'pcre_exec: recursion limit of NUM exceeded' from regexp
|
||||
SELECT CONCAT(REPEAT('100,',190),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$';
|
||||
CONCAT(REPEAT('100,',190),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$'
|
||||
1
|
||||
SELECT CONCAT(REPEAT('100,',600),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$';
|
||||
CONCAT(REPEAT('100,',600),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$'
|
||||
0
|
||||
CONCAT(REPEAT('100,',600),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$'
|
||||
0
|
||||
Warnings:
|
||||
Warning 1139 Got error 'pcre_exec: recursion limit of NUM exceeded' from regexp
|
||||
SELECT REGEXP_INSTR(CONCAT(REPEAT('100,',190),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$');
|
||||
REGEXP_INSTR(CONCAT(REPEAT('100,',190),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$')
|
||||
1
|
||||
SELECT REGEXP_INSTR(CONCAT(REPEAT('100,',600),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$');
|
||||
REGEXP_INSTR(CONCAT(REPEAT('100,',600),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$')
|
||||
0
|
||||
Warnings:
|
||||
REGEXP_INSTR(CONCAT(REPEAT('100,',600),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$')
|
||||
0
|
||||
Warnings:
|
||||
Warning 1139 Got error 'pcre_exec: recursion limit of NUM exceeded' from regexp
|
||||
SELECT LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',190/3),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'));
|
||||
LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',190/3),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'))
|
||||
255
|
||||
SELECT LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',600/3),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'));
|
||||
LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',600/3),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'))
|
||||
0
|
||||
LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',600/3),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'))
|
||||
0
|
||||
Warnings:
|
||||
Warning 1139 Got error 'pcre_exec: recursion limit of NUM exceeded' from regexp
|
||||
SELECT LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',190/3),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', ''));
|
||||
|
@ -2745,7 +2745,33 @@ SELECT 1 MOD ADDTIME( '13:58:57', '00:00:01' ) + 2;
|
||||
1 MOD ADDTIME( '13:58:57', '00:00:01' ) + 2
|
||||
3
|
||||
#
|
||||
# Start of 10.0 tests
|
||||
# MDEV-11819 NO_ZERO_IN_DATE: Incorrect generated column value
|
||||
#
|
||||
SET sql_mode='NO_ZERO_IN_DATE';
|
||||
CREATE TABLE t1 (a TIME(6));
|
||||
INSERT INTO t1 SELECT timediff(timestamp'2008-12-31 23:59:59.000001',timestamp'2008-12-30 01:01:01.000002');
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
46:58:57.999999
|
||||
DROP TABLE t1;
|
||||
SET sql_mode=DEFAULT;
|
||||
#
|
||||
# MDEV-13972 crash in Item_func_sec_to_time::get_date
|
||||
#
|
||||
DO TO_DAYS(SEC_TO_TIME(TIME(CEILING(UUID()))));
|
||||
DO TO_DAYS(SEC_TO_TIME(MAKEDATE('',RAND(~('')))));
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: ''
|
||||
Warning 1292 Truncated incorrect INTEGER value: ''
|
||||
Warning 1292 Truncated incorrect INTEGER value: ''
|
||||
Warning 1292 Truncated incorrect time value: '20000101'
|
||||
SELECT SEC_TO_TIME(MAKEDATE(0,RAND(~0)));
|
||||
SEC_TO_TIME(MAKEDATE(0,RAND(~0)))
|
||||
838:59:59
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '20000101'
|
||||
#
|
||||
# End of 5.5 tests
|
||||
#
|
||||
#
|
||||
# MDEV-8205 timediff returns null when comparing decimal time to time string value
|
||||
|
@ -717,3 +717,37 @@ insert ignore into t1 values (1,12);
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '1' for key 'f1'
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-13290 Assertion Assertion `!is_set() || (m_status == DA_OK_BULK
|
||||
# && is_bulk_op())' or `! is_set()' failed
|
||||
#
|
||||
SET @save_mode= @@sql_mode;
|
||||
SET sql_mode= 'STRICT_ALL_TABLES';
|
||||
CREATE TABLE t1 (f1 INT DEFAULT 0, f2 INT);
|
||||
CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f1, f2 FROM t1 WHERE f1 = 'x' WITH CHECK OPTION;
|
||||
REPLACE INTO v1 SET f2 = 1;
|
||||
ERROR 22007: Truncated incorrect DOUBLE value: 'x'
|
||||
SELECT * from t1;
|
||||
f1 f2
|
||||
drop view v1;
|
||||
CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f1, f2 FROM t1 WHERE f1 = cast('' as decimal) WITH CHECK OPTION;
|
||||
REPLACE INTO v1 SET f2 = 1;
|
||||
ERROR 22007: Truncated incorrect DECIMAL value: ''
|
||||
SELECT * from t1;
|
||||
f1 f2
|
||||
drop view v1;
|
||||
SELECT 0,0 INTO OUTFILE 't1.txt';
|
||||
CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f1, f2 FROM t1 WHERE f1 = 'x' WITH CHECK OPTION;
|
||||
LOAD DATA INFILE 't1.txt' INTO TABLE v1;
|
||||
ERROR 22007: Truncated incorrect DOUBLE value: 'x'
|
||||
SELECT * from t1;
|
||||
f1 f2
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
SET @@sql_mode= @save_mode;
|
||||
CREATE TABLE t1 (f INT);
|
||||
CREATE VIEW v1 AS SELECT * FROM t1 WHERE f <=> 'foo' WITH CHECK OPTION;
|
||||
REPLACE INTO v1 SET f = NULL;
|
||||
ERROR HY000: CHECK OPTION failed 'test.v1'
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
@ -1,3 +1,4 @@
|
||||
set @log_output.saved = @@global.log_output;
|
||||
set @@global.log_output = 'TABLE';
|
||||
set session long_query_time=10;
|
||||
select get_lock('bug27638', 1);
|
||||
@ -7,25 +8,25 @@ set session long_query_time=1;
|
||||
select get_lock('bug27638', 2);
|
||||
get_lock('bug27638', 2)
|
||||
0
|
||||
select if (query_time >= '00:00:01', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
|
||||
select if (query_time >= '00:00:01', 'OK', concat('WRONG: ',query_time)) as qt, sql_text from mysql.slow_log
|
||||
where sql_text = 'select get_lock(\'bug27638\', 2)';
|
||||
qt sql_text
|
||||
OK select get_lock('bug27638', 2)
|
||||
select get_lock('bug27638', 60);
|
||||
get_lock('bug27638', 60)
|
||||
0
|
||||
select if (query_time >= '00:00:59', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
|
||||
select if (query_time >= '00:00:59', 'OK', concat('WRONG: ',query_time)) as qt, sql_text from mysql.slow_log
|
||||
where sql_text = 'select get_lock(\'bug27638\', 60)';
|
||||
qt sql_text
|
||||
OK select get_lock('bug27638', 60)
|
||||
select get_lock('bug27638', 101);
|
||||
get_lock('bug27638', 101)
|
||||
0
|
||||
select if (query_time >= '00:01:40', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
|
||||
select if (query_time >= '00:01:40', 'OK', concat('WRONG: ',query_time)) as qt, sql_text from mysql.slow_log
|
||||
where sql_text = 'select get_lock(\'bug27638\', 101)';
|
||||
qt sql_text
|
||||
OK select get_lock('bug27638', 101)
|
||||
select release_lock('bug27638');
|
||||
release_lock('bug27638')
|
||||
1
|
||||
set @@global.log_output=default;
|
||||
set @@global.log_output = @log_output.saved;
|
||||
|
469
mysql-test/r/mdev13607.result
Normal file
469
mysql-test/r/mdev13607.result
Normal file
@ -0,0 +1,469 @@
|
||||
#
|
||||
# Bug mdev-13607: overflow of current_record_count
|
||||
#
|
||||
CREATE TABLE t1 (id INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES
|
||||
(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),
|
||||
(11),(12),(13),(14),(15),(16),(17),(18),(19),(20),
|
||||
(21),(22),(23),(24),(25),(26),(27),(28),(29),(30),
|
||||
(31),(32),(33),(34),(35),(36),(37),(38),(39),(40),
|
||||
(41),(42),(43),(44),(45),(46),(47),(48),(49),(50);
|
||||
CREATE TABLE t2 (id INT) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (1),(2);
|
||||
CREATE TABLE t3 (id INT) ENGINE=InnoDB;
|
||||
INSERT INTO t3 VALUES (1),(2);
|
||||
ANALYZE TABLE t1, t2, t3;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status OK
|
||||
test.t2 analyze status OK
|
||||
test.t3 analyze status OK
|
||||
explain SELECT * FROM
|
||||
(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_1
|
||||
INNER JOIN
|
||||
(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_2
|
||||
INNER JOIN
|
||||
(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_3
|
||||
INNER JOIN
|
||||
(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_4
|
||||
INNER JOIN
|
||||
(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_5
|
||||
INNER JOIN
|
||||
(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_6
|
||||
INNER JOIN
|
||||
(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_7
|
||||
INNER JOIN
|
||||
(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_8
|
||||
INNER JOIN
|
||||
(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_9
|
||||
INNER JOIN
|
||||
(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_10
|
||||
INNER JOIN
|
||||
(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_11
|
||||
INNER JOIN
|
||||
(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_12
|
||||
INNER JOIN
|
||||
(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_13
|
||||
INNER JOIN
|
||||
(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_14
|
||||
INNER JOIN
|
||||
(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_15
|
||||
INNER JOIN
|
||||
(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_16
|
||||
;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY r1 ALL NULL NULL NULL NULL 2
|
||||
1 PRIMARY d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
1 PRIMARY r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY <derived3> ALL NULL NULL NULL NULL -1127208515966861312 Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY <derived4> ALL NULL NULL NULL NULL -1127208515966861312 Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY <derived5> ALL NULL NULL NULL NULL -1127208515966861312 Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY <derived6> ALL NULL NULL NULL NULL -1127208515966861312 Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY <derived7> ALL NULL NULL NULL NULL -1127208515966861312 Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY <derived8> ALL NULL NULL NULL NULL -1127208515966861312 Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY <derived9> ALL NULL NULL NULL NULL -1127208515966861312 Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY <derived10> ALL NULL NULL NULL NULL -1127208515966861312 Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY <derived11> ALL NULL NULL NULL NULL -1127208515966861312 Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY <derived12> ALL NULL NULL NULL NULL -1127208515966861312 Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY <derived13> ALL NULL NULL NULL NULL -1127208515966861312 Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY <derived14> ALL NULL NULL NULL NULL -1127208515966861312 Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY <derived15> ALL NULL NULL NULL NULL -1127208515966861312 Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY <derived16> ALL NULL NULL NULL NULL -1127208515966861312 Using join buffer (incremental, BNL join)
|
||||
1 PRIMARY <derived17> ALL NULL NULL NULL NULL -1127208515966861312 Using join buffer (incremental, BNL join)
|
||||
17 DERIVED r1 ALL NULL NULL NULL NULL 2
|
||||
17 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
17 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
17 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
17 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
17 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
17 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
17 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
17 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
17 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
17 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
17 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
17 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
17 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
17 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
17 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
17 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
17 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
17 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
17 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
17 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
17 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
17 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
17 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
17 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
16 DERIVED r1 ALL NULL NULL NULL NULL 2
|
||||
16 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
16 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
16 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
16 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
16 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
16 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
16 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
16 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
16 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
16 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
16 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
16 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
16 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
16 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
16 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
16 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
16 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
16 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
16 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
16 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
16 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
16 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
16 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
16 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
15 DERIVED r1 ALL NULL NULL NULL NULL 2
|
||||
15 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
15 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
15 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
15 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
15 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
15 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
15 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
15 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
15 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
15 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
15 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
15 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
15 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
15 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
15 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
15 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
15 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
15 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
15 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
15 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
15 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
15 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
15 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
15 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
14 DERIVED r1 ALL NULL NULL NULL NULL 2
|
||||
14 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
14 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
14 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
14 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
14 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
14 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
14 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
14 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
14 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
14 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
14 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
14 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
14 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
14 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
14 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
14 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
14 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
14 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
14 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
14 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
14 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
14 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
14 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
14 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
13 DERIVED r1 ALL NULL NULL NULL NULL 2
|
||||
13 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
13 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
13 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
13 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
13 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
13 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
13 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
13 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
13 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
13 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
13 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
13 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
13 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
13 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
13 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
13 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
13 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
13 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
13 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
13 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
13 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
13 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
13 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
13 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
12 DERIVED r1 ALL NULL NULL NULL NULL 2
|
||||
12 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
12 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
12 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
12 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
12 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
12 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
12 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
12 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
12 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
12 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
12 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
12 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
12 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
12 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
12 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
12 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
12 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
12 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
12 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
12 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
12 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
12 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
12 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
12 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
11 DERIVED r1 ALL NULL NULL NULL NULL 2
|
||||
11 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
11 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
11 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
11 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
11 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
11 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
11 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
11 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
11 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
11 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
11 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
11 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
11 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
11 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
11 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
11 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
11 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
11 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
11 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
11 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
11 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
11 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
11 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
11 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
10 DERIVED r1 ALL NULL NULL NULL NULL 2
|
||||
10 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
10 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
10 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
10 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
10 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
10 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
10 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
10 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
10 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
10 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
10 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
10 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
10 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
10 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
10 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
10 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
10 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
10 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
10 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
10 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
10 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
10 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
10 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
10 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
9 DERIVED r1 ALL NULL NULL NULL NULL 2
|
||||
9 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
9 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
9 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
9 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
9 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
9 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
9 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
9 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
9 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
9 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
9 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
9 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
9 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
9 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
9 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
9 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
9 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
9 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
9 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
9 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
9 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
9 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
9 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
9 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
8 DERIVED r1 ALL NULL NULL NULL NULL 2
|
||||
8 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
8 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
8 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
8 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
8 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
8 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
8 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
8 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
8 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
8 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
8 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
8 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
8 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
8 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
8 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
8 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
8 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
8 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
8 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
8 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
8 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
8 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
8 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
8 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
7 DERIVED r1 ALL NULL NULL NULL NULL 2
|
||||
7 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
7 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
7 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
7 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
7 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
7 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
7 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
7 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
7 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
7 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
7 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
7 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
7 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
7 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
7 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
7 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
7 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
7 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
7 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
7 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
7 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
7 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
7 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
7 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
6 DERIVED r1 ALL NULL NULL NULL NULL 2
|
||||
6 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
6 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
6 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
6 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
6 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
6 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
6 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
6 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
6 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
6 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
6 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
6 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
6 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
6 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
6 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
6 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
6 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
6 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
6 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
6 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
6 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
6 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
6 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
6 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
5 DERIVED r1 ALL NULL NULL NULL NULL 2
|
||||
5 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
5 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
5 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
5 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
5 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
5 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
5 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
5 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
5 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
5 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
5 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
5 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
5 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
5 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
5 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
5 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
5 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
5 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
5 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
5 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
5 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
5 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
5 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
5 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
4 DERIVED r1 ALL NULL NULL NULL NULL 2
|
||||
4 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
4 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
4 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
4 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
4 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
4 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
4 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
4 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
4 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
4 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
4 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
4 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
4 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
4 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
4 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
4 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
4 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
4 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
4 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
4 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
4 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
4 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
4 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
4 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
3 DERIVED r1 ALL NULL NULL NULL NULL 2
|
||||
3 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
3 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
3 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
3 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
3 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
3 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
3 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
3 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
3 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
3 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
3 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
3 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
3 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
3 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
3 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
|
||||
3 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
3 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
3 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
3 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
3 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
3 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
3 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
3 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
3 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join)
|
||||
DROP TABLE t1,t2,t3;
|
@ -1699,7 +1699,14 @@ t1 CREATE TABLE `t1` (
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 (v varchar(65535));
|
||||
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
|
||||
Warnings:
|
||||
Note 1246 Converting column 'v' from VARCHAR to TEXT
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`v` text
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
set storage_engine=MyISAM;
|
||||
set @save_concurrent_insert=@@concurrent_insert;
|
||||
set global concurrent_insert=1;
|
||||
|
@ -1176,7 +1176,7 @@ character-sets-dir MYSQL_CHARSETSDIR/
|
||||
chroot (No default value)
|
||||
completion-type NO_CHAIN
|
||||
concurrent-insert AUTO
|
||||
console FALSE
|
||||
console TRUE
|
||||
date-format %Y-%m-%d
|
||||
datetime-format %Y-%m-%d %H:%i:%s
|
||||
deadlock-search-depth-long 15
|
||||
|
@ -314,12 +314,14 @@ bbbb
|
||||
drop table t1;
|
||||
create table t1 (a varchar(3070)) partition by key (a);
|
||||
ERROR HY000: The total length of the partitioning fields is too large
|
||||
create table t1 (a varchar(65532) not null) partition by key (a);
|
||||
ERROR HY000: The total length of the partitioning fields is too large
|
||||
create table t1 (a varchar(65533)) partition by key (a);
|
||||
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
|
||||
ERROR HY000: A BLOB field is not allowed in partition function
|
||||
create table t1 (a varchar(65534) not null) partition by key (a);
|
||||
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
|
||||
ERROR HY000: A BLOB field is not allowed in partition function
|
||||
create table t1 (a varchar(65535)) partition by key (a);
|
||||
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
|
||||
ERROR HY000: A BLOB field is not allowed in partition function
|
||||
create table t1 (a bit(27), primary key (a)) engine=myisam
|
||||
partition by hash (a)
|
||||
(partition p0, partition p1, partition p2);
|
||||
|
@ -4179,4 +4179,147 @@ Warnings:
|
||||
Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where 0
|
||||
deallocate prepare stmt2;
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-9208: Function->Function->View = Mysqld segfault
|
||||
# (Server crashes in Dependency_marker::visit_field on 2nd
|
||||
# execution with merged subquery)
|
||||
#
|
||||
CREATE TABLE t1 (i1 INT);
|
||||
insert into t1 values(1),(2);
|
||||
CREATE TABLE t2 (i2 INT);
|
||||
insert into t2 values(1),(2);
|
||||
prepare stmt from "
|
||||
select 1 from (
|
||||
select
|
||||
if (i1<0, 0, 0) as f1,
|
||||
(select f1) as f2
|
||||
from t1, t2
|
||||
) sq
|
||||
";
|
||||
execute stmt;
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
execute stmt;
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
drop table t1,t2;
|
||||
#
|
||||
# MDEV-9619: Assertion `null_ref_table' failed in virtual
|
||||
# table_map Item_direct_view_ref::used_tables() const on 2nd
|
||||
# execution of PS
|
||||
#
|
||||
CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE=MyISAM;
|
||||
CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
|
||||
INSERT INTO t1 VALUES ('a'),('b');
|
||||
CREATE TABLE t2 (f2 VARCHAR(10)) ENGINE=MyISAM;
|
||||
INSERT INTO t2 VALUES ('c'),('d');
|
||||
PREPARE stmt FROM "SELECT * FROM v1 WHERE f1 = SOME ( SELECT f2 FROM t2 )";
|
||||
EXECUTE stmt;
|
||||
f1
|
||||
EXECUTE stmt;
|
||||
f1
|
||||
insert into t1 values ('c');
|
||||
EXECUTE stmt;
|
||||
f1
|
||||
c
|
||||
EXECUTE stmt;
|
||||
f1
|
||||
c
|
||||
deallocate prepare stmt;
|
||||
drop view v1;
|
||||
drop table t1,t2;
|
||||
CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE=MyISAM;
|
||||
CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
|
||||
INSERT INTO t1 VALUES ('a'),('b');
|
||||
CREATE TABLE t2 (f2 VARCHAR(10)) ENGINE=MyISAM;
|
||||
INSERT INTO t2 VALUES ('c'),('d');
|
||||
PREPARE stmt FROM "SELECT * FROM v1 WHERE (f1,f1) = SOME ( SELECT f2,f2 FROM t2 )";
|
||||
EXECUTE stmt;
|
||||
f1
|
||||
EXECUTE stmt;
|
||||
f1
|
||||
insert into t1 values ('c');
|
||||
EXECUTE stmt;
|
||||
f1
|
||||
c
|
||||
EXECUTE stmt;
|
||||
f1
|
||||
c
|
||||
deallocate prepare stmt;
|
||||
drop view v1;
|
||||
drop table t1,t2;
|
||||
CREATE TABLE t1 (column1 INT) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (3),(9);
|
||||
CREATE TABLE t2 (column2 INT) ENGINE=MyISAM;
|
||||
INSERT INTO t2 VALUES (1),(4);
|
||||
CREATE TABLE t3 (column3 INT) ENGINE=MyISAM;
|
||||
INSERT INTO t3 VALUES (6),(8);
|
||||
CREATE TABLE t4 (column4 INT) ENGINE=MyISAM;
|
||||
INSERT INTO t4 VALUES (2),(5);
|
||||
PREPARE stmt FROM "
|
||||
SELECT (
|
||||
SELECT MAX( table1.column1 ) AS field1
|
||||
FROM t1 AS table1
|
||||
WHERE (111,table3.column3) IN ( SELECT 111,table2.column2 AS field2 FROM t2 AS table2 )
|
||||
) AS sq
|
||||
FROM t3 AS table3, t4 AS table4 GROUP BY sq
|
||||
";
|
||||
EXECUTE stmt;
|
||||
sq
|
||||
NULL
|
||||
EXECUTE stmt;
|
||||
sq
|
||||
NULL
|
||||
deallocate prepare stmt;
|
||||
drop table t1,t2,t3,t4;
|
||||
create table t1 (a int, b int, c int);
|
||||
create table t2 (x int, y int, z int);
|
||||
create table t3 as select * from t1;
|
||||
insert into t1 values (1,2,3),(4,5,6),(100,200,300),(400,500,600);
|
||||
insert into t2 values (1,2,3),(7,8,9),(100,200,300),(400,500,600);
|
||||
insert into t3 values (1,2,3),(11,12,13),(100,0,0),(400,500,600);
|
||||
set @optimizer_switch_save=@@optimizer_switch;
|
||||
set @join_cache_level_save=@@join_cache_level;
|
||||
set optimizer_switch='materialization=off';
|
||||
set join_cache_level=0;
|
||||
select * from t1 where (select a,b from t3 where t3.c=t1.c) in (select x,y from t2 where t1.c= t2.z);
|
||||
a b c
|
||||
1 2 3
|
||||
400 500 600
|
||||
prepare stmt from "select * from t1 where (select a,b from t3 where t3.c=t1.c) in (select x,y from t2 where t1.c= t2.z)";
|
||||
EXECUTE stmt;
|
||||
a b c
|
||||
1 2 3
|
||||
400 500 600
|
||||
EXECUTE stmt;
|
||||
a b c
|
||||
1 2 3
|
||||
400 500 600
|
||||
create view v1 as select * from t1;
|
||||
create view v2 as select * from t2;
|
||||
create view v3 as select * from t3;
|
||||
select * from v1 where (select a,b from v3 where v3.c=v1.c) in (select x,y from v2 where v1.c= v2.z);
|
||||
a b c
|
||||
1 2 3
|
||||
400 500 600
|
||||
prepare stmt from "select * from v1 where (select a,b from v3 where v3.c=v1.c) in (select x,y from v2 where v1.c= v2.z)";
|
||||
EXECUTE stmt;
|
||||
a b c
|
||||
1 2 3
|
||||
400 500 600
|
||||
EXECUTE stmt;
|
||||
a b c
|
||||
1 2 3
|
||||
400 500 600
|
||||
set optimizer_switch=@optimizer_switch_save;
|
||||
set join_cache_level=@join_cache_level_save;
|
||||
deallocate prepare stmt;
|
||||
drop view v1,v2,v3;
|
||||
drop table t1,t2,t3;
|
||||
# End of 5.5 tests
|
||||
|
@ -1807,4 +1807,85 @@ id state capital
|
||||
7 Pennsylvania Harrisburg
|
||||
8 Virginia Richmond
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# mdev-11574: do not build index merge of two indexes when
|
||||
# one index is an infix of the other index
|
||||
#
|
||||
set names utf8;
|
||||
CREATE DATABASE world;
|
||||
use world;
|
||||
CREATE TABLE Country (
|
||||
Code char(3) NOT NULL default '',
|
||||
Name char(52) NOT NULL default '',
|
||||
SurfaceArea float(10,2) NOT NULL default '0.00',
|
||||
Population int(11) NOT NULL default '0',
|
||||
Capital int(11) default NULL,
|
||||
PRIMARY KEY (Code),
|
||||
UNIQUE INDEX (Name)
|
||||
);
|
||||
CREATE TABLE City (
|
||||
ID int(11) NOT NULL auto_increment,
|
||||
Name char(35) NOT NULL default '',
|
||||
Country char(3) NOT NULL default '',
|
||||
Population int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (ID),
|
||||
INDEX (Population),
|
||||
INDEX (Country)
|
||||
);
|
||||
CREATE TABLE CountryLanguage (
|
||||
Country char(3) NOT NULL default '',
|
||||
Language char(30) NOT NULL default '',
|
||||
Percentage float(3,1) NOT NULL default '0.0',
|
||||
PRIMARY KEY (Country, Language),
|
||||
INDEX (Percentage)
|
||||
);
|
||||
DROP INDEX Country ON City;
|
||||
CREATE INDEX CountryName ON City(Country,Name);
|
||||
CREATE INDEX Name ON City(Name);
|
||||
select * from City
|
||||
where
|
||||
Country='FIN' AND Name IN ('Lahti','Imatra') OR
|
||||
Country='RUS' AND Name IN ('St Petersburg', 'Moscow') OR
|
||||
Country='SWE' AND Name IN ('Stockholm', 'Uppsala') OR
|
||||
Country='DEU' AND Name IN ('Berlin', 'Bonn') OR
|
||||
Country='BEL' AND Name IN ('Antwerpen', 'Gent') OR
|
||||
Country='PRT' AND Name IN ('Braga', 'Porto') OR
|
||||
Country='FRA' AND Name IN ('Paris', 'Marcel') OR
|
||||
Country='POL' AND Name IN ('Warszawa', 'Wroclaw') OR
|
||||
Country='NOR' AND Name IN ('Oslo', 'Bergen') OR
|
||||
Country='ITA' AND Name IN ('Napoli', 'Venezia');
|
||||
ID Name Country Population
|
||||
175 Antwerpen BEL 446525
|
||||
176 Gent BEL 224180
|
||||
3068 Berlin DEU 3386667
|
||||
3087 Bonn DEU 301048
|
||||
3242 Lahti FIN 96921
|
||||
2974 Paris FRA 2125246
|
||||
1466 Napoli ITA 1002619
|
||||
1474 Venezia ITA 277305
|
||||
2808 Bergen NOR 230948
|
||||
2807 Oslo NOR 508726
|
||||
2928 Warszawa POL 1615369
|
||||
2931 Wroclaw POL 636765
|
||||
2918 Braga PRT 90535
|
||||
2915 Porto PRT 273060
|
||||
3580 Moscow RUS 8389200
|
||||
3581 St Petersburg RUS 4694000
|
||||
3048 Stockholm SWE 750348
|
||||
3051 Uppsala SWE 189569
|
||||
explain select * from City
|
||||
where
|
||||
Country='FIN' AND Name IN ('Lahti','Imatra') OR
|
||||
Country='RUS' AND Name IN ('St Petersburg', 'Moscow') OR
|
||||
Country='SWE' AND Name IN ('Stockholm', 'Uppsala') OR
|
||||
Country='DEU' AND Name IN ('Berlin', 'Bonn') OR
|
||||
Country='BEL' AND Name IN ('Antwerpen', 'Gent') OR
|
||||
Country='PRT' AND Name IN ('Braga', 'Porto') OR
|
||||
Country='FRA' AND Name IN ('Paris', 'Marcel') OR
|
||||
Country='POL' AND Name IN ('Warszawa', 'Wroclaw') OR
|
||||
Country='NOR' AND Name IN ('Oslo', 'Bergen') OR
|
||||
Country='ITA' AND Name IN ('Napoli', 'Venezia');
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City range CountryName,Name CountryName 38 NULL 22 Using index condition; Using where
|
||||
DROP DATABASE world;
|
||||
set session optimizer_switch='index_merge_sort_intersection=default';
|
||||
|
@ -1808,5 +1808,86 @@ id state capital
|
||||
7 Pennsylvania Harrisburg
|
||||
8 Virginia Richmond
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# mdev-11574: do not build index merge of two indexes when
|
||||
# one index is an infix of the other index
|
||||
#
|
||||
set names utf8;
|
||||
CREATE DATABASE world;
|
||||
use world;
|
||||
CREATE TABLE Country (
|
||||
Code char(3) NOT NULL default '',
|
||||
Name char(52) NOT NULL default '',
|
||||
SurfaceArea float(10,2) NOT NULL default '0.00',
|
||||
Population int(11) NOT NULL default '0',
|
||||
Capital int(11) default NULL,
|
||||
PRIMARY KEY (Code),
|
||||
UNIQUE INDEX (Name)
|
||||
);
|
||||
CREATE TABLE City (
|
||||
ID int(11) NOT NULL auto_increment,
|
||||
Name char(35) NOT NULL default '',
|
||||
Country char(3) NOT NULL default '',
|
||||
Population int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (ID),
|
||||
INDEX (Population),
|
||||
INDEX (Country)
|
||||
);
|
||||
CREATE TABLE CountryLanguage (
|
||||
Country char(3) NOT NULL default '',
|
||||
Language char(30) NOT NULL default '',
|
||||
Percentage float(3,1) NOT NULL default '0.0',
|
||||
PRIMARY KEY (Country, Language),
|
||||
INDEX (Percentage)
|
||||
);
|
||||
DROP INDEX Country ON City;
|
||||
CREATE INDEX CountryName ON City(Country,Name);
|
||||
CREATE INDEX Name ON City(Name);
|
||||
select * from City
|
||||
where
|
||||
Country='FIN' AND Name IN ('Lahti','Imatra') OR
|
||||
Country='RUS' AND Name IN ('St Petersburg', 'Moscow') OR
|
||||
Country='SWE' AND Name IN ('Stockholm', 'Uppsala') OR
|
||||
Country='DEU' AND Name IN ('Berlin', 'Bonn') OR
|
||||
Country='BEL' AND Name IN ('Antwerpen', 'Gent') OR
|
||||
Country='PRT' AND Name IN ('Braga', 'Porto') OR
|
||||
Country='FRA' AND Name IN ('Paris', 'Marcel') OR
|
||||
Country='POL' AND Name IN ('Warszawa', 'Wroclaw') OR
|
||||
Country='NOR' AND Name IN ('Oslo', 'Bergen') OR
|
||||
Country='ITA' AND Name IN ('Napoli', 'Venezia');
|
||||
ID Name Country Population
|
||||
175 Antwerpen BEL 446525
|
||||
176 Gent BEL 224180
|
||||
3068 Berlin DEU 3386667
|
||||
3087 Bonn DEU 301048
|
||||
3242 Lahti FIN 96921
|
||||
2974 Paris FRA 2125246
|
||||
1466 Napoli ITA 1002619
|
||||
1474 Venezia ITA 277305
|
||||
2808 Bergen NOR 230948
|
||||
2807 Oslo NOR 508726
|
||||
2928 Warszawa POL 1615369
|
||||
2931 Wroclaw POL 636765
|
||||
2918 Braga PRT 90535
|
||||
2915 Porto PRT 273060
|
||||
3580 Moscow RUS 8389200
|
||||
3581 St Petersburg RUS 4694000
|
||||
3048 Stockholm SWE 750348
|
||||
3051 Uppsala SWE 189569
|
||||
explain select * from City
|
||||
where
|
||||
Country='FIN' AND Name IN ('Lahti','Imatra') OR
|
||||
Country='RUS' AND Name IN ('St Petersburg', 'Moscow') OR
|
||||
Country='SWE' AND Name IN ('Stockholm', 'Uppsala') OR
|
||||
Country='DEU' AND Name IN ('Berlin', 'Bonn') OR
|
||||
Country='BEL' AND Name IN ('Antwerpen', 'Gent') OR
|
||||
Country='PRT' AND Name IN ('Braga', 'Porto') OR
|
||||
Country='FRA' AND Name IN ('Paris', 'Marcel') OR
|
||||
Country='POL' AND Name IN ('Warszawa', 'Wroclaw') OR
|
||||
Country='NOR' AND Name IN ('Oslo', 'Bergen') OR
|
||||
Country='ITA' AND Name IN ('Napoli', 'Venezia');
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City range CountryName,Name CountryName 38 NULL 20 Using index condition; Using where
|
||||
DROP DATABASE world;
|
||||
set session optimizer_switch='index_merge_sort_intersection=default';
|
||||
SET SESSION STORAGE_ENGINE=DEFAULT;
|
||||
|
@ -47,6 +47,9 @@ delete t1 from t1,t3 where t1.a=t3.a;
|
||||
drop table t1;
|
||||
insert into t1 values(1);
|
||||
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
|
||||
drop temporary table if exists t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 'test.t1'
|
||||
connection default;
|
||||
set global read_only=0;
|
||||
lock table t1 write;
|
||||
|
@ -959,7 +959,7 @@ def information_schema COLUMNS COLUMNS TABLE_CATALOG TABLE_CATALOG 253 1536 3 N
|
||||
def information_schema COLUMNS COLUMNS TABLE_SCHEMA TABLE_SCHEMA 253 192 4 N 1 0 33
|
||||
def information_schema COLUMNS COLUMNS TABLE_NAME TABLE_NAME 253 192 2 N 1 0 33
|
||||
def information_schema COLUMNS COLUMNS COLUMN_NAME COLUMN_NAME 253 192 1 N 1 0 33
|
||||
def information_schema COLUMNS COLUMNS COLUMN_DEFAULT COLUMN_DEFAULT 252 589815 0 Y 16 0 33
|
||||
def information_schema COLUMNS COLUMNS COLUMN_DEFAULT COLUMN_DEFAULT 252 589788 0 Y 16 0 33
|
||||
def information_schema COLUMNS COLUMNS IS_NULLABLE IS_NULLABLE 253 9 2 N 1 0 33
|
||||
def information_schema COLUMNS COLUMNS DATA_TYPE DATA_TYPE 253 192 3 N 1 0 33
|
||||
def information_schema COLUMNS COLUMNS CHARACTER_SET_NAME CHARACTER_SET_NAME 253 96 0 Y 0 0 33
|
||||
@ -984,7 +984,7 @@ def information_schema COLUMNS COLUMNS COLUMN_NAME Field 253 192 1 N 1 0 33
|
||||
def information_schema COLUMNS COLUMNS COLUMN_TYPE Type 252 589815 7 N 17 0 33
|
||||
def information_schema COLUMNS COLUMNS IS_NULLABLE Null 253 9 2 N 1 0 33
|
||||
def information_schema COLUMNS COLUMNS COLUMN_KEY Key 253 9 3 N 1 0 33
|
||||
def information_schema COLUMNS COLUMNS COLUMN_DEFAULT Default 252 589815 0 Y 16 0 33
|
||||
def information_schema COLUMNS COLUMNS COLUMN_DEFAULT Default 252 589788 0 Y 16 0 33
|
||||
def information_schema COLUMNS COLUMNS EXTRA Extra 253 81 0 N 1 0 33
|
||||
Field Type Null Key Default Extra
|
||||
c int(11) NO PRI NULL
|
||||
|
@ -0,0 +1,24 @@
|
||||
create function f() returns int return 1;
|
||||
show function status;
|
||||
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
|
||||
T f T T T T T T T T T
|
||||
set sql_mode = 'PAD_CHAR_TO_FULL_LENGTH';
|
||||
show function status;
|
||||
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
|
||||
T f T T T T T T T T T
|
||||
drop function f;
|
||||
select @@sql_mode;
|
||||
@@sql_mode
|
||||
PAD_CHAR_TO_FULL_LENGTH
|
||||
create function f() returns int return 1;
|
||||
select ROUTINE_NAME from information_schema.ROUTINES where ROUTINE_NAME='f';
|
||||
ROUTINE_NAME
|
||||
f
|
||||
set sql_mode = 'PAD_CHAR_TO_FULL_LENGTH';
|
||||
select ROUTINE_NAME from information_schema.ROUTINES where ROUTINE_NAME='f';
|
||||
ROUTINE_NAME
|
||||
f
|
||||
drop function f;
|
||||
select @@sql_mode;
|
||||
@@sql_mode
|
||||
PAD_CHAR_TO_FULL_LENGTH
|
@ -1238,9 +1238,9 @@ Warning 1364 Field 'i' doesn't have a default value
|
||||
DROP TABLE t1;
|
||||
set @@sql_mode='traditional';
|
||||
create table t1(a varchar(65537));
|
||||
ERROR 42000: Column length too big for column 'a' (max = 65535); use BLOB or TEXT instead
|
||||
ERROR 42000: Column length too big for column 'a' (max = 65532); use BLOB or TEXT instead
|
||||
create table t1(a varbinary(65537));
|
||||
ERROR 42000: Column length too big for column 'a' (max = 65535); use BLOB or TEXT instead
|
||||
ERROR 42000: Column length too big for column 'a' (max = 65532); use BLOB or TEXT instead
|
||||
set @@sql_mode='traditional';
|
||||
create table t1(a int, b date not null);
|
||||
alter table t1 modify a bigint unsigned not null;
|
||||
|
@ -502,3 +502,20 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 index idx idx 5 NULL 5 Using where; Using index
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-13135: subquery with ON expression subject to
|
||||
# semi-join optimizations
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE ALGORITHM=MERGE VIEW v1 AS SELECT a AS v_a FROM t1;
|
||||
INSERT INTO t1 VALUES (1),(3);
|
||||
CREATE TABLE t2 (b INT, KEY(b));
|
||||
INSERT INTO t2 VALUES (3),(4);
|
||||
SELECT * FROM t1 WHERE a NOT IN (
|
||||
SELECT b FROM t2 INNER JOIN v1 ON (b IN ( SELECT a FROM t1 ))
|
||||
WHERE v_a = b
|
||||
);
|
||||
a
|
||||
1
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1,t2;
|
||||
|
37
mysql-test/r/tc_heuristic_recover.result
Normal file
37
mysql-test/r/tc_heuristic_recover.result
Normal file
@ -0,0 +1,37 @@
|
||||
call mtr.add_suppression("Can't init tc log");
|
||||
call mtr.add_suppression("Found 1 prepared transactions!");
|
||||
call mtr.add_suppression("Aborting");
|
||||
set debug_sync='RESET';
|
||||
CREATE TABLE t1 (i INT) ENGINE=InnoDB;
|
||||
SET GLOBAL innodb_flush_log_at_trx_commit=1;
|
||||
FLUSH TABLES;
|
||||
set debug_sync='ha_commit_trans_after_prepare WAIT_FOR go';
|
||||
INSERT INTO t1 VALUES (1);;
|
||||
# Prove that no COMMIT or ROLLBACK occurred yet.
|
||||
SELECT * FROM t1;
|
||||
i
|
||||
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
SELECT * FROM t1;
|
||||
i
|
||||
1
|
||||
# Kill the server
|
||||
FOUND 1 /was in the XA prepared state/ in mysqld.1.err
|
||||
FOUND 1 /Found 1 prepared transactions!/ in mysqld.1.err
|
||||
NOT FOUND /\[ERROR\] Can\'t init tc log/ in mysqld.1.err
|
||||
FOUND 2 /was in the XA prepared state/ in mysqld.1.err
|
||||
FOUND 1 /Found 1 prepared transactions!/ in mysqld.1.err
|
||||
FOUND 1 /\[ERROR\] Can\'t init tc log/ in mysqld.1.err
|
||||
FOUND 1 /Please restart mysqld without --tc-heuristic-recover/ in mysqld.1.err
|
||||
FOUND 3 /was in the XA prepared state/ in mysqld.1.err
|
||||
FOUND 1 /Found 1 prepared transactions!/ in mysqld.1.err
|
||||
FOUND 2 /\[ERROR\] Can\'t init tc log/ in mysqld.1.err
|
||||
FOUND 2 /Please restart mysqld without --tc-heuristic-recover/ in mysqld.1.err
|
||||
FOUND 3 /was in the XA prepared state/ in mysqld.1.err
|
||||
FOUND 1 /Found 1 prepared transactions!/ in mysqld.1.err
|
||||
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
SELECT * FROM t1;
|
||||
i
|
||||
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
SELECT * FROM t1;
|
||||
i
|
||||
DROP TABLE t1;
|
@ -37,7 +37,7 @@ ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT
|
||||
CREATE TABLE t2 (a char(256));
|
||||
ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead
|
||||
CREATE TABLE t1 (a varchar(70000) default "hello");
|
||||
ERROR 42000: Column length too big for column 'a' (max = 65535); use BLOB or TEXT instead
|
||||
ERROR 42000: Column length too big for column 'a' (max = 65532); use BLOB or TEXT instead
|
||||
CREATE TABLE t2 (a blob default "hello");
|
||||
ERROR 42000: BLOB/TEXT column 'a' can't have a default value
|
||||
drop table if exists t1,t2;
|
||||
|
@ -511,7 +511,76 @@ Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 's '
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Start of 10.0 tests
|
||||
# MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535
|
||||
#
|
||||
CREATE TABLE t1 (c1 VARBINARY(65532));
|
||||
DESCRIBE t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 varbinary(65532) YES NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 VARBINARY(65533));
|
||||
Warnings:
|
||||
Note 1246 Converting column 'c1' from VARBINARY to BLOB
|
||||
DESCRIBE t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 blob YES NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 VARBINARY(65534));
|
||||
Warnings:
|
||||
Note 1246 Converting column 'c1' from VARBINARY to BLOB
|
||||
DESCRIBE t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 blob YES NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 VARBINARY(65535));
|
||||
Warnings:
|
||||
Note 1246 Converting column 'c1' from VARBINARY to BLOB
|
||||
DESCRIBE t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 blob YES NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 VARBINARY(65536));
|
||||
Warnings:
|
||||
Note 1246 Converting column 'c1' from VARBINARY to BLOB
|
||||
DESCRIBE t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 mediumblob YES NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 VARCHAR(65532));
|
||||
DESCRIBE t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 varchar(65532) YES NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 VARCHAR(65533));
|
||||
Warnings:
|
||||
Note 1246 Converting column 'c1' from VARCHAR to TEXT
|
||||
DESCRIBE t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 text YES NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 VARCHAR(65534));
|
||||
Warnings:
|
||||
Note 1246 Converting column 'c1' from VARCHAR to TEXT
|
||||
DESCRIBE t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 text YES NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 VARCHAR(65535));
|
||||
Warnings:
|
||||
Note 1246 Converting column 'c1' from VARCHAR to TEXT
|
||||
DESCRIBE t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 text YES NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 VARCHAR(65536));
|
||||
Warnings:
|
||||
Note 1246 Converting column 'c1' from VARCHAR to TEXT
|
||||
DESCRIBE t1;
|
||||
Field Type Null Key Default Extra
|
||||
c1 mediumtext YES NULL
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 5.5 tests
|
||||
#
|
||||
#
|
||||
# MDEV-6950 Bad results with joins comparing DATE and INT/ENUM/VARCHAR columns
|
||||
|
@ -5627,9 +5627,6 @@ CREATE TABLE t3 (a INT);
|
||||
CREATE ALGORITHM = MERGE VIEW v1 AS SELECT t2.a FROM t3 AS t1, t3 AS t2;
|
||||
CREATE ALGORITHM = MERGE VIEW v2 AS SELECT * FROM v1;
|
||||
PREPARE stmt FROM 'REPLACE INTO v2 SELECT a FROM t3';
|
||||
EXECUTE stmt;
|
||||
ERROR HY000: Can not insert into join view 'test.v2' without fields list
|
||||
EXECUTE stmt;
|
||||
ERROR HY000: Can not insert into join view 'test.v2' without fields list
|
||||
drop view v1,v2;
|
||||
drop table t3;
|
||||
|
@ -2,9 +2,9 @@
|
||||
--echo # Bug#20821: INSERT DELAYED fails to write some rows to binlog
|
||||
--echo #
|
||||
|
||||
--source include/master-slave.inc
|
||||
--source include/not_embedded.inc
|
||||
--source include/not_windows.inc
|
||||
--source include/master-slave.inc
|
||||
|
||||
--disable_warnings
|
||||
CREATE SCHEMA IF NOT EXISTS mysqlslap;
|
||||
|
40
mysql-test/suite/innodb/include/import.inc
Normal file
40
mysql-test/suite/innodb/include/import.inc
Normal file
@ -0,0 +1,40 @@
|
||||
# Export Table and Import from saved files .cfg and .ibd
|
||||
# Caller should create t1 table definition and populate table
|
||||
|
||||
let $MYSQLD_DATADIR = `SELECT @@datadir`;
|
||||
|
||||
if(!$source_db) {
|
||||
let $source_db = test;
|
||||
}
|
||||
|
||||
if(!$dest_db) {
|
||||
let $dest_db = test;
|
||||
}
|
||||
|
||||
eval FLUSH TABLES $source_db.t1 FOR EXPORT;
|
||||
|
||||
--copy_file $MYSQLD_DATADIR/$source_db/t1.cfg $MYSQLD_DATADIR/t1.cfg_back
|
||||
--copy_file $MYSQLD_DATADIR/$source_db/t1.ibd $MYSQLD_DATADIR/t1.ibd_back
|
||||
|
||||
UNLOCK TABLES;
|
||||
|
||||
if($source_db != $dest_db) {
|
||||
eval USE $dest_db;
|
||||
let $create1 = query_get_value(SHOW CREATE TABLE $source_db.t1, Create Table, 1);
|
||||
eval $create1;
|
||||
}
|
||||
|
||||
eval ALTER TABLE $dest_db.t1 DISCARD TABLESPACE;
|
||||
|
||||
--move_file $MYSQLD_DATADIR/t1.cfg_back $MYSQLD_DATADIR/$dest_db/t1.cfg
|
||||
--move_file $MYSQLD_DATADIR/t1.ibd_back $MYSQLD_DATADIR/$dest_db/t1.ibd
|
||||
|
||||
eval ALTER TABLE $dest_db.t1 IMPORT TABLESPACE;
|
||||
|
||||
eval CHECK TABLE $dest_db.t1;
|
||||
eval SHOW CREATE TABLE $dest_db.t1;
|
||||
eval SELECT * FROM $dest_db.t1;
|
||||
|
||||
if($source_db != $dest_db) {
|
||||
eval DROP TABLE $dest_db.t1;
|
||||
}
|
9
mysql-test/suite/innodb/include/innodb_dict.inc
Normal file
9
mysql-test/suite/innodb/include/innodb_dict.inc
Normal file
@ -0,0 +1,9 @@
|
||||
SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
|
||||
SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i
|
||||
INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID;
|
||||
|
||||
SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i
|
||||
INNER JOIN sys_foreign sf ON i.ID = sf.ID;
|
96
mysql-test/suite/innodb/r/alter_rename_existing.result
Normal file
96
mysql-test/suite/innodb/r/alter_rename_existing.result
Normal file
@ -0,0 +1,96 @@
|
||||
#
|
||||
# Show what happens during ALTER TABLE when an existing file
|
||||
# exists in the target location.
|
||||
#
|
||||
# Bug #19218794: IF TABLESPACE EXISTS, CAN'T CREATE TABLE,
|
||||
# BUT CAN ALTER ENGINE=INNODB
|
||||
#
|
||||
CREATE TABLE t1 (a SERIAL, b CHAR(10)) ENGINE=Memory;
|
||||
INSERT INTO t1(b) VALUES('one'), ('two'), ('three');
|
||||
#
|
||||
# Create a file called MYSQLD_DATADIR/test/t1.ibd
|
||||
# Directory listing of test/*.ibd
|
||||
#
|
||||
t1.ibd
|
||||
ALTER TABLE t1 ENGINE = InnoDB;
|
||||
ERROR HY000: Error on rename of 'OLD_FILE_NAME' to 'NEW_FILE_NAME' (errno: 184 "Tablespace already exists")
|
||||
#
|
||||
# Move the file to InnoDB as t2
|
||||
#
|
||||
ALTER TABLE t1 RENAME TO t2, ENGINE = INNODB;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`b` char(10) DEFAULT NULL,
|
||||
UNIQUE KEY `a` (`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
|
||||
SELECT * from t2;
|
||||
a b
|
||||
1 one
|
||||
2 two
|
||||
3 three
|
||||
ALTER TABLE t2 RENAME TO t1;
|
||||
ERROR HY000: Error on rename of 'OLD_FILE_NAME' to 'NEW_FILE_NAME' (errno: 184 "Tablespace already exists")
|
||||
#
|
||||
# Create another t1, but in the system tablespace.
|
||||
#
|
||||
SET GLOBAL innodb_file_per_table=OFF;
|
||||
CREATE TABLE t1 (a SERIAL, b CHAR(20)) ENGINE=InnoDB;
|
||||
INSERT INTO t1(b) VALUES('one'), ('two'), ('three');
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`b` char(20) DEFAULT NULL,
|
||||
UNIQUE KEY `a` (`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
|
||||
SELECT name, space=0 FROM information_schema.innodb_sys_tables WHERE name = 'test/t1';
|
||||
name space=0
|
||||
test/t1 1
|
||||
#
|
||||
# ALTER TABLE from system tablespace to system tablespace
|
||||
#
|
||||
ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=INPLACE;
|
||||
ALTER TABLE t1 ADD COLUMN d INT, ALGORITHM=COPY;
|
||||
#
|
||||
# Try to move t1 from the system tablespace to a file-per-table
|
||||
# while a blocking t1.ibd file exists.
|
||||
#
|
||||
SET GLOBAL innodb_file_per_table=ON;
|
||||
ALTER TABLE t1 ADD COLUMN e1 INT, ALGORITHM=INPLACE;
|
||||
ERROR HY000: Tablespace for table 'test/t1' exists. Please DISCARD the tablespace before IMPORT.
|
||||
ALTER TABLE t1 ADD COLUMN e2 INT, ALGORITHM=COPY;
|
||||
ERROR HY000: Error on rename of 'OLD_FILE_NAME' to 'NEW_FILE_NAME' (errno: 184 "Tablespace already exists")
|
||||
#
|
||||
# Delete the blocking file called MYSQLD_DATADIR/test/t1.ibd
|
||||
# Move t1 to file-per-table using ALGORITHM=INPLACE with no blocking t1.ibd.
|
||||
#
|
||||
ALTER TABLE t1 ADD COLUMN e INT, ALGORITHM=INPLACE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`b` char(20) DEFAULT NULL,
|
||||
`c` int(11) DEFAULT NULL,
|
||||
`d` int(11) DEFAULT NULL,
|
||||
`e` int(11) DEFAULT NULL,
|
||||
UNIQUE KEY `a` (`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
|
||||
SELECT name, space=0 FROM information_schema.innodb_sys_tables WHERE name = 'test/t1';
|
||||
name space=0
|
||||
test/t1 0
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Rename t2.ibd to t1.ibd.
|
||||
#
|
||||
ALTER TABLE t2 RENAME TO t1;
|
||||
SELECT name, space=0 FROM information_schema.innodb_sys_tables WHERE name = 'test/t1';
|
||||
name space=0
|
||||
test/t1 0
|
||||
SELECT * from t1;
|
||||
a b
|
||||
1 one
|
||||
2 two
|
||||
3 three
|
||||
DROP TABLE t1;
|
26
mysql-test/suite/innodb/r/create-index-debug.result
Normal file
26
mysql-test/suite/innodb/r/create-index-debug.result
Normal file
@ -0,0 +1,26 @@
|
||||
SET @saved_debug_dbug = @@SESSION.debug_dbug;
|
||||
#
|
||||
#BUG#21326304 INNODB ONLINE ALTER TABLE ENDS IN CRASH ON DISK FULL
|
||||
#
|
||||
CREATE TABLE t1(f1 CHAR(255) NOT NULL, f2 CHAR(255) NOT NULL, f3
|
||||
CHAR(255) NOT NULL, f4 CHAR(255) NOT NULL, f5 CHAR(255) NOT NULL,f6
|
||||
CHAR(255) NOT NULL, f7 CHAR(255) NOT NULL, f8 CHAR(255) NOT NULL,f9
|
||||
CHAR(255) NOT NULL, f10 CHAR(255) NOT NULL, f11 CHAR(255) NOT NULL,f12
|
||||
CHAR(255) NOT NULL, f13 CHAR(255) NOT NULL, f14 CHAR(255) NOT NULL,f15
|
||||
CHAR(255) NOT NULL, f16 CHAR(255) NOT NULL, f17 CHAR(255) NOT NULL,f18
|
||||
CHAR(255) NOT NULL)
|
||||
ENGINE=INNODB ROW_FORMAT=DYNAMIC;
|
||||
Warnings:
|
||||
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
|
||||
Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
|
||||
INSERT INTO t1
|
||||
VALUES('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r');
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
SET debug_dbug = '+d,disk_is_full';
|
||||
ALTER TABLE t1 FORCE, ALGORITHM=INPLACE;
|
||||
ERROR HY000: The table 't1' is full
|
||||
SET debug_dbug= @saved_debug_dbug;
|
||||
DROP TABLE t1;
|
55
mysql-test/suite/innodb/r/index_tree_operation.result
Normal file
55
mysql-test/suite/innodb/r/index_tree_operation.result
Normal file
@ -0,0 +1,55 @@
|
||||
#
|
||||
# Bug#15923864 (Bug#67718):
|
||||
# INNODB DRASTICALLY UNDER-FILLS PAGES IN CERTAIN CONDITIONS
|
||||
#
|
||||
SET GLOBAL innodb_file_per_table=ON;
|
||||
CREATE TABLE t1 (a BIGINT PRIMARY KEY, b VARCHAR(4096)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (0, REPEAT('a', 4096));
|
||||
INSERT INTO t1 VALUES (1000, REPEAT('a', 4096));
|
||||
INSERT INTO t1 VALUES (1001, REPEAT('a', 4096));
|
||||
INSERT INTO t1 VALUES (1002, REPEAT('a', 4096));
|
||||
INSERT INTO t1 VALUES (1, REPEAT('a', 4096));
|
||||
INSERT INTO t1 VALUES (2, REPEAT('a', 4096));
|
||||
SELECT page_number, number_records
|
||||
FROM information_schema.innodb_sys_tablespaces s1,
|
||||
information_schema.innodb_buffer_page s2
|
||||
WHERE s1.space = s2.space AND name = 'test/t1'
|
||||
AND page_type = "INDEX" ORDER BY page_number;
|
||||
page_number number_records
|
||||
3 2
|
||||
4 3
|
||||
5 3
|
||||
INSERT INTO t1 VALUES (999, REPEAT('a', 4096));
|
||||
SELECT page_number, number_records
|
||||
FROM information_schema.innodb_sys_tablespaces s1,
|
||||
information_schema.innodb_buffer_page s2
|
||||
WHERE s1.space = s2.space AND name = 'test/t1'
|
||||
AND page_type = "INDEX" ORDER BY page_number;
|
||||
page_number number_records
|
||||
3 3
|
||||
4 3
|
||||
5 3
|
||||
6 1
|
||||
INSERT INTO t1 VALUES (998, REPEAT('a', 4096));
|
||||
SELECT page_number, number_records
|
||||
FROM information_schema.innodb_sys_tablespaces s1,
|
||||
information_schema.innodb_buffer_page s2
|
||||
WHERE s1.space = s2.space AND name = 'test/t1'
|
||||
AND page_type = "INDEX" ORDER BY page_number;
|
||||
page_number number_records
|
||||
3 3
|
||||
4 3
|
||||
5 3
|
||||
6 2
|
||||
INSERT INTO t1 VALUES (997, REPEAT('a', 4096));
|
||||
SELECT page_number, number_records
|
||||
FROM information_schema.innodb_sys_tablespaces s1,
|
||||
information_schema.innodb_buffer_page s2
|
||||
WHERE s1.space = s2.space AND name = 'test/t1'
|
||||
AND page_type = "INDEX" ORDER BY page_number;
|
||||
page_number number_records
|
||||
3 3
|
||||
4 3
|
||||
5 3
|
||||
6 3
|
||||
DROP TABLE t1;
|
174
mysql-test/suite/innodb/r/innodb-alter-autoinc.result
Normal file
174
mysql-test/suite/innodb/r/innodb-alter-autoinc.result
Normal file
@ -0,0 +1,174 @@
|
||||
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(347),(33101),(123),(45),(6);
|
||||
SET @old_sql_mode = @@sql_mode;
|
||||
SET @@sql_mode = 'STRICT_TRANS_TABLES';
|
||||
ALTER TABLE t1 ADD PRIMARY KEY(a);
|
||||
SET @@sql_mode = @old_sql_mode;
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
LOCK=NONE;
|
||||
ERROR 0A000: LOCK=NONE is not supported. Reason: Adding an auto-increment column requires a lock. Try LOCK=SHARED.
|
||||
ALTER TABLE t1 ADD id INT AUTO_INCREMENT;
|
||||
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
|
||||
ALTER TABLE t1 ADD id INT AUTO_INCREMENT, ADD INDEX(a, id);
|
||||
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
|
||||
ALTER TABLE t1 ADD id INT NOT NULL, ADD INDEX(id, a);
|
||||
SELECT * FROM t1;
|
||||
a id
|
||||
6 0
|
||||
45 0
|
||||
123 0
|
||||
347 0
|
||||
33101 0
|
||||
SET AUTO_INCREMENT_INCREMENT = 5, AUTO_INCREMENT_OFFSET = 30;
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
DROP COLUMN id, AUTO_INCREMENT = 42, ALGORITHM=COPY;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id` (`id`,`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=latin1
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(7,0);
|
||||
SELECT * FROM t1;
|
||||
a id
|
||||
6 45
|
||||
45 50
|
||||
123 55
|
||||
347 60
|
||||
33101 65
|
||||
7 70
|
||||
ROLLBACK;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id` (`id`,`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=75 DEFAULT CHARSET=latin1
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
DROP COLUMN id, AUTO_INCREMENT = 42, LOCK=NONE;
|
||||
ERROR 0A000: LOCK=NONE is not supported. Reason: Adding an auto-increment column requires a lock. Try LOCK=SHARED.
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
DROP COLUMN id, AUTO_INCREMENT = 42, ALGORITHM=INPLACE;
|
||||
SELECT * FROM t1;
|
||||
a id
|
||||
6 45
|
||||
45 50
|
||||
123 55
|
||||
347 60
|
||||
33101 65
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id` (`id`,`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 SET a=123;
|
||||
INSERT INTO t1 VALUES(-123,-45);
|
||||
ALTER TABLE t1 AUTO_INCREMENT = 75;
|
||||
INSERT INTO t1 SET a=123;
|
||||
SELECT * FROM t1;
|
||||
a id
|
||||
-123 -45
|
||||
6 45
|
||||
45 50
|
||||
123 55
|
||||
347 60
|
||||
33101 65
|
||||
123 70
|
||||
123 75
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id` (`id`,`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=80 DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(347),(33101),(123),(45),(6);
|
||||
ALTER TABLE t1 ADD PRIMARY KEY(a);
|
||||
ALTER TABLE t1 ADD id INT NOT NULL, ADD INDEX(id, a);
|
||||
SELECT * FROM t1;
|
||||
a id
|
||||
6 0
|
||||
45 0
|
||||
123 0
|
||||
347 0
|
||||
33101 0
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
DROP COLUMN id, AUTO_INCREMENT = 42, ALGORITHM=INPLACE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id` (`id`,`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=latin1
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(7,0);
|
||||
SELECT * FROM t1;
|
||||
a id
|
||||
6 45
|
||||
45 50
|
||||
123 55
|
||||
347 60
|
||||
33101 65
|
||||
7 70
|
||||
ROLLBACK;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id` (`id`,`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=75 DEFAULT CHARSET=latin1
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
DROP COLUMN id, AUTO_INCREMENT = 42, ALGORITHM=COPY;
|
||||
SELECT * FROM t1;
|
||||
a id
|
||||
6 45
|
||||
45 50
|
||||
123 55
|
||||
347 60
|
||||
33101 65
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id` (`id`,`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=75 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 SET a=123;
|
||||
INSERT INTO t1 VALUES(-123,-45);
|
||||
ALTER TABLE t1 AUTO_INCREMENT = 75;
|
||||
INSERT INTO t1 SET a=123;
|
||||
SELECT * FROM t1;
|
||||
a id
|
||||
-123 -45
|
||||
6 45
|
||||
45 50
|
||||
123 55
|
||||
347 60
|
||||
33101 65
|
||||
123 75
|
||||
123 80
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id` (`id`,`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=85 DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
@ -185,3 +185,44 @@ ticket CREATE TABLE `ticket` (
|
||||
KEY `org_id` (`org_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE ticket;
|
||||
CREATE TABLE t (
|
||||
id bigint(20) unsigned NOT NULL auto_increment,
|
||||
d date NOT NULL,
|
||||
a bigint(20) unsigned NOT NULL,
|
||||
b smallint(5) unsigned DEFAULT NULL,
|
||||
PRIMARY KEY (id,d)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs STATS_SAMPLE_PAGES=2
|
||||
PARTITION BY RANGE COLUMNS(d)
|
||||
(
|
||||
PARTITION p20170914 VALUES LESS THAN ('2017-09-15') ENGINE = InnoDB,
|
||||
PARTITION p99991231 VALUES LESS THAN (MAXVALUE) ENGINE = InnoDB);
|
||||
insert into t(d,a,b) values ('2017-09-15',rand()*10000,rand()*10);
|
||||
insert into t(d,a,b) values ('2017-09-15',rand()*10000,rand()*10);
|
||||
replace into t(d,a,b) select '2017-09-15',rand()*10000,rand()*10 from t t1, t t2, t t3, t t4;
|
||||
select count(*) from t where d ='2017-09-15';
|
||||
count(*)
|
||||
18
|
||||
ALTER TABLE t CHANGE b c smallint(5) unsigned , ADD KEY idx_d_a (d, a);
|
||||
SHOW CREATE TABLE t;
|
||||
Table Create Table
|
||||
t CREATE TABLE `t` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`d` date NOT NULL,
|
||||
`a` bigint(20) unsigned NOT NULL,
|
||||
`c` smallint(5) unsigned DEFAULT NULL,
|
||||
PRIMARY KEY (`id`,`d`),
|
||||
KEY `idx_d_a` (`d`,`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs STATS_SAMPLE_PAGES=2
|
||||
/*!50500 PARTITION BY RANGE COLUMNS(d)
|
||||
(PARTITION p20170914 VALUES LESS THAN ('2017-09-15') ENGINE = InnoDB,
|
||||
PARTITION p99991231 VALUES LESS THAN (MAXVALUE) ENGINE = InnoDB) */
|
||||
analyze table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t analyze status OK
|
||||
select count(*) from t where d ='2017-09-15';
|
||||
count(*)
|
||||
18
|
||||
select count(*) from t force index(primary) where d ='2017-09-15';
|
||||
count(*)
|
||||
18
|
||||
DROP TABLE t;
|
||||
|
861
mysql-test/suite/innodb/r/innodb-alter.result
Normal file
861
mysql-test/suite/innodb/r/innodb-alter.result
Normal file
@ -0,0 +1,861 @@
|
||||
SET NAMES utf8;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT PRIMARY KEY, c2 INT DEFAULT 1, ct TEXT,
|
||||
INDEX(c2))
|
||||
ENGINE=InnoDB;
|
||||
INSERT INTO t1 SET c1=1;
|
||||
CREATE TABLE sys_tables SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
|
||||
WHERE NAME LIKE 'test/t%';
|
||||
CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
CREATE TABLE t1p LIKE t1;
|
||||
CREATE TABLE t1c (c1 INT PRIMARY KEY, c2 INT, c3 INT, INDEX(c2), INDEX(c3),
|
||||
CONSTRAINT t1c2 FOREIGN KEY (c2) REFERENCES t1(c2),
|
||||
CONSTRAINT t1c3 FOREIGN KEY (c3) REFERENCES t1p(c2))
|
||||
ENGINE=InnoDB;
|
||||
CREATE TABLE sys_foreign SELECT i.*
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN i
|
||||
WHERE FOR_NAME LIKE 'test/t%';
|
||||
SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i
|
||||
INNER JOIN sys_foreign sf ON i.ID = sf.ID;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/t1c2 c2 c2 0
|
||||
test/t1c3 c3 c2 0
|
||||
SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
NAME POS MTYPE PRTYPE LEN
|
||||
c1 0 6 1283 4
|
||||
c2 1 6 1027 4
|
||||
ct 2 5 524540 10
|
||||
SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i
|
||||
INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID;
|
||||
NAME POS NAME
|
||||
PRIMARY 0 c1
|
||||
c2 0 c2
|
||||
SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i
|
||||
INNER JOIN sys_foreign sf ON i.ID = sf.ID;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/t1c2 c2 c2 0
|
||||
test/t1c3 c3 c2 0
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c2` int(11) DEFAULT '1',
|
||||
`ct` text,
|
||||
PRIMARY KEY (`c1`),
|
||||
KEY `c2` (`c2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
ALTER TABLE t1 ALTER c2 DROP DEFAULT;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c2` int(11),
|
||||
`ct` text,
|
||||
PRIMARY KEY (`c1`),
|
||||
KEY `c2` (`c2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
NAME POS MTYPE PRTYPE LEN
|
||||
c1 0 6 1283 4
|
||||
c2 1 6 1027 4
|
||||
ct 2 5 524540 10
|
||||
SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i
|
||||
INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID;
|
||||
NAME POS NAME
|
||||
PRIMARY 0 c1
|
||||
c2 0 c2
|
||||
SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i
|
||||
INNER JOIN sys_foreign sf ON i.ID = sf.ID;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/t1c2 c2 c2 0
|
||||
test/t1c3 c3 c2 0
|
||||
ALTER TABLE t1 CHANGE c2 c2 INT AFTER c1;
|
||||
ALTER TABLE t1 CHANGE c1 c1 INT FIRST;
|
||||
SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
NAME POS MTYPE PRTYPE LEN
|
||||
c1 0 6 1283 4
|
||||
c2 1 6 1027 4
|
||||
ct 2 5 524540 10
|
||||
SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i
|
||||
INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID;
|
||||
NAME POS NAME
|
||||
PRIMARY 0 c1
|
||||
c2 0 c2
|
||||
SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i
|
||||
INNER JOIN sys_foreign sf ON i.ID = sf.ID;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/t1c2 c2 c2 0
|
||||
test/t1c3 c3 c2 0
|
||||
ALTER TABLE t1 CHANGE C2 c3 INT;
|
||||
SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
NAME POS MTYPE PRTYPE LEN
|
||||
c1 0 6 1283 4
|
||||
c3 1 6 1027 4
|
||||
ct 2 5 524540 10
|
||||
SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i
|
||||
INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID;
|
||||
NAME POS NAME
|
||||
PRIMARY 0 c1
|
||||
c2 0 c3
|
||||
SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i
|
||||
INNER JOIN sys_foreign sf ON i.ID = sf.ID;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/t1c2 c2 c3 0
|
||||
test/t1c3 c3 c2 0
|
||||
ALTER TABLE t1 CHANGE c3 C INT;
|
||||
SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
NAME POS MTYPE PRTYPE LEN
|
||||
c1 0 6 1283 4
|
||||
C 1 6 1027 4
|
||||
ct 2 5 524540 10
|
||||
SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i
|
||||
INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID;
|
||||
NAME POS NAME
|
||||
PRIMARY 0 c1
|
||||
c2 0 C
|
||||
SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i
|
||||
INNER JOIN sys_foreign sf ON i.ID = sf.ID;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/t1c2 c2 C 0
|
||||
test/t1c3 c3 c2 0
|
||||
ALTER TABLE t1 CHANGE C Cöŀumň_TWO INT;
|
||||
SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i
|
||||
INNER JOIN sys_foreign sf ON i.ID = sf.ID;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/t1c2 c2 Cöŀumň_TWO 0
|
||||
test/t1c3 c3 c2 0
|
||||
SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
NAME POS MTYPE PRTYPE LEN
|
||||
c1 0 6 1283 4
|
||||
Cöŀumň_TWO 1 6 1027 4
|
||||
ct 2 5 524540 10
|
||||
SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i
|
||||
INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID;
|
||||
NAME POS NAME
|
||||
PRIMARY 0 c1
|
||||
c2 0 Cöŀumň_TWO
|
||||
SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i
|
||||
INNER JOIN sys_foreign sf ON i.ID = sf.ID;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/t1c2 c2 Cöŀumň_TWO 0
|
||||
test/t1c3 c3 c2 0
|
||||
ALTER TABLE t1 CHANGE cöĿǖmň_two c3 INT;
|
||||
ERROR 42S22: Unknown column 'cöĿǖmň_two' in 't1'
|
||||
ALTER TABLE t1 CHANGE cÖĿUMŇ_two c3 INT, RENAME TO t3;
|
||||
SELECT st.NAME, i.NAME
|
||||
FROM sys_tables st INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_TABLES i
|
||||
ON i.TABLE_ID=st.TABLE_ID;
|
||||
NAME NAME
|
||||
test/t1 test/t3
|
||||
SHOW CREATE TABLE t3;
|
||||
Table Create Table
|
||||
t3 CREATE TABLE `t3` (
|
||||
`c1` int(11) NOT NULL DEFAULT '0',
|
||||
`c3` int(11) DEFAULT NULL,
|
||||
`ct` text,
|
||||
PRIMARY KEY (`c1`),
|
||||
KEY `c2` (`c3`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
SHOW CREATE TABLE t1c;
|
||||
Table Create Table
|
||||
t1c CREATE TABLE `t1c` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c2` int(11) DEFAULT NULL,
|
||||
`c3` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`c1`),
|
||||
KEY `c2` (`c2`),
|
||||
KEY `c3` (`c3`),
|
||||
CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t3` (`c3`),
|
||||
CONSTRAINT `t1c3` FOREIGN KEY (`c3`) REFERENCES `t1p` (`c2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
ALTER TABLE t3 CHANGE c3
|
||||
`12345678901234567890123456789012345678901234567890123456789012345` INT;
|
||||
ERROR 42000: Identifier name '12345678901234567890123456789012345678901234567890123456789012345' is too long
|
||||
ALTER TABLE t3 CHANGE c3
|
||||
`1234567890123456789012345678901234567890123456789012345678901234` INT;
|
||||
SHOW CREATE TABLE t3;
|
||||
Table Create Table
|
||||
t3 CREATE TABLE `t3` (
|
||||
`c1` int(11) NOT NULL DEFAULT '0',
|
||||
`1234567890123456789012345678901234567890123456789012345678901234` int(11) DEFAULT NULL,
|
||||
`ct` text,
|
||||
PRIMARY KEY (`c1`),
|
||||
KEY `c2` (`1234567890123456789012345678901234567890123456789012345678901234`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
ALTER TABLE t3 CHANGE
|
||||
`1234567890123456789012345678901234567890123456789012345678901234`
|
||||
`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾倿偀` INT;
|
||||
ERROR 42000: Identifier name '倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠' is too long
|
||||
ALTER TABLE t3 CHANGE
|
||||
`1234567890123456789012345678901234567890123456789012345678901234`
|
||||
`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾倿ä` INT;
|
||||
ERROR 42000: Identifier name '倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠' is too long
|
||||
ALTER TABLE t3 CHANGE
|
||||
`1234567890123456789012345678901234567890123456789012345678901234`
|
||||
`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾ä` INT;
|
||||
ALTER TABLE t3 CHANGE
|
||||
`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾Ä`
|
||||
c3 INT;
|
||||
ALTER TABLE t3 CHANGE c3 𐌀𐌁𐌂𐌃𐌄𐌅𐌆𐌇𐌈𐌉𐌊𐌋𐌌𐌍𐌎𐌏𐌐𐌑𐌒𐌓𐌔𐌕𐌖𐌗𐌘𐌙𐌚𐌛𐌜 INT;
|
||||
ERROR HY000: Invalid utf8 character string: '\xF0\x90\x8C\x80\xF0\x90\x8C\x81\xF0\x90\x8C\x82\xF0\x90\x8C\x83'
|
||||
ALTER TABLE t3 CHANGE c3 😲 INT;
|
||||
ERROR HY000: Invalid utf8 character string: '\xF0\x9F\x98\xB2'
|
||||
ALTER TABLE t3 RENAME TO t2;
|
||||
SELECT st.NAME, i.NAME
|
||||
FROM sys_tables st INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_TABLES i
|
||||
ON i.TABLE_ID=st.TABLE_ID;
|
||||
NAME NAME
|
||||
test/t1 test/t2
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`c1` int(11) NOT NULL DEFAULT '0',
|
||||
`c3` int(11) DEFAULT NULL,
|
||||
`ct` text,
|
||||
PRIMARY KEY (`c1`),
|
||||
KEY `c2` (`c3`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
RENAME TABLE t2 TO t1;
|
||||
SELECT st.NAME, i.NAME
|
||||
FROM sys_tables st INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_TABLES i
|
||||
ON i.TABLE_ID=st.TABLE_ID;
|
||||
NAME NAME
|
||||
test/t1 test/t1
|
||||
SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
NAME POS MTYPE PRTYPE LEN
|
||||
c1 0 6 1283 4
|
||||
c3 1 6 1027 4
|
||||
ct 2 5 524540 10
|
||||
SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i
|
||||
INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID;
|
||||
NAME POS NAME
|
||||
PRIMARY 0 c1
|
||||
c2 0 c3
|
||||
SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i
|
||||
INNER JOIN sys_foreign sf ON i.ID = sf.ID;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/t1c2 c2 c3 0
|
||||
test/t1c3 c3 c2 0
|
||||
ALTER TABLE t1 DROP INDEX c2;
|
||||
ERROR HY000: Cannot drop index 'c2': needed in a foreign key constraint
|
||||
ALTER TABLE t1 DROP INDEX c4;
|
||||
ERROR 42000: Can't DROP 'c4'; check that column/key exists
|
||||
ALTER TABLE t1c DROP FOREIGN KEY c2;
|
||||
ERROR 42000: Can't DROP 'c2'; check that column/key exists
|
||||
ALTER TABLE t1c DROP FOREIGN KEY t1c2, DROP FOREIGN KEY c2;
|
||||
ERROR 42000: Can't DROP 'c2'; check that column/key exists
|
||||
ALTER TABLE t1c DROP FOREIGN KEY t1c2, DROP FOREIGN KEY c2, DROP INDEX c2;
|
||||
ERROR 42000: Can't DROP 'c2'; check that column/key exists
|
||||
ALTER TABLE t1c DROP INDEX c2;
|
||||
ERROR HY000: Cannot drop index 'c2': needed in a foreign key constraint
|
||||
ALTER TABLE t1c DROP FOREIGN KEY ẗ1C2;
|
||||
ERROR 42000: Can't DROP 'ẗ1C2'; check that column/key exists
|
||||
SHOW CREATE TABLE t1c;
|
||||
Table Create Table
|
||||
t1c CREATE TABLE `t1c` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c2` int(11) DEFAULT NULL,
|
||||
`c3` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`c1`),
|
||||
KEY `c2` (`c2`),
|
||||
KEY `c3` (`c3`),
|
||||
CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t1` (`c3`),
|
||||
CONSTRAINT `t1c3` FOREIGN KEY (`c3`) REFERENCES `t1p` (`c2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
SET foreign_key_checks=0;
|
||||
DROP TABLE t1p;
|
||||
SET foreign_key_checks=1;
|
||||
SHOW CREATE TABLE t1c;
|
||||
Table Create Table
|
||||
t1c CREATE TABLE `t1c` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c2` int(11) DEFAULT NULL,
|
||||
`c3` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`c1`),
|
||||
KEY `c2` (`c2`),
|
||||
KEY `c3` (`c3`),
|
||||
CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t1` (`c3`),
|
||||
CONSTRAINT `t1c3` FOREIGN KEY (`c3`) REFERENCES `t1p` (`c2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
NAME POS MTYPE PRTYPE LEN
|
||||
c1 0 6 1283 4
|
||||
c3 1 6 1027 4
|
||||
ct 2 5 524540 10
|
||||
SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i
|
||||
INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID;
|
||||
NAME POS NAME
|
||||
PRIMARY 0 c1
|
||||
c2 0 c3
|
||||
SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i
|
||||
INNER JOIN sys_foreign sf ON i.ID = sf.ID;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/t1c2 c2 c3 0
|
||||
test/t1c3 c3 c2 0
|
||||
CREATE TABLE t1p (c1 INT PRIMARY KEY, c2 INT, INDEX(c2)) ENGINE=InnoDB;
|
||||
ALTER TABLE t1c DROP INDEX C2, DROP INDEX C3;
|
||||
ERROR HY000: Cannot drop index 'c2': needed in a foreign key constraint
|
||||
ALTER TABLE t1c DROP INDEX C3;
|
||||
ERROR HY000: Cannot drop index 'c3': needed in a foreign key constraint
|
||||
SET foreign_key_checks=0;
|
||||
ALTER TABLE t1c DROP INDEX C3;
|
||||
SET foreign_key_checks=1;
|
||||
SHOW CREATE TABLE t1c;
|
||||
Table Create Table
|
||||
t1c CREATE TABLE `t1c` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c2` int(11) DEFAULT NULL,
|
||||
`c3` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`c1`),
|
||||
KEY `c2` (`c2`),
|
||||
CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t1` (`c3`),
|
||||
CONSTRAINT `t1c3` FOREIGN KEY (`c3`) REFERENCES `t1p` (`c2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
NAME POS MTYPE PRTYPE LEN
|
||||
c1 0 6 1283 4
|
||||
c3 1 6 1027 4
|
||||
ct 2 5 524540 10
|
||||
SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i
|
||||
INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID;
|
||||
NAME POS NAME
|
||||
PRIMARY 0 c1
|
||||
c2 0 c3
|
||||
SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i
|
||||
INNER JOIN sys_foreign sf ON i.ID = sf.ID;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/t1c2 c2 c3 0
|
||||
test/t1c3 c3 c2 0
|
||||
ALTER TABLE t1c DROP FOREIGN KEY t1C3;
|
||||
SHOW CREATE TABLE t1c;
|
||||
Table Create Table
|
||||
t1c CREATE TABLE `t1c` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c2` int(11) DEFAULT NULL,
|
||||
`c3` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`c1`),
|
||||
KEY `c2` (`c2`),
|
||||
CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t1` (`c3`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
NAME POS MTYPE PRTYPE LEN
|
||||
c1 0 6 1283 4
|
||||
c3 1 6 1027 4
|
||||
ct 2 5 524540 10
|
||||
SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i
|
||||
INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID;
|
||||
NAME POS NAME
|
||||
PRIMARY 0 c1
|
||||
c2 0 c3
|
||||
SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i
|
||||
INNER JOIN sys_foreign sf ON i.ID = sf.ID;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/t1c2 c2 c3 0
|
||||
ALTER TABLE t1c DROP INDEX c2, DROP FOREIGN KEY t1C2;
|
||||
SHOW CREATE TABLE t1c;
|
||||
Table Create Table
|
||||
t1c CREATE TABLE `t1c` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c2` int(11) DEFAULT NULL,
|
||||
`c3` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
NAME POS MTYPE PRTYPE LEN
|
||||
c1 0 6 1283 4
|
||||
c3 1 6 1027 4
|
||||
ct 2 5 524540 10
|
||||
SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i
|
||||
INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID;
|
||||
NAME POS NAME
|
||||
PRIMARY 0 c1
|
||||
c2 0 c3
|
||||
SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i
|
||||
INNER JOIN sys_foreign sf ON i.ID = sf.ID;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
ALTER TABLE t1 DROP INDEX c2, CHANGE c3 c2 INT;
|
||||
SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
NAME POS MTYPE PRTYPE LEN
|
||||
c1 0 6 1283 4
|
||||
c2 1 6 1027 4
|
||||
ct 2 5 524540 10
|
||||
SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i
|
||||
INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID;
|
||||
NAME POS NAME
|
||||
PRIMARY 0 c1
|
||||
SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i
|
||||
INNER JOIN sys_foreign sf ON i.ID = sf.ID;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
CREATE TABLE t1o LIKE t1;
|
||||
ALTER TABLE t1 ADD FULLTEXT INDEX (ct),
|
||||
CHANGE c1 pk INT, ALTER c2 SET DEFAULT 42, RENAME TO tt,
|
||||
ALGORITHM=INPLACE, LOCK=NONE;
|
||||
ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED.
|
||||
ALTER TABLE t1 ADD FULLTEXT INDEX (ct),
|
||||
CHANGE c1 pk INT, ALTER c2 SET DEFAULT 42, RENAME TO tt,
|
||||
ALGORITHM=INPLACE, LOCK=SHARED;
|
||||
Warnings:
|
||||
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
|
||||
SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
NAME POS MTYPE PRTYPE LEN
|
||||
SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i
|
||||
INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID;
|
||||
NAME POS NAME
|
||||
SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i
|
||||
INNER JOIN sys_foreign sf ON i.ID = sf.ID;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
SHOW CREATE TABLE tt;
|
||||
Table Create Table
|
||||
tt CREATE TABLE `tt` (
|
||||
`pk` int(11) NOT NULL DEFAULT '0',
|
||||
`c2` int(11) DEFAULT '42',
|
||||
`ct` text,
|
||||
PRIMARY KEY (`pk`),
|
||||
FULLTEXT KEY `ct` (`ct`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
ALTER TABLE t1o CHANGE c1 dB_row_Id INT, ALGORITHM=COPY;
|
||||
ERROR 42000: Incorrect column name 'dB_row_Id'
|
||||
ALTER TABLE t1o CHANGE c1 dB_row_Id INT, ALGORITHM=INPLACE;
|
||||
ERROR 42000: Incorrect column name 'DB_ROW_ID'
|
||||
ALTER TABLE t1o CHANGE c1 DB_TRX_ID INT;
|
||||
ERROR 42000: Incorrect column name 'DB_TRX_ID'
|
||||
ALTER TABLE t1o CHANGE c1 db_roll_ptr INT;
|
||||
ERROR 42000: Incorrect column name 'DB_ROLL_PTR'
|
||||
ALTER TABLE t1o ADD COLUMN DB_TRX_ID INT;
|
||||
ERROR 42000: Incorrect column name 'DB_TRX_ID'
|
||||
ALTER TABLE t1o ADD COLUMN db_roll_ptr INT;
|
||||
ERROR 42000: Incorrect column name 'db_roll_ptr'
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ADD COLUMN FTS_DOC_ID BIGINT;
|
||||
ERROR HY000: Column 'FTS_DOC_ID' is of wrong type for an InnoDB FULLTEXT index
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED;
|
||||
ERROR HY000: Column 'FTS_DOC_ID' is of wrong type for an InnoDB FULLTEXT index
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct),
|
||||
ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED NOT NULL;
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ADD COLUMN FTS_DOC_ID INT;
|
||||
ERROR 42S21: Duplicate column name 'FTS_DOC_ID'
|
||||
ALTER TABLE t1o DROP COLUMN FTS_DOC_ID, ALGORITHM=INPLACE;
|
||||
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot drop or rename FTS_DOC_ID. Try ALGORITHM=COPY.
|
||||
ALTER TABLE t1o DROP COLUMN FTS_DOC_ID, DROP INDEX ct, ALGORITHM=INPLACE;
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ADD COLUMN cu TEXT;
|
||||
Warnings:
|
||||
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(cu), ADD COLUMN FTS_DOC_ID BIGINT,
|
||||
ALGORITHM=INPLACE;
|
||||
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY.
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(cu), ADD COLUMN FTS_DOC_ID BIGINT;
|
||||
ERROR 42000: Incorrect column name 'FTS_DOC_ID'
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(cu), ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED,
|
||||
ALGORITHM=INPLACE;
|
||||
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY.
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(cu), ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED;
|
||||
ERROR 42000: Incorrect column name 'FTS_DOC_ID'
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(cu),
|
||||
ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE;
|
||||
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY.
|
||||
ALTER TABLE t1o ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
|
||||
ALGORITHM=INPLACE;
|
||||
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY.
|
||||
ALTER TABLE t1o ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED NOT NULL;
|
||||
ALTER TABLE t1o DROP COLUMN FTS_DOC_ID, ALGORITHM=INPLACE;
|
||||
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot drop or rename FTS_DOC_ID. Try ALGORITHM=COPY.
|
||||
ALTER TABLE t1o DROP COLUMN FTS_DOC_ID;
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct), CHANGE c1 FTS_DOC_ID INT,
|
||||
ALGORITHM=COPY;
|
||||
ERROR 42000: Incorrect column name 'FTS_DOC_ID'
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct), CHANGE c1 FTS_DOC_ID INT,
|
||||
ALGORITHM=INPLACE;
|
||||
ERROR 42000: Incorrect column name 'FTS_DOC_ID'
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct), CHANGE c1 FTS_Doc_ID INT,
|
||||
ALGORITHM=INPLACE;
|
||||
ERROR 42000: Incorrect column name 'FTS_DOC_ID'
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct),
|
||||
CHANGE c1 FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
|
||||
ALGORITHM=INPLACE;
|
||||
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot change column type INPLACE. Try ALGORITHM=COPY.
|
||||
CREATE TABLE t1n LIKE t1o;
|
||||
ALTER TABLE t1n ADD FULLTEXT INDEX(ct);
|
||||
ALTER TABLE t1n CHANGE c1 Fts_DOC_ID INT, ALGORITHM=INPLACE;
|
||||
ERROR 42000: Incorrect column name 'FTS_DOC_ID'
|
||||
ALTER TABLE t1n CHANGE c1 Fts_DOC_ID INT, ALGORITHM=COPY;
|
||||
ERROR 42000: Incorrect column name 'Fts_DOC_ID'
|
||||
ALTER TABLE t1n CHANGE FTS_DOC_ID c11 INT, ALGORITHM=INPLACE;
|
||||
ERROR 42S22: Unknown column 'FTS_DOC_ID' in 't1n'
|
||||
ALTER TABLE t1n CHANGE c1 FTS_DOC_ïD INT, ALGORITHM=INPLACE;
|
||||
ALTER TABLE t1n CHANGE FTS_DOC_ÏD c1 INT, ALGORITHM=INPLACE;
|
||||
ALTER TABLE t1n CHANGE c1 c2 INT, CHANGE c2 ct INT, CHANGE ct c1 TEXT,
|
||||
ALGORITHM=INPLACE;
|
||||
SHOW CREATE TABLE t1n;
|
||||
Table Create Table
|
||||
t1n CREATE TABLE `t1n` (
|
||||
`c2` int(11) NOT NULL DEFAULT '0',
|
||||
`ct` int(11) DEFAULT NULL,
|
||||
`c1` text,
|
||||
`cu` text,
|
||||
PRIMARY KEY (`c2`),
|
||||
FULLTEXT KEY `ct` (`c1`),
|
||||
FULLTEXT KEY `ct_2` (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
ALTER TABLE t1n CHANGE c2 c1 INT, CHANGE ct c2 INT, CHANGE c1 ct TEXT,
|
||||
ALGORITHM=COPY;
|
||||
SHOW CREATE TABLE t1n;
|
||||
Table Create Table
|
||||
t1n CREATE TABLE `t1n` (
|
||||
`c1` int(11) NOT NULL DEFAULT '0',
|
||||
`c2` int(11) DEFAULT NULL,
|
||||
`ct` text,
|
||||
`cu` text,
|
||||
PRIMARY KEY (`c1`),
|
||||
FULLTEXT KEY `ct` (`ct`),
|
||||
FULLTEXT KEY `ct_2` (`ct`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=INPLACE;
|
||||
ERROR 42000: Key column 'c2' doesn't exist in table
|
||||
ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=COPY;
|
||||
ERROR 42000: Key column 'c2' doesn't exist in table
|
||||
ALTER TABLE t1n ADD INDEX(c4), CHANGE c2 c4 INT, ALGORITHM=INPLACE;
|
||||
SHOW CREATE TABLE t1n;
|
||||
Table Create Table
|
||||
t1n CREATE TABLE `t1n` (
|
||||
`c1` int(11) NOT NULL DEFAULT '0',
|
||||
`c4` int(11) DEFAULT NULL,
|
||||
`ct` text,
|
||||
`cu` text,
|
||||
PRIMARY KEY (`c1`),
|
||||
KEY `c4` (`c4`),
|
||||
FULLTEXT KEY `ct` (`ct`),
|
||||
FULLTEXT KEY `ct_2` (`ct`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
ALTER TABLE t1n DROP INDEX c4;
|
||||
ALTER TABLE t1n CHANGE c4 c1 INT, ADD INDEX(c1), ALGORITHM=INPLACE;
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
ALTER TABLE t1n CHANGE c4 c11 INT, ADD INDEX(c11), ALGORITHM=INPLACE;
|
||||
SHOW CREATE TABLE t1n;
|
||||
Table Create Table
|
||||
t1n CREATE TABLE `t1n` (
|
||||
`c1` int(11) NOT NULL DEFAULT '0',
|
||||
`c11` int(11) DEFAULT NULL,
|
||||
`ct` text,
|
||||
`cu` text,
|
||||
PRIMARY KEY (`c1`),
|
||||
KEY `c11` (`c11`),
|
||||
FULLTEXT KEY `ct` (`ct`),
|
||||
FULLTEXT KEY `ct_2` (`ct`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1n;
|
||||
ALTER TABLE t1o MODIFY c1 BIGINT UNSIGNED NOT NULL, DROP INDEX ct,
|
||||
ALGORITHM=INPLACE;
|
||||
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot change column type INPLACE. Try ALGORITHM=COPY.
|
||||
ALTER TABLE t1o MODIFY c1 BIGINT UNSIGNED NOT NULL, DROP INDEX ct;
|
||||
ALTER TABLE t1o CHANGE c1 FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
|
||||
ALGORITHM=INPLACE;
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ALGORITHM=INPLACE;
|
||||
ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL,
|
||||
ALGORITHM=INPLACE;
|
||||
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot drop or rename FTS_DOC_ID. Try ALGORITHM=COPY.
|
||||
SELECT sc.pos FROM information_schema.innodb_sys_columns sc
|
||||
INNER JOIN information_schema.innodb_sys_tables st
|
||||
ON sc.TABLE_ID=st.TABLE_ID
|
||||
WHERE st.NAME='test/t1o' AND sc.NAME='FTS_DOC_ID';
|
||||
pos
|
||||
0
|
||||
SHOW CREATE TABLE t1o;
|
||||
Table Create Table
|
||||
t1o CREATE TABLE `t1o` (
|
||||
`FTS_DOC_ID` bigint(20) unsigned NOT NULL,
|
||||
`c2` int(11) DEFAULT NULL,
|
||||
`ct` text,
|
||||
`cu` text,
|
||||
PRIMARY KEY (`FTS_DOC_ID`),
|
||||
FULLTEXT KEY `ct` (`ct`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL,
|
||||
DROP INDEX ct, ALGORITHM=INPLACE;
|
||||
SHOW CREATE TABLE t1o;
|
||||
Table Create Table
|
||||
t1o CREATE TABLE `t1o` (
|
||||
`foo_id` bigint(20) unsigned NOT NULL,
|
||||
`c2` int(11) DEFAULT NULL,
|
||||
`ct` text,
|
||||
`cu` text,
|
||||
PRIMARY KEY (`foo_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1c, t1p, sys_tables, sys_indexes, sys_foreign;
|
||||
CREATE TABLE sys_tables SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
|
||||
WHERE NAME='test/t1o';
|
||||
CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
CREATE TABLE sys_foreign SELECT i.*
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN i WHERE FOR_NAME='test/t1o';
|
||||
SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
NAME POS MTYPE PRTYPE LEN
|
||||
foo_id 0 6 1800 8
|
||||
c2 1 6 1027 4
|
||||
ct 2 5 524540 10
|
||||
cu 3 5 524540 10
|
||||
SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i
|
||||
INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID;
|
||||
NAME POS NAME
|
||||
PRIMARY 0 foo_id
|
||||
SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i
|
||||
INNER JOIN sys_foreign sf ON i.ID = sf.ID;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
ALTER TABLE t1o ADD UNIQUE INDEX FTS_DOC_ID_INDEX(FTS_DOC_ID),
|
||||
ADD FULLTEXT INDEX(ct),
|
||||
CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL;
|
||||
ALTER TABLE t1o DROP INDEX ct, DROP INDEX FTS_DOC_ID_INDEX,
|
||||
CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL;
|
||||
ALTER TABLE t1o ADD UNIQUE INDEX FTS_DOC_ID_INDEX(foo_id);
|
||||
ALTER TABLE t1o CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
|
||||
ADD FULLTEXT INDEX(ct);
|
||||
ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL,
|
||||
ALGORITHM=INPLACE;
|
||||
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot drop or rename FTS_DOC_ID. Try ALGORITHM=COPY.
|
||||
DROP TABLE sys_indexes;
|
||||
CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
NAME POS MTYPE PRTYPE LEN
|
||||
FTS_DOC_ID 0 6 1800 8
|
||||
c2 1 6 1027 4
|
||||
ct 2 5 524540 10
|
||||
cu 3 5 524540 10
|
||||
SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i
|
||||
INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID;
|
||||
NAME POS NAME
|
||||
PRIMARY 0 FTS_DOC_ID
|
||||
FTS_DOC_ID_INDEX 0 FTS_DOC_ID
|
||||
ct 0 ct
|
||||
SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i
|
||||
INNER JOIN sys_foreign sf ON i.ID = sf.ID;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
DROP TABLE tt, t1o, sys_tables, sys_indexes, sys_foreign;
|
||||
CREATE TABLE t (t TEXT, FULLTEXT(t)) ENGINE=InnoDB;
|
||||
DROP INDEX t ON t;
|
||||
SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
|
||||
WHERE name LIKE '%FTS_%' ORDER BY 1, 2;
|
||||
prefix name
|
||||
FTS_0 test/FTS_AUX_BEING_DELETED
|
||||
FTS_0 test/FTS_AUX_BEING_DELETED_CACHE
|
||||
FTS_0 test/FTS_AUX_CONFIG
|
||||
FTS_0 test/FTS_AUX_DELETED
|
||||
FTS_0 test/FTS_AUX_DELETED_CACHE
|
||||
SELECT sc.pos, sc.NAME FROM information_schema.innodb_sys_columns sc
|
||||
INNER JOIN information_schema.innodb_sys_tables st
|
||||
ON sc.TABLE_ID=st.TABLE_ID
|
||||
WHERE st.NAME='test/t';
|
||||
pos NAME
|
||||
0 t
|
||||
1 FTS_DOC_ID
|
||||
ALTER TABLE t ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE;
|
||||
SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
|
||||
WHERE name LIKE '%FTS_%' ORDER BY 1, 2;
|
||||
prefix name
|
||||
ALTER TABLE t ADD FULLTEXT INDEX(t);
|
||||
Warnings:
|
||||
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
|
||||
SELECT sc.pos, sc.NAME FROM information_schema.innodb_sys_columns sc
|
||||
INNER JOIN information_schema.innodb_sys_tables st
|
||||
ON sc.TABLE_ID=st.TABLE_ID
|
||||
WHERE st.NAME='test/t';
|
||||
pos NAME
|
||||
0 t
|
||||
1 FTS_DOC_ID
|
||||
DROP TABLE t;
|
||||
#
|
||||
# Bug #19465984 INNODB DATA DICTIONARY IS NOT UPDATED WHILE
|
||||
# RENAMING THE COLUMN
|
||||
#
|
||||
CREATE TABLE t1(c1 INT NOT NULL, PRIMARY KEY(c1))ENGINE=INNODB;
|
||||
CREATE TABLE t2(c2 INT NOT NULL, FOREIGN KEY(c2) REFERENCES t1(c1))ENGINE=INNODB;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`c2` int(11) NOT NULL,
|
||||
KEY `c2` (`c2`),
|
||||
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t1` (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
ALTER TABLE t1 CHANGE COLUMN c1 C1 INT;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`C1` int(11) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`C1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`c2` int(11) NOT NULL,
|
||||
KEY `c2` (`c2`),
|
||||
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t1` (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`C1` int(11) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`C1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`c2` int(11) NOT NULL,
|
||||
KEY `c2` (`c2`),
|
||||
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t1` (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t2, t1;
|
||||
#
|
||||
# BUG 20029625 - HANDLE_FATAL_SIGNAL (SIG=11) IN
|
||||
# DICT_MEM_TABLE_COL_RENAME_LOW
|
||||
#
|
||||
CREATE TABLE parent(a INT, b INT, KEY(a, b)) ENGINE = InnoDB;
|
||||
CREATE TABLE t1(a1 INT, a2 INT) ENGINE = InnoDB;
|
||||
set foreign_key_checks=0;
|
||||
ALTER TABLE t1 ADD CONSTRAINT fk_a FOREIGN KEY(a1, a2) REFERENCES parent(a, b) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
ALTER TABLE t1 CHANGE a2 a3 INT,ADD CONSTRAINT fk_1 FOREIGN KEY(a1, a3) REFERENCES parent(a, b) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a1` int(11) DEFAULT NULL,
|
||||
`a3` int(11) DEFAULT NULL,
|
||||
KEY `fk_1` (`a1`,`a3`),
|
||||
CONSTRAINT `fk_1` FOREIGN KEY (`a1`, `a3`) REFERENCES `parent` (`a`, `b`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_a` FOREIGN KEY (`a1`, `a3`) REFERENCES `parent` (`a`, `b`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
ALTER TABLE t1 CHANGE a3 a4 INT;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a1` int(11) DEFAULT NULL,
|
||||
`a4` int(11) DEFAULT NULL,
|
||||
KEY `fk_1` (`a1`,`a4`),
|
||||
CONSTRAINT `fk_1` FOREIGN KEY (`a1`, `a4`) REFERENCES `parent` (`a`, `b`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_a` FOREIGN KEY (`a1`, `a4`) REFERENCES `parent` (`a`, `b`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
ALTER TABLE parent CHANGE b c INT;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a1` int(11) DEFAULT NULL,
|
||||
`a4` int(11) DEFAULT NULL,
|
||||
KEY `fk_1` (`a1`,`a4`),
|
||||
CONSTRAINT `fk_1` FOREIGN KEY (`a1`, `a4`) REFERENCES `parent` (`a`, `c`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_a` FOREIGN KEY (`a1`, `a4`) REFERENCES `parent` (`a`, `c`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
DROP TABLE t1, parent;
|
||||
#
|
||||
#BUG#21514135 SCHEMA MISMATCH ERROR WHEN IMPORTING TABLESPACE AFTER
|
||||
#DROPPING AN INDEX
|
||||
#
|
||||
CREATE DATABASE source_db;
|
||||
CREATE DATABASE dest_db;
|
||||
CREATE TABLE source_db.t1 (
|
||||
id int(11) NOT NULL,
|
||||
age int(11) DEFAULT NULL,
|
||||
name varchar(20),
|
||||
PRIMARY KEY (id),
|
||||
KEY index1 (age)
|
||||
) ENGINE=InnoDB;
|
||||
ALTER TABLE source_db.t1 DROP INDEX index1, ADD INDEX index2(name, age), algorithm=inplace;
|
||||
FLUSH TABLES source_db.t1 FOR EXPORT;
|
||||
UNLOCK TABLES;
|
||||
USE dest_db;
|
||||
CREATE TABLE `t1` (
|
||||
`id` int(11) NOT NULL,
|
||||
`age` int(11) DEFAULT NULL,
|
||||
`name` varchar(20) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `index2` (`name`,`age`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
ALTER TABLE dest_db.t1 DISCARD TABLESPACE;
|
||||
ALTER TABLE dest_db.t1 IMPORT TABLESPACE;
|
||||
CHECK TABLE dest_db.t1;
|
||||
Table Op Msg_type Msg_text
|
||||
dest_db.t1 check status OK
|
||||
SHOW CREATE TABLE dest_db.t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`id` int(11) NOT NULL,
|
||||
`age` int(11) DEFAULT NULL,
|
||||
`name` varchar(20) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `index2` (`name`,`age`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
SELECT * FROM dest_db.t1;
|
||||
id age name
|
||||
DROP TABLE dest_db.t1;
|
||||
ALTER TABLE source_db.t1 DROP INDEX index2, algorithm=inplace;
|
||||
FLUSH TABLES source_db.t1 FOR EXPORT;
|
||||
UNLOCK TABLES;
|
||||
USE dest_db;
|
||||
CREATE TABLE `t1` (
|
||||
`id` int(11) NOT NULL,
|
||||
`age` int(11) DEFAULT NULL,
|
||||
`name` varchar(20) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
ALTER TABLE dest_db.t1 DISCARD TABLESPACE;
|
||||
ALTER TABLE dest_db.t1 IMPORT TABLESPACE;
|
||||
CHECK TABLE dest_db.t1;
|
||||
Table Op Msg_type Msg_text
|
||||
dest_db.t1 check status OK
|
||||
SHOW CREATE TABLE dest_db.t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`id` int(11) NOT NULL,
|
||||
`age` int(11) DEFAULT NULL,
|
||||
`name` varchar(20) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
SELECT * FROM dest_db.t1;
|
||||
id age name
|
||||
DROP TABLE dest_db.t1;
|
||||
DROP TABLE source_db.t1;
|
||||
DROP DATABASE source_db;
|
||||
DROP DATABASE dest_db;
|
@ -40,6 +40,9 @@ crew_role_assigned CREATE TABLE `crew_role_assigned` (
|
||||
CONSTRAINT `fk_crewRoleAssigned_crewId` FOREIGN KEY (`crew_id`) REFERENCES `crew` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_crewRoleAssigned_pilotId` FOREIGN KEY (`crew_id`) REFERENCES `pilot` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='This is a comment about tables'
|
||||
SET GLOBAL innodb_buffer_pool_load_now = ON;
|
||||
SET GLOBAL innodb_buffer_pool_dump_now = ON;
|
||||
SET GLOBAL innodb_buffer_pool_load_abort = ON;
|
||||
ALTER TABLE `repro`.`crew_role_assigned` COMMENT = "This is a new comment about tables";
|
||||
SHOW CREATE TABLE `repro`.`crew_role_assigned`;
|
||||
Table Create Table
|
||||
|
69
mysql-test/suite/innodb/r/innodb-index-debug.result
Normal file
69
mysql-test/suite/innodb/r/innodb-index-debug.result
Normal file
@ -0,0 +1,69 @@
|
||||
set global innodb_file_per_table=on;
|
||||
set global innodb_file_format='Barracuda';
|
||||
CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1)) Engine=InnoDB;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c2` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5);
|
||||
SET @saved_debug_dbug = @@SESSION.debug_dbug;
|
||||
SET DEBUG_DBUG='+d,ib_build_indexes_too_many_concurrent_trxs, ib_rename_indexes_too_many_concurrent_trxs, ib_drop_index_too_many_concurrent_trxs';
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
||||
ERROR HY000: Too many active concurrent transactions
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c2` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE bug13861218 (c1 INT NOT NULL, c2 INT NOT NULL, INDEX(c2))
|
||||
ENGINE=InnoDB;
|
||||
INSERT INTO bug13861218 VALUES (8, 0), (4, 0), (0, 0);
|
||||
SET DEBUG_DBUG = '+d,ib_row_merge_buf_add_two';
|
||||
CREATE UNIQUE INDEX ui ON bug13861218(c1);
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
DROP TABLE bug13861218;
|
||||
CREATE TABLE bug13861218 (c1 INT NOT NULL, c2 INT UNIQUE) ENGINE=InnoDB;
|
||||
INSERT INTO bug13861218 VALUES (8, NULL), (4, NULL), (0, NULL);
|
||||
SET DEBUG_DBUG = '+d,ib_row_merge_buf_add_two';
|
||||
CREATE UNIQUE INDEX ui ON bug13861218(c1);
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
DROP TABLE bug13861218;
|
||||
set global innodb_file_per_table=1;
|
||||
set global innodb_file_format=Antelope;
|
||||
set global innodb_file_format_max=Antelope;
|
||||
#
|
||||
# Bug #21762319 ADDING INDEXES ON EMPTY TABLE IS SLOW
|
||||
# WITH LARGE INNODB_SORT_BUFFER_SIZE.
|
||||
call mtr.add_suppression("InnoDB: Cannot create temporary merge file");
|
||||
create table t480(a serial)engine=innodb;
|
||||
insert into t480
|
||||
values(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),
|
||||
(),(),(),(),(),(),(),();
|
||||
insert into t480 select 0 from t480;
|
||||
insert into t480 select 0 from t480;
|
||||
insert into t480 select 0 from t480;
|
||||
insert into t480 select 0 from t480;
|
||||
create table t1(f1 int auto_increment not null,
|
||||
f2 char(200) not null, f3 char(200) not null,
|
||||
f4 char(200) not null,primary key(f1))engine=innodb;
|
||||
insert into t1 select NULL,'aaa','bbb','ccc' from t480;
|
||||
insert into t1 select NULL,'aaaa','bbbb','cccc' from t480;
|
||||
insert into t1 select NULL,'aaaaa','bbbbb','ccccc' from t480;
|
||||
insert into t1 select NULL,'aaaaaa','bbbbbb','cccccc' from t480;
|
||||
insert into t1 select NULL,'aaaaaaa','bbbbbbb','ccccccc' from t480;
|
||||
insert into t1 select NULL,'aaaaaaaa','bbbbbbbb','cccccccc' from t480;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2880
|
||||
SET DEBUG_DBUG = '+d,innobase_tmpfile_creation_failure';
|
||||
alter table t1 force, algorithm=inplace;
|
||||
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
drop table t1, t480;
|
13
mysql-test/suite/innodb/r/innodb-index-online-delete.result
Normal file
13
mysql-test/suite/innodb/r/innodb-index-online-delete.result
Normal file
@ -0,0 +1,13 @@
|
||||
CREATE TABLE t (a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB;
|
||||
INSERT INTO t VALUES(1,2),(2,3);
|
||||
SET DEBUG_SYNC='alter_table_inplace_after_lock_downgrade SIGNAL do WAIT_FOR m';
|
||||
SET DEBUG_SYNC='innodb_after_inplace_alter_table SIGNAL scanned WAIT_FOR done';
|
||||
CREATE INDEX tb ON t(b);
|
||||
SET DEBUG_SYNC='now WAIT_FOR do';
|
||||
SET DEBUG_SYNC='row_update_for_mysql_error SIGNAL m WAIT_FOR scanned';
|
||||
UPDATE t SET a=2 WHERE a=1;
|
||||
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
|
||||
call mtr.add_suppression('InnoDB: record in index .*tb was not found on rollback, trying to insert');
|
||||
SET DEBUG_SYNC='now SIGNAL done';
|
||||
SET DEBUG_SYNC='RESET';
|
||||
DROP TABLE t;
|
604
mysql-test/suite/innodb/r/innodb-index-online-fk.result
Normal file
604
mysql-test/suite/innodb/r/innodb-index-online-fk.result
Normal file
@ -0,0 +1,604 @@
|
||||
CREATE TABLE parent (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB;
|
||||
INSERT INTO parent VALUES(1,2),(2,3);
|
||||
CREATE INDEX tb ON parent(b);
|
||||
INSERT INTO parent VALUES(10,20),(20,30);
|
||||
CREATE TABLE child (a1 INT PRIMARY KEY, a2 INT) ENGINE = InnoDB;
|
||||
CREATE INDEX tb ON child(a2);
|
||||
INSERT INTO child VALUES(10,20);
|
||||
ALTER TABLE child ADD FOREIGN KEY(a2) REFERENCES parent(b),
|
||||
ALGORITHM = INPLACE;
|
||||
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding foreign keys needs foreign_key_checks=OFF. Try ALGORITHM=COPY.
|
||||
SET foreign_key_checks = 0;
|
||||
ALTER TABLE child ADD CONSTRAINT fk_1 FOREIGN KEY (a2)
|
||||
REFERENCES parent(b) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN;
|
||||
ID FOR_NAME REF_NAME N_COLS TYPE
|
||||
test/fk_1 test/child test/parent 1 6
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/fk_1 a2 b 0
|
||||
ALTER TABLE child ADD CONSTRAINT fk_1 FOREIGN KEY (a2)
|
||||
REFERENCES parent(b) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
ERROR HY000: Duplicate foreign key constraint name 'test/fk_1'
|
||||
SET foreign_key_checks = 1;
|
||||
INSERT INTO child VALUES(1,2),(2,3);
|
||||
INSERT INTO child VALUES(4,4);
|
||||
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fk_1` FOREIGN KEY (`a2`) REFERENCES `parent` (`b`) ON DELETE SET NULL ON UPDATE CASCADE)
|
||||
SELECT * FROM parent;
|
||||
a b
|
||||
1 2
|
||||
2 3
|
||||
10 20
|
||||
20 30
|
||||
SET foreign_key_checks = 0;
|
||||
ALTER TABLE child ADD CONSTRAINT fk_20 FOREIGN KEY (a1, a2)
|
||||
REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk_20' in the referenced table 'parent'
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1822 Failed to add the foreign key constaint. Missing index for constraint 'fk_20' in the referenced table 'parent'
|
||||
SHOW ERRORS;
|
||||
Level Code Message
|
||||
Error 1822 Failed to add the foreign key constaint. Missing index for constraint 'fk_20' in the referenced table 'parent'
|
||||
CREATE INDEX idx1 on parent(a, b);
|
||||
ALTER TABLE child ADD CONSTRAINT fk_10 FOREIGN KEY (a1, a2)
|
||||
REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
ALTER TABLE child ADD CONSTRAINT fk_2 FOREIGN KEY (a1, a2)
|
||||
REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE, ADD INDEX idx1(a1,a2),
|
||||
ALGORITHM = INPLACE;
|
||||
ALTER TABLE child ADD CONSTRAINT fk_3 FOREIGN KEY (a1, a2)
|
||||
REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN;
|
||||
ID FOR_NAME REF_NAME N_COLS TYPE
|
||||
test/fk_1 test/child test/parent 1 6
|
||||
test/fk_10 test/child test/parent 2 5
|
||||
test/fk_2 test/child test/parent 2 5
|
||||
test/fk_3 test/child test/parent 2 5
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/fk_1 a2 b 0
|
||||
test/fk_10 a1 a 0
|
||||
test/fk_10 a2 b 1
|
||||
test/fk_2 a1 a 0
|
||||
test/fk_2 a2 b 1
|
||||
test/fk_3 a1 a 0
|
||||
test/fk_3 a2 b 1
|
||||
SET foreign_key_checks = 1;
|
||||
INSERT INTO child VALUES(5,4);
|
||||
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fk_1` FOREIGN KEY (`a2`) REFERENCES `parent` (`b`) ON DELETE SET NULL ON UPDATE CASCADE)
|
||||
SHOW CREATE TABLE child;
|
||||
Table Create Table
|
||||
child CREATE TABLE `child` (
|
||||
`a1` int(11) NOT NULL,
|
||||
`a2` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`a1`),
|
||||
KEY `tb` (`a2`),
|
||||
KEY `idx1` (`a1`,`a2`),
|
||||
CONSTRAINT `fk_1` FOREIGN KEY (`a2`) REFERENCES `parent` (`b`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_10` FOREIGN KEY (`a1`, `a2`) REFERENCES `parent` (`a`, `b`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_2` FOREIGN KEY (`a1`, `a2`) REFERENCES `parent` (`a`, `b`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_3` FOREIGN KEY (`a1`, `a2`) REFERENCES `parent` (`a`, `b`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DELETE FROM parent where a = 1;
|
||||
SELECT * FROM child;
|
||||
a1 a2
|
||||
1 NULL
|
||||
2 3
|
||||
10 20
|
||||
SET foreign_key_checks = 0;
|
||||
SET @saved_debug_dbug = @@SESSION.debug_dbug;
|
||||
SET DEBUG_DBUG = '+d,innodb_test_open_ref_fail';
|
||||
ALTER TABLE child ADD CONSTRAINT fk_4 FOREIGN KEY (a1, a2)
|
||||
REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN;
|
||||
ID FOR_NAME REF_NAME N_COLS TYPE
|
||||
test/fk_1 test/child test/parent 1 6
|
||||
test/fk_10 test/child test/parent 2 5
|
||||
test/fk_2 test/child test/parent 2 5
|
||||
test/fk_3 test/child test/parent 2 5
|
||||
test/fk_4 test/child test/parent 2 5
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/fk_1 a2 b 0
|
||||
test/fk_10 a1 a 0
|
||||
test/fk_10 a2 b 1
|
||||
test/fk_2 a1 a 0
|
||||
test/fk_2 a2 b 1
|
||||
test/fk_3 a1 a 0
|
||||
test/fk_3 a2 b 1
|
||||
test/fk_4 a1 a 0
|
||||
test/fk_4 a2 b 1
|
||||
SELECT t2.name, t1.name FROM information_schema.innodb_sys_columns t1, information_schema.innodb_sys_tables t2 WHERE t1.table_id = t2.table_id AND t2.name LIKE "%child" ORDER BY t1.name;
|
||||
name name
|
||||
test/child a1
|
||||
test/child a2
|
||||
SELECT NAME FROM information_schema.INNODB_SYS_TABLES;
|
||||
NAME
|
||||
SYS_DATAFILES
|
||||
SYS_FOREIGN
|
||||
SYS_FOREIGN_COLS
|
||||
SYS_TABLESPACES
|
||||
mysql/innodb_index_stats
|
||||
mysql/innodb_table_stats
|
||||
test/child
|
||||
test/parent
|
||||
INSERT INTO child VALUES(5,4);
|
||||
SET foreign_key_checks = 1;
|
||||
INSERT INTO child VALUES(6,5);
|
||||
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fk_1` FOREIGN KEY (`a2`) REFERENCES `parent` (`b`) ON DELETE SET NULL ON UPDATE CASCADE)
|
||||
SET foreign_key_checks = 0;
|
||||
CREATE TABLE `#parent` (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB;
|
||||
CREATE INDEX tb ON `#parent`(a, b);
|
||||
CREATE TABLE `#child` (a1 INT PRIMARY KEY, a2 INT) ENGINE = InnoDB;
|
||||
CREATE INDEX tb ON `#child`(a1, a2);
|
||||
SET DEBUG_DBUG = '+d,innodb_test_no_foreign_idx';
|
||||
ALTER TABLE `#child` ADD CONSTRAINT fk_40 FOREIGN KEY (a1, a2)
|
||||
REFERENCES `#parent`(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk_40' in the foreign table '#child'
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
SHOW ERRORS;
|
||||
Level Code Message
|
||||
Error 1821 Failed to add the foreign key constaint. Missing index for constraint 'fk_40' in the foreign table '#child'
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN;
|
||||
ID FOR_NAME REF_NAME N_COLS TYPE
|
||||
test/fk_1 test/child test/parent 1 6
|
||||
test/fk_10 test/child test/parent 2 5
|
||||
test/fk_2 test/child test/parent 2 5
|
||||
test/fk_3 test/child test/parent 2 5
|
||||
test/fk_4 test/child test/parent 2 5
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/fk_1 a2 b 0
|
||||
test/fk_10 a1 a 0
|
||||
test/fk_10 a2 b 1
|
||||
test/fk_2 a1 a 0
|
||||
test/fk_2 a2 b 1
|
||||
test/fk_3 a1 a 0
|
||||
test/fk_3 a2 b 1
|
||||
test/fk_4 a1 a 0
|
||||
test/fk_4 a2 b 1
|
||||
SET DEBUG_DBUG = '+d,innodb_test_no_reference_idx';
|
||||
ALTER TABLE child ADD CONSTRAINT fk_42 FOREIGN KEY (a1, a2)
|
||||
REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk_42' in the referenced table 'parent'
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
SHOW ERRORS;
|
||||
Level Code Message
|
||||
Error 1822 Failed to add the foreign key constaint. Missing index for constraint 'fk_42' in the referenced table 'parent'
|
||||
SET DEBUG_DBUG = '+d,innodb_test_wrong_fk_option';
|
||||
ALTER TABLE child ADD CONSTRAINT fk_42 FOREIGN KEY (a1, a2)
|
||||
REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
ERROR HY000: Failed to add the foreign key constraint on table 'child'. Incorrect options in FOREIGN KEY constraint 'test/fk_42'
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN;
|
||||
ID FOR_NAME REF_NAME N_COLS TYPE
|
||||
test/fk_1 test/child test/parent 1 6
|
||||
test/fk_10 test/child test/parent 2 5
|
||||
test/fk_2 test/child test/parent 2 5
|
||||
test/fk_3 test/child test/parent 2 5
|
||||
test/fk_4 test/child test/parent 2 5
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/fk_1 a2 b 0
|
||||
test/fk_10 a1 a 0
|
||||
test/fk_10 a2 b 1
|
||||
test/fk_2 a1 a 0
|
||||
test/fk_2 a2 b 1
|
||||
test/fk_3 a1 a 0
|
||||
test/fk_3 a2 b 1
|
||||
test/fk_4 a1 a 0
|
||||
test/fk_4 a2 b 1
|
||||
SET DEBUG_DBUG = '+d,innodb_test_cannot_add_fk_system';
|
||||
ALTER TABLE `#child` ADD CONSTRAINT fk_43 FOREIGN KEY (a1, a2)
|
||||
REFERENCES `#parent`(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
ERROR HY000: Failed to add the foreign key constraint 'test/fk_43' to system tables
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
SHOW ERRORS;
|
||||
Level Code Message
|
||||
Error 1823 Failed to add the foreign key constraint 'test/fk_43' to system tables
|
||||
DROP TABLE `#child`;
|
||||
DROP TABLE `#parent`;
|
||||
SET foreign_key_checks = 0;
|
||||
ALTER TABLE child ADD CONSTRAINT fk_5 FOREIGN KEY (a2) REFERENCES parent(b)
|
||||
ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT fk_6 FOREIGN KEY (a1, a2)
|
||||
REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN;
|
||||
ID FOR_NAME REF_NAME N_COLS TYPE
|
||||
test/fk_1 test/child test/parent 1 6
|
||||
test/fk_10 test/child test/parent 2 5
|
||||
test/fk_2 test/child test/parent 2 5
|
||||
test/fk_3 test/child test/parent 2 5
|
||||
test/fk_4 test/child test/parent 2 5
|
||||
test/fk_5 test/child test/parent 1 6
|
||||
test/fk_6 test/child test/parent 2 5
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/fk_1 a2 b 0
|
||||
test/fk_10 a1 a 0
|
||||
test/fk_10 a2 b 1
|
||||
test/fk_2 a1 a 0
|
||||
test/fk_2 a2 b 1
|
||||
test/fk_3 a1 a 0
|
||||
test/fk_3 a2 b 1
|
||||
test/fk_4 a1 a 0
|
||||
test/fk_4 a2 b 1
|
||||
test/fk_5 a2 b 0
|
||||
test/fk_6 a1 a 0
|
||||
test/fk_6 a2 b 1
|
||||
DROP TABLE child;
|
||||
DROP TABLE parent;
|
||||
CREATE TABLE parent (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB;
|
||||
INSERT INTO parent VALUES(1,2),(2,3);
|
||||
CREATE INDEX tb ON parent(b);
|
||||
INSERT INTO parent VALUES(10,20),(20,30);
|
||||
CREATE TABLE child (a1 INT PRIMARY KEY, a2 INT) ENGINE = InnoDB;
|
||||
CREATE INDEX tb ON child(a2);
|
||||
INSERT INTO child VALUES(10,20);
|
||||
SET foreign_key_checks = 0;
|
||||
ALTER TABLE child DROP INDEX tb, ADD CONSTRAINT fk_4 FOREIGN KEY (a2)
|
||||
REFERENCES parent(b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
SHOW CREATE TABLE child;
|
||||
Table Create Table
|
||||
child CREATE TABLE `child` (
|
||||
`a1` int(11) NOT NULL,
|
||||
`a2` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`a1`),
|
||||
KEY `fk_4` (`a2`),
|
||||
CONSTRAINT `fk_4` FOREIGN KEY (`a2`) REFERENCES `parent` (`b`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN;
|
||||
ID FOR_NAME REF_NAME N_COLS TYPE
|
||||
test/fk_4 test/child test/parent 1 5
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/fk_4 a2 b 0
|
||||
SET foreign_key_checks = 1;
|
||||
DROP TABLE child;
|
||||
DROP TABLE parent;
|
||||
CREATE TABLE parent (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB;
|
||||
INSERT INTO parent VALUES(1,2),(2,3);
|
||||
CREATE INDEX tb ON parent(b);
|
||||
INSERT INTO parent VALUES(10,20),(20,30);
|
||||
CREATE TABLE child (a1 INT PRIMARY KEY, a2 INT) ENGINE = InnoDB;
|
||||
CREATE INDEX tb ON child(a2);
|
||||
SET foreign_key_checks = 0;
|
||||
ALTER TABLE child CHANGE a2 a3 INT,
|
||||
ADD CONSTRAINT fk_1 FOREIGN KEY (a2) REFERENCES parent(b)
|
||||
ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
ERROR 42000: Key column 'a2' doesn't exist in table
|
||||
ALTER TABLE child CHANGE a2 a3 INT,
|
||||
ADD CONSTRAINT fk_1 FOREIGN KEY (a3) REFERENCES parent(b)
|
||||
ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
DROP TABLE child;
|
||||
DROP TABLE parent;
|
||||
CREATE TABLE parent (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB;
|
||||
INSERT INTO parent VALUES(1,2),(2,3);
|
||||
CREATE INDEX tb ON parent(b);
|
||||
INSERT INTO parent VALUES(10,20),(20,30);
|
||||
CREATE TABLE child (a1 INT NOT NULL, a2 INT) ENGINE = InnoDB;
|
||||
CREATE INDEX tb ON child(a2);
|
||||
SET foreign_key_checks = 0;
|
||||
SET DEBUG_DBUG = '+d,innodb_test_cannot_add_fk_system';
|
||||
ALTER TABLE child ADD PRIMARY KEY idx (a3), CHANGE a1 a3 INT,
|
||||
ADD CONSTRAINT fk_1 FOREIGN KEY (a2) REFERENCES parent(b)
|
||||
ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
ERROR HY000: Failed to add the foreign key constraint 'test/fk_1' to system tables
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
|
||||
ID FOR_NAME REF_NAME N_COLS TYPE
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
SELECT t2.name, t1.name FROM information_schema.innodb_sys_columns t1, information_schema.innodb_sys_tables t2 WHERE t1.table_id = t2.table_id AND t2.name LIKE "%child" ORDER BY t1.name;
|
||||
name name
|
||||
test/child a1
|
||||
test/child a2
|
||||
SELECT NAME FROM information_schema.INNODB_SYS_TABLES;
|
||||
NAME
|
||||
SYS_DATAFILES
|
||||
SYS_FOREIGN
|
||||
SYS_FOREIGN_COLS
|
||||
SYS_TABLESPACES
|
||||
mysql/innodb_index_stats
|
||||
mysql/innodb_table_stats
|
||||
test/child
|
||||
test/parent
|
||||
ALTER TABLE child ADD PRIMARY KEY idx (a3), CHANGE a1 a3 INT,
|
||||
ADD CONSTRAINT fk_1 FOREIGN KEY (a2) REFERENCES parent(b)
|
||||
ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
|
||||
ID FOR_NAME REF_NAME N_COLS TYPE
|
||||
test/fk_1 test/child test/parent 1 6
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/fk_1 a2 b 0
|
||||
SELECT t2.name, t1.name FROM information_schema.innodb_sys_columns t1, information_schema.innodb_sys_tables t2 WHERE t1.table_id = t2.table_id AND t2.name LIKE "%child" ORDER BY t1.name;
|
||||
name name
|
||||
test/child a2
|
||||
test/child a3
|
||||
SELECT NAME FROM information_schema.INNODB_SYS_TABLES;
|
||||
NAME
|
||||
SYS_DATAFILES
|
||||
SYS_FOREIGN
|
||||
SYS_FOREIGN_COLS
|
||||
SYS_TABLESPACES
|
||||
mysql/innodb_index_stats
|
||||
mysql/innodb_table_stats
|
||||
test/child
|
||||
test/parent
|
||||
SHOW CREATE TABLE child;
|
||||
Table Create Table
|
||||
child CREATE TABLE `child` (
|
||||
`a3` int(11) NOT NULL DEFAULT '0',
|
||||
`a2` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`a3`),
|
||||
KEY `tb` (`a2`),
|
||||
CONSTRAINT `fk_1` FOREIGN KEY (`a2`) REFERENCES `parent` (`b`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE child;
|
||||
CREATE TABLE child (a1 INT NOT NULL, a2 INT) ENGINE = InnoDB;
|
||||
ALTER TABLE child ADD PRIMARY KEY idx (a1),
|
||||
ADD CONSTRAINT fk_1 FOREIGN KEY (a2) REFERENCES parent(b)
|
||||
ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN;
|
||||
ID FOR_NAME REF_NAME N_COLS TYPE
|
||||
test/fk_1 test/child test/parent 1 6
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/fk_1 a2 b 0
|
||||
SELECT t2.name, t1.name FROM information_schema.innodb_sys_columns t1, information_schema.innodb_sys_tables t2 WHERE t1.table_id = t2.table_id AND t2.name LIKE "%child" ORDER BY t1.name;
|
||||
name name
|
||||
test/child a1
|
||||
test/child a2
|
||||
SELECT NAME FROM information_schema.INNODB_SYS_TABLES;
|
||||
NAME
|
||||
SYS_DATAFILES
|
||||
SYS_FOREIGN
|
||||
SYS_FOREIGN_COLS
|
||||
SYS_TABLESPACES
|
||||
mysql/innodb_index_stats
|
||||
mysql/innodb_table_stats
|
||||
test/child
|
||||
test/parent
|
||||
SHOW CREATE TABLE child;
|
||||
Table Create Table
|
||||
child CREATE TABLE `child` (
|
||||
`a1` int(11) NOT NULL,
|
||||
`a2` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`a1`),
|
||||
KEY `fk_1` (`a2`),
|
||||
CONSTRAINT `fk_1` FOREIGN KEY (`a2`) REFERENCES `parent` (`b`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE child;
|
||||
CREATE TABLE child (a1 INT NOT NULL, a2 INT) ENGINE = InnoDB;
|
||||
ALTER TABLE child CHANGE a1 a3 INT,
|
||||
ADD CONSTRAINT fk_1 FOREIGN KEY (a3) REFERENCES parent(b)
|
||||
ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN;
|
||||
ID FOR_NAME REF_NAME N_COLS TYPE
|
||||
test/fk_1 test/child test/parent 1 6
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/fk_1 a3 b 0
|
||||
SELECT t2.name, t1.name FROM information_schema.innodb_sys_columns t1, information_schema.innodb_sys_tables t2 WHERE t1.table_id = t2.table_id AND t2.name LIKE "%child" ORDER BY t1.name;
|
||||
name name
|
||||
test/child a2
|
||||
test/child a3
|
||||
SELECT NAME FROM information_schema.INNODB_SYS_TABLES;
|
||||
NAME
|
||||
SYS_DATAFILES
|
||||
SYS_FOREIGN
|
||||
SYS_FOREIGN_COLS
|
||||
SYS_TABLESPACES
|
||||
mysql/innodb_index_stats
|
||||
mysql/innodb_table_stats
|
||||
test/child
|
||||
test/parent
|
||||
SHOW CREATE TABLE child;
|
||||
Table Create Table
|
||||
child CREATE TABLE `child` (
|
||||
`a3` int(11) DEFAULT NULL,
|
||||
`a2` int(11) DEFAULT NULL,
|
||||
KEY `fk_1` (`a3`),
|
||||
CONSTRAINT `fk_1` FOREIGN KEY (`a3`) REFERENCES `parent` (`b`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE child;
|
||||
CREATE TABLE child (a1 INT NOT NULL, a2 INT) ENGINE = InnoDB;
|
||||
ALTER TABLE child ADD PRIMARY KEY idx (a3), CHANGE a1 a3 INT,
|
||||
ADD CONSTRAINT fk_1 FOREIGN KEY (a3) REFERENCES parent(b)
|
||||
ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
ERROR HY000: Failed to add the foreign key constraint on table 'child'. Incorrect options in FOREIGN KEY constraint 'test/fk_1'
|
||||
DROP TABLE parent;
|
||||
DROP TABLE child;
|
||||
CREATE TABLE parent (a INT PRIMARY KEY, b INT NOT NULL, c INT) ENGINE = InnoDB;
|
||||
INSERT INTO parent VALUES(1,2,3),(2,3,4);
|
||||
CREATE INDEX tb ON parent(b);
|
||||
CREATE TABLE child (a1 INT NOT NULL, a2 INT, a3 INT) ENGINE = InnoDB;
|
||||
CREATE INDEX tb ON child(a2);
|
||||
ALTER TABLE child
|
||||
ADD CONSTRAINT fk_a FOREIGN KEY (a2) REFERENCES parent(b)
|
||||
ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
ALTER TABLE child
|
||||
ADD CONSTRAINT fk_b FOREIGN KEY (a1) REFERENCES parent(a),
|
||||
ALGORITHM = INPLACE;
|
||||
ALTER TABLE child CHANGE a2 a2_new INT, CHANGE a1 a1_new INT;
|
||||
SHOW CREATE TABLE child;
|
||||
Table Create Table
|
||||
child CREATE TABLE `child` (
|
||||
`a1_new` int(11) DEFAULT NULL,
|
||||
`a2_new` int(11) DEFAULT NULL,
|
||||
`a3` int(11) DEFAULT NULL,
|
||||
KEY `tb` (`a2_new`),
|
||||
KEY `fk_b` (`a1_new`),
|
||||
CONSTRAINT `fk_a` FOREIGN KEY (`a2_new`) REFERENCES `parent` (`b`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_b` FOREIGN KEY (`a1_new`) REFERENCES `parent` (`a`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN;
|
||||
ID FOR_NAME REF_NAME N_COLS TYPE
|
||||
test/fk_a test/child test/parent 1 6
|
||||
test/fk_b test/child test/parent 1 0
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/fk_a a2_new b 0
|
||||
test/fk_b a1_new a 0
|
||||
ALTER TABLE child
|
||||
ADD CONSTRAINT fk_new_1 FOREIGN KEY (a1_new) REFERENCES parent(b),
|
||||
ADD CONSTRAINT fk_new_2 FOREIGN KEY (a2_new) REFERENCES parent(a),
|
||||
ADD CONSTRAINT fk_new_3 FOREIGN KEY (a3) REFERENCES parent(c),
|
||||
ALGORITHM = INPLACE;
|
||||
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk_new_3' in the referenced table 'parent'
|
||||
SHOW CREATE TABLE child;
|
||||
Table Create Table
|
||||
child CREATE TABLE `child` (
|
||||
`a1_new` int(11) DEFAULT NULL,
|
||||
`a2_new` int(11) DEFAULT NULL,
|
||||
`a3` int(11) DEFAULT NULL,
|
||||
KEY `tb` (`a2_new`),
|
||||
KEY `fk_b` (`a1_new`),
|
||||
CONSTRAINT `fk_a` FOREIGN KEY (`a2_new`) REFERENCES `parent` (`b`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_b` FOREIGN KEY (`a1_new`) REFERENCES `parent` (`a`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN;
|
||||
ID FOR_NAME REF_NAME N_COLS TYPE
|
||||
test/fk_a test/child test/parent 1 6
|
||||
test/fk_b test/child test/parent 1 0
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/fk_a a2_new b 0
|
||||
test/fk_b a1_new a 0
|
||||
ALTER TABLE child
|
||||
ADD CONSTRAINT fk_new_1 FOREIGN KEY (a1_new) REFERENCES parent(b),
|
||||
ADD CONSTRAINT fk_new_2 FOREIGN KEY (a2_new) REFERENCES parent(a),
|
||||
ADD CONSTRAINT fk_new_3 FOREIGN KEY (a3) REFERENCES parent(a),
|
||||
ALGORITHM = INPLACE;
|
||||
SHOW CREATE TABLE child;
|
||||
Table Create Table
|
||||
child CREATE TABLE `child` (
|
||||
`a1_new` int(11) DEFAULT NULL,
|
||||
`a2_new` int(11) DEFAULT NULL,
|
||||
`a3` int(11) DEFAULT NULL,
|
||||
KEY `tb` (`a2_new`),
|
||||
KEY `fk_new_1` (`a1_new`),
|
||||
KEY `fk_new_3` (`a3`),
|
||||
CONSTRAINT `fk_a` FOREIGN KEY (`a2_new`) REFERENCES `parent` (`b`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_b` FOREIGN KEY (`a1_new`) REFERENCES `parent` (`a`),
|
||||
CONSTRAINT `fk_new_1` FOREIGN KEY (`a1_new`) REFERENCES `parent` (`b`),
|
||||
CONSTRAINT `fk_new_2` FOREIGN KEY (`a2_new`) REFERENCES `parent` (`a`),
|
||||
CONSTRAINT `fk_new_3` FOREIGN KEY (`a3`) REFERENCES `parent` (`a`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN;
|
||||
ID FOR_NAME REF_NAME N_COLS TYPE
|
||||
test/fk_a test/child test/parent 1 6
|
||||
test/fk_b test/child test/parent 1 0
|
||||
test/fk_new_1 test/child test/parent 1 0
|
||||
test/fk_new_2 test/child test/parent 1 0
|
||||
test/fk_new_3 test/child test/parent 1 0
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/fk_a a2_new b 0
|
||||
test/fk_b a1_new a 0
|
||||
test/fk_new_1 a1_new b 0
|
||||
test/fk_new_2 a2_new a 0
|
||||
test/fk_new_3 a3 a 0
|
||||
DROP TABLE child;
|
||||
CREATE TABLE child (a1 INT NOT NULL, a2 INT, a3 INT) ENGINE = InnoDB;
|
||||
CREATE INDEX tb ON child(a2);
|
||||
ALTER TABLE child ADD PRIMARY KEY idx (a1),
|
||||
ADD CONSTRAINT fk_new_1 FOREIGN KEY (a1) REFERENCES parent(b),
|
||||
ADD CONSTRAINT fk_new_2 FOREIGN KEY (a2) REFERENCES parent(a),
|
||||
ADD CONSTRAINT fk_new_3 FOREIGN KEY (a3) REFERENCES parent(c),
|
||||
ALGORITHM = INPLACE;
|
||||
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk_new_3' in the referenced table 'parent'
|
||||
SHOW CREATE TABLE child;
|
||||
Table Create Table
|
||||
child CREATE TABLE `child` (
|
||||
`a1` int(11) NOT NULL,
|
||||
`a2` int(11) DEFAULT NULL,
|
||||
`a3` int(11) DEFAULT NULL,
|
||||
KEY `tb` (`a2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN;
|
||||
ID FOR_NAME REF_NAME N_COLS TYPE
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
ALTER TABLE child ADD PRIMARY KEY idx (a1),
|
||||
ADD CONSTRAINT fk_new_1 FOREIGN KEY (a1) REFERENCES parent(b),
|
||||
ADD CONSTRAINT fk_new_2 FOREIGN KEY (a2) REFERENCES parent(a),
|
||||
ADD CONSTRAINT fk_new_3 FOREIGN KEY (a3) REFERENCES parent(a),
|
||||
ALGORITHM = INPLACE;
|
||||
SHOW CREATE TABLE child;
|
||||
Table Create Table
|
||||
child CREATE TABLE `child` (
|
||||
`a1` int(11) NOT NULL,
|
||||
`a2` int(11) DEFAULT NULL,
|
||||
`a3` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`a1`),
|
||||
KEY `tb` (`a2`),
|
||||
KEY `fk_new_3` (`a3`),
|
||||
CONSTRAINT `fk_new_1` FOREIGN KEY (`a1`) REFERENCES `parent` (`b`),
|
||||
CONSTRAINT `fk_new_2` FOREIGN KEY (`a2`) REFERENCES `parent` (`a`),
|
||||
CONSTRAINT `fk_new_3` FOREIGN KEY (`a3`) REFERENCES `parent` (`a`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN;
|
||||
ID FOR_NAME REF_NAME N_COLS TYPE
|
||||
test/fk_new_1 test/child test/parent 1 0
|
||||
test/fk_new_2 test/child test/parent 1 0
|
||||
test/fk_new_3 test/child test/parent 1 0
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/fk_new_1 a1 b 0
|
||||
test/fk_new_2 a2 a 0
|
||||
test/fk_new_3 a3 a 0
|
||||
SET foreign_key_checks = 1;
|
||||
DROP TABLE child;
|
||||
DROP TABLE parent;
|
||||
CREATE TABLE Parent (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB;
|
||||
INSERT INTO Parent VALUES(1,2),(2,3);
|
||||
CREATE INDEX tb ON Parent(b);
|
||||
INSERT INTO Parent VALUES(10,20),(20,30);
|
||||
CREATE TABLE Child (a1 INT PRIMARY KEY, a2 INT) ENGINE = InnoDB;
|
||||
CREATE INDEX tb ON Child(a2);
|
||||
INSERT INTO Child VALUES(10,20);
|
||||
SET foreign_key_checks = 0;
|
||||
ALTER TABLE Child ADD CONSTRAINT fk_1 FOREIGN KEY (a2)
|
||||
REFERENCES Parent(b) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
DROP TABLE Child;
|
||||
DROP TABLE Parent;
|
||||
CREATE TABLE `t2`(a int,c int,d int) ENGINE=INNODB;
|
||||
CREATE TABLE `t3`(a int,c int,d int) ENGINE=INNODB;
|
||||
CREATE INDEX idx ON t3(a);
|
||||
ALTER TABLE `t2` ADD CONSTRAINT `fw` FOREIGN KEY (`c`) REFERENCES t3 (a);
|
||||
ALTER TABLE `t2` ADD CONSTRAINT `e` foreign key (`d`) REFERENCES t3(a);
|
||||
ALTER TABLE `t3` ADD CONSTRAINT `e` foreign key (`c`) REFERENCES `t2`(`c`) ON UPDATE SET NULL;
|
||||
ERROR HY000: Failed to add the foreign key constraint 'test/e' to system tables
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
|
||||
ID FOR_NAME REF_NAME N_COLS TYPE
|
||||
test/e test/t2 test/t3 1 0
|
||||
test/fw test/t2 test/t3 1 0
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/e d a 0
|
||||
test/fw c a 0
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t3;
|
36
mysql-test/suite/innodb/r/innodb-index-online-purge.result
Normal file
36
mysql-test/suite/innodb/r/innodb-index-online-purge.result
Normal file
@ -0,0 +1,36 @@
|
||||
CREATE TABLE t (a INT PRIMARY KEY, c TEXT) ENGINE=InnoDB;
|
||||
CREATE TABLE u (a INT PRIMARY KEY, b INT, c INT NOT NULL) ENGINE=InnoDB;
|
||||
INSERT INTO t VALUES (1,'aa');
|
||||
BEGIN;
|
||||
INSERT INTO u SET a=1, c=1;
|
||||
INSERT INTO u SELECT a+1,NULL,a+1 FROM u;
|
||||
INSERT INTO u SELECT a+2,NULL,a+2 FROM u;
|
||||
INSERT INTO u SELECT a+4,NULL,a+4 FROM u;
|
||||
INSERT INTO u SELECT a+8,NULL,a+8 FROM u;
|
||||
INSERT INTO u SELECT a+16,NULL,a+16 FROM u;
|
||||
INSERT INTO u SELECT a+32,NULL,a+32 FROM u;
|
||||
INSERT INTO u SELECT a+64,NULL,a+64 FROM u;
|
||||
INSERT INTO u SELECT a+128,NULL,a+64 FROM u;
|
||||
INSERT INTO u SELECT a+256,NULL,a+64 FROM u;
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
DELETE FROM u;
|
||||
SET DEBUG_SYNC='row_log_apply_before SIGNAL created_u WAIT_FOR dml_done_u';
|
||||
ALTER TABLE u ADD INDEX (c);
|
||||
COMMIT;
|
||||
SET DEBUG_SYNC='now WAIT_FOR created_u';
|
||||
SELECT state FROM information_schema.processlist
|
||||
WHERE info='ALTER TABLE u ADD INDEX (c)';
|
||||
state
|
||||
debug sync point: row_log_apply_before
|
||||
SET DEBUG_SYNC='row_log_apply_before SIGNAL created_t WAIT_FOR dml_done_t';
|
||||
CREATE INDEX c1 ON t (c(1));
|
||||
SET DEBUG_SYNC='now WAIT_FOR created_t';
|
||||
UPDATE t SET c='ab';
|
||||
SELECT SLEEP(10);
|
||||
SLEEP(10)
|
||||
0
|
||||
SET DEBUG_SYNC='now SIGNAL dml_done_u';
|
||||
SET DEBUG_SYNC='now SIGNAL dml_done_t';
|
||||
SET DEBUG_SYNC='RESET';
|
||||
DROP TABLE t,u;
|
344
mysql-test/suite/innodb/r/innodb-index-online.result
Normal file
344
mysql-test/suite/innodb/r/innodb-index-online.result
Normal file
@ -0,0 +1,344 @@
|
||||
call mtr.add_suppression("InnoDB: Warning: Small buffer pool size");
|
||||
SET @global_innodb_file_per_table_orig = @@global.innodb_file_per_table;
|
||||
SET GLOBAL innodb_file_per_table = on;
|
||||
CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, c3 TEXT)
|
||||
ENGINE=InnoDB STATS_PERSISTENT=0;
|
||||
INSERT INTO t1 VALUES (1,1,''), (2,2,''), (3,3,''), (4,4,''), (5,5,'');
|
||||
SET GLOBAL innodb_monitor_enable = module_ddl;
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 0
|
||||
ddl_pending_alter_table 0
|
||||
SET DEBUG_SYNC = 'RESET';
|
||||
SET DEBUG_SYNC = 'write_row_noreplace SIGNAL have_handle WAIT_FOR go_ahead';
|
||||
INSERT INTO t1 VALUES(1,2,3);
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR have_handle';
|
||||
SET lock_wait_timeout = 1;
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
SET DEBUG_SYNC = 'now SIGNAL go_ahead';
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 0
|
||||
ddl_pending_alter_table 0
|
||||
SET @saved_debug_dbug = @@SESSION.debug_dbug;
|
||||
SET DEBUG_DBUG = '+d,innodb_OOM_prepare_inplace_alter';
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
||||
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
SET DEBUG_DBUG = '+d,innodb_OOM_inplace_alter';
|
||||
CREATE UNIQUE INDEX c2 ON t1(c2);
|
||||
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
CREATE UNIQUE INDEX c2 ON t1(c2);
|
||||
DROP INDEX c2 ON t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c2` int(11) DEFAULT NULL,
|
||||
`c3` text,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(7,4,2);
|
||||
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL scanned WAIT_FOR rollback_done';
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
COMMIT;
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
||||
ERROR 23000: Duplicate entry '4' for key 'c2'
|
||||
DELETE FROM t1 WHERE c1 = 7;
|
||||
ALTER TABLE t1 ADD FOREIGN KEY(c2) REFERENCES t1(c2), ALGORITHM = INPLACE;
|
||||
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding foreign keys needs foreign_key_checks=OFF. Try ALGORITHM=COPY.
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(c2), LOCK = EXCLUSIVE, ALGORITHM = INPLACE;
|
||||
DROP INDEX c2 ON t1;
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR scanned';
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 1
|
||||
ddl_pending_alter_table 1
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(7,4,2);
|
||||
ROLLBACK;
|
||||
SET DEBUG_SYNC = 'now SIGNAL rollback_done';
|
||||
ERROR 23000: Duplicate entry '4' for key 'c2'
|
||||
SET DEBUG_SYNC = 'row_log_apply_after SIGNAL created WAIT_FOR dml_done';
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR created';
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 0
|
||||
ddl_pending_alter_table 1
|
||||
INSERT INTO t1 VALUES(6,3,1);
|
||||
SET DEBUG_SYNC = 'now SIGNAL dml_done';
|
||||
ERROR 23000: Duplicate entry for key 'c2'
|
||||
DELETE FROM t1 WHERE c1=6;
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 0
|
||||
ddl_pending_alter_table 0
|
||||
INSERT INTO t1 VALUES(6,3,1);
|
||||
ERROR 23000: Duplicate entry '3' for key 'c2'
|
||||
INSERT INTO t1 VALUES(7,4,2);
|
||||
ERROR 23000: Duplicate entry '4' for key 'c2'
|
||||
ALTER TABLE t1 STATS_PERSISTENT=1;
|
||||
ANALYZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status OK
|
||||
UPDATE mysql.innodb_index_stats SET stat_value = 5
|
||||
WHERE database_name = 'test' AND table_name= 't1' AND index_name = 'PRIMARY'
|
||||
AND stat_value = 6;
|
||||
SELECT * FROM mysql.innodb_index_stats WHERE table_name IN ('t1');
|
||||
database_name table_name index_name last_update stat_name stat_value sample_size stat_description
|
||||
test t1 PRIMARY LAST_UPDATE n_diff_pfx01 5 1 c1
|
||||
test t1 PRIMARY LAST_UPDATE n_leaf_pages 1 NULL Number of leaf pages in the index
|
||||
test t1 PRIMARY LAST_UPDATE size 1 NULL Number of pages in the index
|
||||
test t1 c2 LAST_UPDATE n_diff_pfx01 5 1 c2
|
||||
test t1 c2 LAST_UPDATE n_leaf_pages 1 NULL Number of leaf pages in the index
|
||||
test t1 c2 LAST_UPDATE size 1 NULL Number of pages in the index
|
||||
CREATE TABLE t1_c2_stats SELECT * FROM mysql.innodb_index_stats
|
||||
WHERE database_name = 'test' AND table_name = 't1' and index_name = 'c2';
|
||||
ALTER TABLE t1_c2_stats ENGINE=INNODB;
|
||||
DROP INDEX c2 ON t1;
|
||||
ANALYZE TABLE t1_c2_stats;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1_c2_stats analyze status OK
|
||||
SELECT * FROM mysql.innodb_index_stats WHERE table_name IN ('t1', 't1_c2_stats');
|
||||
database_name table_name index_name last_update stat_name stat_value sample_size stat_description
|
||||
test t1 PRIMARY LAST_UPDATE n_diff_pfx01 5 1 c1
|
||||
test t1 PRIMARY LAST_UPDATE n_leaf_pages 1 NULL Number of leaf pages in the index
|
||||
test t1 PRIMARY LAST_UPDATE size 1 NULL Number of pages in the index
|
||||
KILL QUERY @id;
|
||||
ERROR 70100: Query execution was interrupted
|
||||
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2d_created WAIT_FOR kill_done';
|
||||
CREATE INDEX c2d ON t1(c2);
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR c2d_created';
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 1
|
||||
ddl_pending_alter_table 1
|
||||
KILL QUERY @id;
|
||||
SET DEBUG_SYNC = 'now SIGNAL kill_done';
|
||||
ERROR 70100: Query execution was interrupted
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 0
|
||||
ddl_pending_alter_table 0
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
INSERT INTO t1 SELECT 5 + c1, c2, c3 FROM t1;
|
||||
INSERT INTO t1 SELECT 10 + c1, c2, c3 FROM t1;
|
||||
INSERT INTO t1 SELECT 20 + c1, c2, c3 FROM t1;
|
||||
INSERT INTO t1 SELECT 40 + c1, c2, c3 FROM t1;
|
||||
EXPLAIN SELECT COUNT(*) FROM t1 WHERE c2 > 3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 80 Using where
|
||||
ANALYZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status OK
|
||||
UPDATE t1_c2_stats SET index_name = 'c2d';
|
||||
UPDATE t1_c2_stats SET stat_value = 2 WHERE stat_name = 'n_diff_pfx01';
|
||||
INSERT INTO t1_c2_stats
|
||||
SELECT database_name, table_name, index_name, last_update, 'n_diff_pfx02', 80,
|
||||
sample_size, 'c2,c1' FROM t1_c2_stats
|
||||
WHERE stat_name = 'n_diff_pfx01' AND stat_description = 'c2';
|
||||
INSERT INTO mysql.innodb_index_stats SELECT * FROM t1_c2_stats;
|
||||
DROP TABLE t1_c2_stats;
|
||||
CREATE INDEX c2d ON t1(c2);
|
||||
SHOW INDEX FROM t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||
t1 0 PRIMARY 1 c1 A 80 NULL NULL BTREE
|
||||
t1 1 c2d 1 c2 A 10 NULL NULL YES BTREE
|
||||
EXPLAIN SELECT COUNT(*) FROM t1 WHERE c2 > 3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range c2d c2d 5 NULL 32 Using where; Using index
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c2` int(11) DEFAULT NULL,
|
||||
`c3` text,
|
||||
PRIMARY KEY (`c1`),
|
||||
KEY `c2d` (`c2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=1
|
||||
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2e_created WAIT_FOR dml2_done';
|
||||
SET lock_wait_timeout = 10;
|
||||
ALTER TABLE t1 DROP INDEX c2d, ADD INDEX c2e(c2),
|
||||
ALGORITHM = INPLACE;
|
||||
INSERT INTO t1 SELECT 80 + c1, c2, c3 FROM t1;
|
||||
INSERT INTO t1 SELECT 160 + c1, c2, c3 FROM t1;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR c2e_created';
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 1
|
||||
ddl_pending_alter_table 1
|
||||
BEGIN;
|
||||
DELETE FROM t1;
|
||||
ROLLBACK;
|
||||
UPDATE t1 SET c2 = c2 + 1;
|
||||
BEGIN;
|
||||
UPDATE t1 SET c2 = c2 + 1;
|
||||
DELETE FROM t1;
|
||||
ROLLBACK;
|
||||
BEGIN;
|
||||
DELETE FROM t1;
|
||||
ROLLBACK;
|
||||
UPDATE t1 SET c2 = c2 + 1;
|
||||
BEGIN;
|
||||
UPDATE t1 SET c2 = c2 + 1;
|
||||
DELETE FROM t1;
|
||||
ROLLBACK;
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 1
|
||||
ddl_pending_alter_table 1
|
||||
SELECT sf.name, sf.pos FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES si
|
||||
INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_FIELDS sf
|
||||
ON si.index_id = sf.index_id WHERE si.name = '?c2e';
|
||||
name pos
|
||||
c2 0
|
||||
SET DEBUG_SYNC = 'now SIGNAL dml2_done';
|
||||
ERROR HY000: Creating index 'c2e' required more than 'innodb_online_alter_log_max_size' bytes of modification log. Please try again.
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 1
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 0
|
||||
ddl_pending_alter_table 0
|
||||
SELECT sf.name, sf.pos FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES si
|
||||
INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_FIELDS sf
|
||||
ON si.index_id = sf.index_id WHERE si.name = 'c2e';
|
||||
name pos
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 1
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 0
|
||||
ddl_pending_alter_table 0
|
||||
ALTER TABLE t1 COMMENT 'testing if c2e will be dropped';
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 0
|
||||
ddl_pending_alter_table 0
|
||||
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2f_created WAIT_FOR dml3_done';
|
||||
ALTER TABLE t1 ADD INDEX c2f(c2);
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR c2f_created';
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 1
|
||||
ddl_pending_alter_table 1
|
||||
BEGIN;
|
||||
INSERT INTO t1 SELECT 320 + c1, c2, c3 FROM t1 WHERE c1 > 160;
|
||||
DELETE FROM t1 WHERE c1 > 320;
|
||||
ROLLBACK;
|
||||
BEGIN;
|
||||
UPDATE t1 SET c2 = c2 + 1;
|
||||
DELETE FROM t1;
|
||||
ROLLBACK;
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 1
|
||||
ddl_pending_alter_table 1
|
||||
SET DEBUG_SYNC = 'now SIGNAL dml3_done';
|
||||
Warnings:
|
||||
Note 1831 Duplicate index `c2f`. This is deprecated and will be disallowed in a future release.
|
||||
ALTER TABLE t1 CHANGE c2 c22f INT;
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 0
|
||||
ddl_pending_alter_table 0
|
||||
SELECT COUNT(c22f) FROM t1;
|
||||
COUNT(c22f)
|
||||
320
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX c3p5(c3(5));
|
||||
ERROR 23000: Duplicate entry 'NULL' for key 'c3p5'
|
||||
UPDATE t1 SET c3 = NULL WHERE c3 = '';
|
||||
SET lock_wait_timeout = 1;
|
||||
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c3p5_created WAIT_FOR ins_done';
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX c3p5(c3(5));
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR c3p5_created';
|
||||
SELECT sf.name, sf.pos FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES si
|
||||
INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_FIELDS sf
|
||||
ON si.index_id = sf.index_id WHERE si.name = '?c3p5';
|
||||
name pos
|
||||
c3 0
|
||||
SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL ins_done WAIT_FOR ddl_timed_out';
|
||||
INSERT INTO t1 VALUES(347,33101,NULL);
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
SET DEBUG_SYNC = 'now SIGNAL ddl_timed_out';
|
||||
SELECT sf.name, sf.pos FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES si
|
||||
INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_FIELDS sf
|
||||
ON si.index_id = sf.index_id WHERE si.name = 'c3p5';
|
||||
name pos
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 1
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 0
|
||||
ddl_pending_alter_table 0
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 1
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 0
|
||||
ddl_pending_alter_table 0
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c22f` int(11) DEFAULT NULL,
|
||||
`c3` text,
|
||||
PRIMARY KEY (`c1`),
|
||||
KEY `c2d` (`c22f`),
|
||||
KEY `c2f` (`c22f`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=1 COMMENT='testing if c2e will be dropped'
|
||||
ALTER TABLE t1 DROP INDEX c2d, DROP INDEX c2f;
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 0
|
||||
ddl_pending_alter_table 0
|
||||
ALTER TABLE t1 ADD INDEX c2h(c22f), ALGORITHM = INPLACE;
|
||||
ALTER TABLE t1 ADD INDEX c2h(c22f), ALGORITHM = COPY;
|
||||
ERROR 42000: Duplicate key name 'c2h'
|
||||
SET DEBUG_SYNC = 'RESET';
|
||||
SET GLOBAL innodb_monitor_disable = module_ddl;
|
||||
DROP TABLE t1;
|
||||
SET GLOBAL innodb_file_per_table = @global_innodb_file_per_table_orig;
|
||||
SET GLOBAL innodb_monitor_enable = default;
|
||||
SET GLOBAL innodb_monitor_disable = default;
|
379
mysql-test/suite/innodb/r/innodb-table-online.result
Normal file
379
mysql-test/suite/innodb/r/innodb-table-online.result
Normal file
@ -0,0 +1,379 @@
|
||||
call mtr.add_suppression("InnoDB: Warning: Small buffer pool size");
|
||||
call mtr.add_suppression("InnoDB: Error: table 'test/t1'");
|
||||
call mtr.add_suppression("MySQL is trying to open a table handle but the .ibd file for");
|
||||
SET @global_innodb_file_per_table_orig = @@global.innodb_file_per_table;
|
||||
SET GLOBAL innodb_file_per_table = on;
|
||||
CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT NOT NULL, c3 TEXT NOT NULL)
|
||||
ENGINE = InnoDB;
|
||||
INSERT INTO t1 VALUES (1,1,''), (2,2,''), (3,3,''), (4,4,''), (5,5,'');
|
||||
SET GLOBAL innodb_monitor_enable = module_ddl;
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 0
|
||||
ddl_pending_alter_table 0
|
||||
SET DEBUG_SYNC = 'RESET';
|
||||
SET DEBUG_SYNC = 'write_row_noreplace SIGNAL have_handle WAIT_FOR go_ahead';
|
||||
INSERT INTO t1 VALUES(1,2,3);
|
||||
# Establish session con1 (user=root)
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR have_handle';
|
||||
SET lock_wait_timeout = 1;
|
||||
ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
SET DEBUG_SYNC = 'now SIGNAL go_ahead';
|
||||
# session default
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 0
|
||||
ddl_pending_alter_table 0
|
||||
# session con1
|
||||
SET @saved_debug_dbug = @@SESSION.debug_dbug;
|
||||
SET DEBUG_DBUG = '+d,innodb_OOM_prepare_inplace_alter';
|
||||
ALTER TABLE t1 ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE, LOCK=NONE;
|
||||
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
|
||||
SET SESSION DEBUG = @saved_debug_dbug;
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
SET SESSION DEBUG = '+d,innodb_OOM_inplace_alter';
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
ALTER TABLE t1 ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE, LOCK=NONE;
|
||||
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
|
||||
SET SESSION DEBUG = @saved_debug_dbug;
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
ALTER TABLE t1 ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE, LOCK=NONE;
|
||||
# session default
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c2` int(11) NOT NULL,
|
||||
`c3` text NOT NULL,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(7,4,2);
|
||||
# session con1
|
||||
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL scanned WAIT_FOR insert_done';
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD UNIQUE INDEX(c2);
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
# session default
|
||||
COMMIT;
|
||||
# session con1
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD UNIQUE INDEX(c2);
|
||||
ERROR 23000: Duplicate entry '4' for key 'c2'
|
||||
# session default
|
||||
DELETE FROM t1 WHERE c1 = 7;
|
||||
# session con1
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD UNIQUE INDEX(c2), ROW_FORMAT=COMPACT,
|
||||
LOCK = SHARED, ALGORITHM = INPLACE;
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(c2),
|
||||
LOCK = EXCLUSIVE, ALGORITHM = INPLACE;
|
||||
Warnings:
|
||||
Note 1831 Duplicate index `c2_2`. This is deprecated and will be disallowed in a future release.
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c2` int(11) NOT NULL,
|
||||
`c3` text NOT NULL,
|
||||
UNIQUE KEY `c2` (`c2`),
|
||||
UNIQUE KEY `c2_2` (`c2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
|
||||
ALTER TABLE t1 DROP INDEX c2, ALGORITHM = INPLACE;
|
||||
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Dropping a primary key is not allowed without also adding a new primary key. Try ALGORITHM=COPY.
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c2` int(11) NOT NULL,
|
||||
`c3` text NOT NULL,
|
||||
UNIQUE KEY `c2` (`c2`),
|
||||
UNIQUE KEY `c2_2` (`c2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
|
||||
ALTER TABLE t1 DROP INDEX c2, ADD PRIMARY KEY(c1);
|
||||
# session default
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR scanned';
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 1
|
||||
ddl_pending_alter_table 1
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(4,7,2);
|
||||
SET DEBUG_SYNC = 'now SIGNAL insert_done';
|
||||
# session con1
|
||||
ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
|
||||
# session default
|
||||
ROLLBACK;
|
||||
# session con1
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c2` int(11) NOT NULL,
|
||||
`c3` text NOT NULL,
|
||||
UNIQUE KEY `c2` (`c2`),
|
||||
UNIQUE KEY `c2_2` (`c2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD UNIQUE INDEX(c2), ALGORITHM = INPLACE;
|
||||
ERROR 42000: Can't DROP 'PRIMARY'; check that column/key exists
|
||||
ALTER TABLE t1 DROP INDEX c2, ADD PRIMARY KEY(c1), ALGORITHM = INPLACE;
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 0
|
||||
ddl_pending_alter_table 0
|
||||
# session default
|
||||
INSERT INTO t1 VALUES(6,3,1);
|
||||
ERROR 23000: Duplicate entry '3' for key 'c2_2'
|
||||
INSERT INTO t1 VALUES(7,4,2);
|
||||
ERROR 23000: Duplicate entry '4' for key 'c2_2'
|
||||
DROP INDEX c2_2 ON t1;
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(7,4,2);
|
||||
ROLLBACK;
|
||||
# session con1
|
||||
KILL QUERY @id;
|
||||
ERROR 70100: Query execution was interrupted
|
||||
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuilt WAIT_FOR dml_done';
|
||||
SET DEBUG_SYNC = 'row_log_table_apply2_before SIGNAL applied WAIT_FOR kill_done';
|
||||
ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
|
||||
# session default
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR rebuilt';
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 1
|
||||
ddl_pending_alter_table 1
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(7,4,2);
|
||||
ROLLBACK;
|
||||
SET DEBUG_SYNC = 'now SIGNAL dml_done WAIT_FOR applied';
|
||||
KILL QUERY @id;
|
||||
SET DEBUG_SYNC = 'now SIGNAL kill_done';
|
||||
# session con1
|
||||
ERROR 70100: Query execution was interrupted
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 0
|
||||
ddl_pending_alter_table 0
|
||||
# session default
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
INSERT INTO t1 SELECT 5 + c1, c2, c3 FROM t1;
|
||||
INSERT INTO t1 SELECT 10 + c1, c2, c3 FROM t1;
|
||||
INSERT INTO t1 SELECT 20 + c1, c2, c3 FROM t1;
|
||||
INSERT INTO t1 SELECT 40 + c1, c2, c3 FROM t1;
|
||||
EXPLAIN SELECT COUNT(*) FROM t1 WHERE c2 > 3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 80 Using where
|
||||
ANALYZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status OK
|
||||
# session con1
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c2` int(11) NOT NULL,
|
||||
`c3` text NOT NULL,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
|
||||
ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
|
||||
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuilt2 WAIT_FOR dml2_done';
|
||||
SET lock_wait_timeout = 10;
|
||||
ALTER TABLE t1 ROW_FORMAT=COMPACT, ALGORITHM = INPLACE;
|
||||
# session default
|
||||
INSERT INTO t1 SELECT 80 + c1, c2, c3 FROM t1;
|
||||
INSERT INTO t1 SELECT 160 + c1, c2, c3 FROM t1;
|
||||
UPDATE t1 SET c2 = c2 + 1;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR rebuilt2';
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 1
|
||||
ddl_pending_alter_table 1
|
||||
BEGIN;
|
||||
DELETE FROM t1;
|
||||
ROLLBACK;
|
||||
UPDATE t1 SET c2 = c2 + 1;
|
||||
BEGIN;
|
||||
UPDATE t1 SET c2 = c2 + 1;
|
||||
DELETE FROM t1;
|
||||
ROLLBACK;
|
||||
BEGIN;
|
||||
DELETE FROM t1;
|
||||
ROLLBACK;
|
||||
UPDATE t1 SET c2 = c2 + 1;
|
||||
BEGIN;
|
||||
UPDATE t1 SET c2 = c2 + 1;
|
||||
DELETE FROM t1;
|
||||
ROLLBACK;
|
||||
BEGIN;
|
||||
DELETE FROM t1;
|
||||
ROLLBACK;
|
||||
UPDATE t1 SET c2 = c2 + 1;
|
||||
BEGIN;
|
||||
UPDATE t1 SET c2 = c2 + 1;
|
||||
DELETE FROM t1;
|
||||
ROLLBACK;
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 1
|
||||
ddl_pending_alter_table 1
|
||||
SET DEBUG_SYNC = 'now SIGNAL dml2_done';
|
||||
# session con1
|
||||
ERROR HY000: Creating index 'PRIMARY' required more than 'innodb_online_alter_log_max_size' bytes of modification log. Please try again.
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 0
|
||||
ddl_pending_alter_table 0
|
||||
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuilt3 WAIT_FOR dml3_done';
|
||||
ALTER TABLE t1 ADD PRIMARY KEY(c22f), CHANGE c2 c22f INT;
|
||||
ERROR 42000: Multiple primary key defined
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(c22f), CHANGE c2 c22f INT;
|
||||
ERROR 23000: Duplicate entry '5' for key 'PRIMARY'
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(c1,c22f,c4(5)),
|
||||
CHANGE c2 c22f INT, CHANGE c3 c3 TEXT NULL, CHANGE c1 c1 INT AFTER c22f,
|
||||
ADD COLUMN c4 VARCHAR(6) DEFAULT 'Online';
|
||||
# session default
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR rebuilt3';
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 1
|
||||
ddl_pending_alter_table 1
|
||||
BEGIN;
|
||||
INSERT INTO t1 SELECT 320 + c1, c2, c3 FROM t1 WHERE c1 > 240;
|
||||
DELETE FROM t1 WHERE c1 > 320;
|
||||
ROLLBACK;
|
||||
BEGIN;
|
||||
UPDATE t1 SET c2 = c2 + 1;
|
||||
DELETE FROM t1;
|
||||
ROLLBACK;
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 1
|
||||
ddl_pending_alter_table 1
|
||||
SET DEBUG_SYNC = 'now SIGNAL dml3_done';
|
||||
# session con1
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 0
|
||||
ddl_pending_alter_table 0
|
||||
SELECT COUNT(c22f) FROM t1;
|
||||
COUNT(c22f)
|
||||
320
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY c3p5(c3(5));
|
||||
ERROR 23000: Duplicate entry '' for key 'PRIMARY'
|
||||
UPDATE t1 SET c3 = NULL WHERE c3 = '';
|
||||
SET lock_wait_timeout = 1;
|
||||
ALTER TABLE t1 DROP COLUMN c22f, ADD PRIMARY KEY c3p5(c3(5));
|
||||
ERROR 42000: Multiple primary key defined
|
||||
SET @old_sql_mode = @@sql_mode;
|
||||
SET @@sql_mode = 'STRICT_TRANS_TABLES';
|
||||
ALTER TABLE t1 DROP COLUMN c22f, DROP PRIMARY KEY, ADD PRIMARY KEY c3p5(c3(5)),
|
||||
ALGORITHM = INPLACE;
|
||||
ERROR 22004: Invalid use of NULL value
|
||||
ALTER TABLE t1 MODIFY c3 TEXT NOT NULL;
|
||||
ERROR 22004: Invalid use of NULL value
|
||||
SET @@sql_mode = @old_sql_mode;
|
||||
UPDATE t1 SET c3=CONCAT(c1,REPEAT('foo',c1)) WHERE c3 IS NULL;
|
||||
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL c3p5_created0 WAIT_FOR ins_done0';
|
||||
SET @@sql_mode = 'STRICT_TRANS_TABLES';
|
||||
ALTER TABLE t1 MODIFY c3 TEXT NOT NULL, DROP COLUMN c22f,
|
||||
ADD COLUMN c5 CHAR(5) DEFAULT 'tired' FIRST;
|
||||
# session default
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR c3p5_created0';
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(347,33101,'Pikku kakkosen posti','YLETV2');
|
||||
INSERT INTO t1 VALUES(33101,347,NULL,'');
|
||||
SET DEBUG_SYNC = 'now SIGNAL ins_done0';
|
||||
# session con1
|
||||
ERROR 22004: Invalid use of NULL value
|
||||
SET @@sql_mode = @old_sql_mode;
|
||||
# session default
|
||||
ROLLBACK;
|
||||
# session con1
|
||||
ALTER TABLE t1 MODIFY c3 TEXT NOT NULL;
|
||||
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL c3p5_created WAIT_FOR ins_done';
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, DROP COLUMN c22f,
|
||||
ADD COLUMN c6 VARCHAR(1000) DEFAULT
|
||||
'I love tracking down hard-to-reproduce bugs.',
|
||||
ADD PRIMARY KEY c3p5(c3(5), c6(2));
|
||||
# session default
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR c3p5_created';
|
||||
SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL ins_done WAIT_FOR ddl_timed_out';
|
||||
INSERT INTO t1 VALUES(347,33101,NULL,'');
|
||||
ERROR 23000: Column 'c3' cannot be null
|
||||
INSERT INTO t1 VALUES(347,33101,'Pikku kakkosen posti','');
|
||||
# session con1
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
SET DEBUG_SYNC = 'now SIGNAL ddl_timed_out';
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 0
|
||||
ddl_pending_alter_table 0
|
||||
# session default
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
321
|
||||
ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
|
||||
SELECT * FROM t1 LIMIT 10;
|
||||
c22f c1 c3 c4
|
||||
5 1 1foo Online
|
||||
6 2 2foofoo Online
|
||||
7 3 3foofoofoo Online
|
||||
8 4 4foofoofoofoo Online
|
||||
9 5 5foofoofoofoofoo Online
|
||||
5 6 6foofoofoofoofoofoo Online
|
||||
6 7 7foofoofoofoofoofoofoo Online
|
||||
7 8 8foofoofoofoofoofoofoofoo Online
|
||||
8 9 9foofoofoofoofoofoofoofoofoo Online
|
||||
9 10 10foofoofoofoofoofoofoofoofoofoo Online
|
||||
# session con1
|
||||
ALTER TABLE t1 DISCARD TABLESPACE;
|
||||
# Disconnect session con1
|
||||
# session default
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c22f` int(11) NOT NULL DEFAULT '0',
|
||||
`c1` int(11) NOT NULL DEFAULT '0',
|
||||
`c3` text NOT NULL,
|
||||
`c4` varchar(6) NOT NULL DEFAULT 'Online',
|
||||
PRIMARY KEY (`c1`,`c22f`,`c4`(5))
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
|
||||
SET DEBUG_SYNC = 'RESET';
|
||||
SET GLOBAL innodb_monitor_disable = module_ddl;
|
||||
DROP TABLE t1;
|
||||
SET GLOBAL innodb_file_per_table = @global_innodb_file_per_table_orig;
|
||||
SET GLOBAL innodb_monitor_enable = default;
|
||||
SET GLOBAL innodb_monitor_disable = default;
|
1409
mysql-test/suite/innodb/r/innodb-wl5980-alter.result
Normal file
1409
mysql-test/suite/innodb/r/innodb-wl5980-alter.result
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,16 @@
|
||||
SET @save_tdc= @@GLOBAL.table_definition_cache;
|
||||
SET @save_toc= @@GLOBAL.table_open_cache;
|
||||
SET GLOBAL table_definition_cache= 400;
|
||||
SET GLOBAL table_open_cache= 1024;
|
||||
CREATE TABLE to_be_evicted(a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB;
|
||||
INSERT INTO to_be_evicted VALUES(1,2),(2,1);
|
||||
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL scanned WAIT_FOR got_duplicate';
|
||||
ALTER TABLE to_be_evicted ADD UNIQUE INDEX(b);
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR scanned';
|
||||
BEGIN;
|
||||
INSERT INTO to_be_evicted VALUES(3, 2);
|
||||
SET DEBUG_SYNC = 'now SIGNAL got_duplicate';
|
||||
ERROR 23000: Duplicate entry '2' for key 'b'
|
||||
COMMIT;
|
||||
SET DEBUG_SYNC = RESET;
|
||||
FLUSH TABLES;
|
142
mysql-test/suite/innodb/r/undo_log.result
Normal file
142
mysql-test/suite/innodb/r/undo_log.result
Normal file
@ -0,0 +1,142 @@
|
||||
CREATE TABLE test_tab (
|
||||
a_str_18 mediumtext,
|
||||
b_str_3 varchar(32) DEFAULT NULL,
|
||||
a_str_13 mediumtext,
|
||||
b_str_5 varchar(40) DEFAULT NULL,
|
||||
b_str_6 varchar(50) DEFAULT NULL,
|
||||
b_str_7 char(32) DEFAULT NULL,
|
||||
b_str_8 varchar(32) DEFAULT NULL,
|
||||
b_str_9 varchar(255) DEFAULT NULL,
|
||||
a_str_28 char(255) DEFAULT NULL,
|
||||
a_str_27 varchar(255) DEFAULT NULL,
|
||||
b_str_10 varchar(32) DEFAULT NULL,
|
||||
a_str_26 varchar(255) DEFAULT NULL,
|
||||
a_str_6 varchar(50) DEFAULT NULL,
|
||||
b_str_11 varchar(32) DEFAULT NULL,
|
||||
b_str_12 varchar(255) DEFAULT NULL,
|
||||
b_str_13 char(32) DEFAULT NULL,
|
||||
b_str_14 varchar(32) DEFAULT NULL,
|
||||
b_str_15 char(32) DEFAULT NULL,
|
||||
b_str_16 char(32) DEFAULT NULL,
|
||||
b_str_17 varchar(32) DEFAULT NULL,
|
||||
b_str_18 varchar(32) DEFAULT NULL,
|
||||
a_str_25 varchar(40) DEFAULT NULL,
|
||||
b_str_19 varchar(255) DEFAULT NULL,
|
||||
a_str_23 varchar(40) DEFAULT NULL,
|
||||
b_str_20 varchar(32) DEFAULT NULL,
|
||||
a_str_21 varchar(255) DEFAULT NULL,
|
||||
a_str_20 varchar(255) DEFAULT NULL,
|
||||
a_str_39 varchar(255) DEFAULT NULL,
|
||||
a_str_38 varchar(255) DEFAULT NULL,
|
||||
a_str_37 varchar(255) DEFAULT NULL,
|
||||
b_str_21 char(32) DEFAULT NULL,
|
||||
b_str_23 varchar(80) DEFAULT NULL,
|
||||
b_str_24 varchar(32) DEFAULT NULL,
|
||||
b_str_25 varchar(32) DEFAULT NULL,
|
||||
b_str_26 char(32) NOT NULL DEFAULT '',
|
||||
b_str_27 varchar(255) DEFAULT NULL,
|
||||
a_str_36 varchar(255) DEFAULT NULL,
|
||||
a_str_33 varchar(100) DEFAULT NULL,
|
||||
a_ref_10 char(32) DEFAULT NULL,
|
||||
b_str_28 char(32) DEFAULT NULL,
|
||||
b_str_29 char(32) DEFAULT NULL,
|
||||
a_ref_6 char(32) DEFAULT NULL,
|
||||
a_ref_12 varchar(32) DEFAULT NULL,
|
||||
a_ref_11 varchar(32) DEFAULT NULL,
|
||||
a_str_49 varchar(40) DEFAULT NULL,
|
||||
b_str_30 varchar(32) DEFAULT NULL,
|
||||
a_ref_3 varchar(32) DEFAULT NULL,
|
||||
a_str_48 varchar(40) DEFAULT NULL,
|
||||
a_ref_1 char(32) DEFAULT NULL,
|
||||
b_str_31 varchar(32) DEFAULT NULL,
|
||||
b_str_32 varchar(255) DEFAULT NULL,
|
||||
b_str_33 char(32) DEFAULT NULL,
|
||||
b_str_34 varchar(32) DEFAULT NULL,
|
||||
a_str_47 varchar(40) DEFAULT NULL,
|
||||
b_str_36 varchar(255) DEFAULT NULL,
|
||||
a_str_46 varchar(40) DEFAULT NULL,
|
||||
a_str_45 varchar(255) DEFAULT NULL,
|
||||
b_str_38 varchar(32) DEFAULT NULL,
|
||||
b_str_39 char(32) DEFAULT NULL,
|
||||
b_str_40 varchar(32) DEFAULT NULL,
|
||||
a_str_41 varchar(255) DEFAULT NULL,
|
||||
b_str_41 varchar(32) DEFAULT NULL,
|
||||
PRIMARY KEY (b_str_26),
|
||||
UNIQUE KEY a_str_47 (a_str_47),
|
||||
UNIQUE KEY a_str_49 (a_str_49),
|
||||
UNIQUE KEY a_str_33 (a_str_33),
|
||||
UNIQUE KEY a_str_46 (a_str_46),
|
||||
UNIQUE KEY a_str_48 (a_str_48),
|
||||
KEY b_str_18 (b_str_18),
|
||||
KEY a_str_26 (a_str_26),
|
||||
KEY b_str_27 (b_str_27,b_str_19),
|
||||
KEY b_str_41 (b_str_41),
|
||||
KEY b_str_15 (b_str_15),
|
||||
KEY a_str_20 (a_str_20),
|
||||
KEY b_str_17 (b_str_17),
|
||||
KEY b_str_40 (b_str_40),
|
||||
KEY b_str_24 (b_str_24),
|
||||
KEY b_str_10 (b_str_10),
|
||||
KEY b_str_16 (b_str_16),
|
||||
KEY b_str_29 (b_str_29),
|
||||
KEY a_str_41 (a_str_41),
|
||||
KEY b_str_7 (b_str_7),
|
||||
KEY a_str_45 (a_str_45),
|
||||
KEY a_str_28 (a_str_28),
|
||||
KEY a_str_37 (a_str_37),
|
||||
KEY b_str_6 (b_str_6),
|
||||
KEY a_ref_6 (a_ref_6),
|
||||
KEY b_str_34 (b_str_34),
|
||||
KEY b_str_38 (b_str_38),
|
||||
KEY a_ref_10 (a_ref_10),
|
||||
KEY b_str_21 (b_str_21),
|
||||
KEY b_str_23 (b_str_23,b_str_19),
|
||||
KEY b_str_33 (b_str_33),
|
||||
KEY a_ref_12 (a_ref_12),
|
||||
KEY a_str_18 (a_str_18(255)),
|
||||
KEY a_str_39 (a_str_39),
|
||||
KEY a_str_27 (a_str_27),
|
||||
KEY a_str_25 (a_str_25),
|
||||
KEY b_str_9 (b_str_9),
|
||||
KEY a_str_23 (a_str_23),
|
||||
KEY b_str_8 (b_str_8),
|
||||
KEY a_str_21 (a_str_21),
|
||||
KEY b_str_3 (b_str_3),
|
||||
KEY b_str_30 (b_str_30),
|
||||
KEY b_str_12 (b_str_12),
|
||||
KEY b_str_25 (b_str_25),
|
||||
KEY b_str_13 (b_str_13),
|
||||
KEY a_str_38 (a_str_38),
|
||||
KEY a_str_13 (a_str_13(255)),
|
||||
KEY a_str_36 (a_str_36),
|
||||
KEY b_str_28 (b_str_28),
|
||||
KEY b_str_19 (b_str_19),
|
||||
KEY b_str_11 (b_str_11),
|
||||
KEY a_ref_1 (a_ref_1),
|
||||
KEY b_str_20 (b_str_20),
|
||||
KEY b_str_14 (b_str_14),
|
||||
KEY a_ref_3 (a_ref_3),
|
||||
KEY b_str_39 (b_str_39),
|
||||
KEY b_str_32 (b_str_32),
|
||||
KEY a_str_6 (a_str_6),
|
||||
KEY b_str_5 (b_str_5),
|
||||
KEY b_str_31 (b_str_31),
|
||||
KEY a_ref_11 (a_ref_11)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;
|
||||
BEGIN;
|
||||
INSERT INTO test_tab (b_str_26, a_str_13, a_str_18) VALUES
|
||||
('a', REPEAT('f',4031), REPEAT('g', 4031));
|
||||
UPDATE test_tab SET a_str_13=REPEAT('h',4032), a_str_18=REPEAT('i',4032);
|
||||
SELECT 'Reducing length to 4030';
|
||||
Reducing length to 4030
|
||||
Reducing length to 4030
|
||||
UPDATE test_tab SET a_str_13=REPEAT('j',4030), a_str_18=REPEAT('k',4030);
|
||||
UPDATE test_tab SET a_str_13=REPEAT('l',4031), a_str_18=REPEAT('m',4031);
|
||||
ROLLBACK;
|
||||
SELECT COUNT(*) FROM test_tab;
|
||||
COUNT(*)
|
||||
0
|
||||
CHECK TABLE test_tab;
|
||||
Table Op Msg_type Msg_text
|
||||
test.test_tab check status OK
|
||||
DROP TABLE test_tab;
|
@ -4,7 +4,7 @@ XA START 'x';
|
||||
UPDATE t1 set a=2;
|
||||
XA END 'x';
|
||||
XA PREPARE 'x';
|
||||
# Kill and restart
|
||||
# Kill and restart: --innodb-force-recovery=2
|
||||
SELECT * FROM t1 LOCK IN SHARE MODE;
|
||||
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
SELECT * FROM t1;
|
||||
|
93
mysql-test/suite/innodb/t/alter_rename_existing.test
Normal file
93
mysql-test/suite/innodb/t/alter_rename_existing.test
Normal file
@ -0,0 +1,93 @@
|
||||
--echo #
|
||||
--echo # Show what happens during ALTER TABLE when an existing file
|
||||
--echo # exists in the target location.
|
||||
--echo #
|
||||
--echo # Bug #19218794: IF TABLESPACE EXISTS, CAN'T CREATE TABLE,
|
||||
--echo # BUT CAN ALTER ENGINE=INNODB
|
||||
--echo #
|
||||
|
||||
--source include/have_innodb.inc
|
||||
|
||||
--disable_query_log
|
||||
LET $MYSQLD_DATADIR = `select @@datadir`;
|
||||
SET @old_innodb_file_per_table = @@innodb_file_per_table;
|
||||
--enable_query_log
|
||||
|
||||
CREATE TABLE t1 (a SERIAL, b CHAR(10)) ENGINE=Memory;
|
||||
INSERT INTO t1(b) VALUES('one'), ('two'), ('three');
|
||||
|
||||
--echo #
|
||||
--echo # Create a file called MYSQLD_DATADIR/test/t1.ibd
|
||||
--exec echo "This is not t1.ibd" > $MYSQLD_DATADIR/test/t1.ibd
|
||||
|
||||
--echo # Directory listing of test/*.ibd
|
||||
--echo #
|
||||
--list_files $MYSQLD_DATADIR/test/ *.ibd
|
||||
|
||||
--replace_regex /Error on rename of '.*' to '.*'/Error on rename of 'OLD_FILE_NAME' to 'NEW_FILE_NAME'/
|
||||
--error ER_ERROR_ON_RENAME
|
||||
ALTER TABLE t1 ENGINE = InnoDB;
|
||||
|
||||
--echo #
|
||||
--echo # Move the file to InnoDB as t2
|
||||
--echo #
|
||||
ALTER TABLE t1 RENAME TO t2, ENGINE = INNODB;
|
||||
SHOW CREATE TABLE t2;
|
||||
SELECT * from t2;
|
||||
|
||||
--replace_regex /Error on rename of '.*' to '.*'/Error on rename of 'OLD_FILE_NAME' to 'NEW_FILE_NAME'/
|
||||
--error ER_ERROR_ON_RENAME
|
||||
ALTER TABLE t2 RENAME TO t1;
|
||||
|
||||
--echo #
|
||||
--echo # Create another t1, but in the system tablespace.
|
||||
--echo #
|
||||
SET GLOBAL innodb_file_per_table=OFF;
|
||||
CREATE TABLE t1 (a SERIAL, b CHAR(20)) ENGINE=InnoDB;
|
||||
INSERT INTO t1(b) VALUES('one'), ('two'), ('three');
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT name, space=0 FROM information_schema.innodb_sys_tables WHERE name = 'test/t1';
|
||||
|
||||
--echo #
|
||||
--echo # ALTER TABLE from system tablespace to system tablespace
|
||||
--echo #
|
||||
ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=INPLACE;
|
||||
ALTER TABLE t1 ADD COLUMN d INT, ALGORITHM=COPY;
|
||||
|
||||
--echo #
|
||||
--echo # Try to move t1 from the system tablespace to a file-per-table
|
||||
--echo # while a blocking t1.ibd file exists.
|
||||
--echo #
|
||||
SET GLOBAL innodb_file_per_table=ON;
|
||||
--replace_regex /$MYSQLD_DATADIR/MYSQLD_DATADIR/
|
||||
--error ER_TABLESPACE_EXISTS
|
||||
ALTER TABLE t1 ADD COLUMN e1 INT, ALGORITHM=INPLACE;
|
||||
--replace_regex /Error on rename of '.*' to '.*'/Error on rename of 'OLD_FILE_NAME' to 'NEW_FILE_NAME'/
|
||||
--error ER_ERROR_ON_RENAME
|
||||
ALTER TABLE t1 ADD COLUMN e2 INT, ALGORITHM=COPY;
|
||||
|
||||
--echo #
|
||||
--echo # Delete the blocking file called MYSQLD_DATADIR/test/t1.ibd
|
||||
--remove_file $MYSQLD_DATADIR/test/t1.ibd
|
||||
|
||||
--echo # Move t1 to file-per-table using ALGORITHM=INPLACE with no blocking t1.ibd.
|
||||
--echo #
|
||||
ALTER TABLE t1 ADD COLUMN e INT, ALGORITHM=INPLACE;
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT name, space=0 FROM information_schema.innodb_sys_tables WHERE name = 'test/t1';
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Rename t2.ibd to t1.ibd.
|
||||
--echo #
|
||||
ALTER TABLE t2 RENAME TO t1;
|
||||
SELECT name, space=0 FROM information_schema.innodb_sys_tables WHERE name = 'test/t1';
|
||||
SELECT * from t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--disable_query_log
|
||||
call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot rename '.*' to '.*' for space ID .* because the target file exists. Remove the target file and try again");
|
||||
SET GLOBAL innodb_file_per_table = @old_innodb_file_per_table;
|
||||
--enable_query_log
|
34
mysql-test/suite/innodb/t/create-index-debug.test
Normal file
34
mysql-test/suite/innodb/t/create-index-debug.test
Normal file
@ -0,0 +1,34 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_innodb_16k.inc
|
||||
--source include/have_debug.inc
|
||||
|
||||
SET @saved_debug_dbug = @@SESSION.debug_dbug;
|
||||
|
||||
--echo #
|
||||
--echo #BUG#21326304 INNODB ONLINE ALTER TABLE ENDS IN CRASH ON DISK FULL
|
||||
--echo #
|
||||
CREATE TABLE t1(f1 CHAR(255) NOT NULL, f2 CHAR(255) NOT NULL, f3
|
||||
CHAR(255) NOT NULL, f4 CHAR(255) NOT NULL, f5 CHAR(255) NOT NULL,f6
|
||||
CHAR(255) NOT NULL, f7 CHAR(255) NOT NULL, f8 CHAR(255) NOT NULL,f9
|
||||
CHAR(255) NOT NULL, f10 CHAR(255) NOT NULL, f11 CHAR(255) NOT NULL,f12
|
||||
CHAR(255) NOT NULL, f13 CHAR(255) NOT NULL, f14 CHAR(255) NOT NULL,f15
|
||||
CHAR(255) NOT NULL, f16 CHAR(255) NOT NULL, f17 CHAR(255) NOT NULL,f18
|
||||
CHAR(255) NOT NULL)
|
||||
ENGINE=INNODB ROW_FORMAT=DYNAMIC;
|
||||
|
||||
INSERT INTO t1
|
||||
VALUES('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r');
|
||||
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
|
||||
SET debug_dbug = '+d,disk_is_full';
|
||||
|
||||
--error ER_RECORD_FILE_FULL
|
||||
ALTER TABLE t1 FORCE, ALGORITHM=INPLACE;
|
||||
|
||||
SET debug_dbug= @saved_debug_dbug;
|
||||
|
||||
DROP TABLE t1;
|
1
mysql-test/suite/innodb/t/index_tree_operation.opt
Normal file
1
mysql-test/suite/innodb/t/index_tree_operation.opt
Normal file
@ -0,0 +1 @@
|
||||
--innodb-sys-tablespaces
|
74
mysql-test/suite/innodb/t/index_tree_operation.test
Normal file
74
mysql-test/suite/innodb/t/index_tree_operation.test
Normal file
@ -0,0 +1,74 @@
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/have_innodb_16k.inc
|
||||
--echo #
|
||||
--echo # Bug#15923864 (Bug#67718):
|
||||
--echo # INNODB DRASTICALLY UNDER-FILLS PAGES IN CERTAIN CONDITIONS
|
||||
--echo #
|
||||
# InnoDB should try to insert to the next page before split,
|
||||
# if the insert record for split_and_insert is last of the page.
|
||||
# Otherwise, the follwing records 999,998,997 cause each page per record.
|
||||
#
|
||||
|
||||
--disable_query_log
|
||||
SET @old_innodb_file_per_table = @@innodb_file_per_table;
|
||||
--enable_query_log
|
||||
|
||||
SET GLOBAL innodb_file_per_table=ON;
|
||||
|
||||
CREATE TABLE t1 (a BIGINT PRIMARY KEY, b VARCHAR(4096)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (0, REPEAT('a', 4096));
|
||||
INSERT INTO t1 VALUES (1000, REPEAT('a', 4096));
|
||||
INSERT INTO t1 VALUES (1001, REPEAT('a', 4096));
|
||||
INSERT INTO t1 VALUES (1002, REPEAT('a', 4096));
|
||||
INSERT INTO t1 VALUES (1, REPEAT('a', 4096));
|
||||
INSERT INTO t1 VALUES (2, REPEAT('a', 4096));
|
||||
|
||||
# | 0, 1, 2 | 1000, 1001, 1002|
|
||||
|
||||
SELECT page_number, number_records
|
||||
FROM information_schema.innodb_sys_tablespaces s1,
|
||||
information_schema.innodb_buffer_page s2
|
||||
WHERE s1.space = s2.space AND name = 'test/t1'
|
||||
AND page_type = "INDEX" ORDER BY page_number;
|
||||
|
||||
INSERT INTO t1 VALUES (999, REPEAT('a', 4096));
|
||||
|
||||
# try to insert '999' to the end of '0,1,2' page, but no space
|
||||
# the next '1000,1001,1002' page has also no space.
|
||||
# | 0, 1, 2 | 999 | 1000, 1001, 1002|
|
||||
|
||||
SELECT page_number, number_records
|
||||
FROM information_schema.innodb_sys_tablespaces s1,
|
||||
information_schema.innodb_buffer_page s2
|
||||
WHERE s1.space = s2.space AND name = 'test/t1'
|
||||
AND page_type = "INDEX" ORDER BY page_number;
|
||||
|
||||
|
||||
INSERT INTO t1 VALUES (998, REPEAT('a', 4096));
|
||||
|
||||
# try to insert to the end of '0,1,2' page, but no space
|
||||
# the next '998' page has space.
|
||||
# | 0, 1, 2 | 998, 999 | 1000, 1001, 1002|
|
||||
|
||||
SELECT page_number, number_records
|
||||
FROM information_schema.innodb_sys_tablespaces s1,
|
||||
information_schema.innodb_buffer_page s2
|
||||
WHERE s1.space = s2.space AND name = 'test/t1'
|
||||
AND page_type = "INDEX" ORDER BY page_number;
|
||||
|
||||
INSERT INTO t1 VALUES (997, REPEAT('a', 4096));
|
||||
|
||||
# same
|
||||
# | 0, 1, 2 | 997, 998, 999 | 1000, 1001, 1002|
|
||||
|
||||
SELECT page_number, number_records
|
||||
FROM information_schema.innodb_sys_tablespaces s1,
|
||||
information_schema.innodb_buffer_page s2
|
||||
WHERE s1.space = s2.space AND name = 'test/t1'
|
||||
AND page_type = "INDEX" ORDER BY page_number;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--disable_query_log
|
||||
SET GLOBAL innodb_file_per_table = @old_innodb_file_per_table;
|
||||
--enable_query_log
|
104
mysql-test/suite/innodb/t/innodb-alter-autoinc.test
Normal file
104
mysql-test/suite/innodb/t/innodb-alter-autoinc.test
Normal file
@ -0,0 +1,104 @@
|
||||
--source include/have_innodb.inc
|
||||
|
||||
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(347),(33101),(123),(45),(6);
|
||||
# NULL -> NOT NULL only allowed INPLACE if strict sql_mode is on.
|
||||
SET @old_sql_mode = @@sql_mode;
|
||||
SET @@sql_mode = 'STRICT_TRANS_TABLES';
|
||||
ALTER TABLE t1 ADD PRIMARY KEY(a);
|
||||
SET @@sql_mode = @old_sql_mode;
|
||||
|
||||
# We cannot assign AUTO_INCREMENT values during online index creation.
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
LOCK=NONE;
|
||||
|
||||
--error ER_WRONG_AUTO_KEY
|
||||
ALTER TABLE t1 ADD id INT AUTO_INCREMENT;
|
||||
|
||||
--error ER_WRONG_AUTO_KEY
|
||||
ALTER TABLE t1 ADD id INT AUTO_INCREMENT, ADD INDEX(a, id);
|
||||
|
||||
ALTER TABLE t1 ADD id INT NOT NULL, ADD INDEX(id, a);
|
||||
|
||||
SELECT * FROM t1;
|
||||
|
||||
# Test with a non-default increment and offset
|
||||
SET AUTO_INCREMENT_INCREMENT = 5, AUTO_INCREMENT_OFFSET = 30;
|
||||
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
DROP COLUMN id, AUTO_INCREMENT = 42, ALGORITHM=COPY;
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
# The autoinc next value should increase. It is not rolled back.
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(7,0);
|
||||
SELECT * FROM t1;
|
||||
ROLLBACK;
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
# We cannot assign AUTO_INCREMENT values during online index creation.
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
DROP COLUMN id, AUTO_INCREMENT = 42, LOCK=NONE;
|
||||
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
DROP COLUMN id, AUTO_INCREMENT = 42, ALGORITHM=INPLACE;
|
||||
|
||||
SELECT * FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
INSERT INTO t1 SET a=123;
|
||||
INSERT INTO t1 VALUES(-123,-45);
|
||||
|
||||
ALTER TABLE t1 AUTO_INCREMENT = 75;
|
||||
|
||||
INSERT INTO t1 SET a=123;
|
||||
SELECT * FROM t1;
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
# ALGORITHM=INPLACE should deliver identical results to ALGORITHM=COPY.
|
||||
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(347),(33101),(123),(45),(6);
|
||||
ALTER TABLE t1 ADD PRIMARY KEY(a);
|
||||
|
||||
ALTER TABLE t1 ADD id INT NOT NULL, ADD INDEX(id, a);
|
||||
|
||||
SELECT * FROM t1;
|
||||
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
DROP COLUMN id, AUTO_INCREMENT = 42, ALGORITHM=INPLACE;
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
# The autoinc next value should increase. It is not rolled back.
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(7,0);
|
||||
SELECT * FROM t1;
|
||||
ROLLBACK;
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
DROP COLUMN id, AUTO_INCREMENT = 42, ALGORITHM=COPY;
|
||||
|
||||
SELECT * FROM t1;
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
INSERT INTO t1 SET a=123;
|
||||
INSERT INTO t1 VALUES(-123,-45);
|
||||
|
||||
ALTER TABLE t1 AUTO_INCREMENT = 75;
|
||||
|
||||
INSERT INTO t1 SET a=123;
|
||||
SELECT * FROM t1;
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
DROP TABLE t1;
|
@ -1,4 +1,5 @@
|
||||
--source include/innodb_page_size.inc
|
||||
--source include/have_partition.inc
|
||||
|
||||
#
|
||||
# MMDEV-8386: MariaDB creates very big tmp file and hangs on xtradb
|
||||
@ -171,3 +172,35 @@ ALTER TABLE ticket
|
||||
SHOW CREATE TABLE ticket;
|
||||
|
||||
DROP TABLE ticket;
|
||||
|
||||
#
|
||||
# MDEV-13838: Wrong result after altering a partitioned table
|
||||
#
|
||||
|
||||
CREATE TABLE t (
|
||||
id bigint(20) unsigned NOT NULL auto_increment,
|
||||
d date NOT NULL,
|
||||
a bigint(20) unsigned NOT NULL,
|
||||
b smallint(5) unsigned DEFAULT NULL,
|
||||
PRIMARY KEY (id,d)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs STATS_SAMPLE_PAGES=2
|
||||
PARTITION BY RANGE COLUMNS(d)
|
||||
(
|
||||
PARTITION p20170914 VALUES LESS THAN ('2017-09-15') ENGINE = InnoDB,
|
||||
PARTITION p99991231 VALUES LESS THAN (MAXVALUE) ENGINE = InnoDB);
|
||||
|
||||
insert into t(d,a,b) values ('2017-09-15',rand()*10000,rand()*10);
|
||||
insert into t(d,a,b) values ('2017-09-15',rand()*10000,rand()*10);
|
||||
|
||||
replace into t(d,a,b) select '2017-09-15',rand()*10000,rand()*10 from t t1, t t2, t t3, t t4;
|
||||
|
||||
select count(*) from t where d ='2017-09-15';
|
||||
|
||||
ALTER TABLE t CHANGE b c smallint(5) unsigned , ADD KEY idx_d_a (d, a);
|
||||
SHOW CREATE TABLE t;
|
||||
analyze table t;
|
||||
|
||||
select count(*) from t where d ='2017-09-15';
|
||||
select count(*) from t force index(primary) where d ='2017-09-15';
|
||||
|
||||
DROP TABLE t;
|
||||
|
3
mysql-test/suite/innodb/t/innodb-alter.opt
Normal file
3
mysql-test/suite/innodb/t/innodb-alter.opt
Normal file
@ -0,0 +1,3 @@
|
||||
--loose-innodb-sys-indexes
|
||||
--loose-innodb-sys-columns
|
||||
--loose-innodb-sys-fields
|
483
mysql-test/suite/innodb/t/innodb-alter.test
Normal file
483
mysql-test/suite/innodb/t/innodb-alter.test
Normal file
@ -0,0 +1,483 @@
|
||||
--source include/have_innodb.inc
|
||||
|
||||
SET NAMES utf8;
|
||||
|
||||
CREATE TABLE t1 (
|
||||
c1 INT PRIMARY KEY, c2 INT DEFAULT 1, ct TEXT,
|
||||
INDEX(c2))
|
||||
ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO t1 SET c1=1;
|
||||
|
||||
CREATE TABLE sys_tables SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
|
||||
WHERE NAME LIKE 'test/t%';
|
||||
CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
|
||||
CREATE TABLE t1p LIKE t1;
|
||||
|
||||
CREATE TABLE t1c (c1 INT PRIMARY KEY, c2 INT, c3 INT, INDEX(c2), INDEX(c3),
|
||||
CONSTRAINT t1c2 FOREIGN KEY (c2) REFERENCES t1(c2),
|
||||
CONSTRAINT t1c3 FOREIGN KEY (c3) REFERENCES t1p(c2))
|
||||
ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE sys_foreign SELECT i.*
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN i
|
||||
WHERE FOR_NAME LIKE 'test/t%';
|
||||
|
||||
SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i
|
||||
INNER JOIN sys_foreign sf ON i.ID = sf.ID;
|
||||
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
ALTER TABLE t1 ALTER c2 DROP DEFAULT;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
# These should be no-op.
|
||||
ALTER TABLE t1 CHANGE c2 c2 INT AFTER c1;
|
||||
ALTER TABLE t1 CHANGE c1 c1 INT FIRST;
|
||||
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
ALTER TABLE t1 CHANGE C2 c3 INT;
|
||||
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
ALTER TABLE t1 CHANGE c3 C INT;
|
||||
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
ALTER TABLE t1 CHANGE C Cöŀumň_TWO INT;
|
||||
|
||||
SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i
|
||||
INNER JOIN sys_foreign sf ON i.ID = sf.ID;
|
||||
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
-- error ER_BAD_FIELD_ERROR
|
||||
ALTER TABLE t1 CHANGE cöĿǖmň_two c3 INT;
|
||||
|
||||
ALTER TABLE t1 CHANGE cÖĿUMŇ_two c3 INT, RENAME TO t3;
|
||||
|
||||
SELECT st.NAME, i.NAME
|
||||
FROM sys_tables st INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_TABLES i
|
||||
ON i.TABLE_ID=st.TABLE_ID;
|
||||
|
||||
SHOW CREATE TABLE t3;
|
||||
SHOW CREATE TABLE t1c;
|
||||
|
||||
# The maximum column name length should be 64 characters.
|
||||
--error ER_TOO_LONG_IDENT
|
||||
ALTER TABLE t3 CHANGE c3
|
||||
`12345678901234567890123456789012345678901234567890123456789012345` INT;
|
||||
ALTER TABLE t3 CHANGE c3
|
||||
`1234567890123456789012345678901234567890123456789012345678901234` INT;
|
||||
SHOW CREATE TABLE t3;
|
||||
|
||||
# Test the length limit with non-ASCII utf-8 characters.
|
||||
--error ER_TOO_LONG_IDENT
|
||||
ALTER TABLE t3 CHANGE
|
||||
`1234567890123456789012345678901234567890123456789012345678901234`
|
||||
`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾倿偀` INT;
|
||||
--error ER_TOO_LONG_IDENT
|
||||
ALTER TABLE t3 CHANGE
|
||||
`1234567890123456789012345678901234567890123456789012345678901234`
|
||||
`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾倿ä` INT;
|
||||
ALTER TABLE t3 CHANGE
|
||||
`1234567890123456789012345678901234567890123456789012345678901234`
|
||||
`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾ä` INT;
|
||||
|
||||
# check that the rename is case-insensitive (note the upper-case ä at end)
|
||||
ALTER TABLE t3 CHANGE
|
||||
`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾Ä`
|
||||
c3 INT;
|
||||
|
||||
# test with 4-byte UTF-8 (should be disallowed)
|
||||
--error ER_INVALID_CHARACTER_STRING
|
||||
ALTER TABLE t3 CHANGE c3 𐌀𐌁𐌂𐌃𐌄𐌅𐌆𐌇𐌈𐌉𐌊𐌋𐌌𐌍𐌎𐌏𐌐𐌑𐌒𐌓𐌔𐌕𐌖𐌗𐌘𐌙𐌚𐌛𐌜 INT;
|
||||
--error ER_INVALID_CHARACTER_STRING
|
||||
ALTER TABLE t3 CHANGE c3 😲 INT;
|
||||
|
||||
ALTER TABLE t3 RENAME TO t2;
|
||||
|
||||
SELECT st.NAME, i.NAME
|
||||
FROM sys_tables st INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_TABLES i
|
||||
ON i.TABLE_ID=st.TABLE_ID;
|
||||
|
||||
SHOW CREATE TABLE t2;
|
||||
|
||||
RENAME TABLE t2 TO t1;
|
||||
|
||||
SELECT st.NAME, i.NAME
|
||||
FROM sys_tables st INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_TABLES i
|
||||
ON i.TABLE_ID=st.TABLE_ID;
|
||||
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
--error ER_DROP_INDEX_FK
|
||||
ALTER TABLE t1 DROP INDEX c2;
|
||||
|
||||
--error ER_CANT_DROP_FIELD_OR_KEY
|
||||
ALTER TABLE t1 DROP INDEX c4;
|
||||
|
||||
--error ER_CANT_DROP_FIELD_OR_KEY
|
||||
ALTER TABLE t1c DROP FOREIGN KEY c2;
|
||||
|
||||
--error ER_CANT_DROP_FIELD_OR_KEY
|
||||
ALTER TABLE t1c DROP FOREIGN KEY t1c2, DROP FOREIGN KEY c2;
|
||||
|
||||
--error ER_CANT_DROP_FIELD_OR_KEY
|
||||
ALTER TABLE t1c DROP FOREIGN KEY t1c2, DROP FOREIGN KEY c2, DROP INDEX c2;
|
||||
|
||||
--error ER_DROP_INDEX_FK
|
||||
ALTER TABLE t1c DROP INDEX c2;
|
||||
|
||||
--error ER_CANT_DROP_FIELD_OR_KEY
|
||||
ALTER TABLE t1c DROP FOREIGN KEY ẗ1C2;
|
||||
|
||||
SHOW CREATE TABLE t1c;
|
||||
|
||||
SET foreign_key_checks=0;
|
||||
DROP TABLE t1p;
|
||||
SET foreign_key_checks=1;
|
||||
|
||||
SHOW CREATE TABLE t1c;
|
||||
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
CREATE TABLE t1p (c1 INT PRIMARY KEY, c2 INT, INDEX(c2)) ENGINE=InnoDB;
|
||||
|
||||
--error ER_DROP_INDEX_FK
|
||||
ALTER TABLE t1c DROP INDEX C2, DROP INDEX C3;
|
||||
--error ER_DROP_INDEX_FK
|
||||
ALTER TABLE t1c DROP INDEX C3;
|
||||
|
||||
SET foreign_key_checks=0;
|
||||
ALTER TABLE t1c DROP INDEX C3;
|
||||
SET foreign_key_checks=1;
|
||||
|
||||
SHOW CREATE TABLE t1c;
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
ALTER TABLE t1c DROP FOREIGN KEY t1C3;
|
||||
|
||||
SHOW CREATE TABLE t1c;
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
ALTER TABLE t1c DROP INDEX c2, DROP FOREIGN KEY t1C2;
|
||||
|
||||
SHOW CREATE TABLE t1c;
|
||||
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
ALTER TABLE t1 DROP INDEX c2, CHANGE c3 c2 INT;
|
||||
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
CREATE TABLE t1o LIKE t1;
|
||||
|
||||
# This will implicitly add a FTS_DOC_ID column, which cannot be done online.
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE t1 ADD FULLTEXT INDEX (ct),
|
||||
CHANGE c1 pk INT, ALTER c2 SET DEFAULT 42, RENAME TO tt,
|
||||
ALGORITHM=INPLACE, LOCK=NONE;
|
||||
|
||||
ALTER TABLE t1 ADD FULLTEXT INDEX (ct),
|
||||
CHANGE c1 pk INT, ALTER c2 SET DEFAULT 42, RENAME TO tt,
|
||||
ALGORITHM=INPLACE, LOCK=SHARED;
|
||||
|
||||
# The output should be empty, because index->id was reassigned.
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
SHOW CREATE TABLE tt;
|
||||
|
||||
# DB_ROW_ID, DB_TRX_ID, DB_ROLL_PTR are reserved InnoDB system column names.
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
ALTER TABLE t1o CHANGE c1 dB_row_Id INT, ALGORITHM=COPY;
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
ALTER TABLE t1o CHANGE c1 dB_row_Id INT, ALGORITHM=INPLACE;
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
ALTER TABLE t1o CHANGE c1 DB_TRX_ID INT;
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
ALTER TABLE t1o CHANGE c1 db_roll_ptr INT;
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
ALTER TABLE t1o ADD COLUMN DB_TRX_ID INT;
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
ALTER TABLE t1o ADD COLUMN db_roll_ptr INT;
|
||||
|
||||
--error ER_INNODB_FT_WRONG_DOCID_COLUMN
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ADD COLUMN FTS_DOC_ID BIGINT;
|
||||
--error ER_INNODB_FT_WRONG_DOCID_COLUMN
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED;
|
||||
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct),
|
||||
ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED NOT NULL;
|
||||
|
||||
--error ER_DUP_FIELDNAME
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ADD COLUMN FTS_DOC_ID INT;
|
||||
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE t1o DROP COLUMN FTS_DOC_ID, ALGORITHM=INPLACE;
|
||||
|
||||
ALTER TABLE t1o DROP COLUMN FTS_DOC_ID, DROP INDEX ct, ALGORITHM=INPLACE;
|
||||
|
||||
# This creates a hidden FTS_DOC_ID column.
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ADD COLUMN cu TEXT;
|
||||
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(cu), ADD COLUMN FTS_DOC_ID BIGINT,
|
||||
ALGORITHM=INPLACE;
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(cu), ADD COLUMN FTS_DOC_ID BIGINT;
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(cu), ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED,
|
||||
ALGORITHM=INPLACE;
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(cu), ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED;
|
||||
|
||||
# This would drop the hidden FTS_DOC_ID column and create
|
||||
# a fulltext index on ct and another fulltext index on cu.
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(cu),
|
||||
ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE;
|
||||
|
||||
# Replace the hidden FTS_DOC_ID column with a user-visible one.
|
||||
# This used to work if there is at most one fulltext index.
|
||||
# Currently, we disallow native ALTER TABLE if the table
|
||||
# contains any FULLTEXT indexes.
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE t1o ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
|
||||
ALGORITHM=INPLACE;
|
||||
ALTER TABLE t1o ADD COLUMN FTS_DOC_ID BIGINT UNSIGNED NOT NULL;
|
||||
# Replace the user-visible FTS_DOC_ID column with a hidden one.
|
||||
# We do not support this in-place.
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE t1o DROP COLUMN FTS_DOC_ID, ALGORITHM=INPLACE;
|
||||
ALTER TABLE t1o DROP COLUMN FTS_DOC_ID;
|
||||
|
||||
# FTS_DOC_ID is the internal row identifier for full-text search.
|
||||
# It should be of type BIGINT UNSIGNED NOT NULL.
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct), CHANGE c1 FTS_DOC_ID INT,
|
||||
ALGORITHM=COPY;
|
||||
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct), CHANGE c1 FTS_DOC_ID INT,
|
||||
ALGORITHM=INPLACE;
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct), CHANGE c1 FTS_Doc_ID INT,
|
||||
ALGORITHM=INPLACE;
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct),
|
||||
CHANGE c1 FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
|
||||
ALGORITHM=INPLACE;
|
||||
|
||||
CREATE TABLE t1n LIKE t1o;
|
||||
|
||||
ALTER TABLE t1n ADD FULLTEXT INDEX(ct);
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
ALTER TABLE t1n CHANGE c1 Fts_DOC_ID INT, ALGORITHM=INPLACE;
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
ALTER TABLE t1n CHANGE c1 Fts_DOC_ID INT, ALGORITHM=COPY;
|
||||
--error ER_BAD_FIELD_ERROR
|
||||
ALTER TABLE t1n CHANGE FTS_DOC_ID c11 INT, ALGORITHM=INPLACE;
|
||||
ALTER TABLE t1n CHANGE c1 FTS_DOC_ïD INT, ALGORITHM=INPLACE;
|
||||
|
||||
ALTER TABLE t1n CHANGE FTS_DOC_ÏD c1 INT, ALGORITHM=INPLACE;
|
||||
ALTER TABLE t1n CHANGE c1 c2 INT, CHANGE c2 ct INT, CHANGE ct c1 TEXT,
|
||||
ALGORITHM=INPLACE;
|
||||
SHOW CREATE TABLE t1n;
|
||||
ALTER TABLE t1n CHANGE c2 c1 INT, CHANGE ct c2 INT, CHANGE c1 ct TEXT,
|
||||
ALGORITHM=COPY;
|
||||
SHOW CREATE TABLE t1n;
|
||||
|
||||
--error ER_KEY_COLUMN_DOES_NOT_EXITS
|
||||
ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=INPLACE;
|
||||
--error ER_KEY_COLUMN_DOES_NOT_EXITS
|
||||
ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=COPY;
|
||||
ALTER TABLE t1n ADD INDEX(c4), CHANGE c2 c4 INT, ALGORITHM=INPLACE;
|
||||
SHOW CREATE TABLE t1n;
|
||||
ALTER TABLE t1n DROP INDEX c4;
|
||||
--error ER_DUP_FIELDNAME
|
||||
ALTER TABLE t1n CHANGE c4 c1 INT, ADD INDEX(c1), ALGORITHM=INPLACE;
|
||||
ALTER TABLE t1n CHANGE c4 c11 INT, ADD INDEX(c11), ALGORITHM=INPLACE;
|
||||
|
||||
SHOW CREATE TABLE t1n;
|
||||
DROP TABLE t1n;
|
||||
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE t1o MODIFY c1 BIGINT UNSIGNED NOT NULL, DROP INDEX ct,
|
||||
ALGORITHM=INPLACE;
|
||||
|
||||
# This will copy the table, removing the hidden FTS_DOC_ID column.
|
||||
ALTER TABLE t1o MODIFY c1 BIGINT UNSIGNED NOT NULL, DROP INDEX ct;
|
||||
|
||||
ALTER TABLE t1o CHANGE c1 FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
|
||||
ALGORITHM=INPLACE;
|
||||
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ALGORITHM=INPLACE;
|
||||
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL,
|
||||
ALGORITHM=INPLACE;
|
||||
|
||||
# This should not show duplicates.
|
||||
SELECT sc.pos FROM information_schema.innodb_sys_columns sc
|
||||
INNER JOIN information_schema.innodb_sys_tables st
|
||||
ON sc.TABLE_ID=st.TABLE_ID
|
||||
WHERE st.NAME='test/t1o' AND sc.NAME='FTS_DOC_ID';
|
||||
|
||||
SHOW CREATE TABLE t1o;
|
||||
|
||||
ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL,
|
||||
DROP INDEX ct, ALGORITHM=INPLACE;
|
||||
|
||||
SHOW CREATE TABLE t1o;
|
||||
|
||||
DROP TABLE t1c, t1p, sys_tables, sys_indexes, sys_foreign;
|
||||
|
||||
# Check the internal schemata of tt, t1o.
|
||||
|
||||
CREATE TABLE sys_tables SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
|
||||
WHERE NAME='test/t1o';
|
||||
CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
CREATE TABLE sys_foreign SELECT i.*
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN i WHERE FOR_NAME='test/t1o';
|
||||
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
# Ensure that there exists no hidden FTS_DOC_ID_INDEX on foo_id.
|
||||
|
||||
ALTER TABLE t1o ADD UNIQUE INDEX FTS_DOC_ID_INDEX(FTS_DOC_ID),
|
||||
ADD FULLTEXT INDEX(ct),
|
||||
CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL;
|
||||
|
||||
ALTER TABLE t1o DROP INDEX ct, DROP INDEX FTS_DOC_ID_INDEX,
|
||||
CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL;
|
||||
|
||||
ALTER TABLE t1o ADD UNIQUE INDEX FTS_DOC_ID_INDEX(foo_id);
|
||||
|
||||
ALTER TABLE t1o CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
|
||||
ADD FULLTEXT INDEX(ct);
|
||||
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL,
|
||||
ALGORITHM=INPLACE;
|
||||
|
||||
DROP TABLE sys_indexes;
|
||||
CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
DROP TABLE tt, t1o, sys_tables, sys_indexes, sys_foreign;
|
||||
|
||||
CREATE TABLE t (t TEXT, FULLTEXT(t)) ENGINE=InnoDB;
|
||||
DROP INDEX t ON t;
|
||||
|
||||
LET $regexp=/FTS_([0-9a-f_]+)([A-Z_]+)/FTS_AUX_\2/;
|
||||
--replace_regex $regexp
|
||||
SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
|
||||
WHERE name LIKE '%FTS_%' ORDER BY 1, 2;
|
||||
|
||||
SELECT sc.pos, sc.NAME FROM information_schema.innodb_sys_columns sc
|
||||
INNER JOIN information_schema.innodb_sys_tables st
|
||||
ON sc.TABLE_ID=st.TABLE_ID
|
||||
WHERE st.NAME='test/t';
|
||||
|
||||
ALTER TABLE t ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE;
|
||||
|
||||
--replace_regex $regexp
|
||||
SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
|
||||
WHERE name LIKE '%FTS_%' ORDER BY 1, 2;
|
||||
|
||||
ALTER TABLE t ADD FULLTEXT INDEX(t);
|
||||
|
||||
SELECT sc.pos, sc.NAME FROM information_schema.innodb_sys_columns sc
|
||||
INNER JOIN information_schema.innodb_sys_tables st
|
||||
ON sc.TABLE_ID=st.TABLE_ID
|
||||
WHERE st.NAME='test/t';
|
||||
|
||||
DROP TABLE t;
|
||||
|
||||
--disable_query_log
|
||||
call mtr.add_suppression("deleting orphaned .ibd file");
|
||||
--enable_query_log
|
||||
|
||||
--echo #
|
||||
--echo # Bug #19465984 INNODB DATA DICTIONARY IS NOT UPDATED WHILE
|
||||
--echo # RENAMING THE COLUMN
|
||||
--echo #
|
||||
CREATE TABLE t1(c1 INT NOT NULL, PRIMARY KEY(c1))ENGINE=INNODB;
|
||||
CREATE TABLE t2(c2 INT NOT NULL, FOREIGN KEY(c2) REFERENCES t1(c1))ENGINE=INNODB;
|
||||
SHOW CREATE TABLE t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
ALTER TABLE t1 CHANGE COLUMN c1 C1 INT;
|
||||
SHOW CREATE TABLE t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
# FIXME: MDEV-13671 InnoDB should use case-insensitive column name comparisons
|
||||
# like the rest of the server
|
||||
#ALTER TABLE t1 CHANGE COLUMN C1 c5 INT;
|
||||
SHOW CREATE TABLE t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
DROP TABLE t2, t1;
|
||||
|
||||
--echo #
|
||||
--echo # BUG 20029625 - HANDLE_FATAL_SIGNAL (SIG=11) IN
|
||||
--echo # DICT_MEM_TABLE_COL_RENAME_LOW
|
||||
--echo #
|
||||
CREATE TABLE parent(a INT, b INT, KEY(a, b)) ENGINE = InnoDB;
|
||||
CREATE TABLE t1(a1 INT, a2 INT) ENGINE = InnoDB;
|
||||
|
||||
set foreign_key_checks=0;
|
||||
ALTER TABLE t1 ADD CONSTRAINT fk_a FOREIGN KEY(a1, a2) REFERENCES parent(a, b) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE t1 CHANGE a2 a3 INT,ADD CONSTRAINT fk_1 FOREIGN KEY(a1, a3) REFERENCES parent(a, b) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
SHOW CREATE TABLE t1;
|
||||
CHECK TABLE t1;
|
||||
|
||||
ALTER TABLE t1 CHANGE a3 a4 INT;
|
||||
SHOW CREATE TABLE t1;
|
||||
CHECK TABLE t1;
|
||||
|
||||
ALTER TABLE parent CHANGE b c INT;
|
||||
SHOW CREATE TABLE t1;
|
||||
CHECK TABLE t1;
|
||||
|
||||
DROP TABLE t1, parent;
|
||||
|
||||
--echo #
|
||||
--echo #BUG#21514135 SCHEMA MISMATCH ERROR WHEN IMPORTING TABLESPACE AFTER
|
||||
--echo #DROPPING AN INDEX
|
||||
--echo #
|
||||
let $source_db = source_db;
|
||||
let $dest_db = dest_db;
|
||||
|
||||
eval CREATE DATABASE $source_db;
|
||||
eval CREATE DATABASE $dest_db;
|
||||
|
||||
eval CREATE TABLE $source_db.t1 (
|
||||
id int(11) NOT NULL,
|
||||
age int(11) DEFAULT NULL,
|
||||
name varchar(20),
|
||||
PRIMARY KEY (id),
|
||||
KEY index1 (age)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
eval ALTER TABLE $source_db.t1 DROP INDEX index1, ADD INDEX index2(name, age), algorithm=inplace;
|
||||
|
||||
--source suite/innodb/include/import.inc
|
||||
|
||||
eval ALTER TABLE $source_db.t1 DROP INDEX index2, algorithm=inplace;
|
||||
|
||||
--source suite/innodb/include/import.inc
|
||||
|
||||
eval DROP TABLE $source_db.t1;
|
||||
eval DROP DATABASE $source_db;
|
||||
eval DROP DATABASE $dest_db;
|
@ -40,6 +40,11 @@ CONSTRAINT `fk_crewRoleAssigned_pilotId` FOREIGN KEY (`crew_id`) REFERENCES `rep
|
||||
ALTER TABLE `repro`.`crew_role_assigned` COMMENT = 'innodb_read_only';
|
||||
SHOW CREATE TABLE `repro`.`crew_role_assigned`;
|
||||
|
||||
# These should be ignored in innodb_read_only mode.
|
||||
SET GLOBAL innodb_buffer_pool_load_now = ON;
|
||||
SET GLOBAL innodb_buffer_pool_dump_now = ON;
|
||||
SET GLOBAL innodb_buffer_pool_load_abort = ON;
|
||||
|
||||
-- let $restart_parameters=
|
||||
-- source include/restart_mysqld.inc
|
||||
|
||||
|
1
mysql-test/suite/innodb/t/innodb-index-debug.opt
Normal file
1
mysql-test/suite/innodb/t/innodb-index-debug.opt
Normal file
@ -0,0 +1 @@
|
||||
--innodb-sort-buffer-size=64k
|
84
mysql-test/suite/innodb/t/innodb-index-debug.test
Normal file
84
mysql-test/suite/innodb/t/innodb-index-debug.test
Normal file
@ -0,0 +1,84 @@
|
||||
-- source include/have_debug.inc
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
|
||||
let $per_table=`select @@innodb_file_per_table`;
|
||||
let $format=`select @@innodb_file_format`;
|
||||
set global innodb_file_per_table=on;
|
||||
set global innodb_file_format='Barracuda';
|
||||
|
||||
#
|
||||
# Test for BUG# 12739098, check whether trx->error_status is reset on error.
|
||||
#
|
||||
CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1)) Engine=InnoDB;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5);
|
||||
|
||||
SET @saved_debug_dbug = @@SESSION.debug_dbug;
|
||||
SET DEBUG_DBUG='+d,ib_build_indexes_too_many_concurrent_trxs, ib_rename_indexes_too_many_concurrent_trxs, ib_drop_index_too_many_concurrent_trxs';
|
||||
--error ER_TOO_MANY_CONCURRENT_TRXS
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Test for Bug#13861218 Records are not fully sorted during index creation
|
||||
#
|
||||
CREATE TABLE bug13861218 (c1 INT NOT NULL, c2 INT NOT NULL, INDEX(c2))
|
||||
ENGINE=InnoDB;
|
||||
INSERT INTO bug13861218 VALUES (8, 0), (4, 0), (0, 0);
|
||||
SET DEBUG_DBUG = '+d,ib_row_merge_buf_add_two';
|
||||
# Force creation of a PRIMARY KEY on c1 to see what happens on the index(c2).
|
||||
# No crash here, because n_uniq for c2 includes the clustered index fields
|
||||
CREATE UNIQUE INDEX ui ON bug13861218(c1);
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
DROP TABLE bug13861218;
|
||||
|
||||
CREATE TABLE bug13861218 (c1 INT NOT NULL, c2 INT UNIQUE) ENGINE=InnoDB;
|
||||
INSERT INTO bug13861218 VALUES (8, NULL), (4, NULL), (0, NULL);
|
||||
SET DEBUG_DBUG = '+d,ib_row_merge_buf_add_two';
|
||||
# Force creation of a PRIMARY KEY on c1 to see what happens on the index(c2).
|
||||
# assertion failure: ut_ad(cmp_dtuple_rec(dtuple, rec, rec_offsets) > 0)
|
||||
CREATE UNIQUE INDEX ui ON bug13861218(c1);
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
DROP TABLE bug13861218;
|
||||
|
||||
eval set global innodb_file_per_table=$per_table;
|
||||
eval set global innodb_file_format=$format;
|
||||
eval set global innodb_file_format_max=$format;
|
||||
|
||||
--echo #
|
||||
--echo # Bug #21762319 ADDING INDEXES ON EMPTY TABLE IS SLOW
|
||||
--echo # WITH LARGE INNODB_SORT_BUFFER_SIZE.
|
||||
|
||||
call mtr.add_suppression("InnoDB: Cannot create temporary merge file");
|
||||
|
||||
# Table with large data which is greater than sort buffer
|
||||
|
||||
create table t480(a serial)engine=innodb;
|
||||
insert into t480
|
||||
values(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),
|
||||
(),(),(),(),(),(),(),();
|
||||
insert into t480 select 0 from t480;
|
||||
insert into t480 select 0 from t480;
|
||||
insert into t480 select 0 from t480;
|
||||
insert into t480 select 0 from t480;
|
||||
create table t1(f1 int auto_increment not null,
|
||||
f2 char(200) not null, f3 char(200) not null,
|
||||
f4 char(200) not null,primary key(f1))engine=innodb;
|
||||
insert into t1 select NULL,'aaa','bbb','ccc' from t480;
|
||||
insert into t1 select NULL,'aaaa','bbbb','cccc' from t480;
|
||||
insert into t1 select NULL,'aaaaa','bbbbb','ccccc' from t480;
|
||||
insert into t1 select NULL,'aaaaaa','bbbbbb','cccccc' from t480;
|
||||
insert into t1 select NULL,'aaaaaaa','bbbbbbb','ccccccc' from t480;
|
||||
insert into t1 select NULL,'aaaaaaaa','bbbbbbbb','cccccccc' from t480;
|
||||
select count(*) from t1;
|
||||
|
||||
SET DEBUG_DBUG = '+d,innobase_tmpfile_creation_failure';
|
||||
--error ER_OUT_OF_RESOURCES
|
||||
alter table t1 force, algorithm=inplace;
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
drop table t1, t480;
|
36
mysql-test/suite/innodb/t/innodb-index-online-delete.test
Normal file
36
mysql-test/suite/innodb/t/innodb-index-online-delete.test
Normal file
@ -0,0 +1,36 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_debug_sync.inc
|
||||
|
||||
# Save the initial number of concurrent sessions.
|
||||
--source include/count_sessions.inc
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
|
||||
connection default;
|
||||
|
||||
CREATE TABLE t (a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB;
|
||||
INSERT INTO t VALUES(1,2),(2,3);
|
||||
|
||||
SET DEBUG_SYNC='alter_table_inplace_after_lock_downgrade SIGNAL do WAIT_FOR m';
|
||||
SET DEBUG_SYNC='innodb_after_inplace_alter_table SIGNAL scanned WAIT_FOR done';
|
||||
--send
|
||||
CREATE INDEX tb ON t(b);
|
||||
|
||||
connection con1;
|
||||
SET DEBUG_SYNC='now WAIT_FOR do';
|
||||
SET DEBUG_SYNC='row_update_for_mysql_error SIGNAL m WAIT_FOR scanned';
|
||||
--error ER_DUP_ENTRY
|
||||
UPDATE t SET a=2 WHERE a=1;
|
||||
call mtr.add_suppression('InnoDB: record in index .*tb was not found on rollback, trying to insert');
|
||||
SET DEBUG_SYNC='now SIGNAL done';
|
||||
|
||||
disconnect con1;
|
||||
|
||||
connection default;
|
||||
reap;
|
||||
SET DEBUG_SYNC='RESET';
|
||||
DROP TABLE t;
|
||||
|
||||
# Check that all connections opened by test cases in this file are really
|
||||
# gone so execution of other tests won't be affected by their presence.
|
||||
--source include/wait_until_count_sessions.inc
|
4
mysql-test/suite/innodb/t/innodb-index-online-fk.opt
Normal file
4
mysql-test/suite/innodb/t/innodb-index-online-fk.opt
Normal file
@ -0,0 +1,4 @@
|
||||
--loose-innodb-sys-tables
|
||||
--loose-innodb-sys-columns
|
||||
--loose-innodb-sys-foreign
|
||||
--loose-innodb-sys-foreign-cols
|
484
mysql-test/suite/innodb/t/innodb-index-online-fk.test
Normal file
484
mysql-test/suite/innodb/t/innodb-index-online-fk.test
Normal file
@ -0,0 +1,484 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_debug.inc
|
||||
|
||||
CREATE TABLE parent (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB;
|
||||
INSERT INTO parent VALUES(1,2),(2,3);
|
||||
|
||||
CREATE INDEX tb ON parent(b);
|
||||
|
||||
INSERT INTO parent VALUES(10,20),(20,30);
|
||||
|
||||
CREATE TABLE child (a1 INT PRIMARY KEY, a2 INT) ENGINE = InnoDB;
|
||||
|
||||
CREATE INDEX tb ON child(a2);
|
||||
|
||||
INSERT INTO child VALUES(10,20);
|
||||
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE child ADD FOREIGN KEY(a2) REFERENCES parent(b),
|
||||
ALGORITHM = INPLACE;
|
||||
|
||||
SET foreign_key_checks = 0;
|
||||
|
||||
ALTER TABLE child ADD CONSTRAINT fk_1 FOREIGN KEY (a2)
|
||||
REFERENCES parent(b) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN;
|
||||
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
|
||||
# duplicated foreign key name
|
||||
--error ER_FK_DUP_NAME
|
||||
ALTER TABLE child ADD CONSTRAINT fk_1 FOREIGN KEY (a2)
|
||||
REFERENCES parent(b) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
|
||||
SET foreign_key_checks = 1;
|
||||
|
||||
INSERT INTO child VALUES(1,2),(2,3);
|
||||
|
||||
--error ER_NO_REFERENCED_ROW_2
|
||||
INSERT INTO child VALUES(4,4);
|
||||
|
||||
SELECT * FROM parent;
|
||||
|
||||
SET foreign_key_checks = 0;
|
||||
|
||||
# This would fail. No corresponding index
|
||||
--error ER_FK_NO_INDEX_PARENT
|
||||
ALTER TABLE child ADD CONSTRAINT fk_20 FOREIGN KEY (a1, a2)
|
||||
REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
|
||||
SHOW WARNINGS;
|
||||
|
||||
SHOW ERRORS;
|
||||
|
||||
CREATE INDEX idx1 on parent(a, b);
|
||||
|
||||
ALTER TABLE child ADD CONSTRAINT fk_10 FOREIGN KEY (a1, a2)
|
||||
REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
|
||||
# This should be successful, as we added the index
|
||||
ALTER TABLE child ADD CONSTRAINT fk_2 FOREIGN KEY (a1, a2)
|
||||
REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE, ADD INDEX idx1(a1,a2),
|
||||
ALGORITHM = INPLACE;
|
||||
|
||||
ALTER TABLE child ADD CONSTRAINT fk_3 FOREIGN KEY (a1, a2)
|
||||
REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN;
|
||||
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
|
||||
SET foreign_key_checks = 1;
|
||||
|
||||
--error ER_NO_REFERENCED_ROW_2
|
||||
INSERT INTO child VALUES(5,4);
|
||||
|
||||
SHOW CREATE TABLE child;
|
||||
|
||||
DELETE FROM parent where a = 1;
|
||||
|
||||
SELECT * FROM child;
|
||||
|
||||
# Now test referenced table cannot be opened. This should work fine
|
||||
# when foreign_key_checks is set to 0
|
||||
|
||||
SET foreign_key_checks = 0;
|
||||
|
||||
# This is to test the scenario we cannot open the referenced table.
|
||||
# Since foreign_key_checks is set to 0, the foreign key should still
|
||||
# be added.
|
||||
SET @saved_debug_dbug = @@SESSION.debug_dbug;
|
||||
SET DEBUG_DBUG = '+d,innodb_test_open_ref_fail';
|
||||
ALTER TABLE child ADD CONSTRAINT fk_4 FOREIGN KEY (a1, a2)
|
||||
REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN;
|
||||
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
|
||||
SELECT t2.name, t1.name FROM information_schema.innodb_sys_columns t1, information_schema.innodb_sys_tables t2 WHERE t1.table_id = t2.table_id AND t2.name LIKE "%child" ORDER BY t1.name;
|
||||
|
||||
SELECT NAME FROM information_schema.INNODB_SYS_TABLES;
|
||||
|
||||
# this should succeed, since we disabled the foreign key check
|
||||
INSERT INTO child VALUES(5,4);
|
||||
|
||||
SET foreign_key_checks = 1;
|
||||
|
||||
--error ER_NO_REFERENCED_ROW_2
|
||||
INSERT INTO child VALUES(6,5);
|
||||
|
||||
SET foreign_key_checks = 0;
|
||||
|
||||
# Create some table with 'funny' characters, for testing the
|
||||
# error message
|
||||
CREATE TABLE `#parent` (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB;
|
||||
|
||||
CREATE INDEX tb ON `#parent`(a, b);
|
||||
|
||||
CREATE TABLE `#child` (a1 INT PRIMARY KEY, a2 INT) ENGINE = InnoDB;
|
||||
|
||||
CREATE INDEX tb ON `#child`(a1, a2);
|
||||
|
||||
# This is to test the scenario no foreign index, alter table should fail
|
||||
SET DEBUG_DBUG = '+d,innodb_test_no_foreign_idx';
|
||||
--error ER_FK_NO_INDEX_CHILD,
|
||||
ALTER TABLE `#child` ADD CONSTRAINT fk_40 FOREIGN KEY (a1, a2)
|
||||
REFERENCES `#parent`(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
|
||||
SHOW ERRORS;
|
||||
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN;
|
||||
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
|
||||
# This is to test the scenario no index on referenced table,
|
||||
# alter table should fail
|
||||
SET DEBUG_DBUG = '+d,innodb_test_no_reference_idx';
|
||||
--error ER_FK_NO_INDEX_PARENT,
|
||||
ALTER TABLE child ADD CONSTRAINT fk_42 FOREIGN KEY (a1, a2)
|
||||
REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
|
||||
SHOW ERRORS;
|
||||
|
||||
# This is to test the scenario no index on referenced table,
|
||||
# alter table should fail
|
||||
SET DEBUG_DBUG = '+d,innodb_test_wrong_fk_option';
|
||||
--error ER_FK_INCORRECT_OPTION
|
||||
ALTER TABLE child ADD CONSTRAINT fk_42 FOREIGN KEY (a1, a2)
|
||||
REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN;
|
||||
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
|
||||
# This is to test the scenario cannot add fk to the system table,
|
||||
# alter table should fail
|
||||
SET DEBUG_DBUG = '+d,innodb_test_cannot_add_fk_system';
|
||||
--error ER_FK_FAIL_ADD_SYSTEM
|
||||
ALTER TABLE `#child` ADD CONSTRAINT fk_43 FOREIGN KEY (a1, a2)
|
||||
REFERENCES `#parent`(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
|
||||
SHOW ERRORS;
|
||||
|
||||
DROP TABLE `#child`;
|
||||
DROP TABLE `#parent`;
|
||||
|
||||
# Now test add multiple foreign key constrain in a single clause
|
||||
SET foreign_key_checks = 0;
|
||||
|
||||
ALTER TABLE child ADD CONSTRAINT fk_5 FOREIGN KEY (a2) REFERENCES parent(b)
|
||||
ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT fk_6 FOREIGN KEY (a1, a2)
|
||||
REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN;
|
||||
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
|
||||
DROP TABLE child;
|
||||
DROP TABLE parent;
|
||||
|
||||
# Test a case where child's foreign key index is being dropped in the
|
||||
# same clause of adding the foreign key. In theory, MySQL will
|
||||
# automatically create a new index to meet the index requirement
|
||||
CREATE TABLE parent (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB;
|
||||
|
||||
INSERT INTO parent VALUES(1,2),(2,3);
|
||||
|
||||
CREATE INDEX tb ON parent(b);
|
||||
|
||||
INSERT INTO parent VALUES(10,20),(20,30);
|
||||
|
||||
CREATE TABLE child (a1 INT PRIMARY KEY, a2 INT) ENGINE = InnoDB;
|
||||
|
||||
CREATE INDEX tb ON child(a2);
|
||||
|
||||
INSERT INTO child VALUES(10,20);
|
||||
|
||||
SET foreign_key_checks = 0;
|
||||
|
||||
ALTER TABLE child DROP INDEX tb, ADD CONSTRAINT fk_4 FOREIGN KEY (a2)
|
||||
REFERENCES parent(b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
|
||||
SHOW CREATE TABLE child;
|
||||
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN;
|
||||
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
|
||||
SET foreign_key_checks = 1;
|
||||
|
||||
DROP TABLE child;
|
||||
|
||||
DROP TABLE parent;
|
||||
|
||||
# Test ADD FOREIGN KEY together with renaming columns.
|
||||
CREATE TABLE parent (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB;
|
||||
|
||||
INSERT INTO parent VALUES(1,2),(2,3);
|
||||
|
||||
CREATE INDEX tb ON parent(b);
|
||||
|
||||
INSERT INTO parent VALUES(10,20),(20,30);
|
||||
|
||||
CREATE TABLE child (a1 INT PRIMARY KEY, a2 INT) ENGINE = InnoDB;
|
||||
|
||||
CREATE INDEX tb ON child(a2);
|
||||
|
||||
SET foreign_key_checks = 0;
|
||||
|
||||
--error ER_KEY_COLUMN_DOES_NOT_EXITS
|
||||
ALTER TABLE child CHANGE a2 a3 INT,
|
||||
ADD CONSTRAINT fk_1 FOREIGN KEY (a2) REFERENCES parent(b)
|
||||
ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
|
||||
ALTER TABLE child CHANGE a2 a3 INT,
|
||||
ADD CONSTRAINT fk_1 FOREIGN KEY (a3) REFERENCES parent(b)
|
||||
ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
|
||||
DROP TABLE child;
|
||||
|
||||
DROP TABLE parent;
|
||||
|
||||
# Add test for add Primary key and FK on changing columns
|
||||
CREATE TABLE parent (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB;
|
||||
INSERT INTO parent VALUES(1,2),(2,3);
|
||||
|
||||
CREATE INDEX tb ON parent(b);
|
||||
|
||||
INSERT INTO parent VALUES(10,20),(20,30);
|
||||
|
||||
CREATE TABLE child (a1 INT NOT NULL, a2 INT) ENGINE = InnoDB;
|
||||
|
||||
CREATE INDEX tb ON child(a2);
|
||||
|
||||
SET foreign_key_checks = 0;
|
||||
|
||||
# Let's rebuild the table and add the FK, make the add FK failed.
|
||||
|
||||
SET DEBUG_DBUG = '+d,innodb_test_cannot_add_fk_system';
|
||||
--error ER_FK_FAIL_ADD_SYSTEM
|
||||
ALTER TABLE child ADD PRIMARY KEY idx (a3), CHANGE a1 a3 INT,
|
||||
ADD CONSTRAINT fk_1 FOREIGN KEY (a2) REFERENCES parent(b)
|
||||
ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
|
||||
SELECT t2.name, t1.name FROM information_schema.innodb_sys_columns t1, information_schema.innodb_sys_tables t2 WHERE t1.table_id = t2.table_id AND t2.name LIKE "%child" ORDER BY t1.name;
|
||||
SELECT NAME FROM information_schema.INNODB_SYS_TABLES;
|
||||
|
||||
# This should be successful. It will also check any left over
|
||||
# from previous failed operation (if dictionary entries not cleaned,
|
||||
# it will have dup key error.
|
||||
ALTER TABLE child ADD PRIMARY KEY idx (a3), CHANGE a1 a3 INT,
|
||||
ADD CONSTRAINT fk_1 FOREIGN KEY (a2) REFERENCES parent(b)
|
||||
ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
|
||||
SELECT t2.name, t1.name FROM information_schema.innodb_sys_columns t1, information_schema.innodb_sys_tables t2 WHERE t1.table_id = t2.table_id AND t2.name LIKE "%child" ORDER BY t1.name;
|
||||
SELECT NAME FROM information_schema.INNODB_SYS_TABLES;
|
||||
|
||||
SHOW CREATE TABLE child;
|
||||
|
||||
DROP TABLE child;
|
||||
|
||||
CREATE TABLE child (a1 INT NOT NULL, a2 INT) ENGINE = InnoDB;
|
||||
|
||||
# Now try primary index and FK
|
||||
ALTER TABLE child ADD PRIMARY KEY idx (a1),
|
||||
ADD CONSTRAINT fk_1 FOREIGN KEY (a2) REFERENCES parent(b)
|
||||
ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN;
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
SELECT t2.name, t1.name FROM information_schema.innodb_sys_columns t1, information_schema.innodb_sys_tables t2 WHERE t1.table_id = t2.table_id AND t2.name LIKE "%child" ORDER BY t1.name;
|
||||
SELECT NAME FROM information_schema.INNODB_SYS_TABLES;
|
||||
|
||||
SHOW CREATE TABLE child;
|
||||
|
||||
DROP TABLE child;
|
||||
|
||||
CREATE TABLE child (a1 INT NOT NULL, a2 INT) ENGINE = InnoDB;
|
||||
|
||||
ALTER TABLE child CHANGE a1 a3 INT,
|
||||
ADD CONSTRAINT fk_1 FOREIGN KEY (a3) REFERENCES parent(b)
|
||||
ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN;
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
SELECT t2.name, t1.name FROM information_schema.innodb_sys_columns t1, information_schema.innodb_sys_tables t2 WHERE t1.table_id = t2.table_id AND t2.name LIKE "%child" ORDER BY t1.name;
|
||||
SELECT NAME FROM information_schema.INNODB_SYS_TABLES;
|
||||
|
||||
SHOW CREATE TABLE child;
|
||||
|
||||
DROP TABLE child;
|
||||
|
||||
CREATE TABLE child (a1 INT NOT NULL, a2 INT) ENGINE = InnoDB;
|
||||
# Now try all three
|
||||
--error ER_FK_INCORRECT_OPTION
|
||||
ALTER TABLE child ADD PRIMARY KEY idx (a3), CHANGE a1 a3 INT,
|
||||
ADD CONSTRAINT fk_1 FOREIGN KEY (a3) REFERENCES parent(b)
|
||||
ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
|
||||
DROP TABLE parent;
|
||||
DROP TABLE child;
|
||||
|
||||
CREATE TABLE parent (a INT PRIMARY KEY, b INT NOT NULL, c INT) ENGINE = InnoDB;
|
||||
INSERT INTO parent VALUES(1,2,3),(2,3,4);
|
||||
|
||||
CREATE INDEX tb ON parent(b);
|
||||
|
||||
CREATE TABLE child (a1 INT NOT NULL, a2 INT, a3 INT) ENGINE = InnoDB;
|
||||
CREATE INDEX tb ON child(a2);
|
||||
|
||||
ALTER TABLE child
|
||||
ADD CONSTRAINT fk_a FOREIGN KEY (a2) REFERENCES parent(b)
|
||||
ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
|
||||
ALTER TABLE child
|
||||
ADD CONSTRAINT fk_b FOREIGN KEY (a1) REFERENCES parent(a),
|
||||
ALGORITHM = INPLACE;
|
||||
|
||||
ALTER TABLE child CHANGE a2 a2_new INT, CHANGE a1 a1_new INT;
|
||||
|
||||
SHOW CREATE TABLE child;
|
||||
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN;
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
|
||||
# The third add FK will fail
|
||||
--error ER_FK_NO_INDEX_PARENT
|
||||
ALTER TABLE child
|
||||
ADD CONSTRAINT fk_new_1 FOREIGN KEY (a1_new) REFERENCES parent(b),
|
||||
ADD CONSTRAINT fk_new_2 FOREIGN KEY (a2_new) REFERENCES parent(a),
|
||||
ADD CONSTRAINT fk_new_3 FOREIGN KEY (a3) REFERENCES parent(c),
|
||||
ALGORITHM = INPLACE;
|
||||
|
||||
# It should still have only 2 FKs
|
||||
SHOW CREATE TABLE child;
|
||||
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN;
|
||||
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
|
||||
#Now let's make it successful
|
||||
ALTER TABLE child
|
||||
ADD CONSTRAINT fk_new_1 FOREIGN KEY (a1_new) REFERENCES parent(b),
|
||||
ADD CONSTRAINT fk_new_2 FOREIGN KEY (a2_new) REFERENCES parent(a),
|
||||
ADD CONSTRAINT fk_new_3 FOREIGN KEY (a3) REFERENCES parent(a),
|
||||
ALGORITHM = INPLACE;
|
||||
|
||||
# It should still have 5 FKs
|
||||
SHOW CREATE TABLE child;
|
||||
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN;
|
||||
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
|
||||
DROP TABLE child;
|
||||
CREATE TABLE child (a1 INT NOT NULL, a2 INT, a3 INT) ENGINE = InnoDB;
|
||||
CREATE INDEX tb ON child(a2);
|
||||
|
||||
# Let's try this 3rd fk failure with add primary index
|
||||
--error ER_FK_NO_INDEX_PARENT
|
||||
ALTER TABLE child ADD PRIMARY KEY idx (a1),
|
||||
ADD CONSTRAINT fk_new_1 FOREIGN KEY (a1) REFERENCES parent(b),
|
||||
ADD CONSTRAINT fk_new_2 FOREIGN KEY (a2) REFERENCES parent(a),
|
||||
ADD CONSTRAINT fk_new_3 FOREIGN KEY (a3) REFERENCES parent(c),
|
||||
ALGORITHM = INPLACE;
|
||||
|
||||
# It should still have no FKs, no PRIMARY
|
||||
SHOW CREATE TABLE child;
|
||||
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN;
|
||||
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
|
||||
# make it successful
|
||||
ALTER TABLE child ADD PRIMARY KEY idx (a1),
|
||||
ADD CONSTRAINT fk_new_1 FOREIGN KEY (a1) REFERENCES parent(b),
|
||||
ADD CONSTRAINT fk_new_2 FOREIGN KEY (a2) REFERENCES parent(a),
|
||||
ADD CONSTRAINT fk_new_3 FOREIGN KEY (a3) REFERENCES parent(a),
|
||||
ALGORITHM = INPLACE;
|
||||
|
||||
# It should have 3 FKs, a new PRIMARY
|
||||
SHOW CREATE TABLE child;
|
||||
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN;
|
||||
|
||||
SELECT * from information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
|
||||
SET foreign_key_checks = 1;
|
||||
|
||||
DROP TABLE child;
|
||||
DROP TABLE parent;
|
||||
|
||||
CREATE TABLE Parent (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB;
|
||||
INSERT INTO Parent VALUES(1,2),(2,3);
|
||||
|
||||
CREATE INDEX tb ON Parent(b);
|
||||
|
||||
INSERT INTO Parent VALUES(10,20),(20,30);
|
||||
|
||||
CREATE TABLE Child (a1 INT PRIMARY KEY, a2 INT) ENGINE = InnoDB;
|
||||
|
||||
CREATE INDEX tb ON Child(a2);
|
||||
|
||||
INSERT INTO Child VALUES(10,20);
|
||||
|
||||
SET foreign_key_checks = 0;
|
||||
|
||||
ALTER TABLE Child ADD CONSTRAINT fk_1 FOREIGN KEY (a2)
|
||||
REFERENCES Parent(b) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
|
||||
DROP TABLE Child;
|
||||
DROP TABLE Parent;
|
||||
|
||||
# This is the test for bug 14594526 - FK: ASSERTION IN
|
||||
# DICT_TABLE_CHECK_FOR_DUP_INDEXES
|
||||
CREATE TABLE `t2`(a int,c int,d int) ENGINE=INNODB;
|
||||
CREATE TABLE `t3`(a int,c int,d int) ENGINE=INNODB;
|
||||
CREATE INDEX idx ON t3(a);
|
||||
|
||||
ALTER TABLE `t2` ADD CONSTRAINT `fw` FOREIGN KEY (`c`) REFERENCES t3 (a);
|
||||
|
||||
ALTER TABLE `t2` ADD CONSTRAINT `e` foreign key (`d`) REFERENCES t3(a);
|
||||
|
||||
--error ER_FK_FAIL_ADD_SYSTEM
|
||||
ALTER TABLE `t3` ADD CONSTRAINT `e` foreign key (`c`) REFERENCES `t2`(`c`) ON UPDATE SET NULL;
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
|
||||
|
||||
DROP TABLE t2;
|
||||
|
||||
DROP TABLE t3;
|
73
mysql-test/suite/innodb/t/innodb-index-online-purge.test
Normal file
73
mysql-test/suite/innodb/t/innodb-index-online-purge.test
Normal file
@ -0,0 +1,73 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_debug_sync.inc
|
||||
|
||||
# Save the initial number of concurrent sessions.
|
||||
--source include/count_sessions.inc
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
|
||||
connect (con2,localhost,root,,);
|
||||
connection default;
|
||||
|
||||
CREATE TABLE t (a INT PRIMARY KEY, c TEXT) ENGINE=InnoDB;
|
||||
CREATE TABLE u (a INT PRIMARY KEY, b INT, c INT NOT NULL) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO t VALUES (1,'aa');
|
||||
BEGIN;
|
||||
INSERT INTO u SET a=1, c=1;
|
||||
INSERT INTO u SELECT a+1,NULL,a+1 FROM u;
|
||||
INSERT INTO u SELECT a+2,NULL,a+2 FROM u;
|
||||
INSERT INTO u SELECT a+4,NULL,a+4 FROM u;
|
||||
INSERT INTO u SELECT a+8,NULL,a+8 FROM u;
|
||||
INSERT INTO u SELECT a+16,NULL,a+16 FROM u;
|
||||
INSERT INTO u SELECT a+32,NULL,a+32 FROM u;
|
||||
INSERT INTO u SELECT a+64,NULL,a+64 FROM u;
|
||||
INSERT INTO u SELECT a+128,NULL,a+64 FROM u;
|
||||
INSERT INTO u SELECT a+256,NULL,a+64 FROM u;
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
DELETE FROM u;
|
||||
|
||||
connection con2;
|
||||
SET DEBUG_SYNC='row_log_apply_before SIGNAL created_u WAIT_FOR dml_done_u';
|
||||
--send
|
||||
ALTER TABLE u ADD INDEX (c);
|
||||
|
||||
connection default;
|
||||
# Check that the above SELECT is blocked
|
||||
let $wait_condition=
|
||||
SELECT COUNT(*) = 1 from information_schema.processlist
|
||||
WHERE state = 'Waiting for table metadata lock' AND
|
||||
info = 'ALTER TABLE u ADD INDEX (c)';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
COMMIT;
|
||||
SET DEBUG_SYNC='now WAIT_FOR created_u';
|
||||
SELECT state FROM information_schema.processlist
|
||||
WHERE info='ALTER TABLE u ADD INDEX (c)';
|
||||
|
||||
connection con1;
|
||||
SET DEBUG_SYNC='row_log_apply_before SIGNAL created_t WAIT_FOR dml_done_t';
|
||||
--send
|
||||
CREATE INDEX c1 ON t (c(1));
|
||||
connection default;
|
||||
SET DEBUG_SYNC='now WAIT_FOR created_t';
|
||||
UPDATE t SET c='ab';
|
||||
# Allow purge to kick in. TODO: Trigger this faster, somehow.
|
||||
SELECT SLEEP(10);
|
||||
SET DEBUG_SYNC='now SIGNAL dml_done_u';
|
||||
connection con2;
|
||||
reap;
|
||||
SET DEBUG_SYNC='now SIGNAL dml_done_t';
|
||||
disconnect con2;
|
||||
connection con1;
|
||||
reap;
|
||||
disconnect con1;
|
||||
connection default;
|
||||
SET DEBUG_SYNC='RESET';
|
||||
DROP TABLE t,u;
|
||||
|
||||
# Check that all connections opened by test cases in this file are really
|
||||
# gone so execution of other tests won't be affected by their presence.
|
||||
--source include/wait_until_count_sessions.inc
|
6
mysql-test/suite/innodb/t/innodb-index-online.opt
Normal file
6
mysql-test/suite/innodb/t/innodb-index-online.opt
Normal file
@ -0,0 +1,6 @@
|
||||
--innodb-sort-buffer-size=64k
|
||||
--innodb-online-alter-log-max-size=64k
|
||||
--innodb-buffer-pool-size=5M
|
||||
--innodb-log-buffer-size=256k
|
||||
--innodb-sys-indexes
|
||||
--innodb-sys-fields
|
410
mysql-test/suite/innodb/t/innodb-index-online.test
Normal file
410
mysql-test/suite/innodb/t/innodb-index-online.test
Normal file
@ -0,0 +1,410 @@
|
||||
--source include/innodb_page_size_small.inc
|
||||
--source include/have_debug.inc
|
||||
--source include/have_debug_sync.inc
|
||||
|
||||
let $innodb_metrics_select=
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
|
||||
call mtr.add_suppression("InnoDB: Warning: Small buffer pool size");
|
||||
|
||||
# DISCARD TABLESPACE needs file-per-table
|
||||
SET @global_innodb_file_per_table_orig = @@global.innodb_file_per_table;
|
||||
SET GLOBAL innodb_file_per_table = on;
|
||||
|
||||
# Save the initial number of concurrent sessions.
|
||||
--source include/count_sessions.inc
|
||||
|
||||
CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, c3 TEXT)
|
||||
ENGINE=InnoDB STATS_PERSISTENT=0;
|
||||
INSERT INTO t1 VALUES (1,1,''), (2,2,''), (3,3,''), (4,4,''), (5,5,'');
|
||||
|
||||
SET GLOBAL innodb_monitor_enable = module_ddl;
|
||||
eval $innodb_metrics_select;
|
||||
|
||||
SET DEBUG_SYNC = 'RESET';
|
||||
SET DEBUG_SYNC = 'write_row_noreplace SIGNAL have_handle WAIT_FOR go_ahead';
|
||||
--send
|
||||
INSERT INTO t1 VALUES(1,2,3);
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
connection con1;
|
||||
|
||||
# This should block at the end because of the INSERT in connection default
|
||||
# is holding a metadata lock.
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR have_handle';
|
||||
SET lock_wait_timeout = 1;
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
||||
SET DEBUG_SYNC = 'now SIGNAL go_ahead';
|
||||
|
||||
connection default;
|
||||
--error ER_DUP_ENTRY
|
||||
reap;
|
||||
eval $innodb_metrics_select;
|
||||
|
||||
connection con1;
|
||||
SET @saved_debug_dbug = @@SESSION.debug_dbug;
|
||||
SET DEBUG_DBUG = '+d,innodb_OOM_prepare_inplace_alter';
|
||||
--error ER_OUT_OF_RESOURCES
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
SET DEBUG_DBUG = '+d,innodb_OOM_inplace_alter';
|
||||
--error ER_OUT_OF_RESOURCES
|
||||
CREATE UNIQUE INDEX c2 ON t1(c2);
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
CREATE UNIQUE INDEX c2 ON t1(c2);
|
||||
DROP INDEX c2 ON t1;
|
||||
|
||||
connection default;
|
||||
SHOW CREATE TABLE t1;
|
||||
# Insert a duplicate entry (4) for the upcoming UNIQUE INDEX(c2).
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(7,4,2);
|
||||
|
||||
connection con1;
|
||||
# This DEBUG_SYNC should not kick in yet, because the duplicate key will be
|
||||
# detected before we get a chance to apply the online log.
|
||||
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL scanned WAIT_FOR rollback_done';
|
||||
# This will be a lock wait timeout on the meta-data lock,
|
||||
# because the transaction inserting (7,4,2) is still active.
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
||||
connection default;
|
||||
COMMIT;
|
||||
connection con1;
|
||||
--error ER_DUP_ENTRY
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
||||
connection default;
|
||||
DELETE FROM t1 WHERE c1 = 7;
|
||||
connection con1;
|
||||
# ADD FOREIGN KEY is not supported in-place
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE t1 ADD FOREIGN KEY(c2) REFERENCES t1(c2), ALGORITHM = INPLACE;
|
||||
# The previous DEBUG_SYNC should be ignored, because an exclusive lock
|
||||
# has been requested and the online log is not being allocated.
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(c2), LOCK = EXCLUSIVE, ALGORITHM = INPLACE;
|
||||
DROP INDEX c2 ON t1;
|
||||
# Now the previous DEBUG_SYNC should kick in.
|
||||
--send
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
||||
connection default;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR scanned';
|
||||
eval $innodb_metrics_select;
|
||||
|
||||
# Insert a duplicate entry (4) for the already started UNIQUE INDEX(c2).
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(7,4,2);
|
||||
ROLLBACK;
|
||||
SET DEBUG_SYNC = 'now SIGNAL rollback_done';
|
||||
|
||||
connection con1;
|
||||
# Because the modification log will be applied in order, there will be
|
||||
# a duplicate key error on the (7,4,2) even though we roll it back.
|
||||
--error ER_DUP_ENTRY
|
||||
reap;
|
||||
# Now, create the index without any concurrent DML, while no duplicate exists.
|
||||
SET DEBUG_SYNC = 'row_log_apply_after SIGNAL created WAIT_FOR dml_done';
|
||||
--send
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
||||
connection default;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR created';
|
||||
# At this point, the index has been created inside InnoDB but not yet
|
||||
# in the MySQL data dictionary.
|
||||
eval $innodb_metrics_select;
|
||||
# A duplicate key error should now be triggered by InnoDB, but reported
|
||||
# by the ALTER TABLE because the index does not 'officially' exist yet.
|
||||
INSERT INTO t1 VALUES(6,3,1);
|
||||
SET DEBUG_SYNC = 'now SIGNAL dml_done';
|
||||
connection con1;
|
||||
# This is due to the duplicate entry (6,3,1).
|
||||
--error ER_DUP_UNKNOWN_IN_INDEX
|
||||
reap;
|
||||
DELETE FROM t1 WHERE c1=6;
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
||||
eval $innodb_metrics_select;
|
||||
|
||||
connection default;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES(6,3,1);
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES(7,4,2);
|
||||
ALTER TABLE t1 STATS_PERSISTENT=1;
|
||||
ANALYZE TABLE t1;
|
||||
# Purge may or may not have cleaned up the DELETE FROM t1 WHERE c1 = 7;
|
||||
UPDATE mysql.innodb_index_stats SET stat_value = 5
|
||||
WHERE database_name = 'test' AND table_name= 't1' AND index_name = 'PRIMARY'
|
||||
AND stat_value = 6;
|
||||
--replace_column 4 LAST_UPDATE
|
||||
SELECT * FROM mysql.innodb_index_stats WHERE table_name IN ('t1');
|
||||
CREATE TABLE t1_c2_stats SELECT * FROM mysql.innodb_index_stats
|
||||
WHERE database_name = 'test' AND table_name = 't1' and index_name = 'c2';
|
||||
# in Embedded mode (./mtr --embedded-server) the t1_c2_stats table gets
|
||||
# created in MyISAM format by default even if we set
|
||||
# default_storage_engine='innodb'
|
||||
ALTER TABLE t1_c2_stats ENGINE=INNODB;
|
||||
DROP INDEX c2 ON t1;
|
||||
ANALYZE TABLE t1_c2_stats;
|
||||
--replace_column 4 LAST_UPDATE
|
||||
SELECT * FROM mysql.innodb_index_stats WHERE table_name IN ('t1', 't1_c2_stats');
|
||||
|
||||
connection con1;
|
||||
let $ID= `SELECT @id := CONNECTION_ID()`;
|
||||
--error ER_QUERY_INTERRUPTED
|
||||
KILL QUERY @id;
|
||||
|
||||
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2d_created WAIT_FOR kill_done';
|
||||
--send
|
||||
CREATE INDEX c2d ON t1(c2);
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR c2d_created';
|
||||
eval $innodb_metrics_select;
|
||||
let $ignore= `SELECT @id := $ID`;
|
||||
KILL QUERY @id;
|
||||
SET DEBUG_SYNC = 'now SIGNAL kill_done';
|
||||
|
||||
connection con1;
|
||||
--error ER_QUERY_INTERRUPTED
|
||||
reap;
|
||||
eval $innodb_metrics_select;
|
||||
|
||||
connection default;
|
||||
CHECK TABLE t1;
|
||||
INSERT INTO t1 SELECT 5 + c1, c2, c3 FROM t1;
|
||||
INSERT INTO t1 SELECT 10 + c1, c2, c3 FROM t1;
|
||||
INSERT INTO t1 SELECT 20 + c1, c2, c3 FROM t1;
|
||||
INSERT INTO t1 SELECT 40 + c1, c2, c3 FROM t1;
|
||||
# Purge may or may not have cleaned up the DELETE FROM t1 WHERE c1 = 7;
|
||||
--replace_result 81 80
|
||||
EXPLAIN SELECT COUNT(*) FROM t1 WHERE c2 > 3;
|
||||
ANALYZE TABLE t1;
|
||||
|
||||
connection con1;
|
||||
# Forge some statistics for c2d, and see that they will be used
|
||||
UPDATE t1_c2_stats SET index_name = 'c2d';
|
||||
# Fake the statistics. The cardinality should be 5,80.
|
||||
UPDATE t1_c2_stats SET stat_value = 2 WHERE stat_name = 'n_diff_pfx01';
|
||||
INSERT INTO t1_c2_stats
|
||||
SELECT database_name, table_name, index_name, last_update, 'n_diff_pfx02', 80,
|
||||
sample_size, 'c2,c1' FROM t1_c2_stats
|
||||
WHERE stat_name = 'n_diff_pfx01' AND stat_description = 'c2';
|
||||
INSERT INTO mysql.innodb_index_stats SELECT * FROM t1_c2_stats;
|
||||
DROP TABLE t1_c2_stats;
|
||||
|
||||
CREATE INDEX c2d ON t1(c2);
|
||||
# This should show the newly calculated stats by CREATE INDEX above,
|
||||
# not the faked cardinality=4 for c2d(c2).
|
||||
# Purge may or may not have cleaned up the DELETE FROM t1 WHERE c1 = 7;
|
||||
--replace_result 81 80
|
||||
SHOW INDEX FROM t1;
|
||||
EXPLAIN SELECT COUNT(*) FROM t1 WHERE c2 > 3;
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
# Exceed the configured innodb_online_alter_log_max_size.
|
||||
# The actual limit is a multiple of innodb_sort_buf_size,
|
||||
# because that is the size of the in-memory log buffers.
|
||||
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2e_created WAIT_FOR dml2_done';
|
||||
# Ensure that the ALTER TABLE will be executed even with some concurrent DML.
|
||||
SET lock_wait_timeout = 10;
|
||||
--send
|
||||
# FIXME: MDEV-13668
|
||||
#ALTER TABLE t1 CHANGE c2 c22 INT, DROP INDEX c2d, ADD INDEX c2e(c22),
|
||||
ALTER TABLE t1 DROP INDEX c2d, ADD INDEX c2e(c2),
|
||||
ALGORITHM = INPLACE;
|
||||
|
||||
# Generate some log (delete-mark, delete-unmark, insert etc.)
|
||||
# while the index creation is blocked. Some of this may run
|
||||
# in parallel with the clustered index scan.
|
||||
connection default;
|
||||
INSERT INTO t1 SELECT 80 + c1, c2, c3 FROM t1;
|
||||
INSERT INTO t1 SELECT 160 + c1, c2, c3 FROM t1;
|
||||
#UPDATE t1 SET c2 = c2 + 1;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR c2e_created';
|
||||
# At this point, the clustered index scan must have completed,
|
||||
# but the modification log keeps accumulating due to the DEBUG_SYNC.
|
||||
eval $innodb_metrics_select;
|
||||
let $c= 2;
|
||||
while ($c)
|
||||
{
|
||||
BEGIN;
|
||||
DELETE FROM t1;
|
||||
ROLLBACK;
|
||||
UPDATE t1 SET c2 = c2 + 1;
|
||||
BEGIN;
|
||||
UPDATE t1 SET c2 = c2 + 1;
|
||||
DELETE FROM t1;
|
||||
ROLLBACK;
|
||||
dec $c;
|
||||
}
|
||||
# Incomplete index c2e should exist until the DDL thread notices the overflow.
|
||||
# (The output below strips TEMP_INDEX_PREFIX from the name.)
|
||||
eval $innodb_metrics_select;
|
||||
SELECT sf.name, sf.pos FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES si
|
||||
INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_FIELDS sf
|
||||
ON si.index_id = sf.index_id WHERE si.name = '?c2e';
|
||||
|
||||
# Release con1.
|
||||
SET DEBUG_SYNC = 'now SIGNAL dml2_done';
|
||||
|
||||
connection con1;
|
||||
# If the following fails with the wrong error, it probably means that
|
||||
# you should rerun with a larger mtr --debug-sync-timeout.
|
||||
--error ER_INNODB_ONLINE_LOG_TOO_BIG
|
||||
reap;
|
||||
# The index c2e should have been dropped from the data dictionary
|
||||
# when the above error was noticed. It should still exist in the
|
||||
# cache with index->online_status = ONLINE_INDEX_ABORTED_DROPPED.
|
||||
eval $innodb_metrics_select;
|
||||
SELECT sf.name, sf.pos FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES si
|
||||
INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_FIELDS sf
|
||||
ON si.index_id = sf.index_id WHERE si.name = 'c2e';
|
||||
|
||||
# ddl_background_drop_indexes = 1 here, because the incomplete index c2e still
|
||||
# exists in the InnoDB data dictionary cache.
|
||||
eval $innodb_metrics_select;
|
||||
|
||||
connection default;
|
||||
|
||||
ALTER TABLE t1 COMMENT 'testing if c2e will be dropped';
|
||||
|
||||
# Check that the 'zombie' index c2e was dropped.
|
||||
eval $innodb_metrics_select;
|
||||
|
||||
connection con1;
|
||||
# Accumulate and apply some modification log.
|
||||
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2f_created WAIT_FOR dml3_done';
|
||||
--send
|
||||
# FIXME: MDEV-13668
|
||||
#ALTER TABLE t1 ADD INDEX c2f(c22f), CHANGE c2 c22f INT;
|
||||
ALTER TABLE t1 ADD INDEX c2f(c2);
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR c2f_created';
|
||||
# Generate some log (delete-mark, delete-unmark, insert etc.)
|
||||
eval $innodb_metrics_select;
|
||||
BEGIN;
|
||||
INSERT INTO t1 SELECT 320 + c1, c2, c3 FROM t1 WHERE c1 > 160;
|
||||
DELETE FROM t1 WHERE c1 > 320;
|
||||
ROLLBACK;
|
||||
BEGIN;
|
||||
UPDATE t1 SET c2 = c2 + 1;
|
||||
DELETE FROM t1;
|
||||
ROLLBACK;
|
||||
eval $innodb_metrics_select;
|
||||
# Release con1.
|
||||
SET DEBUG_SYNC = 'now SIGNAL dml3_done';
|
||||
|
||||
connection con1;
|
||||
reap;
|
||||
# FIXME: MDEV-13668
|
||||
ALTER TABLE t1 CHANGE c2 c22f INT;
|
||||
|
||||
eval $innodb_metrics_select;
|
||||
SELECT COUNT(c22f) FROM t1;
|
||||
CHECK TABLE t1;
|
||||
|
||||
# Create a column prefix index.
|
||||
--error ER_DUP_ENTRY
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX c3p5(c3(5));
|
||||
UPDATE t1 SET c3 = NULL WHERE c3 = '';
|
||||
SET lock_wait_timeout = 1;
|
||||
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c3p5_created WAIT_FOR ins_done';
|
||||
--send
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX c3p5(c3(5));
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR c3p5_created';
|
||||
|
||||
# Check that the index was created.
|
||||
SELECT sf.name, sf.pos FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES si
|
||||
INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_FIELDS sf
|
||||
ON si.index_id = sf.index_id WHERE si.name = '?c3p5';
|
||||
|
||||
SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL ins_done WAIT_FOR ddl_timed_out';
|
||||
--send
|
||||
INSERT INTO t1 VALUES(347,33101,NULL);
|
||||
|
||||
connection con1;
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
reap;
|
||||
SET DEBUG_SYNC = 'now SIGNAL ddl_timed_out';
|
||||
|
||||
# InnoDB should have cleaned up the index c3p5 from the data dictionary,
|
||||
# but not yet from the dictionary cache.
|
||||
SELECT sf.name, sf.pos FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES si
|
||||
INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_FIELDS sf
|
||||
ON si.index_id = sf.index_id WHERE si.name = 'c3p5';
|
||||
eval $innodb_metrics_select;
|
||||
|
||||
connection default;
|
||||
reap;
|
||||
# Index c3p5 should still exist in the data dictionary cache.
|
||||
eval $innodb_metrics_select;
|
||||
|
||||
--disable_parsing
|
||||
# Temporarily disabled by fix for bug#14213236. Should be either
|
||||
# removed or updated to take into account that locking for IMPORT/
|
||||
# DISCARD TABLESPACE happens on MDL layer. New test case is added
|
||||
# to validate this at MDL layer(i_main.alter_table.test)
|
||||
|
||||
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2g_created WAIT_FOR dml4_done';
|
||||
# The lock upgrade at the end of the ALTER will conflict with the DISCARD.
|
||||
SET lock_wait_timeout = 1;
|
||||
--send
|
||||
ALTER TABLE t1 DROP INDEX c2f, ADD INDEX c2g(c22f);
|
||||
|
||||
connection con1;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR c2g_created';
|
||||
|
||||
connect (con2,localhost,root,,);
|
||||
connection con2;
|
||||
|
||||
# This will conflict with the ALTER in connection default, above.
|
||||
SET lock_wait_timeout = 10;
|
||||
--send
|
||||
ALTER TABLE t1 DISCARD TABLESPACE;
|
||||
|
||||
connection con1;
|
||||
let $wait_condition=
|
||||
SELECT COUNT(*) = 1 FROM information_schema.processlist
|
||||
WHERE state = 'Waiting for table level lock' and
|
||||
info = 'ALTER TABLE t1 DISCARD TABLESPACE';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
SET DEBUG_SYNC = 'now SIGNAL dml4_done';
|
||||
disconnect con1;
|
||||
connection con2;
|
||||
reap;
|
||||
disconnect con2;
|
||||
connection default;
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
reap;
|
||||
--enable_parsing
|
||||
#remove below con1 disconnect if above test case is enabled
|
||||
connection con1;
|
||||
disconnect con1;
|
||||
connection default;
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
ALTER TABLE t1 DROP INDEX c2d, DROP INDEX c2f;
|
||||
# The ALTER TABLE should have cleaned up c3p5 from the cache.
|
||||
eval $innodb_metrics_select;
|
||||
ALTER TABLE t1 ADD INDEX c2h(c22f), ALGORITHM = INPLACE;
|
||||
--error ER_DUP_KEYNAME
|
||||
ALTER TABLE t1 ADD INDEX c2h(c22f), ALGORITHM = COPY;
|
||||
|
||||
SET DEBUG_SYNC = 'RESET';
|
||||
SET GLOBAL innodb_monitor_disable = module_ddl;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
# Check that all connections opened by test cases in this file are really
|
||||
# gone so execution of other tests won't be affected by their presence.
|
||||
--source include/wait_until_count_sessions.inc
|
||||
|
||||
SET GLOBAL innodb_file_per_table = @global_innodb_file_per_table_orig;
|
||||
--disable_warnings
|
||||
SET GLOBAL innodb_monitor_enable = default;
|
||||
SET GLOBAL innodb_monitor_disable = default;
|
||||
--enable_warnings
|
1
mysql-test/suite/innodb/t/innodb-table-online-master.opt
Normal file
1
mysql-test/suite/innodb/t/innodb-table-online-master.opt
Normal file
@ -0,0 +1 @@
|
||||
--innodb-sort-buffer-size=64k --innodb-online-alter-log-max-size=64k --innodb-buffer-pool-size=5M --innodb-log-buffer-size=256k
|
385
mysql-test/suite/innodb/t/innodb-table-online.test
Normal file
385
mysql-test/suite/innodb/t/innodb-table-online.test
Normal file
@ -0,0 +1,385 @@
|
||||
--source include/innodb_page_size.inc
|
||||
--source include/have_debug.inc
|
||||
--source include/have_debug_sync.inc
|
||||
|
||||
let $innodb_metrics_select=
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
|
||||
call mtr.add_suppression("InnoDB: Warning: Small buffer pool size");
|
||||
# these will be triggered by DISCARD TABLESPACE
|
||||
call mtr.add_suppression("InnoDB: Error: table 'test/t1'");
|
||||
call mtr.add_suppression("MySQL is trying to open a table handle but the .ibd file for");
|
||||
|
||||
# DISCARD TABLESPACE needs file-per-table
|
||||
SET @global_innodb_file_per_table_orig = @@global.innodb_file_per_table;
|
||||
SET GLOBAL innodb_file_per_table = on;
|
||||
|
||||
# Save the initial number of concurrent sessions.
|
||||
--source include/count_sessions.inc
|
||||
|
||||
CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT NOT NULL, c3 TEXT NOT NULL)
|
||||
ENGINE = InnoDB;
|
||||
INSERT INTO t1 VALUES (1,1,''), (2,2,''), (3,3,''), (4,4,''), (5,5,'');
|
||||
|
||||
SET GLOBAL innodb_monitor_enable = module_ddl;
|
||||
eval $innodb_metrics_select;
|
||||
|
||||
SET DEBUG_SYNC = 'RESET';
|
||||
SET DEBUG_SYNC = 'write_row_noreplace SIGNAL have_handle WAIT_FOR go_ahead';
|
||||
--send
|
||||
INSERT INTO t1 VALUES(1,2,3);
|
||||
|
||||
--echo # Establish session con1 (user=root)
|
||||
connect (con1,localhost,root,,);
|
||||
connection con1;
|
||||
|
||||
# This should block at the end because of the INSERT in connection default
|
||||
# is holding a metadata lock.
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR have_handle';
|
||||
SET lock_wait_timeout = 1;
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
|
||||
SET DEBUG_SYNC = 'now SIGNAL go_ahead';
|
||||
|
||||
--echo # session default
|
||||
connection default;
|
||||
--error ER_DUP_ENTRY
|
||||
reap;
|
||||
eval $innodb_metrics_select;
|
||||
|
||||
--echo # session con1
|
||||
connection con1;
|
||||
SET @saved_debug_dbug = @@SESSION.debug_dbug;
|
||||
SET DEBUG_DBUG = '+d,innodb_OOM_prepare_inplace_alter';
|
||||
--error ER_OUT_OF_RESOURCES
|
||||
ALTER TABLE t1 ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE, LOCK=NONE;
|
||||
SET SESSION DEBUG = @saved_debug_dbug;
|
||||
SET SESSION DEBUG = '+d,innodb_OOM_inplace_alter';
|
||||
--error ER_OUT_OF_RESOURCES
|
||||
ALTER TABLE t1 ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE, LOCK=NONE;
|
||||
SET SESSION DEBUG = @saved_debug_dbug;
|
||||
ALTER TABLE t1 ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE, LOCK=NONE;
|
||||
|
||||
--echo # session default
|
||||
connection default;
|
||||
SHOW CREATE TABLE t1;
|
||||
# Insert a duplicate entry (4) for the upcoming UNIQUE INDEX(c2).
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(7,4,2);
|
||||
|
||||
--echo # session con1
|
||||
connection con1;
|
||||
# This DEBUG_SYNC should not kick in yet, because the duplicate key will be
|
||||
# detected before we get a chance to apply the online log.
|
||||
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL scanned WAIT_FOR insert_done';
|
||||
# This will be a lock wait timeout on the meta-data lock,
|
||||
# because the transaction inserting (7,4,2) is still active.
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD UNIQUE INDEX(c2);
|
||||
|
||||
--echo # session default
|
||||
connection default;
|
||||
COMMIT;
|
||||
|
||||
--echo # session con1
|
||||
connection con1;
|
||||
--error ER_DUP_ENTRY
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD UNIQUE INDEX(c2);
|
||||
|
||||
--echo # session default
|
||||
connection default;
|
||||
DELETE FROM t1 WHERE c1 = 7;
|
||||
|
||||
--echo # session con1
|
||||
connection con1;
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD UNIQUE INDEX(c2), ROW_FORMAT=COMPACT,
|
||||
LOCK = SHARED, ALGORITHM = INPLACE;
|
||||
|
||||
# The previous DEBUG_SYNC should be ignored, because an exclusive lock
|
||||
# has been requested and the online log is not being allocated.
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(c2),
|
||||
LOCK = EXCLUSIVE, ALGORITHM = INPLACE;
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
# We do not support plain DROP_PK_INDEX without ADD_PK_INDEX.
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE t1 DROP INDEX c2, ALGORITHM = INPLACE;
|
||||
SHOW CREATE TABLE t1;
|
||||
# Now the previous DEBUG_SYNC should kick in.
|
||||
--send
|
||||
ALTER TABLE t1 DROP INDEX c2, ADD PRIMARY KEY(c1);
|
||||
|
||||
--echo # session default
|
||||
connection default;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR scanned';
|
||||
eval $innodb_metrics_select;
|
||||
|
||||
# Insert a duplicate entry (4) for the already started UNIQUE INDEX(c1).
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(4,7,2);
|
||||
SET DEBUG_SYNC = 'now SIGNAL insert_done';
|
||||
|
||||
--echo # session con1
|
||||
connection con1;
|
||||
# Because the modification log will be applied in order and we did
|
||||
# not roll back before the log apply, there will be a duplicate key
|
||||
# error on the (4,7,2).
|
||||
--error ER_DUP_ENTRY
|
||||
reap;
|
||||
|
||||
--echo # session default
|
||||
connection default;
|
||||
ROLLBACK;
|
||||
|
||||
--echo # session con1
|
||||
connection con1;
|
||||
SHOW CREATE TABLE t1;
|
||||
# Now, rebuild the table without any concurrent DML, while no duplicate exists.
|
||||
--error ER_CANT_DROP_FIELD_OR_KEY
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD UNIQUE INDEX(c2), ALGORITHM = INPLACE;
|
||||
ALTER TABLE t1 DROP INDEX c2, ADD PRIMARY KEY(c1), ALGORITHM = INPLACE;
|
||||
eval $innodb_metrics_select;
|
||||
|
||||
--echo # session default
|
||||
connection default;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES(6,3,1);
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES(7,4,2);
|
||||
DROP INDEX c2_2 ON t1;
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(7,4,2);
|
||||
ROLLBACK;
|
||||
|
||||
--echo # session con1
|
||||
connection con1;
|
||||
let $ID= `SELECT @id := CONNECTION_ID()`;
|
||||
--error ER_QUERY_INTERRUPTED
|
||||
KILL QUERY @id;
|
||||
|
||||
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuilt WAIT_FOR dml_done';
|
||||
SET DEBUG_SYNC = 'row_log_table_apply2_before SIGNAL applied WAIT_FOR kill_done';
|
||||
--send
|
||||
ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
|
||||
|
||||
--echo # session default
|
||||
connection default;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR rebuilt';
|
||||
eval $innodb_metrics_select;
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(7,4,2);
|
||||
ROLLBACK;
|
||||
SET DEBUG_SYNC = 'now SIGNAL dml_done WAIT_FOR applied';
|
||||
let $ignore= `SELECT @id := $ID`;
|
||||
KILL QUERY @id;
|
||||
SET DEBUG_SYNC = 'now SIGNAL kill_done';
|
||||
|
||||
--echo # session con1
|
||||
connection con1;
|
||||
--error ER_QUERY_INTERRUPTED
|
||||
reap;
|
||||
eval $innodb_metrics_select;
|
||||
|
||||
--echo # session default
|
||||
connection default;
|
||||
CHECK TABLE t1;
|
||||
INSERT INTO t1 SELECT 5 + c1, c2, c3 FROM t1;
|
||||
INSERT INTO t1 SELECT 10 + c1, c2, c3 FROM t1;
|
||||
INSERT INTO t1 SELECT 20 + c1, c2, c3 FROM t1;
|
||||
INSERT INTO t1 SELECT 40 + c1, c2, c3 FROM t1;
|
||||
# Purge may or may not have cleaned up the DELETE FROM t1 WHERE c1 = 7;
|
||||
--replace_result 81 80
|
||||
EXPLAIN SELECT COUNT(*) FROM t1 WHERE c2 > 3;
|
||||
ANALYZE TABLE t1;
|
||||
|
||||
--echo # session con1
|
||||
connection con1;
|
||||
SHOW CREATE TABLE t1;
|
||||
ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
|
||||
|
||||
# Exceed the configured innodb_online_alter_log_max_size.
|
||||
# The actual limit is a multiple of innodb_sort_buf_size,
|
||||
# because that is the size of the in-memory log buffers.
|
||||
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuilt2 WAIT_FOR dml2_done';
|
||||
# Ensure that the ALTER TABLE will be executed even with some concurrent DML.
|
||||
SET lock_wait_timeout = 10;
|
||||
--send
|
||||
ALTER TABLE t1 ROW_FORMAT=COMPACT, ALGORITHM = INPLACE;
|
||||
|
||||
# Generate some log (delete-mark, delete-unmark, insert etc.)
|
||||
# while the index creation is blocked. Some of this may run
|
||||
# in parallel with the clustered index scan.
|
||||
--echo # session default
|
||||
connection default;
|
||||
INSERT INTO t1 SELECT 80 + c1, c2, c3 FROM t1;
|
||||
INSERT INTO t1 SELECT 160 + c1, c2, c3 FROM t1;
|
||||
UPDATE t1 SET c2 = c2 + 1;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR rebuilt2';
|
||||
# At this point, the clustered index scan must have completed,
|
||||
# but the modification log keeps accumulating due to the DEBUG_SYNC.
|
||||
eval $innodb_metrics_select;
|
||||
let $c= 3;
|
||||
while ($c)
|
||||
{
|
||||
BEGIN;
|
||||
DELETE FROM t1;
|
||||
ROLLBACK;
|
||||
UPDATE t1 SET c2 = c2 + 1;
|
||||
BEGIN;
|
||||
UPDATE t1 SET c2 = c2 + 1;
|
||||
DELETE FROM t1;
|
||||
ROLLBACK;
|
||||
dec $c;
|
||||
}
|
||||
# Temporary table should exist until the DDL thread notices the overflow.
|
||||
eval $innodb_metrics_select;
|
||||
|
||||
# Release con1.
|
||||
SET DEBUG_SYNC = 'now SIGNAL dml2_done';
|
||||
|
||||
--echo # session con1
|
||||
connection con1;
|
||||
# If the following fails with the wrong error, it probably means that
|
||||
# you should rerun with a larger mtr --debug-sync-timeout.
|
||||
--error ER_INNODB_ONLINE_LOG_TOO_BIG
|
||||
reap;
|
||||
# The table should have been dropped from the data dictionary
|
||||
# when the above error was noticed.
|
||||
eval $innodb_metrics_select;
|
||||
|
||||
# Accumulate and apply some modification log.
|
||||
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuilt3 WAIT_FOR dml3_done';
|
||||
--error ER_MULTIPLE_PRI_KEY
|
||||
ALTER TABLE t1 ADD PRIMARY KEY(c22f), CHANGE c2 c22f INT;
|
||||
--error ER_DUP_ENTRY
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(c22f), CHANGE c2 c22f INT;
|
||||
--send
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(c1,c22f,c4(5)),
|
||||
CHANGE c2 c22f INT, CHANGE c3 c3 TEXT NULL, CHANGE c1 c1 INT AFTER c22f,
|
||||
ADD COLUMN c4 VARCHAR(6) DEFAULT 'Online';
|
||||
|
||||
--echo # session default
|
||||
connection default;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR rebuilt3';
|
||||
# Generate some log (delete-mark, delete-unmark, insert etc.)
|
||||
eval $innodb_metrics_select;
|
||||
BEGIN;
|
||||
INSERT INTO t1 SELECT 320 + c1, c2, c3 FROM t1 WHERE c1 > 240;
|
||||
DELETE FROM t1 WHERE c1 > 320;
|
||||
ROLLBACK;
|
||||
BEGIN;
|
||||
UPDATE t1 SET c2 = c2 + 1;
|
||||
DELETE FROM t1;
|
||||
ROLLBACK;
|
||||
eval $innodb_metrics_select;
|
||||
# Release con1.
|
||||
SET DEBUG_SYNC = 'now SIGNAL dml3_done';
|
||||
|
||||
--echo # session con1
|
||||
connection con1;
|
||||
reap;
|
||||
eval $innodb_metrics_select;
|
||||
SELECT COUNT(c22f) FROM t1;
|
||||
CHECK TABLE t1;
|
||||
|
||||
# Create a column prefix index.
|
||||
--error ER_DUP_ENTRY
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY c3p5(c3(5));
|
||||
UPDATE t1 SET c3 = NULL WHERE c3 = '';
|
||||
SET lock_wait_timeout = 1;
|
||||
--error ER_MULTIPLE_PRI_KEY
|
||||
ALTER TABLE t1 DROP COLUMN c22f, ADD PRIMARY KEY c3p5(c3(5));
|
||||
SET @old_sql_mode = @@sql_mode;
|
||||
# NULL -> NOT NULL only allowed INPLACE if strict sql_mode is on.
|
||||
# And adding a PRIMARY KEY will also add NOT NULL implicitly!
|
||||
SET @@sql_mode = 'STRICT_TRANS_TABLES';
|
||||
--error ER_INVALID_USE_OF_NULL
|
||||
ALTER TABLE t1 DROP COLUMN c22f, DROP PRIMARY KEY, ADD PRIMARY KEY c3p5(c3(5)),
|
||||
ALGORITHM = INPLACE;
|
||||
|
||||
--error ER_INVALID_USE_OF_NULL
|
||||
ALTER TABLE t1 MODIFY c3 TEXT NOT NULL;
|
||||
SET @@sql_mode = @old_sql_mode;
|
||||
UPDATE t1 SET c3=CONCAT(c1,REPEAT('foo',c1)) WHERE c3 IS NULL;
|
||||
|
||||
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL c3p5_created0 WAIT_FOR ins_done0';
|
||||
# NULL -> NOT NULL only allowed INPLACE if strict sql_mode is on.
|
||||
SET @@sql_mode = 'STRICT_TRANS_TABLES';
|
||||
--send
|
||||
ALTER TABLE t1 MODIFY c3 TEXT NOT NULL, DROP COLUMN c22f,
|
||||
ADD COLUMN c5 CHAR(5) DEFAULT 'tired' FIRST;
|
||||
|
||||
--echo # session default
|
||||
connection default;
|
||||
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR c3p5_created0';
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(347,33101,'Pikku kakkosen posti','YLETV2');
|
||||
INSERT INTO t1 VALUES(33101,347,NULL,'');
|
||||
SET DEBUG_SYNC = 'now SIGNAL ins_done0';
|
||||
|
||||
--echo # session con1
|
||||
connection con1;
|
||||
--error ER_INVALID_USE_OF_NULL
|
||||
reap;
|
||||
SET @@sql_mode = @old_sql_mode;
|
||||
|
||||
--echo # session default
|
||||
connection default;
|
||||
ROLLBACK;
|
||||
|
||||
--echo # session con1
|
||||
connection con1;
|
||||
ALTER TABLE t1 MODIFY c3 TEXT NOT NULL;
|
||||
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL c3p5_created WAIT_FOR ins_done';
|
||||
--send
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, DROP COLUMN c22f,
|
||||
ADD COLUMN c6 VARCHAR(1000) DEFAULT
|
||||
'I love tracking down hard-to-reproduce bugs.',
|
||||
ADD PRIMARY KEY c3p5(c3(5), c6(2));
|
||||
|
||||
--echo # session default
|
||||
connection default;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR c3p5_created';
|
||||
SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL ins_done WAIT_FOR ddl_timed_out';
|
||||
--error ER_BAD_NULL_ERROR
|
||||
INSERT INTO t1 VALUES(347,33101,NULL,'');
|
||||
--send
|
||||
INSERT INTO t1 VALUES(347,33101,'Pikku kakkosen posti','');
|
||||
|
||||
--echo # session con1
|
||||
connection con1;
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
reap;
|
||||
SET DEBUG_SYNC = 'now SIGNAL ddl_timed_out';
|
||||
eval $innodb_metrics_select;
|
||||
|
||||
--echo # session default
|
||||
connection default;
|
||||
reap;
|
||||
SELECT COUNT(*) FROM t1;
|
||||
ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
|
||||
SELECT * FROM t1 LIMIT 10;
|
||||
|
||||
--echo # session con1
|
||||
connection con1;
|
||||
ALTER TABLE t1 DISCARD TABLESPACE;
|
||||
--echo # Disconnect session con1
|
||||
disconnect con1;
|
||||
|
||||
--echo # session default
|
||||
connection default;
|
||||
SHOW CREATE TABLE t1;
|
||||
SET DEBUG_SYNC = 'RESET';
|
||||
SET GLOBAL innodb_monitor_disable = module_ddl;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Check that all connections opened by test cases in this file are really
|
||||
# gone so execution of other tests won't be affected by their presence.
|
||||
--source include/wait_until_count_sessions.inc
|
||||
|
||||
SET GLOBAL innodb_file_per_table = @global_innodb_file_per_table_orig;
|
||||
--disable_warnings
|
||||
SET GLOBAL innodb_monitor_enable = default;
|
||||
SET GLOBAL innodb_monitor_disable = default;
|
||||
--enable_warnings
|
3
mysql-test/suite/innodb/t/innodb-wl5980-alter.opt
Normal file
3
mysql-test/suite/innodb/t/innodb-wl5980-alter.opt
Normal file
@ -0,0 +1,3 @@
|
||||
--loose-innodb-sys-indexes
|
||||
--loose-innodb-sys-columns
|
||||
--loose-innodb-sys-fields
|
593
mysql-test/suite/innodb/t/innodb-wl5980-alter.test
Normal file
593
mysql-test/suite/innodb/t/innodb-wl5980-alter.test
Normal file
@ -0,0 +1,593 @@
|
||||
--echo #
|
||||
--echo # This is a copy of innodb-alter.test except using remote tablespaces
|
||||
--echo # and showing those files.
|
||||
--echo #
|
||||
|
||||
--source include/have_innodb.inc
|
||||
|
||||
--disable_query_log
|
||||
# These values can change during the test
|
||||
LET $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
|
||||
LET $regexp=/FTS_([0-9a-f_]+)([A-Z0-9_]+)\.ibd/FTS_AUX_\2.ibd/;
|
||||
|
||||
# Set up some variables
|
||||
LET $MYSQL_DATA_DIR = `select @@datadir`;
|
||||
LET $data_directory_clause = DATA DIRECTORY='$MYSQL_TMP_DIR/alt_dir';
|
||||
--enable_query_log
|
||||
|
||||
SET default_storage_engine=InnoDB;
|
||||
SET GLOBAL innodb_file_per_table=ON;
|
||||
|
||||
SET NAMES utf8;
|
||||
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
eval CREATE TABLE t1 (
|
||||
c1 INT PRIMARY KEY, c2 INT DEFAULT 1, ct TEXT,
|
||||
INDEX(c2))
|
||||
ENGINE=InnoDB $data_directory_clause;
|
||||
|
||||
INSERT INTO t1 SET c1=1;
|
||||
|
||||
CREATE TABLE sys_tables SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
|
||||
WHERE NAME LIKE 'test/t%';
|
||||
CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
|
||||
CREATE TABLE t1p LIKE t1;
|
||||
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
eval CREATE TABLE t1c (c1 INT PRIMARY KEY, c2 INT, c3 INT, INDEX(c2), INDEX(c3),
|
||||
CONSTRAINT t1c2 FOREIGN KEY (c2) REFERENCES t1(c2),
|
||||
CONSTRAINT t1c3 FOREIGN KEY (c3) REFERENCES t1p(c2))
|
||||
ENGINE=InnoDB $data_directory_clause;
|
||||
|
||||
CREATE TABLE sys_foreign SELECT i.*
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN i
|
||||
WHERE FOR_NAME LIKE 'test/t%';
|
||||
|
||||
SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i
|
||||
INNER JOIN sys_foreign sf ON i.ID = sf.ID;
|
||||
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
SHOW CREATE TABLE t1;
|
||||
ALTER TABLE t1 ALTER c2 DROP DEFAULT;
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
# These should be no-op.
|
||||
ALTER TABLE t1 CHANGE c2 c2 INT AFTER c1;
|
||||
ALTER TABLE t1 CHANGE c1 c1 INT FIRST;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
ALTER TABLE t1 CHANGE C2 c3 INT;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
ALTER TABLE t1 CHANGE c3 C INT;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
ALTER TABLE t1 CHANGE C Cöŀumň_TWO INT;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i
|
||||
INNER JOIN sys_foreign sf ON i.ID = sf.ID;
|
||||
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
-- error ER_BAD_FIELD_ERROR
|
||||
ALTER TABLE t1 CHANGE cöĿǖmň_two c3 INT;
|
||||
|
||||
ALTER TABLE t1 CHANGE cÖĿUMŇ_two c3 INT, RENAME TO t3;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
SELECT st.NAME, i.NAME
|
||||
FROM sys_tables st INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_TABLES i
|
||||
ON i.TABLE_ID=st.TABLE_ID;
|
||||
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
SHOW CREATE TABLE t3;
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
SHOW CREATE TABLE t1c;
|
||||
|
||||
# The maximum column name length should be 64 characters.
|
||||
--error ER_TOO_LONG_IDENT
|
||||
ALTER TABLE t3 CHANGE c3
|
||||
`12345678901234567890123456789012345678901234567890123456789012345` INT;
|
||||
ALTER TABLE t3 CHANGE c3
|
||||
`1234567890123456789012345678901234567890123456789012345678901234` INT;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
SHOW CREATE TABLE t3;
|
||||
|
||||
# Test the length limit with non-ASCII utf-8 characters.
|
||||
--error ER_TOO_LONG_IDENT
|
||||
ALTER TABLE t3 CHANGE
|
||||
`1234567890123456789012345678901234567890123456789012345678901234`
|
||||
`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾倿偀` INT;
|
||||
|
||||
--error ER_TOO_LONG_IDENT
|
||||
ALTER TABLE t3 CHANGE
|
||||
`1234567890123456789012345678901234567890123456789012345678901234`
|
||||
`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾倿ä` INT;
|
||||
|
||||
ALTER TABLE t3 CHANGE
|
||||
`1234567890123456789012345678901234567890123456789012345678901234`
|
||||
`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾ä` INT;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
# check that the rename is case-insensitive (note the upper-case ä at end)
|
||||
ALTER TABLE t3 CHANGE
|
||||
`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾Ä`
|
||||
c3 INT;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
# test with 4-byte UTF-8 (should be disallowed)
|
||||
--error ER_INVALID_CHARACTER_STRING
|
||||
ALTER TABLE t3 CHANGE c3 𐌀𐌁𐌂𐌃𐌄𐌅𐌆𐌇𐌈𐌉𐌊𐌋𐌌𐌍𐌎𐌏𐌐𐌑𐌒𐌓𐌔𐌕𐌖𐌗𐌘𐌙𐌚𐌛𐌜 INT;
|
||||
|
||||
--error ER_INVALID_CHARACTER_STRING
|
||||
ALTER TABLE t3 CHANGE c3 😲 INT;
|
||||
|
||||
ALTER TABLE t3 RENAME TO t2;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
SELECT st.NAME, i.NAME
|
||||
FROM sys_tables st INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_TABLES i
|
||||
ON i.TABLE_ID=st.TABLE_ID;
|
||||
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
SHOW CREATE TABLE t2;
|
||||
|
||||
RENAME TABLE t2 TO t1;
|
||||
|
||||
SELECT st.NAME, i.NAME
|
||||
FROM sys_tables st INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_TABLES i
|
||||
ON i.TABLE_ID=st.TABLE_ID;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
--error ER_DROP_INDEX_FK
|
||||
ALTER TABLE t1 DROP INDEX c2;
|
||||
|
||||
--error ER_CANT_DROP_FIELD_OR_KEY
|
||||
ALTER TABLE t1 DROP INDEX c4;
|
||||
|
||||
--error ER_CANT_DROP_FIELD_OR_KEY
|
||||
ALTER TABLE t1c DROP FOREIGN KEY c2;
|
||||
|
||||
--error ER_CANT_DROP_FIELD_OR_KEY
|
||||
ALTER TABLE t1c DROP FOREIGN KEY t1c2, DROP FOREIGN KEY c2;
|
||||
|
||||
--error ER_CANT_DROP_FIELD_OR_KEY
|
||||
ALTER TABLE t1c DROP FOREIGN KEY t1c2, DROP FOREIGN KEY c2, DROP INDEX c2;
|
||||
|
||||
--error ER_DROP_INDEX_FK
|
||||
ALTER TABLE t1c DROP INDEX c2;
|
||||
|
||||
--error ER_CANT_DROP_FIELD_OR_KEY
|
||||
ALTER TABLE t1c DROP FOREIGN KEY ẗ1C2;
|
||||
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
SHOW CREATE TABLE t1c;
|
||||
|
||||
SET foreign_key_checks=0;
|
||||
DROP TABLE t1p;
|
||||
SET foreign_key_checks=1;
|
||||
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
SHOW CREATE TABLE t1c;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
eval CREATE TABLE t1p (c1 INT PRIMARY KEY, c2 INT, INDEX(c2))
|
||||
ENGINE=InnoDB $data_directory_clause;
|
||||
|
||||
--error ER_DROP_INDEX_FK
|
||||
ALTER TABLE t1c DROP INDEX C2, DROP INDEX C3;
|
||||
--error ER_DROP_INDEX_FK
|
||||
ALTER TABLE t1c DROP INDEX C3;
|
||||
|
||||
SET foreign_key_checks=0;
|
||||
ALTER TABLE t1c DROP INDEX C3;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
SET foreign_key_checks=1;
|
||||
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
SHOW CREATE TABLE t1c;
|
||||
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
ALTER TABLE t1c DROP FOREIGN KEY t1C3;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
SHOW CREATE TABLE t1c;
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
ALTER TABLE t1c DROP INDEX c2, DROP FOREIGN KEY t1C2;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
SHOW CREATE TABLE t1c;
|
||||
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
ALTER TABLE t1 DROP INDEX c2, CHANGE c3 c2 INT;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
CREATE TABLE t1o LIKE t1;
|
||||
|
||||
# This will implicitly add a DOC_ID column.
|
||||
# The LOCK=NONE should thus fail.
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE t1 ADD FULLTEXT INDEX (ct),
|
||||
CHANGE c1 pk INT, ALTER c2 SET DEFAULT 42, RENAME TO tt,
|
||||
ALGORITHM=INPLACE, LOCK=NONE;
|
||||
|
||||
# Retry with LOCK=EXCLUSIVE.
|
||||
ALTER TABLE t1 ADD FULLTEXT INDEX (ct),
|
||||
CHANGE c1 pk INT, ALTER c2 SET DEFAULT 42, RENAME TO tt,
|
||||
ALGORITHM=INPLACE, LOCK=SHARED;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
# The output should be empty, because index->id was reassigned.
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
SHOW CREATE TABLE tt;
|
||||
|
||||
# DB_ROW_ID, DB_TRX_ID, DB_ROLL_PTR are reserved InnoDB system column names.
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
ALTER TABLE t1o CHANGE c1 dB_row_Id INT, ALGORITHM=COPY;
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
ALTER TABLE t1o CHANGE c1 dB_row_Id INT, ALGORITHM=INPLACE;
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
ALTER TABLE t1o CHANGE c1 DB_TRX_ID INT;
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
ALTER TABLE t1o CHANGE c1 db_roll_ptr INT;
|
||||
|
||||
# FTS_DOC_ID is the internal row identifier for full-text search.
|
||||
# It should be of type BIGINT UNSIGNED NOT NULL.
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct), CHANGE c1 FTS_DOC_ID INT,
|
||||
ALGORITHM=COPY;
|
||||
|
||||
--error ER_INNODB_FT_WRONG_DOCID_COLUMN
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct), CHANGE c1 FTS_DOC_ID INT,
|
||||
ALGORITHM=INPLACE;
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct), CHANGE c1 FTS_Doc_ID INT,
|
||||
ALGORITHM=INPLACE;
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct),
|
||||
CHANGE c1 FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
|
||||
ALGORITHM=INPLACE;
|
||||
|
||||
CREATE TABLE t1n LIKE t1o;
|
||||
|
||||
ALTER TABLE t1n ADD FULLTEXT INDEX(ct);
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
ALTER TABLE t1n CHANGE c1 Fts_DOC_ID INT, ALGORITHM=INPLACE;
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
ALTER TABLE t1n CHANGE c1 Fts_DOC_ID INT, ALGORITHM=COPY;
|
||||
--error ER_BAD_FIELD_ERROR
|
||||
ALTER TABLE t1n CHANGE FTS_DOC_ID c11 INT, ALGORITHM=INPLACE;
|
||||
ALTER TABLE t1n CHANGE c1 FTS_DOC_ïD INT, ALGORITHM=INPLACE;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
ALTER TABLE t1n CHANGE FTS_DOC_ÏD c1 INT, ALGORITHM=INPLACE;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
ALTER TABLE t1n CHANGE c1 c2 INT, CHANGE c2 ct INT, CHANGE ct c1 TEXT,
|
||||
ALGORITHM=INPLACE;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
SHOW CREATE TABLE t1n;
|
||||
ALTER TABLE t1n CHANGE c2 c1 INT, CHANGE ct c2 INT, CHANGE c1 ct TEXT,
|
||||
ALGORITHM=COPY;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
SHOW CREATE TABLE t1n;
|
||||
|
||||
--error ER_KEY_COLUMN_DOES_NOT_EXITS
|
||||
ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=INPLACE;
|
||||
--error ER_KEY_COLUMN_DOES_NOT_EXITS
|
||||
ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=COPY;
|
||||
|
||||
ALTER TABLE t1n ADD INDEX(c4), CHANGE c2 c4 INT, ALGORITHM=INPLACE;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
SHOW CREATE TABLE t1n;
|
||||
ALTER TABLE t1n DROP INDEX c4;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
--error ER_DUP_FIELDNAME
|
||||
ALTER TABLE t1n CHANGE c4 c1 INT, ADD INDEX(c1), ALGORITHM=INPLACE;
|
||||
ALTER TABLE t1n CHANGE c4 c11 INT, ADD INDEX(c11), ALGORITHM=INPLACE;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
SHOW CREATE TABLE t1n;
|
||||
DROP TABLE t1n;
|
||||
|
||||
ALTER TABLE t1o MODIFY c1 BIGINT UNSIGNED NOT NULL;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct),
|
||||
CHANGE c1 FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
|
||||
ALGORITHM=INPLACE;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
# This would create a hidden FTS_DOC_ID column, which cannot be done online.
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL,
|
||||
LOCK=NONE;
|
||||
|
||||
# This should not show duplicates.
|
||||
SELECT sc.pos FROM information_schema.innodb_sys_columns sc
|
||||
INNER JOIN information_schema.innodb_sys_tables st
|
||||
ON sc.TABLE_ID=st.TABLE_ID
|
||||
WHERE st.NAME='test/t1o' AND sc.NAME='FTS_DOC_ID';
|
||||
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
SHOW CREATE TABLE t1o;
|
||||
|
||||
ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL,
|
||||
DROP INDEX ct, LOCK=NONE;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
SHOW CREATE TABLE t1o;
|
||||
|
||||
DROP TABLE t1c, t1p, sys_tables, sys_indexes, sys_foreign;
|
||||
|
||||
# Check the internal schemata of tt, t1o.
|
||||
|
||||
CREATE TABLE sys_tables SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
|
||||
WHERE NAME='test/t1o';
|
||||
CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
CREATE TABLE sys_foreign SELECT i.*
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN i WHERE FOR_NAME='test/t1o';
|
||||
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
# Ensure that there exists no hidden FTS_DOC_ID_INDEX on foo_id.
|
||||
|
||||
ALTER TABLE t1o ADD UNIQUE INDEX FTS_DOC_ID_INDEX(foo_id);
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
ALTER TABLE t1o CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
|
||||
ADD FULLTEXT INDEX(ct);
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
--error ER_INNODB_FT_WRONG_DOCID_INDEX
|
||||
ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL;
|
||||
|
||||
DROP TABLE sys_indexes;
|
||||
CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
|
||||
-- source suite/innodb/include/innodb_dict.inc
|
||||
|
||||
--echo #
|
||||
--echo # Cleanup
|
||||
--echo #
|
||||
|
||||
DROP TABLE tt, t1o, sys_tables, sys_indexes, sys_foreign;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
--rmdir $MYSQL_TMP_DIR/alt_dir/test
|
||||
--rmdir $MYSQL_TMP_DIR/alt_dir
|
||||
|
||||
-- disable_query_log
|
||||
eval set global innodb_file_per_table=$innodb_file_per_table_orig;
|
||||
call mtr.add_suppression("deleting orphaned .ibd file");
|
||||
-- enable_query_log
|
66
mysql-test/suite/innodb/t/table_definition_cache_debug.test
Normal file
66
mysql-test/suite/innodb/t/table_definition_cache_debug.test
Normal file
@ -0,0 +1,66 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_debug.inc
|
||||
--source include/have_debug_sync.inc
|
||||
|
||||
SET @save_tdc= @@GLOBAL.table_definition_cache;
|
||||
SET @save_toc= @@GLOBAL.table_open_cache;
|
||||
|
||||
# InnoDB plugin essentially ignores table_definition_cache size
|
||||
# and hard-wires it to 400, which also is the minimum allowed value.
|
||||
SET GLOBAL table_definition_cache= 400;
|
||||
SET GLOBAL table_open_cache= 1024;
|
||||
|
||||
CREATE TABLE to_be_evicted(a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB;
|
||||
INSERT INTO to_be_evicted VALUES(1,2),(2,1);
|
||||
|
||||
connect(ddl,localhost,root,,);
|
||||
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL scanned WAIT_FOR got_duplicate';
|
||||
--send
|
||||
ALTER TABLE to_be_evicted ADD UNIQUE INDEX(b);
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR scanned';
|
||||
|
||||
# During the ADD UNIQUE INDEX, start a transaction that inserts a duplicate
|
||||
# and then hogs the table lock, so that the unique index cannot be dropped.
|
||||
BEGIN;
|
||||
INSERT INTO to_be_evicted VALUES(3, 2);
|
||||
SET DEBUG_SYNC = 'now SIGNAL got_duplicate';
|
||||
|
||||
connection ddl;
|
||||
--error ER_DUP_ENTRY
|
||||
reap;
|
||||
|
||||
disconnect ddl;
|
||||
connection default;
|
||||
# Release the table lock.
|
||||
COMMIT;
|
||||
SET DEBUG_SYNC = RESET;
|
||||
|
||||
# Allow cache eviction.
|
||||
FLUSH TABLES;
|
||||
--disable_query_log
|
||||
|
||||
# Pollute the cache with many tables, so that our table will be evicted.
|
||||
let $N=1000;
|
||||
let $loop=$N;
|
||||
while ($loop)
|
||||
{
|
||||
eval CREATE TABLE t_$loop(id INT)ENGINE=InnoDB;
|
||||
dec $loop;
|
||||
}
|
||||
|
||||
# Hopefully let InnoDB evict the tables.
|
||||
sleep 10;
|
||||
|
||||
let $loop=$N;
|
||||
while ($loop)
|
||||
{
|
||||
eval DROP TABLE t_$loop;
|
||||
dec $loop;
|
||||
}
|
||||
|
||||
SET GLOBAL table_definition_cache= @save_tdc;
|
||||
SET GLOBAL table_open_cache= @save_toc;
|
||||
|
||||
DROP TABLE to_be_evicted;
|
139
mysql-test/suite/innodb/t/undo_log.test
Normal file
139
mysql-test/suite/innodb/t/undo_log.test
Normal file
@ -0,0 +1,139 @@
|
||||
--source include/have_innodb.inc
|
||||
CREATE TABLE test_tab (
|
||||
a_str_18 mediumtext,
|
||||
b_str_3 varchar(32) DEFAULT NULL,
|
||||
a_str_13 mediumtext,
|
||||
b_str_5 varchar(40) DEFAULT NULL,
|
||||
b_str_6 varchar(50) DEFAULT NULL,
|
||||
b_str_7 char(32) DEFAULT NULL,
|
||||
b_str_8 varchar(32) DEFAULT NULL,
|
||||
b_str_9 varchar(255) DEFAULT NULL,
|
||||
a_str_28 char(255) DEFAULT NULL,
|
||||
a_str_27 varchar(255) DEFAULT NULL,
|
||||
b_str_10 varchar(32) DEFAULT NULL,
|
||||
a_str_26 varchar(255) DEFAULT NULL,
|
||||
a_str_6 varchar(50) DEFAULT NULL,
|
||||
b_str_11 varchar(32) DEFAULT NULL,
|
||||
b_str_12 varchar(255) DEFAULT NULL,
|
||||
b_str_13 char(32) DEFAULT NULL,
|
||||
b_str_14 varchar(32) DEFAULT NULL,
|
||||
b_str_15 char(32) DEFAULT NULL,
|
||||
b_str_16 char(32) DEFAULT NULL,
|
||||
b_str_17 varchar(32) DEFAULT NULL,
|
||||
b_str_18 varchar(32) DEFAULT NULL,
|
||||
a_str_25 varchar(40) DEFAULT NULL,
|
||||
b_str_19 varchar(255) DEFAULT NULL,
|
||||
a_str_23 varchar(40) DEFAULT NULL,
|
||||
b_str_20 varchar(32) DEFAULT NULL,
|
||||
a_str_21 varchar(255) DEFAULT NULL,
|
||||
a_str_20 varchar(255) DEFAULT NULL,
|
||||
a_str_39 varchar(255) DEFAULT NULL,
|
||||
a_str_38 varchar(255) DEFAULT NULL,
|
||||
a_str_37 varchar(255) DEFAULT NULL,
|
||||
b_str_21 char(32) DEFAULT NULL,
|
||||
b_str_23 varchar(80) DEFAULT NULL,
|
||||
b_str_24 varchar(32) DEFAULT NULL,
|
||||
b_str_25 varchar(32) DEFAULT NULL,
|
||||
b_str_26 char(32) NOT NULL DEFAULT '',
|
||||
b_str_27 varchar(255) DEFAULT NULL,
|
||||
a_str_36 varchar(255) DEFAULT NULL,
|
||||
a_str_33 varchar(100) DEFAULT NULL,
|
||||
a_ref_10 char(32) DEFAULT NULL,
|
||||
b_str_28 char(32) DEFAULT NULL,
|
||||
b_str_29 char(32) DEFAULT NULL,
|
||||
a_ref_6 char(32) DEFAULT NULL,
|
||||
a_ref_12 varchar(32) DEFAULT NULL,
|
||||
a_ref_11 varchar(32) DEFAULT NULL,
|
||||
a_str_49 varchar(40) DEFAULT NULL,
|
||||
b_str_30 varchar(32) DEFAULT NULL,
|
||||
a_ref_3 varchar(32) DEFAULT NULL,
|
||||
a_str_48 varchar(40) DEFAULT NULL,
|
||||
a_ref_1 char(32) DEFAULT NULL,
|
||||
b_str_31 varchar(32) DEFAULT NULL,
|
||||
b_str_32 varchar(255) DEFAULT NULL,
|
||||
b_str_33 char(32) DEFAULT NULL,
|
||||
b_str_34 varchar(32) DEFAULT NULL,
|
||||
a_str_47 varchar(40) DEFAULT NULL,
|
||||
b_str_36 varchar(255) DEFAULT NULL,
|
||||
a_str_46 varchar(40) DEFAULT NULL,
|
||||
a_str_45 varchar(255) DEFAULT NULL,
|
||||
b_str_38 varchar(32) DEFAULT NULL,
|
||||
b_str_39 char(32) DEFAULT NULL,
|
||||
b_str_40 varchar(32) DEFAULT NULL,
|
||||
a_str_41 varchar(255) DEFAULT NULL,
|
||||
b_str_41 varchar(32) DEFAULT NULL,
|
||||
PRIMARY KEY (b_str_26),
|
||||
UNIQUE KEY a_str_47 (a_str_47),
|
||||
UNIQUE KEY a_str_49 (a_str_49),
|
||||
UNIQUE KEY a_str_33 (a_str_33),
|
||||
UNIQUE KEY a_str_46 (a_str_46),
|
||||
UNIQUE KEY a_str_48 (a_str_48),
|
||||
KEY b_str_18 (b_str_18),
|
||||
KEY a_str_26 (a_str_26),
|
||||
KEY b_str_27 (b_str_27,b_str_19),
|
||||
KEY b_str_41 (b_str_41),
|
||||
KEY b_str_15 (b_str_15),
|
||||
KEY a_str_20 (a_str_20),
|
||||
KEY b_str_17 (b_str_17),
|
||||
KEY b_str_40 (b_str_40),
|
||||
KEY b_str_24 (b_str_24),
|
||||
KEY b_str_10 (b_str_10),
|
||||
KEY b_str_16 (b_str_16),
|
||||
KEY b_str_29 (b_str_29),
|
||||
KEY a_str_41 (a_str_41),
|
||||
KEY b_str_7 (b_str_7),
|
||||
KEY a_str_45 (a_str_45),
|
||||
KEY a_str_28 (a_str_28),
|
||||
KEY a_str_37 (a_str_37),
|
||||
KEY b_str_6 (b_str_6),
|
||||
KEY a_ref_6 (a_ref_6),
|
||||
KEY b_str_34 (b_str_34),
|
||||
KEY b_str_38 (b_str_38),
|
||||
KEY a_ref_10 (a_ref_10),
|
||||
KEY b_str_21 (b_str_21),
|
||||
KEY b_str_23 (b_str_23,b_str_19),
|
||||
KEY b_str_33 (b_str_33),
|
||||
KEY a_ref_12 (a_ref_12),
|
||||
KEY a_str_18 (a_str_18(255)),
|
||||
KEY a_str_39 (a_str_39),
|
||||
KEY a_str_27 (a_str_27),
|
||||
KEY a_str_25 (a_str_25),
|
||||
KEY b_str_9 (b_str_9),
|
||||
KEY a_str_23 (a_str_23),
|
||||
KEY b_str_8 (b_str_8),
|
||||
KEY a_str_21 (a_str_21),
|
||||
KEY b_str_3 (b_str_3),
|
||||
KEY b_str_30 (b_str_30),
|
||||
KEY b_str_12 (b_str_12),
|
||||
KEY b_str_25 (b_str_25),
|
||||
KEY b_str_13 (b_str_13),
|
||||
KEY a_str_38 (a_str_38),
|
||||
KEY a_str_13 (a_str_13(255)),
|
||||
KEY a_str_36 (a_str_36),
|
||||
KEY b_str_28 (b_str_28),
|
||||
KEY b_str_19 (b_str_19),
|
||||
KEY b_str_11 (b_str_11),
|
||||
KEY a_ref_1 (a_ref_1),
|
||||
KEY b_str_20 (b_str_20),
|
||||
KEY b_str_14 (b_str_14),
|
||||
KEY a_ref_3 (a_ref_3),
|
||||
KEY b_str_39 (b_str_39),
|
||||
KEY b_str_32 (b_str_32),
|
||||
KEY a_str_6 (a_str_6),
|
||||
KEY b_str_5 (b_str_5),
|
||||
KEY b_str_31 (b_str_31),
|
||||
KEY a_ref_11 (a_ref_11)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO test_tab (b_str_26, a_str_13, a_str_18) VALUES
|
||||
('a', REPEAT('f',4031), REPEAT('g', 4031));
|
||||
|
||||
UPDATE test_tab SET a_str_13=REPEAT('h',4032), a_str_18=REPEAT('i',4032);
|
||||
SELECT 'Reducing length to 4030';
|
||||
UPDATE test_tab SET a_str_13=REPEAT('j',4030), a_str_18=REPEAT('k',4030);
|
||||
UPDATE test_tab SET a_str_13=REPEAT('l',4031), a_str_18=REPEAT('m',4031);
|
||||
ROLLBACK;
|
||||
SELECT COUNT(*) FROM test_tab;
|
||||
CHECK TABLE test_tab;
|
||||
DROP TABLE test_tab;
|
@ -15,7 +15,12 @@ connect (con1,localhost,root);
|
||||
XA START 'x'; UPDATE t1 set a=2; XA END 'x'; XA PREPARE 'x';
|
||||
connection default;
|
||||
|
||||
# innodb_force_recovery=2 prevents the purge and tests that the fix of
|
||||
# MDEV-13606 XA PREPARE transactions should survive innodb_force_recovery=1 or 2
|
||||
# is present.
|
||||
--let $restart_parameters= --innodb-force-recovery=2
|
||||
--source include/kill_and_restart_mysqld.inc
|
||||
--let $restart_parameters=
|
||||
|
||||
disconnect con1;
|
||||
connect (con1,localhost,root);
|
||||
|
8
mysql-test/suite/innodb_fts/r/concurrent_insert.result
Normal file
8
mysql-test/suite/innodb_fts/r/concurrent_insert.result
Normal file
@ -0,0 +1,8 @@
|
||||
CREATE TABLE t1(a VARCHAR(5),FULLTEXT KEY(a)) ENGINE=InnoDB;
|
||||
SET DEBUG_SYNC = 'get_next_FTS_DOC_ID SIGNAL prepared WAIT_FOR race';
|
||||
REPLACE INTO t1(a) values('aaa');
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR prepared';
|
||||
REPLACE INTO t1(a) VALUES('aaa');
|
||||
SET DEBUG_SYNC = 'now SIGNAL race';
|
||||
SET DEBUG_SYNC = 'RESET';
|
||||
DROP TABLE t1;
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user