diff options
author | Sergei Golubchik <serg@mariadb.org> | 2017-10-24 14:53:18 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2017-10-24 14:53:18 +0200 |
commit | e0a1c745ec3ed1ec6c0375a2a624697c29f480a6 (patch) | |
tree | 24ded2c6ebe3ea3413ce56af89ea0f2f63bb3a39 | |
parent | 4ec88ea9c3ec52d996b39167d12a61ab95fdeacc (diff) | |
parent | 2aa51f528fd5d23cc54eca8fbd07e88e7b2993c7 (diff) | |
download | mariadb-git-e0a1c745ec3ed1ec6c0375a2a624697c29f480a6.tar.gz |
Merge branch '10.1' into 10.2
186 files changed, 3307 insertions, 1578 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index f2e7b9150fa..e4d110ba9eb 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1065,8 +1065,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); @@ -1078,7 +1077,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); diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index 47daa88d0a2..5b8aa36ff0d 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -165,9 +165,14 @@ SETA(CPACK_RPM_server_PACKAGE_REQUIRES "MariaDB-client") IF(WITH_WSREP) -SETA(CPACK_RPM_server_PACKAGE_REQUIRES - "galera" "rsync" "lsof" "grep" "gawk" "iproute" - "coreutils" "findutils" "tar" "which") + SETA(CPACK_RPM_server_PACKAGE_REQUIRES + "galera" "rsync" "lsof" "grep" "gawk" "iproute" + "coreutils" "findutils" "tar") + IF (RPM MATCHES "sles11") + SETA(CPACK_RPM_server_PACKAGE_REQUIRES "util-linux") + ELSE() + SETA(CPACK_RPM_server_PACKAGE_REQUIRES "which") + ENDIF() ENDIF() SET(CPACK_RPM_server_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-prein.sh) diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake index bb7c8862dc7..bd2cfd7097c 100644 --- a/cmake/maintainer.cmake +++ b/cmake/maintainer.cmake @@ -20,6 +20,11 @@ IF(have_C__Wvla) SET(MY_WARNING_FLAGS "${MY_WARNING_FLAGS} -Wvla") ENDIF() +MY_CHECK_C_COMPILER_FLAG("-Wno-format-truncation") +IF(HAVE_C__Wno_format_truncation) + SET(MY_WARNING_FLAGS "${MY_WARNING_FLAGS} -Wno-format-truncation") +ENDIF() + # Common warning flags for GCC and Clang SET(MY_C_WARNING_FLAGS "${MY_WARNING_FLAGS} -Wwrite-strings -Wdeclaration-after-statement") diff --git a/cmake/pcre.cmake b/cmake/pcre.cmake index 894bde38974..4c113929866 100644 --- a/cmake/pcre.cmake +++ b/cmake/pcre.cmake @@ -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() ENDIF() - IF(NOT HAVE_PCRE OR WITH_PCRE STREQUAL "bundled") + 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() diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 6bc506f14d0..00e500c181a 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -4512,7 +4512,7 @@ xb_process_datadir( handle_datadir_entry_func_t func) /*!<in: callback */ { ulint ret; - char dbpath[FN_REFLEN]; + char dbpath[OS_FILE_MAX_PATH]; os_file_dir_t dir; os_file_dir_t dbdir; os_file_stat_t dbinfo; @@ -4578,8 +4578,8 @@ next_file_item_1: goto next_datadir_item; } - sprintf(dbpath, "%s/%s", path, - dbinfo.name); + snprintf(dbpath, sizeof(dbpath), "%s/%s", path, dbinfo.name); + os_normalize_path(dbpath); dbdir = os_file_opendir(dbpath, FALSE); @@ -5531,4 +5531,3 @@ static int get_exepath(char *buf, size_t size, const char *argv0) return my_realpath(buf, argv0, 0); } - diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c index bfd0c3c635a..78940e02ca4 100644 --- a/extra/my_print_defaults.c +++ b/extra/my_print_defaults.c @@ -98,18 +98,23 @@ static struct my_option my_long_options[] = {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; -void cleanup_and_exit(int exit_code) +static void cleanup_and_exit(int exit_code) __attribute__ ((noreturn)); +static void cleanup_and_exit(int exit_code) { my_end(0); 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 +138,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 +192,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) diff --git a/extra/replace.c b/extra/replace.c index b8c328f2902..eabf953837b 100644 --- a/extra/replace.c +++ b/extra/replace.c @@ -174,7 +174,7 @@ register char **argv[]; break; case 'V': version=1; - /* fall through */ + /* fall through */ case 'I': case '?': help=1; /* Help text written */ diff --git a/extra/yassl/README b/extra/yassl/README index a3d4f60f561..de1bf5132aa 100644 --- a/extra/yassl/README +++ b/extra/yassl/README @@ -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 diff --git a/extra/yassl/include/openssl/ssl.h b/extra/yassl/include/openssl/ssl.h index ede4581fa13..f750f601d29 100644 --- a/extra/yassl/include/openssl/ssl.h +++ b/extra/yassl/include/openssl/ssl.h @@ -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) diff --git a/extra/yassl/src/yassl_imp.cpp b/extra/yassl/src/yassl_imp.cpp index a481812b3e0..971a5b6654e 100644 --- a/extra/yassl/src/yassl_imp.cpp +++ b/extra/yassl/src/yassl_imp.cpp @@ -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_) diff --git a/extra/yassl/src/yassl_int.cpp b/extra/yassl/src/yassl_int.cpp index edc89df4cfa..1dc89df9d86 100644 --- a/extra/yassl/src/yassl_int.cpp +++ b/extra/yassl/src/yassl_int.cpp @@ -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); } @@ -2702,4 +2707,3 @@ extern "C" void yaSSL_CleanUp() yaSSL::sessionsInstance = 0; yaSSL::errorsInstance = 0; } - diff --git a/mysql-test/README b/mysql-test/README index 28b8203b2dc..d925964fed5 100644 --- a/mysql-test/README +++ b/mysql-test/README @@ -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. +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. - 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 + 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, diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index 13fbe00f2e3..b8f51ee25ad 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -1359,6 +1359,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, @@ -2125,59 +2177,7 @@ t1 CREATE TABLE `t1` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 DROP TABLE t1; # -# 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; -# -# Start of 10.1 tests +# End of 10.0 tests # # # MDEV-7374 : Losing connection to MySQL while running ALTER TABLE @@ -2201,6 +2201,9 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; # +# End of 10.1 tests +# +# # MDEV-10421 duplicate CHECK CONSTRAINTs # CREATE TABLE t1 (a INT, b INT) engine=myisam; @@ -2272,3 +2275,6 @@ t1 CREATE TABLE `t1` ( `c` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; +# +# End of 10.2 tests +# diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result index ab6ae5e6a5a..4d5edbda1ce 100644 --- a/mysql-test/r/case.result +++ b/mysql-test/r/case.result @@ -228,6 +228,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 diff --git a/mysql-test/r/ctype_gbk.result b/mysql-test/r/ctype_gbk.result index a6cea80fef5..5244d6eb333 100644 --- a/mysql-test/r/ctype_gbk.result +++ b/mysql-test/r/ctype_gbk.result @@ -5078,6 +5078,24 @@ 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 # # diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result index fc37dcfda8b..0ca643f25fb 100644 --- a/mysql-test/r/ctype_latin1.result +++ b/mysql-test/r/ctype_latin1.result @@ -8005,6 +8005,24 @@ 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 # # diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 08af0186080..9c5ca0482a1 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -4564,6 +4564,38 @@ 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 +# +set sql_mode=""; +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; +set sql_mode=default; +# # End of 5.5 tests # # diff --git a/mysql-test/r/ctype_utf32.result b/mysql-test/r/ctype_utf32.result index 0a4a49dd39e..59ce4c2f445 100644 --- a/mysql-test/r/ctype_utf32.result +++ b/mysql-test/r/ctype_utf32.result @@ -1680,6 +1680,23 @@ 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 +# +set sql_mode=''; +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; +set sql_mode=default; +# # End of 5.5 tests # # diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index c7e20a4180d..3eb500b5c66 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -6278,6 +6278,30 @@ Warnings: SET sql_mode=DEFAULT; DROP TABLE t1; # +# MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535 +# +SET sql_mode=''; +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; +SET sql_mode=default; +# # End of 5.5 tests # # diff --git a/mysql-test/r/errors.result b/mysql-test/r/errors.result index 6d77a582fb8..2be04abb15d 100644 --- a/mysql-test/r/errors.result +++ b/mysql-test/r/errors.result @@ -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))); diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index d18681bc80d..996ec98da75 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -813,9 +813,17 @@ PREPARE s FROM "SELECT 1 FROM t1 WHERE 1 < ALL (SELECT @:= (1 IN (SELECT 1 FROM EXECUTE s; 1 DROP TABLE t1; +# # End of 5.3 tests # -# Start of 10.0 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; +# +# End of 5.5 tests # # # MDEV-10020 InnoDB NOT IN Query Crash When One Item Is NULL @@ -831,7 +839,7 @@ SELECT * FROM t1 WHERE b NOT IN (NULL, '', 'A'); a b DROP TABLE t1; # -# Start of 10.1 tests +# End of 10.0 tests # # # MDEV-8755 Equal field propagation is not performed any longer for the IN list when multiple comparison types diff --git a/mysql-test/r/func_regexp_pcre.result b/mysql-test/r/func_regexp_pcre.result index ece2019ef83..e030df99756 100644 --- a/mysql-test/r/func_regexp_pcre.result +++ b/mysql-test/r/func_regexp_pcre.result @@ -885,32 +885,32 @@ SELECT 1 FROM dual WHERE ('Alpha,Bravo,Charlie,Delta,Echo,Foxtrot,StrataCentral, 1 Warnings: Warning 1139 Got error 'pcre_exec: recursion limit of NUM exceeded' from regexp -SELECT CONCAT(REPEAT('100,',133),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$'; -CONCAT(REPEAT('100,',133),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$' +SELECT CONCAT(REPEAT('100,',60),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$'; +CONCAT(REPEAT('100,',60),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$' 1 SELECT CONCAT(REPEAT('100,',200),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$'; CONCAT(REPEAT('100,',200),'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,',133),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'); -REGEXP_INSTR(CONCAT(REPEAT('100,',133),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$') +SELECT REGEXP_INSTR(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'); +REGEXP_INSTR(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$') 1 SELECT REGEXP_INSTR(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'); REGEXP_INSTR(CONCAT(REPEAT('100,',200),'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,',133),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$')); -LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',133),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$')) -535 +SELECT LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$')); +LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$')) +243 SELECT LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$')); LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',200),'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,',133),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', '')); -LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',133),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', '')) +SELECT LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', '')); +LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', '')) 0 SELECT LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', '')); LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', '')) diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 54da823c439..3da44417965 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -2772,7 +2772,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 diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 78eb374b142..f20a08d690a 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -1717,8 +1717,16 @@ t1 CREATE TABLE `t1` ( `v` mediumtext CHARACTER SET utf8 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; +set statement sql_mode='' for 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 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; set storage_engine=MyISAM; set @save_concurrent_insert=@@concurrent_insert; set global concurrent_insert=1; diff --git a/mysql-test/r/partition_datatype.result b/mysql-test/r/partition_datatype.result index f0921a2097c..2e518c194f0 100644 --- a/mysql-test/r/partition_datatype.result +++ b/mysql-test/r/partition_datatype.result @@ -312,14 +312,18 @@ select * from t1 where a = 'bbbb'; a bbbb drop table t1; +set sql_mode=''; 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 +set sql_mode=default; create table t1 (a bit(27), primary key (a)) engine=myisam partition by hash (a) (partition p0, partition p1, partition p2); diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 40746d2e6c6..fcd5a8aa7ee 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -4202,6 +4202,149 @@ 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 # # Start of 10.2 tests diff --git a/mysql-test/r/range_vs_index_merge.result b/mysql-test/r/range_vs_index_merge.result index 6813c40a5cf..bc46a4fdd0b 100644 --- a/mysql-test/r/range_vs_index_merge.result +++ b/mysql-test/r/range_vs_index_merge.result @@ -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'; diff --git a/mysql-test/r/range_vs_index_merge_innodb.result b/mysql-test/r/range_vs_index_merge_innodb.result index 0c3b682b197..ce90f522d6e 100644 --- a/mysql-test/r/range_vs_index_merge_innodb.result +++ b/mysql-test/r/range_vs_index_merge_innodb.result @@ -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; diff --git a/mysql-test/r/read_only.result b/mysql-test/r/read_only.result index 2037dcac182..2029413c0f0 100644 --- a/mysql-test/r/read_only.result +++ b/mysql-test/r/read_only.result @@ -51,6 +51,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; diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index bf4627f6f68..1c11bdd13d1 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -972,7 +972,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 @@ -997,7 +997,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 90 0 N 1 0 33 Field Type Null Key Default Extra c int(11) NO PRI NULL diff --git a/mysql-test/r/show_function_with_pad_char_to_full_length.result b/mysql-test/r/show_function_with_pad_char_to_full_length.result new file mode 100644 index 00000000000..785cab7b3e6 --- /dev/null +++ b/mysql-test/r/show_function_with_pad_char_to_full_length.result @@ -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 diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index 025782a365d..315bb9dc1b5 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -1240,9 +1240,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; diff --git a/mysql-test/r/subselect_mat_cost_bugs.result b/mysql-test/r/subselect_mat_cost_bugs.result index bdbe07cf879..ffd93c125ed 100644 --- a/mysql-test/r/subselect_mat_cost_bugs.result +++ b/mysql-test/r/subselect_mat_cost_bugs.result @@ -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; diff --git a/mysql-test/r/type_varchar.result b/mysql-test/r/type_varchar.result index 110c07c37a9..0b2a5b54d08 100644 --- a/mysql-test/r/type_varchar.result +++ b/mysql-test/r/type_varchar.result @@ -513,7 +513,80 @@ Warning 1292 Truncated incorrect DOUBLE value: 's ' Warning 1292 Truncated incorrect DOUBLE value: ' ' DROP TABLE t1; # -# Start of 10.0 tests +# MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535 +# +set sql_mode=''; +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; +set sql_mode=default; +CREATE TABLE t1 (c1 VARCHAR(65536)); +ERROR 42000: Column length too big for column 'c1' (max = 65532); use BLOB or TEXT instead +# +# End of 5.5 tests # # # MDEV-6950 Bad results with joins comparing DATE and INT/ENUM/VARCHAR columns diff --git a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf index fe3bcb1e8ff..91aa53ad7b1 100644 --- a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf +++ b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf @@ -14,6 +14,9 @@ wsrep-causal-reads=ON wsrep-sync-wait=15 [mysqld.1] +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port wsrep-cluster-address='gcomm://' wsrep_provider_options='base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S' diff --git a/mysql-test/suite/innodb/disabled.def b/mysql-test/suite/innodb/disabled.def index c435de278b9..35c941f8af7 100644 --- a/mysql-test/suite/innodb/disabled.def +++ b/mysql-test/suite/innodb/disabled.def @@ -10,5 +10,4 @@ # ############################################################################## -innodb-wl5980-alter : MDEV-9469 / MDEV-13668 extra crash in 10.2 create-index-debug : MDEV-13680 InnoDB may crash when btr_page_alloc() fails diff --git a/mysql-test/suite/innodb/r/innodb-alter-table.result b/mysql-test/suite/innodb/r/innodb-alter-table.result index 6045b6d70a0..0d5afab6bae 100644 --- a/mysql-test/suite/innodb/r/innodb-alter-table.result +++ b/mysql-test/suite/innodb/r/innodb-alter-table.result @@ -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 + 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; diff --git a/mysql-test/suite/innodb/r/innodb-alter.result b/mysql-test/suite/innodb/r/innodb-alter.result index 831356fd872..8bf66bb8914 100644 --- a/mysql-test/suite/innodb/r/innodb-alter.result +++ b/mysql-test/suite/innodb/r/innodb-alter.result @@ -540,9 +540,6 @@ 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; -ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY -ALTER TABLE t1n CHANGE c2 c4 INT, LOCK=NONE; -ALTER TABLE t1n ADD INDEX(c4), LOCK=NONE; SHOW CREATE TABLE t1n; Table Create Table t1n CREATE TABLE `t1n` ( @@ -559,9 +556,6 @@ 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; -ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY -ALTER TABLE t1n CHANGE c4 c11 INT, LOCK=NONE; -ALTER TABLE t1n ADD INDEX(c11), LOCK=NONE; SHOW CREATE TABLE t1n; Table Create Table t1n CREATE TABLE `t1n` ( @@ -649,9 +643,16 @@ 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 diff --git a/mysql-test/suite/innodb/r/innodb-get-fk.result b/mysql-test/suite/innodb/r/innodb-get-fk.result index ee17f262854..aa1bff8f134 100644 --- a/mysql-test/suite/innodb/r/innodb-get-fk.result +++ b/mysql-test/suite/innodb/r/innodb-get-fk.result @@ -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 diff --git a/mysql-test/suite/innodb/r/innodb-wl5980-alter.result b/mysql-test/suite/innodb/r/innodb-wl5980-alter.result index edd101efebb..27866b68303 100644 --- a/mysql-test/suite/innodb/r/innodb-wl5980-alter.result +++ b/mysql-test/suite/innodb/r/innodb-wl5980-alter.result @@ -48,8 +48,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, - `c2` int(11) DEFAULT '1', - `ct` text, + `c2` int(11) DEFAULT 1, + `ct` text DEFAULT NULL, PRIMARY KEY (`c1`), KEY `c2` (`c2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' @@ -59,7 +59,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` int(11), - `ct` text, + `ct` text DEFAULT NULL, PRIMARY KEY (`c1`), KEY `c2` (`c2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' @@ -267,7 +267,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `c1` int(11) NOT NULL, `c3` int(11) DEFAULT NULL, - `ct` text, + `ct` text DEFAULT NULL, PRIMARY KEY (`c1`), KEY `c2` (`c3`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' @@ -309,7 +309,7 @@ Table Create Table t3 CREATE TABLE `t3` ( `c1` int(11) NOT NULL, `1234567890123456789012345678901234567890123456789012345678901234` int(11) DEFAULT NULL, - `ct` text, + `ct` text DEFAULT NULL, PRIMARY KEY (`c1`), KEY `c2` (`1234567890123456789012345678901234567890123456789012345678901234`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' @@ -360,9 +360,9 @@ t3.isl t1c.ibd t3.ibd 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' +ERROR HY000: Invalid utf8mb4 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' +ERROR HY000: Invalid utf8mb4 character string: '\xF0\x9F\x98\xB2' ALTER TABLE t3 RENAME TO t2; ### files in MYSQL_DATA_DIR/test sys_foreign.frm @@ -390,7 +390,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `c1` int(11) NOT NULL, `c3` int(11) DEFAULT NULL, - `ct` text, + `ct` text DEFAULT NULL, PRIMARY KEY (`c1`), KEY `c2` (`c3`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' @@ -436,17 +436,17 @@ 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 +ERROR 42000: Can't DROP INDEX `c4`; check that it exists ALTER TABLE t1c DROP FOREIGN KEY c2; -ERROR 42000: Can't DROP 'c2'; check that column/key exists +ERROR 42000: Can't DROP FOREIGN KEY `c2`; check that it exists ALTER TABLE t1c DROP FOREIGN KEY t1c2, DROP FOREIGN KEY c2; -ERROR 42000: Can't DROP 'c2'; check that column/key exists +ERROR 42000: Can't DROP FOREIGN KEY `c2`; check that it 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 +ERROR 42000: Can't DROP FOREIGN KEY `c2`; check that it 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 +ERROR 42000: Can't DROP FOREIGN KEY `ẗ1C2`; check that it exists SHOW CREATE TABLE t1c; Table Create Table t1c CREATE TABLE `t1c` ( @@ -680,24 +680,24 @@ 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. +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 ### files in MYSQL_DATA_DIR/test -FTS_AUX_INDEX_1.ibd -FTS_AUX_INDEX_2.ibd -FTS_AUX_INDEX_3.ibd -FTS_AUX_INDEX_4.ibd -FTS_AUX_INDEX_5.ibd -FTS_AUX_INDEX_6.ibd -FTS_AUX_BEING_DELETED.ibd -FTS_AUX_BEING_DELETED_CACHE.ibd -FTS_AUX_CONFIG.ibd -FTS_AUX_DELETED.ibd -FTS_AUX_DELETED_CACHE.ibd +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl sys_foreign.frm sys_foreign.ibd sys_indexes.frm @@ -713,6 +713,17 @@ t1p.isl tt.frm tt.isl ### files in MYSQL_TMP_DIR/alt_dir/test +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd t1c.ibd t1p.ibd tt.ibd @@ -730,8 +741,8 @@ SHOW CREATE TABLE tt; Table Create Table tt CREATE TABLE `tt` ( `pk` int(11) NOT NULL, - `c2` int(11) DEFAULT '42', - `ct` text, + `c2` int(11) DEFAULT 42, + `ct` text DEFAULT NULL, PRIMARY KEY (`pk`), FULLTEXT KEY `ct` (`ct`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' @@ -755,23 +766,23 @@ 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. +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); Warnings: Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID ### files in MYSQL_DATA_DIR/test -FTS_AUX_INDEX_1.ibd -FTS_AUX_INDEX_2.ibd -FTS_AUX_INDEX_3.ibd -FTS_AUX_INDEX_4.ibd -FTS_AUX_INDEX_5.ibd -FTS_AUX_INDEX_6.ibd -FTS_AUX_BEING_DELETED.ibd -FTS_AUX_BEING_DELETED_CACHE.ibd -FTS_AUX_CONFIG.ibd -FTS_AUX_DELETED.ibd -FTS_AUX_DELETED_CACHE.ibd +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl FTS_AUX_INDEX_1.ibd FTS_AUX_INDEX_2.ibd FTS_AUX_INDEX_3.ibd @@ -800,17 +811,6 @@ t1p.isl tt.frm tt.isl ### files in MYSQL_TMP_DIR/alt_dir/test -t1c.ibd -t1p.ibd -tt.ibd -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; -### files in MYSQL_DATA_DIR/test FTS_AUX_INDEX_1.ibd FTS_AUX_INDEX_2.ibd FTS_AUX_INDEX_3.ibd @@ -822,6 +822,28 @@ FTS_AUX_BEING_DELETED_CACHE.ibd FTS_AUX_CONFIG.ibd FTS_AUX_DELETED.ibd FTS_AUX_DELETED_CACHE.ibd +t1c.ibd +t1p.ibd +tt.ibd +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; +### files in MYSQL_DATA_DIR/test +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl FTS_AUX_INDEX_1.ibd FTS_AUX_INDEX_2.ibd FTS_AUX_INDEX_3.ibd @@ -850,11 +872,6 @@ t1p.isl tt.frm tt.isl ### files in MYSQL_TMP_DIR/alt_dir/test -t1c.ibd -t1p.ibd -tt.ibd -ALTER TABLE t1n CHANGE FTS_DOC_ÏD c1 INT, ALGORITHM=INPLACE; -### files in MYSQL_DATA_DIR/test FTS_AUX_INDEX_1.ibd FTS_AUX_INDEX_2.ibd FTS_AUX_INDEX_3.ibd @@ -866,6 +883,22 @@ FTS_AUX_BEING_DELETED_CACHE.ibd FTS_AUX_CONFIG.ibd FTS_AUX_DELETED.ibd FTS_AUX_DELETED_CACHE.ibd +t1c.ibd +t1p.ibd +tt.ibd +ALTER TABLE t1n CHANGE FTS_DOC_ÏD c1 INT, ALGORITHM=INPLACE; +### files in MYSQL_DATA_DIR/test +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl FTS_AUX_INDEX_1.ibd FTS_AUX_INDEX_2.ibd FTS_AUX_INDEX_3.ibd @@ -894,12 +927,6 @@ t1p.isl tt.frm tt.isl ### files in MYSQL_TMP_DIR/alt_dir/test -t1c.ibd -t1p.ibd -tt.ibd -ALTER TABLE t1n CHANGE c1 c2 INT, CHANGE c2 ct INT, CHANGE ct c1 TEXT, -ALGORITHM=INPLACE; -### files in MYSQL_DATA_DIR/test FTS_AUX_INDEX_1.ibd FTS_AUX_INDEX_2.ibd FTS_AUX_INDEX_3.ibd @@ -911,6 +938,23 @@ FTS_AUX_BEING_DELETED_CACHE.ibd FTS_AUX_CONFIG.ibd FTS_AUX_DELETED.ibd FTS_AUX_DELETED_CACHE.ibd +t1c.ibd +t1p.ibd +tt.ibd +ALTER TABLE t1n CHANGE c1 c2 INT, CHANGE c2 ct INT, CHANGE ct c1 TEXT, +ALGORITHM=INPLACE; +### files in MYSQL_DATA_DIR/test +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl FTS_AUX_INDEX_1.ibd FTS_AUX_INDEX_2.ibd FTS_AUX_INDEX_3.ibd @@ -939,6 +983,17 @@ t1p.isl tt.frm tt.isl ### files in MYSQL_TMP_DIR/alt_dir/test +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd t1c.ibd t1p.ibd tt.ibd @@ -947,24 +1002,24 @@ Table Create Table t1n CREATE TABLE `t1n` ( `c2` int(11) NOT NULL, `ct` int(11) DEFAULT NULL, - `c1` text, + `c1` text DEFAULT NULL, PRIMARY KEY (`c2`), FULLTEXT KEY `ct` (`c1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ALTER TABLE t1n CHANGE c2 c1 INT, CHANGE ct c2 INT, CHANGE c1 ct TEXT, ALGORITHM=COPY; ### files in MYSQL_DATA_DIR/test -FTS_AUX_INDEX_1.ibd -FTS_AUX_INDEX_2.ibd -FTS_AUX_INDEX_3.ibd -FTS_AUX_INDEX_4.ibd -FTS_AUX_INDEX_5.ibd -FTS_AUX_INDEX_6.ibd -FTS_AUX_BEING_DELETED.ibd -FTS_AUX_BEING_DELETED_CACHE.ibd -FTS_AUX_CONFIG.ibd -FTS_AUX_DELETED.ibd -FTS_AUX_DELETED_CACHE.ibd +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl FTS_AUX_INDEX_1.ibd FTS_AUX_INDEX_2.ibd FTS_AUX_INDEX_3.ibd @@ -993,6 +1048,17 @@ t1p.isl tt.frm tt.isl ### files in MYSQL_TMP_DIR/alt_dir/test +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd t1c.ibd t1p.ibd tt.ibd @@ -1001,7 +1067,7 @@ Table Create Table t1n CREATE TABLE `t1n` ( `c1` int(11) NOT NULL, `c2` int(11) DEFAULT NULL, - `ct` text, + `ct` text DEFAULT NULL, PRIMARY KEY (`c1`), FULLTEXT KEY `ct` (`ct`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 @@ -1010,21 +1076,18 @@ 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; -ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY. -ALTER TABLE t1n CHANGE c2 c4 INT, LOCK=NONE; -ALTER TABLE t1n ADD INDEX(c4), LOCK=NONE; ### files in MYSQL_DATA_DIR/test -FTS_AUX_INDEX_1.ibd -FTS_AUX_INDEX_2.ibd -FTS_AUX_INDEX_3.ibd -FTS_AUX_INDEX_4.ibd -FTS_AUX_INDEX_5.ibd -FTS_AUX_INDEX_6.ibd -FTS_AUX_BEING_DELETED.ibd -FTS_AUX_BEING_DELETED_CACHE.ibd -FTS_AUX_CONFIG.ibd -FTS_AUX_DELETED.ibd -FTS_AUX_DELETED_CACHE.ibd +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl FTS_AUX_INDEX_1.ibd FTS_AUX_INDEX_2.ibd FTS_AUX_INDEX_3.ibd @@ -1053,6 +1116,17 @@ t1p.isl tt.frm tt.isl ### files in MYSQL_TMP_DIR/alt_dir/test +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd t1c.ibd t1p.ibd tt.ibd @@ -1061,24 +1135,24 @@ Table Create Table t1n CREATE TABLE `t1n` ( `c1` int(11) NOT NULL, `c4` int(11) DEFAULT NULL, - `ct` text, + `ct` text DEFAULT NULL, PRIMARY KEY (`c1`), KEY `c4` (`c4`), FULLTEXT KEY `ct` (`ct`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ALTER TABLE t1n DROP INDEX c4; ### files in MYSQL_DATA_DIR/test -FTS_AUX_INDEX_1.ibd -FTS_AUX_INDEX_2.ibd -FTS_AUX_INDEX_3.ibd -FTS_AUX_INDEX_4.ibd -FTS_AUX_INDEX_5.ibd -FTS_AUX_INDEX_6.ibd -FTS_AUX_BEING_DELETED.ibd -FTS_AUX_BEING_DELETED_CACHE.ibd -FTS_AUX_CONFIG.ibd -FTS_AUX_DELETED.ibd -FTS_AUX_DELETED_CACHE.ibd +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl FTS_AUX_INDEX_1.ibd FTS_AUX_INDEX_2.ibd FTS_AUX_INDEX_3.ibd @@ -1107,16 +1181,6 @@ t1p.isl tt.frm tt.isl ### files in MYSQL_TMP_DIR/alt_dir/test -t1c.ibd -t1p.ibd -tt.ibd -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; -ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY. -ALTER TABLE t1n CHANGE c4 c11 INT, LOCK=NONE; -ALTER TABLE t1n ADD INDEX(c11), LOCK=NONE; -### files in MYSQL_DATA_DIR/test FTS_AUX_INDEX_1.ibd FTS_AUX_INDEX_2.ibd FTS_AUX_INDEX_3.ibd @@ -1128,6 +1192,24 @@ FTS_AUX_BEING_DELETED_CACHE.ibd FTS_AUX_CONFIG.ibd FTS_AUX_DELETED.ibd FTS_AUX_DELETED_CACHE.ibd +t1c.ibd +t1p.ibd +tt.ibd +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; +### files in MYSQL_DATA_DIR/test +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl FTS_AUX_INDEX_1.ibd FTS_AUX_INDEX_2.ibd FTS_AUX_INDEX_3.ibd @@ -1156,6 +1238,17 @@ t1p.isl tt.frm tt.isl ### files in MYSQL_TMP_DIR/alt_dir/test +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd t1c.ibd t1p.ibd tt.ibd @@ -1164,7 +1257,7 @@ Table Create Table t1n CREATE TABLE `t1n` ( `c1` int(11) NOT NULL, `c11` int(11) DEFAULT NULL, - `ct` text, + `ct` text DEFAULT NULL, PRIMARY KEY (`c1`), KEY `c11` (`c11`), FULLTEXT KEY `ct` (`ct`) @@ -1172,17 +1265,17 @@ t1n CREATE TABLE `t1n` ( DROP TABLE t1n; ALTER TABLE t1o MODIFY c1 BIGINT UNSIGNED NOT NULL; ### files in MYSQL_DATA_DIR/test -FTS_AUX_INDEX_1.ibd -FTS_AUX_INDEX_2.ibd -FTS_AUX_INDEX_3.ibd -FTS_AUX_INDEX_4.ibd -FTS_AUX_INDEX_5.ibd -FTS_AUX_INDEX_6.ibd -FTS_AUX_BEING_DELETED.ibd -FTS_AUX_BEING_DELETED_CACHE.ibd -FTS_AUX_CONFIG.ibd -FTS_AUX_DELETED.ibd -FTS_AUX_DELETED_CACHE.ibd +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl sys_foreign.frm sys_foreign.ibd sys_indexes.frm @@ -1198,18 +1291,6 @@ t1p.isl tt.frm tt.isl ### files in MYSQL_TMP_DIR/alt_dir/test -t1c.ibd -t1p.ibd -tt.ibd -call mtr.add_suppression("Error: no matching column for .FTS_DOC_ID. in index .ct.--temporary-- of table .test...t1o"); -ALTER TABLE t1o ADD FULLTEXT INDEX(ct), -CHANGE c1 FTS_DOC_ID BIGINT UNSIGNED NOT NULL, -ALGORITHM=INPLACE; -ERROR HY000: Incorrect key file for table 't1o'; try to repair it -# The following would crash 10.2. Re-enable this and test after merge! -ALTER TABLE t1o CHANGE c1 FTS_DOC_ID BIGINT UNSIGNED NOT NULL, LOCK=NONE; -ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ALGORITHM=INPLACE; -### files in MYSQL_DATA_DIR/test FTS_AUX_INDEX_1.ibd FTS_AUX_INDEX_2.ibd FTS_AUX_INDEX_3.ibd @@ -1221,6 +1302,24 @@ FTS_AUX_BEING_DELETED_CACHE.ibd FTS_AUX_CONFIG.ibd FTS_AUX_DELETED.ibd FTS_AUX_DELETED_CACHE.ibd +t1c.ibd +t1p.ibd +tt.ibd +ALTER TABLE t1o ADD FULLTEXT INDEX(ct), +CHANGE c1 FTS_DOC_ID BIGINT UNSIGNED NOT NULL, +ALGORITHM=INPLACE; +### files in MYSQL_DATA_DIR/test +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl FTS_AUX_INDEX_1.ibd FTS_AUX_INDEX_2.ibd FTS_AUX_INDEX_3.ibd @@ -1247,9 +1346,23 @@ t1p.isl tt.frm tt.isl ### files in MYSQL_TMP_DIR/alt_dir/test +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd t1c.ibd t1p.ibd tt.ibd +ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL, +LOCK=NONE; +ERROR 0A000: LOCK=NONE is not supported. Reason: Cannot drop or rename FTS_DOC_ID. Try LOCK=SHARED 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 @@ -1261,24 +1374,24 @@ Table Create Table t1o CREATE TABLE `t1o` ( `FTS_DOC_ID` bigint(20) unsigned NOT NULL, `c2` int(11) DEFAULT NULL, - `ct` text, + `ct` text DEFAULT NULL, 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, LOCK=NONE; ### files in MYSQL_DATA_DIR/test -FTS_AUX_INDEX_1.ibd -FTS_AUX_INDEX_2.ibd -FTS_AUX_INDEX_3.ibd -FTS_AUX_INDEX_4.ibd -FTS_AUX_INDEX_5.ibd -FTS_AUX_INDEX_6.ibd -FTS_AUX_BEING_DELETED.ibd -FTS_AUX_BEING_DELETED_CACHE.ibd -FTS_AUX_CONFIG.ibd -FTS_AUX_DELETED.ibd -FTS_AUX_DELETED_CACHE.ibd +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl sys_foreign.frm sys_foreign.ibd sys_indexes.frm @@ -1294,6 +1407,17 @@ t1p.isl tt.frm tt.isl ### files in MYSQL_TMP_DIR/alt_dir/test +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd t1c.ibd t1p.ibd tt.ibd @@ -1302,7 +1426,7 @@ Table Create Table t1o CREATE TABLE `t1o` ( `foo_id` bigint(20) unsigned NOT NULL, `c2` int(11) DEFAULT NULL, - `ct` text, + `ct` text DEFAULT NULL, PRIMARY KEY (`foo_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1c, t1p, sys_tables, sys_indexes, sys_foreign; @@ -1328,17 +1452,17 @@ 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(foo_id); ### files in MYSQL_DATA_DIR/test -FTS_AUX_INDEX_1.ibd -FTS_AUX_INDEX_2.ibd -FTS_AUX_INDEX_3.ibd -FTS_AUX_INDEX_4.ibd -FTS_AUX_INDEX_5.ibd -FTS_AUX_INDEX_6.ibd -FTS_AUX_BEING_DELETED.ibd -FTS_AUX_BEING_DELETED_CACHE.ibd -FTS_AUX_CONFIG.ibd -FTS_AUX_DELETED.ibd -FTS_AUX_DELETED_CACHE.ibd +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl sys_foreign.frm sys_foreign.ibd sys_indexes.frm @@ -1350,13 +1474,6 @@ t1o.ibd tt.frm tt.isl ### files in MYSQL_TMP_DIR/alt_dir/test -tt.ibd -ALTER TABLE t1o CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL, -ADD FULLTEXT INDEX(ct); -ERROR HY000: Incorrect key file for table 't1o'; try to repair it -ALTER TABLE t1o CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL, LOCK=NONE; -ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ALGORITHM=INPLACE; -### files in MYSQL_DATA_DIR/test FTS_AUX_INDEX_1.ibd FTS_AUX_INDEX_2.ibd FTS_AUX_INDEX_3.ibd @@ -1368,6 +1485,21 @@ FTS_AUX_BEING_DELETED_CACHE.ibd FTS_AUX_CONFIG.ibd FTS_AUX_DELETED.ibd FTS_AUX_DELETED_CACHE.ibd +tt.ibd +ALTER TABLE t1o CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL, +ADD FULLTEXT INDEX(ct); +### files in MYSQL_DATA_DIR/test +FTS_AUX_INDEX_1.isl +FTS_AUX_INDEX_2.isl +FTS_AUX_INDEX_3.isl +FTS_AUX_INDEX_4.isl +FTS_AUX_INDEX_5.isl +FTS_AUX_INDEX_6.isl +FTS_AUX_BEING_DELETED.isl +FTS_AUX_BEING_DELETED_CACHE.isl +FTS_AUX_CONFIG.isl +FTS_AUX_DELETED.isl +FTS_AUX_DELETED_CACHE.isl FTS_AUX_INDEX_1.ibd FTS_AUX_INDEX_2.ibd FTS_AUX_INDEX_3.ibd @@ -1390,6 +1522,17 @@ t1o.ibd tt.frm tt.isl ### files in MYSQL_TMP_DIR/alt_dir/test +FTS_AUX_INDEX_1.ibd +FTS_AUX_INDEX_2.ibd +FTS_AUX_INDEX_3.ibd +FTS_AUX_INDEX_4.ibd +FTS_AUX_INDEX_5.ibd +FTS_AUX_INDEX_6.ibd +FTS_AUX_BEING_DELETED.ibd +FTS_AUX_BEING_DELETED_CACHE.ibd +FTS_AUX_CONFIG.ibd +FTS_AUX_DELETED.ibd +FTS_AUX_DELETED_CACHE.ibd tt.ibd ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL; ERROR HY000: Index 'FTS_DOC_ID_INDEX' is of wrong type for an InnoDB FULLTEXT index diff --git a/mysql-test/suite/innodb/r/table_definition_cache_debug.result b/mysql-test/suite/innodb/r/table_definition_cache_debug.result new file mode 100644 index 00000000000..afceec731b0 --- /dev/null +++ b/mysql-test/suite/innodb/r/table_definition_cache_debug.result @@ -0,0 +1,21 @@ +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); +connect ddl,localhost,root,,; +SET DEBUG_SYNC = 'row_log_apply_before SIGNAL scanned WAIT_FOR got_duplicate'; +ALTER TABLE to_be_evicted ADD UNIQUE INDEX(b); +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR scanned'; +BEGIN; +INSERT INTO to_be_evicted VALUES(3, 2); +SET DEBUG_SYNC = 'now SIGNAL got_duplicate'; +connection ddl; +ERROR 23000: Duplicate entry '2' for key 'b' +disconnect ddl; +connection default; +COMMIT; +SET DEBUG_SYNC = RESET; +FLUSH TABLES; diff --git a/mysql-test/suite/innodb/t/innodb-alter-table.test b/mysql-test/suite/innodb/t/innodb-alter-table.test index 97f0075f344..0cf456ad146 100644 --- a/mysql-test/suite/innodb/t/innodb-alter-table.test +++ b/mysql-test/suite/innodb/t/innodb-alter-table.test @@ -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; diff --git a/mysql-test/suite/innodb/t/innodb-alter.test b/mysql-test/suite/innodb/t/innodb-alter.test index 1810c61eabe..9d84e95b88d 100644 --- a/mysql-test/suite/innodb/t/innodb-alter.test +++ b/mysql-test/suite/innodb/t/innodb-alter.test @@ -298,21 +298,12 @@ SHOW CREATE TABLE t1n; 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; -# FIXME: MDEV-13668 InnoDB unnecessarily rebuilds table -# when renaming a column and adding index ---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON ALTER TABLE t1n ADD INDEX(c4), CHANGE c2 c4 INT, ALGORITHM=INPLACE; -ALTER TABLE t1n CHANGE c2 c4 INT, LOCK=NONE; -ALTER TABLE t1n ADD INDEX(c4), LOCK=NONE; 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; -# FIXME: MDEV-13668 ---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON ALTER TABLE t1n CHANGE c4 c11 INT, ADD INDEX(c11), ALGORITHM=INPLACE; -ALTER TABLE t1n CHANGE c4 c11 INT, LOCK=NONE; -ALTER TABLE t1n ADD INDEX(c11), LOCK=NONE; SHOW CREATE TABLE t1n; DROP TABLE t1n; @@ -488,6 +479,9 @@ eval DROP DATABASE $source_db; eval DROP DATABASE $dest_db; USE test; +# +# End of 10.1 tests +# --echo # --echo # MDEV-14038 ALTER TABLE does not exit on error with InnoDB + bad default function @@ -517,3 +511,7 @@ ALTER TABLE t1 ADD b TIME NOT NULL DEFAULT if(unix_timestamp()>1,TIMESTAMP'2001- --disable_info SELECT * FROM t1; DROP TABLE t1; + +# +# End of 10.2 tests +# diff --git a/mysql-test/suite/innodb/t/innodb-get-fk.test b/mysql-test/suite/innodb/t/innodb-get-fk.test index 339a7968623..46eb7dd0273 100644 --- a/mysql-test/suite/innodb/t/innodb-get-fk.test +++ b/mysql-test/suite/innodb/t/innodb-get-fk.test @@ -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 diff --git a/mysql-test/suite/innodb/t/innodb-wl5980-alter.test b/mysql-test/suite/innodb/t/innodb-wl5980-alter.test index 4b26661793c..a0d80ea8374 100644 --- a/mysql-test/suite/innodb/t/innodb-wl5980-alter.test +++ b/mysql-test/suite/innodb/t/innodb-wl5980-alter.test @@ -8,7 +8,7 @@ --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/; +LET $regexp=/FTS_[0-9a-f_]+([A-Z0-9_]+)\.([islbd]{3})/FTS_AUX_\1.\2/; # Set up some variables LET $MYSQL_DATA_DIR = `select @@datadir`; @@ -447,12 +447,7 @@ 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; -# FIXME: MDEV-13668 InnoDB unnecessarily rebuilds table -# when renaming a column and adding index ---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON ALTER TABLE t1n ADD INDEX(c4), CHANGE c2 c4 INT, ALGORITHM=INPLACE; -ALTER TABLE t1n CHANGE c2 c4 INT, LOCK=NONE; -ALTER TABLE t1n ADD INDEX(c4), LOCK=NONE; --echo ### files in MYSQL_DATA_DIR/test --replace_regex $regexp @@ -474,11 +469,7 @@ ALTER TABLE t1n DROP INDEX c4; --error ER_DUP_FIELDNAME ALTER TABLE t1n CHANGE c4 c1 INT, ADD INDEX(c1), ALGORITHM=INPLACE; -# FIXME: MDEV-13668 ---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON ALTER TABLE t1n CHANGE c4 c11 INT, ADD INDEX(c11), ALGORITHM=INPLACE; -ALTER TABLE t1n CHANGE c4 c11 INT, LOCK=NONE; -ALTER TABLE t1n ADD INDEX(c11), LOCK=NONE; --echo ### files in MYSQL_DATA_DIR/test --replace_regex $regexp @@ -500,18 +491,10 @@ ALTER TABLE t1o MODIFY c1 BIGINT UNSIGNED NOT NULL; --replace_regex $regexp --list_files $MYSQL_TMP_DIR/alt_dir/test -# FIXME: MDEV-9469 'Incorrect key file' on ALTER TABLE -call mtr.add_suppression("Error: no matching column for .FTS_DOC_ID. in index .ct.--temporary-- of table .test...t1o"); ---error ER_NOT_KEYFILE ALTER TABLE t1o ADD FULLTEXT INDEX(ct), CHANGE c1 FTS_DOC_ID BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE; ---echo # The following would crash 10.2. Re-enable this and test after merge! -ALTER TABLE t1o CHANGE c1 FTS_DOC_ID BIGINT UNSIGNED NOT NULL, LOCK=NONE; -ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ALGORITHM=INPLACE; -# end of MDEV-9469 FIXME - --echo ### files in MYSQL_DATA_DIR/test --replace_regex $regexp --list_files $MYSQL_DATA_DIR/test @@ -520,11 +503,9 @@ ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ALGORITHM=INPLACE; --list_files $MYSQL_TMP_DIR/alt_dir/test # This would create a hidden FTS_DOC_ID column, which cannot be done online. -# FIXME: MDEV-9469 (enable this) -#--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON -#ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL, -#LOCK=NONE; -#end of MDEV-9469 FIXME +--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 @@ -535,7 +516,6 @@ WHERE st.NAME='test/t1o' AND sc.NAME='FTS_DOC_ID'; --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR SHOW CREATE TABLE t1o; -# FIXME: MDEV-13668 ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL, DROP INDEX ct, LOCK=NONE; @@ -573,15 +553,9 @@ ALTER TABLE t1o ADD UNIQUE INDEX FTS_DOC_ID_INDEX(foo_id); --replace_regex $regexp --list_files $MYSQL_TMP_DIR/alt_dir/test -# FIXME: MDEV-9469 'Incorrect key file' on ALTER TABLE ---error ER_NOT_KEYFILE ALTER TABLE t1o CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL, ADD FULLTEXT INDEX(ct); -ALTER TABLE t1o CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL, LOCK=NONE; -ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ALGORITHM=INPLACE; -#end of MDEV-9469 FIXME - --echo ### files in MYSQL_DATA_DIR/test --replace_regex $regexp --list_files $MYSQL_DATA_DIR/test diff --git a/mysql-test/suite/innodb/t/table_definition_cache_debug.opt b/mysql-test/suite/innodb/t/table_definition_cache_debug.opt new file mode 100644 index 00000000000..6195e055dc8 --- /dev/null +++ b/mysql-test/suite/innodb/t/table_definition_cache_debug.opt @@ -0,0 +1 @@ +--innodb-open-files=13 diff --git a/mysql-test/suite/innodb/t/table_definition_cache_debug.test b/mysql-test/suite/innodb/t/table_definition_cache_debug.test new file mode 100644 index 00000000000..57d64d6844e --- /dev/null +++ b/mysql-test/suite/innodb/t/table_definition_cache_debug.test @@ -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; diff --git a/mysql-test/suite/innodb_fts/r/concurrent_insert.result b/mysql-test/suite/innodb_fts/r/concurrent_insert.result new file mode 100644 index 00000000000..5644075038a --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/concurrent_insert.result @@ -0,0 +1,11 @@ +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'); +connect dml, localhost, root, ,; +SET DEBUG_SYNC = 'now WAIT_FOR prepared'; +REPLACE INTO t1(a) VALUES('aaa'); +SET DEBUG_SYNC = 'now SIGNAL race'; +disconnect dml; +connection default; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/r/fulltext.result b/mysql-test/suite/innodb_fts/r/fulltext.result index f096f1c7dd5..42e294b3293 100644 --- a/mysql-test/suite/innodb_fts/r/fulltext.result +++ b/mysql-test/suite/innodb_fts/r/fulltext.result @@ -1,4 +1,3 @@ -drop table if exists t1,t2,t3; CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)) ENGINE = InnoDB; INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'), ('Full-text indexes', 'are called collections'), @@ -637,3 +636,58 @@ EXECUTE stmt; DEALLOCATE PREPARE stmt; DROP TABLE t1; End of 5.1 tests +CREATE TABLE z(a INTEGER) engine=innodb; +CREATE TABLE q(b TEXT CHARSET latin1, fulltext(b)) engine=innodb; +EXPLAIN SELECT 1 FROM q WHERE (SELECT MATCH(b) AGAINST ('*') FROM z); +ERROR 42000: syntax error, unexpected $end, expecting FTS_TERM or FTS_NUMB or '*' +SELECT 1 FROM q WHERE (SELECT MATCH(b) AGAINST ('*') FROM z); +ERROR 42000: syntax error, unexpected $end, expecting FTS_TERM or FTS_NUMB or '*' +EXPLAIN SELECT MATCH(b) AGAINST ('*') FROM z; +ERROR 42S22: Unknown column 'b' in 'field list' +SELECT MATCH(b) AGAINST ('*') FROM z; +ERROR 42S22: Unknown column 'b' in 'field list' +EXPLAIN SELECT MATCH(a) AGAINST ('*') FROM z; +ERROR HY000: Can't find FULLTEXT index matching the column list +SELECT MATCH(a) AGAINST ('*') FROM z; +ERROR HY000: Can't find FULLTEXT index matching the column list +EXPLAIN SELECT MATCH(b) AGAINST ('*') FROM q; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE q ALL NULL NULL NULL NULL 1 +SELECT MATCH(b) AGAINST ('*') FROM q; +ERROR 42000: syntax error, unexpected $end, expecting FTS_TERM or FTS_NUMB or '*' +DROP TABLE z, q; +create table t ( +FTS_DOC_ID BIGINT UNSIGNED PRIMARY KEY, t TEXT, FULLTEXT KEY (t) +) ENGINE=InnoDB; +INSERT INTO t values (1, 'foo bar'), (2, 'foo bar'), (3, 'foo'); +SELECT * FROM t WHERE MATCH(t) AGAINST ('foo bar' IN BOOLEAN MODE) +LIMIT 0; +FTS_DOC_ID t +SELECT * FROM t WHERE MATCH(t) AGAINST ('foo bar' IN BOOLEAN MODE) +LIMIT 1; +FTS_DOC_ID t +1 foo bar +SELECT * FROM t WHERE MATCH(t) AGAINST ('foo bar' IN BOOLEAN MODE) +LIMIT 2; +FTS_DOC_ID t +1 foo bar +2 foo bar +SELECT * FROM t WHERE MATCH(t) AGAINST ('foo bar' IN BOOLEAN MODE) +LIMIT 3; +FTS_DOC_ID t +1 foo bar +2 foo bar +3 foo +SELECT * FROM t WHERE MATCH(t) AGAINST ('foo bar' IN BOOLEAN MODE) +LIMIT 4; +FTS_DOC_ID t +1 foo bar +2 foo bar +3 foo +SELECT * FROM t WHERE MATCH(t) AGAINST ('foo bar' IN BOOLEAN MODE) +LIMIT 5; +FTS_DOC_ID t +1 foo bar +2 foo bar +3 foo +DROP TABLE t; diff --git a/mysql-test/suite/innodb_fts/t/concurrent_insert.test b/mysql-test/suite/innodb_fts/t/concurrent_insert.test new file mode 100644 index 00000000000..e5d61cd8b05 --- /dev/null +++ b/mysql-test/suite/innodb_fts/t/concurrent_insert.test @@ -0,0 +1,20 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +CREATE TABLE t1(a VARCHAR(5),FULLTEXT KEY(a)) ENGINE=InnoDB; +SET DEBUG_SYNC = 'get_next_FTS_DOC_ID SIGNAL prepared WAIT_FOR race'; +--send +REPLACE INTO t1(a) values('aaa'); + +connect(dml, localhost, root, ,); +SET DEBUG_SYNC = 'now WAIT_FOR prepared'; +REPLACE INTO t1(a) VALUES('aaa'); +SET DEBUG_SYNC = 'now SIGNAL race'; +disconnect dml; + +connection default; +reap; +SET DEBUG_SYNC = 'RESET'; + +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/t/fulltext.test b/mysql-test/suite/innodb_fts/t/fulltext.test index 90d5d5c71e0..663b202265b 100644 --- a/mysql-test/suite/innodb_fts/t/fulltext.test +++ b/mysql-test/suite/innodb_fts/t/fulltext.test @@ -4,10 +4,6 @@ --source include/have_innodb.inc ---disable_warnings -drop table if exists t1,t2,t3; ---enable_warnings - CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)) ENGINE = InnoDB; INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'), ('Full-text indexes', 'are called collections'), @@ -679,3 +675,45 @@ DEALLOCATE PREPARE stmt; DROP TABLE t1; --echo End of 5.1 tests + +# This is an adapted and extended version of an Oracle test for +# Bug#21140111: Explain ... match against: Assertion failed: ret ... +# No bug was repeatable for MariaDB. + +CREATE TABLE z(a INTEGER) engine=innodb; +CREATE TABLE q(b TEXT CHARSET latin1, fulltext(b)) engine=innodb; + +--error ER_PARSE_ERROR +EXPLAIN SELECT 1 FROM q WHERE (SELECT MATCH(b) AGAINST ('*') FROM z); +--error ER_PARSE_ERROR +SELECT 1 FROM q WHERE (SELECT MATCH(b) AGAINST ('*') FROM z); +--error ER_BAD_FIELD_ERROR +EXPLAIN SELECT MATCH(b) AGAINST ('*') FROM z; +--error ER_BAD_FIELD_ERROR +SELECT MATCH(b) AGAINST ('*') FROM z; +--error ER_FT_MATCHING_KEY_NOT_FOUND +EXPLAIN SELECT MATCH(a) AGAINST ('*') FROM z; +--error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT MATCH(a) AGAINST ('*') FROM z; +EXPLAIN SELECT MATCH(b) AGAINST ('*') FROM q; +--error ER_PARSE_ERROR +SELECT MATCH(b) AGAINST ('*') FROM q; + +DROP TABLE z, q; + +create table t ( + FTS_DOC_ID BIGINT UNSIGNED PRIMARY KEY, t TEXT, FULLTEXT KEY (t) +) ENGINE=InnoDB; + +INSERT INTO t values (1, 'foo bar'), (2, 'foo bar'), (3, 'foo'); +let $limit=0; +let $N=6; +while ($N) +{ + eval SELECT * FROM t WHERE MATCH(t) AGAINST ('foo bar' IN BOOLEAN MODE) + LIMIT $limit; + inc $limit; + dec $N; +} + +DROP TABLE t; diff --git a/mysql-test/suite/innodb_zip/r/restart.result b/mysql-test/suite/innodb_zip/r/restart.result index 88bd79cd428..c4e6daf73fe 100644 --- a/mysql-test/suite/innodb_zip/r/restart.result +++ b/mysql-test/suite/innodb_zip/r/restart.result @@ -211,18 +211,18 @@ test/t7_restart#p#p1#sp#s2 test/t7_restart#p#p1#sp#s2 97 8 Dynamic 0 Single test/t7_restart#p#p1#sp#s3 test/t7_restart#p#p1#sp#s3 97 8 Dynamic 0 Single === information_schema.innodb_sys_tablespaces and innodb_sys_datafiles === Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path -test/t1_restart Single DEFAULT 0 Compact or Redundant MYSQLD_DATADIR/test/t1_restart.ibd -test/t2_restart Single DEFAULT 0 Compact or Redundant MYSQLD_DATADIR/test/t2_restart.ibd +test/t1_restart Single DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t1_restart.ibd +test/t2_restart Single DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t2_restart.ibd test/t3_restart Single DEFAULT 2048 Compressed MYSQLD_DATADIR/test/t3_restart.ibd -test/t4_restart Single DEFAULT 0 Dynamic MYSQLD_DATADIR/test/t4_restart.ibd -test/t5_restart Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd -test/t6_restart#p#p0 Single DEFAULT 2048 Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd -test/t6_restart#p#p1 Single DEFAULT 2048 Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd -test/t6_restart#p#p2 Single DEFAULT 2048 Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd -test/t7_restart#p#p0#sp#s0 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd -test/t7_restart#p#p0#sp#s1 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd -test/t7_restart#p#p1#sp#s2 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd -test/t7_restart#p#p1#sp#s3 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd +test/t4_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4_restart.ibd +test/t5_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd +test/t6_restart#p#p0 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd +test/t6_restart#p#p1 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd +test/t6_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd +test/t7_restart#p#p0#sp#s0 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd +test/t7_restart#p#p0#sp#s1 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd +test/t7_restart#p#p1#sp#s2 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd +test/t7_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd # # Shutdown the server and list the tablespace OS files # @@ -394,18 +394,18 @@ test/t7_restart#p#p1#sp#s2 test/t7_restart#p#p1#sp#s2 97 8 Dynamic 0 Single test/t7_restart#p#p1#sp#s3 test/t7_restart#p#p1#sp#s3 97 8 Dynamic 0 Single === information_schema.innodb_sys_tablespaces and innodb_sys_datafiles === Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path -test/t1_restart Single DEFAULT 0 Compact or Redundant MYSQLD_DATADIR/test/t1_restart.ibd -test/t2_restart Single DEFAULT 0 Compact or Redundant MYSQLD_DATADIR/test/t2_restart.ibd +test/t1_restart Single DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t1_restart.ibd +test/t2_restart Single DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t2_restart.ibd test/t3_restart Single DEFAULT 2048 Compressed MYSQLD_DATADIR/test/t3_restart.ibd -test/t4_restart Single DEFAULT 0 Dynamic MYSQLD_DATADIR/test/t4_restart.ibd -test/t5_restart Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd -test/t6_restart#p#p0 Single DEFAULT 2048 Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd -test/t6_restart#p#p1 Single DEFAULT 2048 Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd -test/t6_restart#p#p2 Single DEFAULT 2048 Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd -test/t7_restart#p#p0#sp#s0 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd -test/t7_restart#p#p0#sp#s1 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd -test/t7_restart#p#p1#sp#s2 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd -test/t7_restart#p#p1#sp#s3 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd +test/t4_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4_restart.ibd +test/t5_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd +test/t6_restart#p#p0 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd +test/t6_restart#p#p1 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd +test/t6_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd +test/t7_restart#p#p0#sp#s0 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd +test/t7_restart#p#p0#sp#s1 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd +test/t7_restart#p#p1#sp#s2 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd +test/t7_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd DROP TABLE t1_restart; DROP TABLE t2_restart; DROP TABLE t3_restart; @@ -417,15 +417,15 @@ ALTER TABLE t6_restart TRUNCATE PARTITION p2; ALTER TABLE t7_restart TRUNCATE PARTITION p1; === information_schema.innodb_sys_tablespaces and innodb_sys_datafiles === Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path -test/t4_restart Single DEFAULT 0 Dynamic MYSQLD_DATADIR/test/t4_restart.ibd -test/t5_restart Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd -test/t6_restart#p#p0 Single DEFAULT 2048 Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd -test/t6_restart#p#p1 Single DEFAULT 2048 Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd -test/t6_restart#p#p2 Single DEFAULT 2048 Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd -test/t7_restart#p#p0#sp#s0 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd -test/t7_restart#p#p0#sp#s1 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd -test/t7_restart#p#p1#sp#s2 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd -test/t7_restart#p#p1#sp#s3 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd +test/t4_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4_restart.ibd +test/t5_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd +test/t6_restart#p#p0 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd +test/t6_restart#p#p1 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd +test/t6_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd +test/t7_restart#p#p0#sp#s0 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd +test/t7_restart#p#p0#sp#s1 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd +test/t7_restart#p#p1#sp#s2 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd +test/t7_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd INSERT INTO t5_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot'); INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart); INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart); @@ -520,15 +520,15 @@ Variable_name Value innodb_file_per_table ON === information_schema.innodb_sys_tablespaces and innodb_sys_datafiles === Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path -test/t4_restart Single DEFAULT 0 Dynamic MYSQLD_DATADIR/test/t4_restart.ibd -test/t5_restart Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd -test/t6_restart#p#p0 Single DEFAULT 2048 Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd -test/t6_restart#p#p1 Single DEFAULT 2048 Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd -test/t6_restart#p#p2 Single DEFAULT 2048 Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd -test/t7_restart#p#p0#sp#s0 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd -test/t7_restart#p#p0#sp#s1 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd -test/t7_restart#p#p1#sp#s2 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd -test/t7_restart#p#p1#sp#s3 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd +test/t4_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4_restart.ibd +test/t5_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd +test/t6_restart#p#p0 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd +test/t6_restart#p#p1 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd +test/t6_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd +test/t7_restart#p#p0#sp#s0 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd +test/t7_restart#p#p0#sp#s1 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd +test/t7_restart#p#p1#sp#s2 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd +test/t7_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd SELECT count(*) FROM t5_restart; count(*) 8 @@ -620,15 +620,15 @@ RENAME TABLE t6_restart TO t66_restart; RENAME TABLE t7_restart TO t77_restart; === information_schema.innodb_sys_tablespaces and innodb_sys_datafiles === Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path -test/t4_restart Single DEFAULT 0 Dynamic MYSQLD_DATADIR/test/t4_restart.ibd -test/t55_restart Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd -test/t66_restart#p#p0 Single DEFAULT 2048 Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p0.ibd -test/t66_restart#p#p1 Single DEFAULT 2048 Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p1.ibd -test/t66_restart#p#p2 Single DEFAULT 2048 Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p2.ibd -test/t77_restart#p#p0#sp#s0 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s0.ibd -test/t77_restart#p#p0#sp#s1 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s1.ibd -test/t77_restart#p#p1#sp#s2 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s2.ibd -test/t77_restart#p#p1#sp#s3 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s3.ibd +test/t4_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4_restart.ibd +test/t55_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd +test/t66_restart#p#p0 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p0.ibd +test/t66_restart#p#p1 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p1.ibd +test/t66_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p2.ibd +test/t77_restart#p#p0#sp#s0 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s0.ibd +test/t77_restart#p#p0#sp#s1 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s1.ibd +test/t77_restart#p#p1#sp#s2 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s2.ibd +test/t77_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s3.ibd INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart); SELECT count(*) FROM t55_restart; count(*) @@ -716,15 +716,15 @@ Variable_name Value innodb_file_per_table ON === information_schema.innodb_sys_tablespaces and innodb_sys_datafiles === Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path -test/t4_restart Single DEFAULT 0 Dynamic MYSQLD_DATADIR/test/t4_restart.ibd -test/t55_restart Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd -test/t66_restart#p#p0 Single DEFAULT 2048 Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p0.ibd -test/t66_restart#p#p1 Single DEFAULT 2048 Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p1.ibd -test/t66_restart#p#p2 Single DEFAULT 2048 Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p2.ibd -test/t77_restart#p#p0#sp#s0 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s0.ibd -test/t77_restart#p#p0#sp#s1 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s1.ibd -test/t77_restart#p#p1#sp#s2 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s2.ibd -test/t77_restart#p#p1#sp#s3 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s3.ibd +test/t4_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4_restart.ibd +test/t55_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd +test/t66_restart#p#p0 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p0.ibd +test/t66_restart#p#p1 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p1.ibd +test/t66_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p2.ibd +test/t77_restart#p#p0#sp#s0 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s0.ibd +test/t77_restart#p#p0#sp#s1 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s1.ibd +test/t77_restart#p#p1#sp#s2 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s2.ibd +test/t77_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s3.ibd INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart); SELECT count(*) FROM t55_restart; count(*) @@ -847,15 +847,15 @@ t77_restart#p#p1#sp#s3.ibd # === information_schema.innodb_sys_tablespaces and innodb_sys_datafiles === Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path -test/t4_restart Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/new_dir/test/t4_restart.ibd -test/t55_restart Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/new_dir/test/t55_restart.ibd -test/t66_restart#p#p0 Single DEFAULT 2048 Compressed MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p0.ibd -test/t66_restart#p#p1 Single DEFAULT 2048 Compressed MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p1.ibd -test/t66_restart#p#p2 Single DEFAULT 2048 Compressed MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p2.ibd -test/t77_restart#p#p0#sp#s0 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p0#sp#s0.ibd -test/t77_restart#p#p0#sp#s1 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p0#sp#s1.ibd -test/t77_restart#p#p1#sp#s2 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p1#sp#s2.ibd -test/t77_restart#p#p1#sp#s3 Single DEFAULT 0 Dynamic MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p1#sp#s3.ibd +test/t4_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/new_dir/test/t4_restart.ibd +test/t55_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/new_dir/test/t55_restart.ibd +test/t66_restart#p#p0 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p0.ibd +test/t66_restart#p#p1 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p1.ibd +test/t66_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p2.ibd +test/t77_restart#p#p0#sp#s0 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p0#sp#s0.ibd +test/t77_restart#p#p0#sp#s1 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p0#sp#s1.ibd +test/t77_restart#p#p1#sp#s2 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p1#sp#s2.ibd +test/t77_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p1#sp#s3.ibd INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart); SELECT count(*) FROM t4_restart; count(*) @@ -982,15 +982,15 @@ t77_restart.par # === information_schema.innodb_sys_tablespaces and innodb_sys_datafiles === Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path -test/t4_restart Single DEFAULT 0 Dynamic MYSQLD_DATADIR/test/t4_restart.ibd -test/t55_restart Single DEFAULT 0 Dynamic MYSQLD_DATADIR/test/t55_restart.ibd -test/t66_restart#p#p0 Single DEFAULT 2048 Compressed MYSQLD_DATADIR/test/t66_restart#p#p0.ibd -test/t66_restart#p#p1 Single DEFAULT 2048 Compressed MYSQLD_DATADIR/test/t66_restart#p#p1.ibd -test/t66_restart#p#p2 Single DEFAULT 2048 Compressed MYSQLD_DATADIR/test/t66_restart#p#p2.ibd -test/t77_restart#p#p0#sp#s0 Single DEFAULT 0 Dynamic MYSQLD_DATADIR/test/t77_restart#p#p0#sp#s0.ibd -test/t77_restart#p#p0#sp#s1 Single DEFAULT 0 Dynamic MYSQLD_DATADIR/test/t77_restart#p#p0#sp#s1.ibd -test/t77_restart#p#p1#sp#s2 Single DEFAULT 0 Dynamic MYSQLD_DATADIR/test/t77_restart#p#p1#sp#s2.ibd -test/t77_restart#p#p1#sp#s3 Single DEFAULT 0 Dynamic MYSQLD_DATADIR/test/t77_restart#p#p1#sp#s3.ibd +test/t4_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4_restart.ibd +test/t55_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t55_restart.ibd +test/t66_restart#p#p0 Single DEFAULT DEFAULT Compressed MYSQLD_DATADIR/test/t66_restart#p#p0.ibd +test/t66_restart#p#p1 Single DEFAULT DEFAULT Compressed MYSQLD_DATADIR/test/t66_restart#p#p1.ibd +test/t66_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQLD_DATADIR/test/t66_restart#p#p2.ibd +test/t77_restart#p#p0#sp#s0 Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t77_restart#p#p0#sp#s0.ibd +test/t77_restart#p#p0#sp#s1 Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t77_restart#p#p0#sp#s1.ibd +test/t77_restart#p#p1#sp#s2 Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t77_restart#p#p1#sp#s2.ibd +test/t77_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t77_restart#p#p1#sp#s3.ibd INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart); SELECT count(*) FROM t4_restart; count(*) diff --git a/mysql-test/suite/maria/maria.result b/mysql-test/suite/maria/maria.result index b5fbcbe113d..c7a08c4d95e 100644 --- a/mysql-test/suite/maria/maria.result +++ b/mysql-test/suite/maria/maria.result @@ -1607,8 +1607,16 @@ t1 CREATE TABLE `t1` ( `v` mediumtext CHARACTER SET utf8 DEFAULT NULL ) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 drop table t1; +set statement sql_mode='' for 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 DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +drop table t1; set @save_concurrent_insert=@@concurrent_insert; set global concurrent_insert=1; create table t1 (a int) ROW_FORMAT=FIXED; diff --git a/mysql-test/suite/maria/maria.test b/mysql-test/suite/maria/maria.test index e710f32ef80..24b97577d5e 100644 --- a/mysql-test/suite/maria/maria.test +++ b/mysql-test/suite/maria/maria.test @@ -931,8 +931,10 @@ show create table t1; drop table t1; # ARIA specific varchar tests ---error 1118 +set statement sql_mode='' for create table t1 (v varchar(65535)); +show create table t1; +drop table t1; # # Test concurrent insert diff --git a/mysql-test/suite/parts/r/partition_alter_maria.result b/mysql-test/suite/parts/r/partition_alter_maria.result new file mode 100644 index 00000000000..6343566e408 --- /dev/null +++ b/mysql-test/suite/parts/r/partition_alter_maria.result @@ -0,0 +1,18 @@ +create table t1 ( +pk bigint not null auto_increment, +dt datetime default null, +unique (pk, dt) +) engine=aria row_format=dynamic +partition by range columns(dt) ( +partition `p20171231` values less than ('2017-12-31'), +partition `p20181231` values less than ('2018-12-31') +); +insert into t1 values (1,'2017-09-28 15:12:00'); +select * from t1; +pk dt +1 2017-09-28 15:12:00 +alter table t1 drop partition p20181231; +select * from t1; +pk dt +1 2017-09-28 15:12:00 +drop table t1; diff --git a/mysql-test/suite/parts/t/partition_alter_maria.test b/mysql-test/suite/parts/t/partition_alter_maria.test new file mode 100644 index 00000000000..db249591158 --- /dev/null +++ b/mysql-test/suite/parts/t/partition_alter_maria.test @@ -0,0 +1,18 @@ +# +# MDEV-13937 Aria engine: Internal Error 160 after partition handling +# +source include/have_partition.inc; +create table t1 ( + pk bigint not null auto_increment, + dt datetime default null, + unique (pk, dt) +) engine=aria row_format=dynamic + partition by range columns(dt) ( + partition `p20171231` values less than ('2017-12-31'), + partition `p20181231` values less than ('2018-12-31') +); +insert into t1 values (1,'2017-09-28 15:12:00'); +select * from t1; +alter table t1 drop partition p20181231; +select * from t1; +drop table t1; diff --git a/mysql-test/suite/roles/definer.result b/mysql-test/suite/roles/definer.result index f7f3e946809..0a83262add1 100644 --- a/mysql-test/suite/roles/definer.result +++ b/mysql-test/suite/roles/definer.result @@ -630,3 +630,122 @@ show grants for utest; Grants for utest GRANT SELECT ON *.* TO 'utest' drop role utest; +# +# MDEV-13676: Field "create Procedure" is NULL, even if the the user +# has role which is the definer. (SHOW CREATE PROCEDURE) +# +create database rtest; +create role r1; +create role r2; +create role r3; +grant all privileges on rtest.* to r1; +create user user1; +grant r1 to user1; +grant r1 to r2; +grant r2 to user1; +grant r3 to user1; +connect user1, localhost,user1,,,,,; +set role r2; +use rtest; +CREATE DEFINER=current_role() PROCEDURE user1_proc() SQL SECURITY INVOKER +BEGIN +SELECT NOW(), VERSION(); +END;// +set role r2; +show create procedure user1_proc; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +user1_proc STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`r2` PROCEDURE `user1_proc`() + SQL SECURITY INVOKER +BEGIN +SELECT NOW(), VERSION(); +END latin1 latin1_swedish_ci latin1_swedish_ci +# +# Currently one can not use as definer any role except CURRENT_ROLE +# +CREATE DEFINER='r1' PROCEDURE user1_proc2() SQL SECURITY INVOKER +BEGIN +SELECT NOW(), VERSION(); +END;// +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation +set role r1; +CREATE DEFINER='r1' PROCEDURE user1_proc2() SQL SECURITY INVOKER +BEGIN +SELECT NOW(), VERSION(); +END;// +show create procedure user1_proc2; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +user1_proc2 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`r1` PROCEDURE `user1_proc2`() + SQL SECURITY INVOKER +BEGIN +SELECT NOW(), VERSION(); +END latin1 latin1_swedish_ci latin1_swedish_ci +# +# Test to see if the user can still see the procedure code if the +# role that owns it is granted to him indirectly. +# +set role r2; +show create procedure user1_proc2; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +user1_proc2 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`r1` PROCEDURE `user1_proc2`() + SQL SECURITY INVOKER +BEGIN +SELECT NOW(), VERSION(); +END latin1 latin1_swedish_ci latin1_swedish_ci +# +# One should not be able to see the procedure code if the role that owns +# the procedure is not set by the user or is not in the subgraph of the +# currently active role. +# +set role r3; +show create procedure user1_proc2; +ERROR 42000: PROCEDURE user1_proc2 does not exist +connection default; +use rtest; +# +# Try a few edge cases, with usernames identical to role name; +# +create user user_like_role; +create user foo; +create role user_like_role; +grant select on rtest.* to user_like_role; +grant select on rtest.* to foo; +grant select on rtest.* to user_like_role@'%'; +grant user_like_role to foo; +# +# Here we have a procedure that is owned by user_like_role USER +# We don't want user_like_role ROLE to have access to its code. +# +CREATE DEFINER=`user_like_role`@`%` PROCEDURE sensitive_proc() SQL SECURITY INVOKER +BEGIN +SELECT NOW(), VERSION(); +END;// +connect user_like_role, localhost, user_like_role,,,,,; +use rtest; +show create procedure sensitive_proc; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +sensitive_proc STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`user_like_role`@`%` PROCEDURE `sensitive_proc`() + SQL SECURITY INVOKER +BEGIN +SELECT NOW(), VERSION(); +END latin1 latin1_swedish_ci latin1_swedish_ci +connect foo, localhost, foo,,,,,; +set role user_like_role; +use rtest; +# +# Foo has the set rolename identical to the procedure's definer's username. +# Foo should not have access to this procedure. +# +show create procedure sensitive_proc; +ERROR 42000: PROCEDURE sensitive_proc does not exist +connection default; +drop role r1; +drop role r2; +drop role r3; +drop role user_like_role; +drop user user1; +drop user foo; +drop user user_like_role; +drop procedure user1_proc; +drop procedure user1_proc2; +drop procedure sensitive_proc; +drop database rtest; diff --git a/mysql-test/suite/roles/definer.test b/mysql-test/suite/roles/definer.test index a4a65a77a9b..16d23386741 100644 --- a/mysql-test/suite/roles/definer.test +++ b/mysql-test/suite/roles/definer.test @@ -336,3 +336,125 @@ execute stmt1; show grants for utest; drop role utest; +--echo # +--echo # MDEV-13676: Field "create Procedure" is NULL, even if the the user +--echo # has role which is the definer. (SHOW CREATE PROCEDURE) +--echo # + +create database rtest; +create role r1; +create role r2; +create role r3; +grant all privileges on rtest.* to r1; + +create user user1; +grant r1 to user1; +grant r1 to r2; +grant r2 to user1; +grant r3 to user1; + +connect (user1, localhost,user1,,,,,); +set role r2; +use rtest; + +DELIMITER //; +CREATE DEFINER=current_role() PROCEDURE user1_proc() SQL SECURITY INVOKER + BEGIN + SELECT NOW(), VERSION(); + END;// +DELIMITER ;// + +set role r2; +show create procedure user1_proc; + +--echo # +--echo # Currently one can not use as definer any role except CURRENT_ROLE +--echo # +DELIMITER //; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +CREATE DEFINER='r1' PROCEDURE user1_proc2() SQL SECURITY INVOKER + BEGIN + SELECT NOW(), VERSION(); + END;// +DELIMITER ;// + +set role r1; +DELIMITER //; +CREATE DEFINER='r1' PROCEDURE user1_proc2() SQL SECURITY INVOKER + BEGIN + SELECT NOW(), VERSION(); + END;// +DELIMITER ;// + +show create procedure user1_proc2; +--echo # +--echo # Test to see if the user can still see the procedure code if the +--echo # role that owns it is granted to him indirectly. +--echo # +set role r2; +show create procedure user1_proc2; + +--echo # +--echo # One should not be able to see the procedure code if the role that owns +--echo # the procedure is not set by the user or is not in the subgraph of the +--echo # currently active role. +--echo # +set role r3; +--error ER_SP_DOES_NOT_EXIST +show create procedure user1_proc2; + +connection default; + +use rtest; + +--echo # +--echo # Try a few edge cases, with usernames identical to role name; +--echo # + +create user user_like_role; +create user foo; +create role user_like_role; +grant select on rtest.* to user_like_role; +grant select on rtest.* to foo; +grant select on rtest.* to user_like_role@'%'; + +grant user_like_role to foo; + +--echo # +--echo # Here we have a procedure that is owned by user_like_role USER +--echo # We don't want user_like_role ROLE to have access to its code. +--echo # +DELIMITER //; +CREATE DEFINER=`user_like_role`@`%` PROCEDURE sensitive_proc() SQL SECURITY INVOKER + BEGIN + SELECT NOW(), VERSION(); + END;// +DELIMITER ;// + +connect (user_like_role, localhost, user_like_role,,,,,); +use rtest; +show create procedure sensitive_proc; + +connect (foo, localhost, foo,,,,,); +set role user_like_role; +use rtest; + +--echo # +--echo # Foo has the set rolename identical to the procedure's definer's username. +--echo # Foo should not have access to this procedure. +--echo # +--error ER_SP_DOES_NOT_EXIST +show create procedure sensitive_proc; + +connection default; +drop role r1; +drop role r2; +drop role r3; +drop role user_like_role; +drop user user1; +drop user foo; +drop user user_like_role; +drop procedure user1_proc; +drop procedure user1_proc2; +drop procedure sensitive_proc; +drop database rtest; diff --git a/mysql-test/suite/sys_vars/inc/explicit_defaults_for_timestamp.inc b/mysql-test/suite/sys_vars/inc/explicit_defaults_for_timestamp.inc index 4cf3914e60a..1fea4ca5bb9 100644 --- a/mysql-test/suite/sys_vars/inc/explicit_defaults_for_timestamp.inc +++ b/mysql-test/suite/sys_vars/inc/explicit_defaults_for_timestamp.inc @@ -97,3 +97,16 @@ CREATE TABLE t1 (a INT); ALTER TABLE t1 ADD b TIMESTAMP; SHOW CREATE TABLE t1; DROP TABLE t1; + +--echo # +--echo # MDEV-10802 TIMESTAMP NOT NULL field with explicit_defaults_for_timestamp and NO_ZERO_DATE shouldn't throw error +--echo # + +SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30'); +SET sql_mode='ANSI,NO_ZERO_DATE'; +CREATE TABLE t1 (a TIMESTAMP NOT NULL); +INSERT INTO t1 VALUES (); +SELECT * FROM t1; +DROP TABLE t1; +SET sql_mode=DEFAULT; +SET timestamp=DEFAULT; diff --git a/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_off.result b/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_off.result index f214e6d7dac..e94766be8bd 100644 --- a/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_off.result +++ b/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_off.result @@ -173,3 +173,16 @@ t1 CREATE TABLE `t1` ( `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; +# +# MDEV-10802 TIMESTAMP NOT NULL field with explicit_defaults_for_timestamp and NO_ZERO_DATE shouldn't throw error +# +SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30'); +SET sql_mode='ANSI,NO_ZERO_DATE'; +CREATE TABLE t1 (a TIMESTAMP NOT NULL); +INSERT INTO t1 VALUES (); +SELECT * FROM t1; +a +2001-01-01 10:20:30 +DROP TABLE t1; +SET sql_mode=DEFAULT; +SET timestamp=DEFAULT; diff --git a/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_on.result b/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_on.result index 5219fd4e9c4..dac796b4319 100644 --- a/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_on.result +++ b/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_on.result @@ -178,3 +178,18 @@ t1 CREATE TABLE `t1` ( `b` timestamp NULL DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; +# +# MDEV-10802 TIMESTAMP NOT NULL field with explicit_defaults_for_timestamp and NO_ZERO_DATE shouldn't throw error +# +SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30'); +SET sql_mode='ANSI,NO_ZERO_DATE'; +CREATE TABLE t1 (a TIMESTAMP NOT NULL); +INSERT INTO t1 VALUES (); +Warnings: +Warning 1364 Field 'a' doesn't have a default value +SELECT * FROM t1; +a +0000-00-00 00:00:00 +DROP TABLE t1; +SET sql_mode=DEFAULT; +SET timestamp=DEFAULT; diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result index 9aadc5ed4bb..c5cd05129f2 100644 --- a/mysql-test/suite/vcol/r/vcol_misc.result +++ b/mysql-test/suite/vcol/r/vcol_misc.result @@ -336,7 +336,26 @@ tsv timestamp as (adddate(ts, interval 1 day)) virtual drop table t1; set sql_mode=default; # -# Start of 10.1 tests +# MDEV-11819 NO_ZERO_IN_DATE: Incorrect generated column value +# +SET sql_mode='NO_ZERO_IN_DATE'; +CREATE TABLE t1 +( +a datetime DEFAULT NULL, +b datetime DEFAULT NULL, +c time GENERATED ALWAYS AS (timediff(`a`,`b`)) VIRTUAL +); +INSERT INTO t1 VALUES ('2008-12-31 23:59:59.000001','2008-12-30 01:01:01.000002',DEFAULT); +SELECT * FROM t1; +a b c +2008-12-31 23:59:59 2008-12-30 01:01:01 46:58:58 +DROP TABLE t1; +SET sql_mode=DEFAULT; +# +# End of 5.5 tests +# +# +# End of 10.0 tests # # # MDEV-8441 Bad SHOW CREATE TABLE output for a table with a virtual column diff --git a/mysql-test/suite/vcol/t/vcol_misc.test b/mysql-test/suite/vcol/t/vcol_misc.test index 5bdd927070a..2244967a968 100644 --- a/mysql-test/suite/vcol/t/vcol_misc.test +++ b/mysql-test/suite/vcol/t/vcol_misc.test @@ -305,9 +305,28 @@ create table t1 ( drop table t1; set sql_mode=default; +--echo # +--echo # MDEV-11819 NO_ZERO_IN_DATE: Incorrect generated column value +--echo # + +SET sql_mode='NO_ZERO_IN_DATE'; +CREATE TABLE t1 +( + a datetime DEFAULT NULL, + b datetime DEFAULT NULL, + c time GENERATED ALWAYS AS (timediff(`a`,`b`)) VIRTUAL +); +INSERT INTO t1 VALUES ('2008-12-31 23:59:59.000001','2008-12-30 01:01:01.000002',DEFAULT); +SELECT * FROM t1; +DROP TABLE t1; +SET sql_mode=DEFAULT; --echo # ---echo # Start of 10.1 tests +--echo # End of 5.5 tests +--echo # + +--echo # +--echo # End of 10.0 tests --echo # --echo # @@ -331,7 +350,6 @@ SELECT COLUMN_GET(@aaa, 'price' AS DECIMAL) aaa; SELECT COLUMN_GET(@aaa, 'price' AS INT) aaa; SELECT COLUMN_GET(@aaa, 'price' AS DOUBLE) aaa; - --echo # --echo # End of 10.1 tests --echo # diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index 487990b61cd..79a01d5e0c4 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -1254,6 +1254,48 @@ execute stmt1; deallocate prepare stmt1; drop table t2; +--echo # +--echo # MDEV-8960 Can't refer the same column twice in one ALTER TABLE +--echo # + +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; +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; +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; +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; +DROP TABLE t1; + # # Test of ALTER TABLE IF [NOT] EXISTS # @@ -1766,49 +1808,7 @@ SHOW CREATE TABLE t1; DROP TABLE t1; --echo # ---echo # MDEV-8960 Can't refer the same column twice in one ALTER TABLE ---echo # - -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; -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; -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; -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; -DROP TABLE t1; - ---echo # ---echo # Start of 10.1 tests +--echo # End of 10.0 tests --echo # --echo # @@ -1830,6 +1830,10 @@ SHOW CREATE TABLE t1; DROP TABLE t1; --echo # +--echo # End of 10.1 tests +--echo # + +--echo # --echo # MDEV-10421 duplicate CHECK CONSTRAINTs --echo # CREATE TABLE t1 (a INT, b INT) engine=myisam; @@ -1877,3 +1881,7 @@ alter table t1 drop column a; alter table t1 drop column a, drop index a; show create table t1; drop table t1; + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test index 7cc74c52b28..702592374b6 100644 --- a/mysql-test/t/case.test +++ b/mysql-test/t/case.test @@ -174,6 +174,18 @@ drop table t1, t2; --echo End of 5.0 tests +--echo # +--echo # Bug#19875294 ASSERTION `SRC' FAILED IN MY_STRNXFRM_UNICODE +--echo # (SIG 6 -STRINGS/CTYPE-UTF8.C:5151) +--echo # + +set @@sql_mode=''; +CREATE TABLE t1(c1 SET('','')CHARACTER SET ucs2); +INSERT INTO t1 VALUES(990101.102); +SELECT COALESCE(c1)FROM t1 ORDER BY 1; +DROP TABLE t1; +set @@sql_mode=default; + # # lp:1001510 # Bug #11764313 57135: CRASH IN ITEM_FUNC_CASE::FIND_ITEM WITH CASE WHEN diff --git a/mysql-test/t/ctype_gbk.test b/mysql-test/t/ctype_gbk.test index aa2d15b9b71..a3dc7f4af44 100644 --- a/mysql-test/t/ctype_gbk.test +++ b/mysql-test/t/ctype_gbk.test @@ -199,6 +199,20 @@ let $ctype_unescape_combinations=selected; SET NAMES gbk; --source include/ctype_E05C.inc +--echo # +--echo # MDEV-9886 Illegal mix of collations with a view comparing a field to a binary constant +--echo # + +SET NAMES latin1; +CREATE TABLE t1 (a TEXT CHARACTER SET gbk); +INSERT INTO t1 VALUES (0xEE5D); +SELECT a<>0xEE5D AS a FROM t1; +CREATE VIEW v1 AS SELECT a<>0xEE5D AS a FROM t1; +SHOW CREATE VIEW v1; +SELECT * FROM v1; +DROP VIEW v1; +DROP TABLE t1; + --echo # --echo # End of 10.0 tests diff --git a/mysql-test/t/ctype_latin1.test b/mysql-test/t/ctype_latin1.test index d40cc8b459b..8c51bfef2d8 100644 --- a/mysql-test/t/ctype_latin1.test +++ b/mysql-test/t/ctype_latin1.test @@ -247,6 +247,22 @@ DROP TABLE t1; --echo # SELECT _latin1 0x7E, _latin1 X'7E', _latin1 B'01111110'; + +--echo # +--echo # MDEV-9886 Illegal mix of collations with a view comparing a field to a binary constant +--echo # + +SET NAMES latin1; +CREATE TABLE t1 (a TEXT CHARACTER SET latin1); +INSERT INTO t1 VALUES (0xC0); +SELECT a<>0xEE5D AS a FROM t1; +CREATE VIEW v1 AS SELECT a<>0xC0 AS a FROM t1; +SHOW CREATE VIEW v1; +SELECT * FROM v1; +DROP VIEW v1; +DROP TABLE t1; + + --echo # --echo # End of 10.0 tests --echo # diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index 7a054534c85..d7a4fd48ccd 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -827,6 +827,31 @@ SET sql_mode=DEFAULT; SET NAMES utf8; --echo # +--echo # MDEV-13972 crash in Item_func_sec_to_time::get_date +--echo # + +SELECT SEC_TO_TIME(CONVERT(900*24*60*60 USING ucs2)); + +--echo # +--echo # MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535 +--echo # + +set sql_mode=""; +CREATE TABLE t1 (c1 VARCHAR(32766) CHARACTER SET ucs2); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARCHAR(32767) CHARACTER SET ucs2); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARCHAR(32768) CHARACTER SET ucs2); +DESCRIBE t1; +DROP TABLE t1; +set sql_mode=default; + + +--echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/ctype_utf32.test b/mysql-test/t/ctype_utf32.test index 343b3c3d54b..6f036898d15 100644 --- a/mysql-test/t/ctype_utf32.test +++ b/mysql-test/t/ctype_utf32.test @@ -906,6 +906,21 @@ SET sql_mode=DEFAULT; SET NAMES utf8; --echo # +--echo # MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535 +--echo # + +set sql_mode=''; +CREATE TABLE t1 (c1 VARCHAR(16383) CHARACTER SET utf32); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARCHAR(16384) CHARACTER SET utf32); +DESCRIBE t1; +DROP TABLE t1; +set sql_mode=default; + + +--echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 877db3f54f6..c3ee7c13bdf 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -1723,6 +1723,24 @@ SET sql_mode=DEFAULT; DROP TABLE t1; --echo # +--echo # MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535 +--echo # + +SET sql_mode=''; +CREATE TABLE t1 (c1 VARCHAR(21844) CHARACTER SET utf8); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARCHAR(21845) CHARACTER SET utf8); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARCHAR(21846) CHARACTER SET utf8); +DESCRIBE t1; +DROP TABLE t1; +SET sql_mode=default; + +--echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test index 6cbd5a63706..c06a53c3884 100644 --- a/mysql-test/t/func_in.test +++ b/mysql-test/t/func_in.test @@ -605,11 +605,20 @@ EXECUTE s; DROP TABLE t1; +--echo # --echo # End of 5.3 tests +--echo # +# +# Bug#26361149 MYSQL SERVER CRASHES AT: COL IN(IFNULL(CONST, COL), NAME_CONST('NAME', NULL)) +# +create table t1 (a int); +insert t1 values (1),(2),(3); +select * from t1 where 1 in (a, name_const('a', null)); +drop table t1; --echo # ---echo # Start of 10.0 tests +--echo # End of 5.5 tests --echo # --echo # @@ -626,7 +635,7 @@ SELECT * FROM t1 WHERE b NOT IN (NULL, '', 'A'); DROP TABLE t1; --echo # ---echo # Start of 10.1 tests +--echo # End of 10.0 tests --echo # --echo # diff --git a/mysql-test/t/func_regexp_pcre.test b/mysql-test/t/func_regexp_pcre.test index d77467b559b..21600390bb2 100644 --- a/mysql-test/t/func_regexp_pcre.test +++ b/mysql-test/t/func_regexp_pcre.test @@ -436,19 +436,19 @@ SELECT 1 FROM dual WHERE ('Alpha,Bravo,Charlie,Delta,Echo,Foxtrot,StrataCentral, # # MDEV-13173 An RLIKE that previously worked on 10.0 now returns "Got error 'pcre_exec: recursion limit of 100 exceeded' from regexp" # -SELECT CONCAT(REPEAT('100,',133),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$'; +SELECT CONCAT(REPEAT('100,',60),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$'; --replace_regex /[0-9]+ exceeded/NUM exceeded/ SELECT CONCAT(REPEAT('100,',200),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$'; -SELECT REGEXP_INSTR(CONCAT(REPEAT('100,',133),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'); +SELECT REGEXP_INSTR(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'); --replace_regex /[0-9]+ exceeded/NUM exceeded/ SELECT REGEXP_INSTR(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'); -SELECT LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',133),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$')); +SELECT LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$')); --replace_regex /[0-9]+ exceeded/NUM exceeded/ SELECT LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$')); -SELECT LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',133),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', '')); +SELECT LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', '')); --replace_regex /[0-9]+ exceeded/NUM exceeded/ SELECT LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', '')); diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 6e0169d97ca..eb6d6436d1f 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -1678,9 +1678,33 @@ DROP TABLE t1; --echo # SELECT 1 MOD ADDTIME( '13:58:57', '00:00:01' ) + 2; +--echo # +--echo # MDEV-11819 NO_ZERO_IN_DATE: Incorrect generated column value +--echo # + +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; +DROP TABLE t1; +SET sql_mode=DEFAULT; + + +--echo # +--echo # MDEV-13972 crash in Item_func_sec_to_time::get_date +--echo # + +# The below query can return warning sporadically +--disable_warnings +DO TO_DAYS(SEC_TO_TIME(TIME(CEILING(UUID())))); +--enable_warnings + +DO TO_DAYS(SEC_TO_TIME(MAKEDATE('',RAND(~(''))))); +SELECT SEC_TO_TIME(MAKEDATE(0,RAND(~0))); + --echo # ---echo # Start of 10.0 tests +--echo # End of 5.5 tests --echo # --echo # diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 0da542e499e..1407e9fcf98 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -1038,8 +1038,10 @@ show create table t1; drop table t1; # MyISAM specific varchar tests ---error 1118 +set statement sql_mode='' for create table t1 (v varchar(65535)); +show create table t1; +drop table t1; eval set storage_engine=$default; diff --git a/mysql-test/t/partition_datatype.test b/mysql-test/t/partition_datatype.test index 4017cdada60..9ab3bd4d5fa 100644 --- a/mysql-test/t/partition_datatype.test +++ b/mysql-test/t/partition_datatype.test @@ -215,14 +215,18 @@ select * from t1 where a = 'aaaa'; select * from t1 where a like 'aaa%'; select * from t1 where a = 'bbbb'; drop table t1; +set sql_mode=''; -- error ER_PARTITION_FIELDS_TOO_LONG create table t1 (a varchar(3070)) partition by key (a); --- error ER_TOO_BIG_ROWSIZE +-- error ER_PARTITION_FIELDS_TOO_LONG +create table t1 (a varchar(65532) not null) partition by key (a); +-- error ER_BLOB_FIELD_IN_PART_FUNC_ERROR create table t1 (a varchar(65533)) partition by key (a); --- error ER_TOO_BIG_ROWSIZE +-- error ER_BLOB_FIELD_IN_PART_FUNC_ERROR create table t1 (a varchar(65534) not null) partition by key (a); --- error ER_TOO_BIG_ROWSIZE +-- error ER_BLOB_FIELD_IN_PART_FUNC_ERROR create table t1 (a varchar(65535)) partition by key (a); +set sql_mode=default; # # Bug#34358: error in key_restore for bitfields with uneven bits diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index b6d1b4862a6..b61c4cf2568 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -3728,6 +3728,135 @@ deallocate prepare stmt2; drop table t1; +--echo # +--echo # MDEV-9208: Function->Function->View = Mysqld segfault +--echo # (Server crashes in Dependency_marker::visit_field on 2nd +--echo # execution with merged subquery) +--echo # + +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; +execute stmt; + +drop table t1,t2; + +--echo # +--echo # MDEV-9619: Assertion `null_ref_table' failed in virtual +--echo # table_map Item_direct_view_ref::used_tables() const on 2nd +--echo # execution of PS +--echo # + +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; +EXECUTE stmt; +insert into t1 values ('c'); +EXECUTE stmt; +EXECUTE stmt; + +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; +EXECUTE stmt; +insert into t1 values ('c'); +EXECUTE stmt; +EXECUTE stmt; + +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; +EXECUTE stmt; + +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); +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; +EXECUTE stmt; + +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); +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; +EXECUTE stmt; +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; + --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/range_vs_index_merge.test b/mysql-test/t/range_vs_index_merge.test index 5d12d46c9e9..84b87579e85 100644 --- a/mysql-test/t/range_vs_index_merge.test +++ b/mysql-test/t/range_vs_index_merge.test @@ -1241,6 +1241,59 @@ WHERE ( state = 'Alabama' OR state >= 'Colorado' ) AND id != 9 DROP TABLE t1; +--echo # +--echo # mdev-11574: do not build index merge of two indexes when +--echo # one index is an infix of the other index +--echo # + +set names utf8; + +CREATE DATABASE world; + +use world; + +--source include/world_schema.inc + +--disable_query_log +--disable_result_log +--disable_warnings +--source include/world.inc +--enable_warnings +--enable_result_log +--enable_query_log + +DROP INDEX Country ON City; +CREATE INDEX CountryName ON City(Country,Name); +CREATE INDEX Name ON City(Name); + +--disable_query_log +--disable_result_log +--disable_warnings +ANALYZE TABLE City; +--enable_warnings +--enable_result_log +--enable_query_log + +let $q= +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'); + +eval $q; +eval explain $q; + + +DROP DATABASE world; + #the following command must be the last one in the file set session optimizer_switch='index_merge_sort_intersection=default'; diff --git a/mysql-test/t/read_only.test b/mysql-test/t/read_only.test index 152770c1731..a05f813346e 100644 --- a/mysql-test/t/read_only.test +++ b/mysql-test/t/read_only.test @@ -114,6 +114,11 @@ drop table t1; insert into t1 values(1); # +# MDEV-14056 DROP TEMPORARY TABLE IF EXISTS causes error 1290 with read_only option +# +drop temporary table if exists t1; + +# # Bug#11733 COMMITs should not happen if read-only is set # diff --git a/mysql-test/t/show_function_with_pad_char_to_full_length.test b/mysql-test/t/show_function_with_pad_char_to_full_length.test new file mode 100644 index 00000000000..f47f36294d4 --- /dev/null +++ b/mysql-test/t/show_function_with_pad_char_to_full_length.test @@ -0,0 +1,23 @@ +# +# Test that show function status succeeds with +# sql_mode = 'PAD_CHAR_TO_FULL_LENGTH (MDEV-13149) + +# show function status + +create function f() returns int return 1; +--replace_column 1 T 3 T 4 T 5 T 6 T 7 T 8 T 9 T 10 T 11 T +show function status; +set sql_mode = 'PAD_CHAR_TO_FULL_LENGTH'; +--replace_column 1 T 3 T 4 T 5 T 6 T 7 T 8 T 9 T 10 T 11 T +show function status; +drop function f; +select @@sql_mode; + +# select ROUTINE_NAME from information_schema.ROUTINES + +create function f() returns int return 1; +select ROUTINE_NAME from information_schema.ROUTINES where ROUTINE_NAME='f'; +set sql_mode = 'PAD_CHAR_TO_FULL_LENGTH'; +select ROUTINE_NAME from information_schema.ROUTINES where ROUTINE_NAME='f'; +drop function f; +select @@sql_mode; diff --git a/mysql-test/t/subselect_mat_cost_bugs.test b/mysql-test/t/subselect_mat_cost_bugs.test index 35f2b9588fe..67af6e3a54a 100644 --- a/mysql-test/t/subselect_mat_cost_bugs.test +++ b/mysql-test/t/subselect_mat_cost_bugs.test @@ -522,4 +522,23 @@ select * from t1 where a in (select max(a) from t1 where a < 4) or a > 5; drop table t1; +--echo # +--echo # MDEV-13135: subquery with ON expression subject to +--echo # semi-join optimizations +--echo # + +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 +); + +DROP VIEW v1; +DROP TABLE t1,t2; diff --git a/mysql-test/t/type_varchar.test b/mysql-test/t/type_varchar.test index cc09069508f..d70cb86fa7b 100644 --- a/mysql-test/t/type_varchar.test +++ b/mysql-test/t/type_varchar.test @@ -219,7 +219,56 @@ SELECT 5 = a FROM t1; DROP TABLE t1; --echo # ---echo # Start of 10.0 tests +--echo # MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535 +--echo # + +set sql_mode=''; +CREATE TABLE t1 (c1 VARBINARY(65532)); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARBINARY(65533)); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARBINARY(65534)); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARBINARY(65535)); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARBINARY(65536)); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARCHAR(65532)); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARCHAR(65533)); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARCHAR(65534)); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARCHAR(65535)); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARCHAR(65536)); +DESCRIBE t1; +DROP TABLE t1; +set sql_mode=default; + +--error ER_TOO_BIG_FIELDLENGTH +CREATE TABLE t1 (c1 VARCHAR(65536)); + +--echo # +--echo # End of 5.5 tests --echo # --echo # diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test index 417c206f6dc..76625bd4e92 100644 --- a/mysql-test/t/xml.test +++ b/mysql-test/t/xml.test @@ -674,9 +674,7 @@ SELECT ExtractValue('<a><b>xxx</c></a>','/a/b'); --echo # Bug#58175 xml functions read initialized bytes when conversions happen --echo # SET NAMES latin1; ---enable_prepare_warnings SELECT UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0); ---disable_prepare_warnings --echo # --echo # Bug#12375190: UPDATEXML CRASHES ON SIMPLE INPUTS diff --git a/mysys/my_new.cc b/mysys/my_new.cc index 4266452da43..a401ccff135 100644 --- a/mysys/my_new.cc +++ b/mysys/my_new.cc @@ -47,6 +47,11 @@ void* operator new[](std::size_t sz, const std::nothrow_t&) throw() return (void *) my_malloc (sz ? sz : 1, MYF(0)); } +void operator delete (void *ptr, std::size_t) +{ + my_free(ptr); +} + void operator delete (void *ptr) { my_free(ptr); @@ -57,6 +62,11 @@ void operator delete[] (void *ptr) throw () my_free(ptr); } +void operator delete[] (void *ptr, std::size_t) throw () +{ + my_free(ptr); +} + void operator delete(void* ptr, const std::nothrow_t&) throw() { my_free(ptr); diff --git a/pcre/CMakeLists.txt b/pcre/CMakeLists.txt index 8aaa9b57361..80e402e5713 100644 --- a/pcre/CMakeLists.txt +++ b/pcre/CMakeLists.txt @@ -128,9 +128,9 @@ SET(PCREGREP_BUFSIZE "20480" CACHE STRING SET(PCRE_NEWLINE "LF" CACHE STRING "What to recognize as a newline (one of CR, LF, CRLF, ANY, ANYCRLF).") -# MARIADB: Changed the default from OFF to ON as pcre_test.bat on Windows -# MARIADB: fails complaining about too small stack size on Windows. -SET(PCRE_NO_RECURSE ON CACHE BOOL +# Windows has much smaller stack (pcre recursion limit of 112, vs +# 250-500 on Linuxes) +SET(PCRE_NO_RECURSE "${WIN32}" CACHE BOOL "If ON, then don't use stack recursion when matching. See NO_RECURSE in config.h.in for details.") SET(PCRE_POSIX_MALLOC_THRESHOLD "10" CACHE STRING diff --git a/pcre/pcre_exec.c b/pcre/pcre_exec.c index 70ac2fea381..fa84d924a4c 100644 --- a/pcre/pcre_exec.c +++ b/pcre/pcre_exec.c @@ -509,6 +509,12 @@ Returns: MATCH_MATCH if matched ) these values are >= 0 (e.g. stopped by repeated call or recursion limit) */ +#ifdef __GNUC__ +static int +match(REGISTER PCRE_PUCHAR eptr, REGISTER const pcre_uchar *ecode, + PCRE_PUCHAR mstart, int offset_top, match_data *md, eptrblock *eptrb, + unsigned int rdepth) __attribute__((noinline,noclone)); +#endif static int match(REGISTER PCRE_PUCHAR eptr, REGISTER const pcre_uchar *ecode, PCRE_PUCHAR mstart, int offset_top, match_data *md, eptrblock *eptrb, diff --git a/plugin/handler_socket/CMakeLists.txt b/plugin/handler_socket/CMakeLists.txt index a10743210e9..bd656ebc5b7 100644 --- a/plugin/handler_socket/CMakeLists.txt +++ b/plugin/handler_socket/CMakeLists.txt @@ -8,6 +8,12 @@ ENDIF() #Remove -fno-implicit-templates from compiler flags(handlersocket would not work with it) STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) +include(CheckCXXCompilerFlag) +check_cxx_compiler_flag(" -Wdeprecated-declarations" HAVE_CXX_WDEPRECATED_DECLARATIONS) +IF (HAVE_CXX_WDEPRECATED_DECLARATIONS) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations") +ENDIF() + INCLUDE_DIRECTORIES(libhsclient) # Handlersocket client library. We do not distribute it, diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 6ee016a3ca9..fc133f53b37 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -185,6 +185,11 @@ ELSE() SET(localstatedir ${MYSQL_DATADIR}) ENDIF() +SET(resolveip_locations "$basedir/${INSTALL_BINDIR} $basedir/bin") +SET(mysqld_locations "$basedir/${INSTALL_SBINDIR} $basedir/libexec $basedir/sbin $basedir/bin") +SET(errmsg_locations "$basedir/${INSTALL_MYSQLSHAREDIR}/english $basedir/share/english $basedir/share/mysql/english") +SET(pkgdata_locations "$basedir/${INSTALL_MYSQLSHAREDIR} $basedir/share $basedir/share/mysql") + IF(UNIX) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_install_db.sh ${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db ESCAPE_QUOTES @ONLY) diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index f8f4859e627..07565f7046d 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -188,7 +188,7 @@ SET @skip_auth_anonymous=1;" ;; # Try to find a specific file within --basedir which can either be a binary # release or installed source directory and return the path. -find_in_basedir() +find_in_dirs() { case "$1" in --dir) @@ -200,13 +200,13 @@ find_in_basedir() for dir in "$@" do - if test -f "$basedir/$dir/$file" + if test -f "$dir/$file" then if test -n "$return_dir" then - echo "$basedir/$dir" + echo "$dir" else - echo "$basedir/$dir/$file" + echo "$dir/$file" fi break fi @@ -270,7 +270,7 @@ then print_defaults="$builddir/extra/my_print_defaults" elif test -n "$basedir" then - print_defaults=`find_in_basedir my_print_defaults bin extra` + print_defaults=`find_in_dirs my_print_defaults $basedir/bin $basedir/extra` if test -z "$print_defaults" then cannot_find_file my_print_defaults $basedir/bin $basedir/extra @@ -296,44 +296,46 @@ if test -n "$srcdir" then basedir="$builddir" bindir="$basedir/client" - extra_bindir="$basedir/extra" + resolveip="$basedir/extra/resolveip" mysqld="$basedir/sql/mysqld" langdir="$basedir/sql/share/english" srcpkgdatadir="$srcdir/scripts" buildpkgdatadir="$builddir/scripts" - scriptdir="$srcdir/scripts" elif test -n "$basedir" then - bindir="$basedir/bin" - extra_bindir="$bindir" - mysqld=`find_in_basedir mysqld libexec sbin bin` + bindir="$basedir/bin" # only used in the help text + resolveip=`find_in_dirs resolveip @resolveip_locations@` + if test -z "$resolveip" + then + cannot_find_file resolveip @resolveip_locations@ + exit 1 + fi + mysqld=`find_in_dirs mysqld @mysqld_locations@` if test -z "$mysqld" then - cannot_find_file mysqld $basedir/libexec $basedir/sbin $basedir/bin + cannot_find_file mysqld @mysqld_locations@ exit 1 fi - langdir=`find_in_basedir --dir errmsg.sys share/english share/mysql/english` + langdir=`find_in_dirs --dir errmsg.sys @errmsg_locations@` if test -z "$langdir" then - cannot_find_file errmsg.sys $basedir/share/english $basedir/share/mysql/english + cannot_find_file errmsg.sys @errmsg_locations@ exit 1 fi - srcpkgdatadir=`find_in_basedir --dir fill_help_tables.sql share share/mysql` + srcpkgdatadir=`find_in_dirs --dir fill_help_tables.sql @pkgdata_locations@` buildpkgdatadir=$srcpkgdatadir if test -z "$srcpkgdatadir" then - cannot_find_file fill_help_tables.sql $basedir/share $basedir/share/mysql + cannot_find_file fill_help_tables.sql @pkgdata_locations@ exit 1 fi - scriptdir="$basedir/scripts" else basedir="@prefix@" bindir="@bindir@" - extra_bindir="$bindir" + resolveip="$bindir/resolveip" mysqld="@libexecdir@/mysqld" srcpkgdatadir="@pkgdatadir@" buildpkgdatadir="@pkgdatadir@" - scriptdir="@scriptdir@" fi # Set up paths to SQL scripts required for bootstrap @@ -377,14 +379,14 @@ hostname=`@HOSTNAME@` # Check if hostname is valid if test "$cross_bootstrap" -eq 0 -a "$in_rpm" -eq 0 -a "$force" -eq 0 then - resolved=`"$extra_bindir/resolveip" $hostname 2>&1` + resolved=`"$resolveip" $hostname 2>&1` if test $? -ne 0 then - resolved=`"$extra_bindir/resolveip" localhost 2>&1` + resolved=`"$resolveip" localhost 2>&1` if test $? -ne 0 then echo "Neither host '$hostname' nor 'localhost' could be looked up with" - echo "'$extra_bindir/resolveip'" + echo "'$resolveip'" echo "Please configure the 'hostname' command to return a correct" echo "hostname." echo "If you want to solve this at a later stage, restart this script" @@ -392,7 +394,7 @@ then link_to_help exit 1 fi - echo "WARNING: The host '$hostname' could not be looked up with resolveip." + echo "WARNING: The host '$hostname' could not be looked up with $resolveip." echo "This probably means that your libc libraries are not 100 % compatible" echo "with this binary MariaDB version. The MariaDB daemon, mysqld, should work" echo "normally with the exception that host name resolving will not work." @@ -480,7 +482,7 @@ else echo "The problem could be conflicting information in an external" echo "my.cnf files. You can ignore these by doing:" echo - echo " shell> $scriptdir/scripts/mysql_install_db --defaults-file=~/.my.cnf" + echo " shell> $0 --defaults-file=~/.my.cnf" echo echo "You can also try to start the mysqld daemon with:" echo diff --git a/scripts/wsrep_sst_xtrabackup-v2.sh b/scripts/wsrep_sst_xtrabackup-v2.sh index a413bd81b42..40e686d4d6b 100644 --- a/scripts/wsrep_sst_xtrabackup-v2.sh +++ b/scripts/wsrep_sst_xtrabackup-v2.sh @@ -37,7 +37,6 @@ REMOTEIP="" REMOTEHOST="" tca="" tcert="" -tpem="" tkey="" sockopt="" progress="" @@ -358,8 +357,7 @@ get_transfer() if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then wsrep_log_info "Decrypting with CERT: $tcert, KEY: $tkey" tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=${tcert},key=${tkey},verify=0${joiner_extra}${sockopt} stdio" - tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=${tpem},key=${tkey},verify=0${sockopt} stdio" - else + else wsrep_log_info "Encrypting with CERT: $tcert, KEY: $tkey" tcmd="socat -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=${tcert},key=${tkey},verify=0${sockopt}" fi diff --git a/sql-common/client.c b/sql-common/client.c index a19d9fca8d1..d2dc79672db 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1150,7 +1150,7 @@ void mysql_read_default_options(struct st_mysql_options *options, break; case OPT_pipe: options->protocol = MYSQL_PROTOCOL_PIPE; - break; + break; case OPT_connect_timeout: case OPT_timeout: if (opt_arg) diff --git a/sql/events.cc b/sql/events.cc index 1f2501646cb..07cfdf1028a 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -188,8 +188,8 @@ common_1_lev_code: expr= tmp_expr - (tmp_expr/60)*60; /* the code after the switch will finish */ - } break; + } case INTERVAL_HOUR_SECOND: { ulonglong tmp_expr= expr; @@ -205,8 +205,8 @@ common_1_lev_code: expr= tmp_expr - (tmp_expr/60)*60; /* the code after the switch will finish */ - } break; + } case INTERVAL_DAY_SECOND: { ulonglong tmp_expr= expr; @@ -228,8 +228,8 @@ common_1_lev_code: expr= tmp_expr - (tmp_expr/60)*60; /* the code after the switch will finish */ - } break; + } case INTERVAL_DAY_MICROSECOND: case INTERVAL_HOUR_MICROSECOND: case INTERVAL_MINUTE_MICROSECOND: @@ -243,7 +243,8 @@ common_1_lev_code: break; case INTERVAL_WEEK: expr/= 7; - /* fall through */ + close_quote= FALSE; + break; default: close_quote= FALSE; break; diff --git a/sql/field.cc b/sql/field.cc index 6b3f836048f..bff936b7052 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1,6 +1,6 @@ /* - Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2008, 2013, Monty Program Ab. + Copyright (c) 2000, 2017, Oracle and/or its affiliates. + Copyright (c) 2008, 2017, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -8913,13 +8913,13 @@ String *Field_set::val_str(String *val_buffer, ulonglong tmp=(ulonglong) Field_enum::val_int(); uint bitnr=0; + /* + Some callers expect *val_buffer to contain the result, + so we assign to it, rather than doing 'return &empty_set_string. + */ + *val_buffer= empty_set_string; if (tmp == 0) { - /* - Some callers expect *val_buffer to contain the result, - so we assign to it, rather than doing 'return &empty_set_string. - */ - *val_buffer= empty_set_string; return val_buffer; } diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index a0fbdffec90..cc5521114f4 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -1,6 +1,6 @@ /* - Copyright (c) 2005, 2013, Oracle and/or its affiliates. - Copyright (c) 2009, 2013, Monty Program Ab & SkySQL Ab + Copyright (c) 2005, 2017, Oracle and/or its affiliates. + Copyright (c) 2009, 2017, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1933,7 +1933,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, cleanup_new_partition(part_count); DBUG_RETURN(error); } - + DBUG_PRINT("info", ("Add partition %s", part_name_buff)); if ((error= prepare_new_partition(table, create_info, new_file_array[i], diff --git a/sql/handler.cc b/sql/handler.cc index 2e499238dba..1f3df447f24 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -404,7 +404,7 @@ static int ha_finish_errors(void) } static volatile int32 need_full_discover_for_existence= 0; -static volatile int32 engines_with_discover_table_names= 0; +static volatile int32 engines_with_discover_file_names= 0; static volatile int32 engines_with_discover= 0; static int full_discover_for_existence(handlerton *, const char *, const char *) @@ -429,8 +429,8 @@ static void update_discovery_counters(handlerton *hton, int val) if (hton->discover_table_existence == full_discover_for_existence) my_atomic_add32(&need_full_discover_for_existence, val); - if (hton->discover_table_names) - my_atomic_add32(&engines_with_discover_table_names, val); + if (hton->discover_table_names && hton->tablefile_extensions[0]) + my_atomic_add32(&engines_with_discover_file_names, val); if (hton->discover_table) my_atomic_add32(&engines_with_discover, val); @@ -5200,6 +5200,7 @@ void Discovered_table_list::remove_duplicates() { LEX_STRING **src= tables->front(); LEX_STRING **dst= src; + sort(); while (++dst <= tables->back()) { LEX_STRING *s= *src, *d= *dst; @@ -5267,10 +5268,12 @@ int ha_discover_table_names(THD *thd, LEX_STRING *db, MY_DIR *dirp, int error; DBUG_ENTER("ha_discover_table_names"); - if (engines_with_discover_table_names == 0 && !reusable) + if (engines_with_discover_file_names == 0 && !reusable) { - error= ext_table_discovery_simple(dirp, result); - result->sort(); + st_discover_names_args args= {db, NULL, result, 0}; + error= ext_table_discovery_simple(dirp, result) || + plugin_foreach(thd, discover_names, + MYSQL_STORAGE_ENGINE_PLUGIN, &args); } else { @@ -5283,8 +5286,6 @@ int ha_discover_table_names(THD *thd, LEX_STRING *db, MY_DIR *dirp, error= extension_based_table_discovery(dirp, reg_ext, result) || plugin_foreach(thd, discover_names, MYSQL_STORAGE_ENGINE_PLUGIN, &args); - result->sort(); - if (args.possible_duplicates > 0) result->remove_duplicates(); } diff --git a/sql/item.cc b/sql/item.cc index 910fdd06303..efd82d4f873 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -2248,6 +2248,9 @@ bool Item_func_or_sum::agg_item_set_converter(const DTCollation &coll, Item **args, uint nargs, uint flags, int item_sep) { + THD *thd= current_thd; + if (thd->lex->is_ps_or_view_context_analysis()) + return false; Item **arg, *safe_args[2]= {NULL, NULL}; /* @@ -2263,7 +2266,6 @@ bool Item_func_or_sum::agg_item_set_converter(const DTCollation &coll, safe_args[1]= args[item_sep]; } - THD *thd= current_thd; bool res= FALSE; uint i; @@ -6188,7 +6190,7 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, Field_string(max_length, maybe_null, name, collation.collation); break; } - /* Fall through */ + /* fall through */ case MYSQL_TYPE_ENUM: case MYSQL_TYPE_SET: case MYSQL_TYPE_VAR_STRING: @@ -7000,6 +7002,7 @@ bool Item::cache_const_expr_analyzer(uchar **arg) */ if (const_item() && !(basic_const_item() || item->basic_const_item() || + item->type() == Item::NULL_ITEM || /* Item_name_const hack */ item->type() == Item::FIELD_ITEM || item->type() == SUBSELECT_ITEM || item->type() == CACHE_ITEM || @@ -7355,7 +7358,11 @@ public: // Find which select the field is in. This is achieved by walking up // the select tree and looking for the table of interest. st_select_lex *sel; - for (sel= current_select; sel; sel= sel->outer_select()) + for (sel= current_select; + sel ; + sel= (sel->context.outer_context ? + sel->context.outer_context->select_lex: + NULL)) { List_iterator<TABLE_LIST> li(sel->leaf_tables); TABLE_LIST *tbl; @@ -8529,7 +8536,6 @@ bool Item_direct_view_ref::send(Protocol *protocol, String *buffer) bool Item_direct_view_ref::fix_fields(THD *thd, Item **reference) { - DBUG_ASSERT(1); /* view fild reference must be defined */ DBUG_ASSERT(*ref); /* (*ref)->check_cols() will be made in Item_direct_ref::fix_fields */ @@ -10597,7 +10603,7 @@ void Item_direct_view_ref::update_used_tables() table_map Item_direct_view_ref::used_tables() const { - DBUG_ASSERT(null_ref_table); + DBUG_ASSERT(fixed); if (get_depended_from()) return OUTER_REF_TABLE_BIT; diff --git a/sql/item.h b/sql/item.h index 76708fb3570..9b94a08c34e 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1,8 +1,8 @@ #ifndef SQL_ITEM_INCLUDED #define SQL_ITEM_INCLUDED -/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2009, 2017, MariaDB Corporation. +/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. + Copyright (c) 2009, 2017, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/item_row.cc b/sql/item_row.cc index fc484f560ee..6486bb66615 100644 --- a/sql/item_row.cc +++ b/sql/item_row.cc @@ -24,7 +24,6 @@ #include "sql_class.h" // THD, set_var.h: THD #include "set_var.h" - void Item_row::illegal_method_call(const char *method) { DBUG_ENTER("Item_row::illegal_method_call"); diff --git a/sql/item_row.h b/sql/item_row.h index cd58e15fe8b..d7326df04ce 100644 --- a/sql/item_row.h +++ b/sql/item_row.h @@ -47,13 +47,10 @@ public: Item_row(THD *thd, List<Item> &list): Item(thd), Item_args(thd, list), not_null_tables_cache(0), with_null(0) { } - Item_row(THD *thd, Item_row *item): - Item(thd), - Item_args(item), - Used_tables_and_const_cache(item), - not_null_tables_cache(0), - with_null(0) - {} + Item_row(THD *thd, Item_row *row): + Item(thd), Item_args(thd, static_cast<Item_args*>(row)), Used_tables_and_const_cache(), + not_null_tables_cache(0), with_null(0) + { } enum Type type() const { return ROW_ITEM; }; void illegal_method_call(const char *); diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 29433be4af8..e6907747a8c 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -1448,6 +1448,10 @@ Item_in_subselect::Item_in_subselect(THD *thd, Item * left_exp, DBUG_ENTER("Item_in_subselect::Item_in_subselect"); DBUG_PRINT("info", ("in_strategy: %u", (uint)in_strategy)); left_expr_orig= left_expr= left_exp; + /* prepare to possible disassembling the item in convert_subq_to_sj() */ + if (left_exp->type() == Item::ROW_ITEM) + left_expr_orig= new (thd->mem_root) + Item_row(thd, static_cast<Item_row*>(left_exp)); func= &eq_creator; init(select_lex, new (thd->mem_root) select_exists_subselect(thd, this)); max_columns= UINT_MAX; @@ -1471,6 +1475,10 @@ Item_allany_subselect::Item_allany_subselect(THD *thd, Item * left_exp, { DBUG_ENTER("Item_allany_subselect::Item_allany_subselect"); left_expr_orig= left_expr= left_exp; + /* prepare to possible disassembling the item in convert_subq_to_sj() */ + if (left_exp->type() == Item::ROW_ITEM) + left_expr_orig= new (thd->mem_root) + Item_row(thd, static_cast<Item_row*>(left_exp)); func= func_creator(all_arg); init(select_lex, new (thd->mem_root) select_exists_subselect(thd, this)); max_columns= 1; diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 2724bb63eda..01b07c00816 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1852,9 +1852,18 @@ overflow: ltime->hour= TIME_MAX_HOUR+1; check_time_range(ltime, decimals, &unused); - make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, - err->ptr(), err->length(), - MYSQL_TIMESTAMP_TIME, NullS); + if (!err) + { + ErrConvInteger err2(sec, unsigned_flag); + make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, + &err2, MYSQL_TIMESTAMP_TIME, NullS); + } + else + { + ErrConvString err2(err); + make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, + &err2, MYSQL_TIMESTAMP_TIME, NullS); + } return 0; } diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index dccccc479ef..354a54a5c1a 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -546,8 +546,16 @@ public: { return val_decimal_from_date(decimal_value); } Field *create_field_for_create_select(TABLE *table) { return tmp_table_field_from_field_type(table, false, false); } +#if MARIADB_VERSION_ID > 100300 +#error This code should be removed in 10.3, to use the derived save_in_field() +#else int save_in_field(Field *field, bool no_conversions) - { return save_date_in_field(field); } + { + return field_type() == MYSQL_TYPE_TIME ? + save_time_in_field(field) : + save_date_in_field(field); + } +#endif void fix_length_and_dec(); }; diff --git a/sql/log_event.cc b/sql/log_event.cc index 8932d0f261d..8840861bfdc 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -8673,22 +8673,7 @@ User_var_log_event(const char* buf, uint event_len, Old events will not have this extra byte, thence, we keep the flags set to UNDEF_F. */ - size_t bytes_read= ((val + val_len) - buf_start); -#ifndef DBUG_OFF - bool old_pre_checksum_fd= description_event->is_version_before_checksum( - &description_event->server_version_split); -#endif - DBUG_ASSERT((bytes_read == data_written - - (old_pre_checksum_fd || - (description_event->checksum_alg == - BINLOG_CHECKSUM_ALG_OFF)) ? - 0 : BINLOG_CHECKSUM_LEN) - || - (bytes_read == data_written -1 - - (old_pre_checksum_fd || - (description_event->checksum_alg == - BINLOG_CHECKSUM_ALG_OFF)) ? - 0 : BINLOG_CHECKSUM_LEN)); + uint bytes_read= ((val + val_len) - buf_start); if ((data_written - bytes_read) > 0) { flags= (uint) *(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE + diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 3d9c1aef4b8..04d2059eb62 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -8536,6 +8536,34 @@ bool sel_trees_can_be_ored(RANGE_OPT_PARAM* param, } /* + Check whether the key parts inf_init..inf_end-1 of one index can compose + an infix for the key parts key_init..key_end-1 of another index +*/ + +static +bool is_key_infix(KEY_PART *key_init, KEY_PART *key_end, + KEY_PART *inf_init, KEY_PART *inf_end) +{ + KEY_PART *key_part, *inf_part; + for (key_part= key_init; key_part < key_end; key_part++) + { + if (key_part->field->eq(inf_init->field)) + break; + } + if (key_part == key_end) + return false; + for (key_part++, inf_part= inf_init + 1; + key_part < key_end && inf_part < inf_end; + key_part++, inf_part++) + { + if (!key_part->field->eq(inf_part->field)) + return false; + } + return inf_part == inf_end; +} + + +/* Check whether range parts of two trees must be ored for some indexes SYNOPSIS @@ -8591,14 +8619,9 @@ bool sel_trees_must_be_ored(RANGE_OPT_PARAM* param, KEY_PART *key2_init= param->key[idx2]+tree2->keys[idx2]->part; KEY_PART *key2_end= param->key[idx2]+tree2->keys[idx2]->max_part_no; - KEY_PART *part1, *part2; - for (part1= key1_init, part2= key2_init; - part1 < key1_end && part2 < key2_end; - part1++, part2++) - { - if (!part1->field->eq(part2->field)) - DBUG_RETURN(FALSE); - } + if (!is_key_infix(key1_init, key1_end, key2_init, key2_end) && + !is_key_infix(key2_init, key2_end, key1_init, key1_end)) + DBUG_RETURN(FALSE); } } diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index f37db88957a..b16fec1de3e 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -1614,6 +1614,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred) sj-nest. */ st_select_lex *subq_lex= subq_pred->unit->first_select(); + DBUG_ASSERT(subq_lex->next_select() == NULL); nested_join->join_list.empty(); List_iterator_fast<TABLE_LIST> li(subq_lex->top_join_list); TABLE_LIST *tl; @@ -1717,7 +1718,8 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred) if (subq_pred->left_expr->cols() == 1) { - nested_join->sj_outer_expr_list.push_back(subq_pred->left_expr, + /* add left = select_list_element */ + nested_join->sj_outer_expr_list.push_back(&subq_pred->left_expr, thd->mem_root); /* Create Item_func_eq. Note that @@ -1731,26 +1733,62 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred) Item_func_eq *item_eq= new (thd->mem_root) Item_func_eq(thd, subq_pred->left_expr_orig, subq_lex->ref_pointer_array[0]); + if (!item_eq) + DBUG_RETURN(TRUE); if (subq_pred->left_expr_orig != subq_pred->left_expr) thd->change_item_tree(item_eq->arguments(), subq_pred->left_expr); item_eq->in_equality_no= 0; sj_nest->sj_on_expr= and_items(thd, sj_nest->sj_on_expr, item_eq); } - else + else if (subq_pred->left_expr->type() == Item::ROW_ITEM) { + /* + disassemple left expression and add + left1 = select_list_element1 and left2 = select_list_element2 ... + */ for (uint i= 0; i < subq_pred->left_expr->cols(); i++) { - nested_join->sj_outer_expr_list.push_back(subq_pred->left_expr-> - element_index(i), + nested_join->sj_outer_expr_list.push_back(subq_pred->left_expr->addr(i), thd->mem_root); - Item_func_eq *item_eq= + Item_func_eq *item_eq= new (thd->mem_root) - Item_func_eq(thd, subq_pred->left_expr->element_index(i), + Item_func_eq(thd, subq_pred->left_expr_orig->element_index(i), subq_lex->ref_pointer_array[i]); + if (!item_eq) + DBUG_RETURN(TRUE); + DBUG_ASSERT(subq_pred->left_expr->element_index(i)->fixed); + if (subq_pred->left_expr_orig->element_index(i) != + subq_pred->left_expr->element_index(i)) + thd->change_item_tree(item_eq->arguments(), + subq_pred->left_expr->element_index(i)); item_eq->in_equality_no= i; sj_nest->sj_on_expr= and_items(thd, sj_nest->sj_on_expr, item_eq); } } + else + { + /* + add row operation + left = (select_list_element1, select_list_element2, ...) + */ + Item_row *row= new (thd->mem_root) Item_row(thd, subq_lex->pre_fix); + /* fix fields on subquery was call so they should be the same */ + DBUG_ASSERT(subq_pred->left_expr->cols() == row->cols()); + if (!row) + DBUG_RETURN(TRUE); + nested_join->sj_outer_expr_list.push_back(&subq_pred->left_expr); + Item_func_eq *item_eq= + new (thd->mem_root) Item_func_eq(thd, subq_pred->left_expr_orig, row); + if (!item_eq) + DBUG_RETURN(TRUE); + for (uint i= 0; i < row->cols(); i++) + { + if (row->element_index(i) != subq_lex->ref_pointer_array[i]) + thd->change_item_tree(row->addr(i), subq_lex->ref_pointer_array[i]); + } + item_eq->in_equality_no= 0; + sj_nest->sj_on_expr= and_items(thd, sj_nest->sj_on_expr, item_eq); + } /* Fix the created equality and AND @@ -3299,8 +3337,8 @@ void restore_prev_sj_state(const table_map remaining_tables, ulonglong get_bound_sj_equalities(TABLE_LIST *sj_nest, table_map remaining_tables) { - List_iterator<Item> li(sj_nest->nested_join->sj_outer_expr_list); - Item *item; + List_iterator<Item_ptr> li(sj_nest->nested_join->sj_outer_expr_list); + Item **item; uint i= 0; ulonglong res= 0; while ((item= li++)) @@ -3311,7 +3349,7 @@ ulonglong get_bound_sj_equalities(TABLE_LIST *sj_nest, class and see if there is an element that is bound? (this is an optional feature) */ - if (!(item->used_tables() & remaining_tables)) + if (!(item[0]->used_tables() & remaining_tables)) { res |= 1ULL << i; } diff --git a/sql/slave.cc b/sql/slave.cc index 1b1a597fa2a..19905841a2c 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -3213,7 +3213,6 @@ static int init_slave_thread(THD* thd, Master_info *mi, thd->variables.sql_log_slow= opt_log_slow_slave_statements; thd->variables.log_slow_filter= global_system_variables.log_slow_filter; set_slave_thread_options(thd); - thd->client_capabilities = CLIENT_LOCAL_FILES; if (thd_type == SLAVE_THD_SQL) THD_STAGE_INFO(thd, stage_waiting_for_the_next_event_in_relay_log); diff --git a/sql/sp_head.cc b/sql/sp_head.cc index b3edcdca474..20c02fce752 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -119,7 +119,6 @@ sp_get_item_value(THD *thd, Item *item, String *str) case DECIMAL_RESULT: if (item->field_type() != MYSQL_TYPE_BIT) return item->val_str(str); - else {/* Bit type is handled as binary string */} /* fall through */ case STRING_RESULT: { @@ -2545,10 +2544,18 @@ bool check_show_routine_access(THD *thd, sp_head *sp, bool *full_access) *full_access= ((!check_table_access(thd, SELECT_ACL, &tables, FALSE, 1, TRUE) && (tables.grant.privilege & SELECT_ACL) != 0) || + /* Check if user owns the routine. */ (!strcmp(sp->m_definer_user.str, thd->security_ctx->priv_user) && !strcmp(sp->m_definer_host.str, - thd->security_ctx->priv_host))); + thd->security_ctx->priv_host)) || + /* Check if current role or any of the sub-granted roles + own the routine. */ + (sp->m_definer_host.length == 0 && + (!strcmp(sp->m_definer_user.str, + thd->security_ctx->priv_role) || + check_role_is_granted(thd->security_ctx->priv_role, NULL, + sp->m_definer_user.str)))); if (!*full_access) return check_some_routine_access(thd, sp->m_db.str, sp->m_name.str, sp->m_type == TYPE_ENUM_PROCEDURE); @@ -4327,4 +4334,3 @@ sp_add_to_query_tables(THD *thd, LEX *lex, lex->add_to_query_tables(table); return table; } - diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index af49eefa2a5..555865804f9 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -9194,6 +9194,16 @@ void get_mqh(const char *user, const char *host, USER_CONN *uc) mysql_mutex_unlock(&acl_cache->lock); } +static int check_role_is_granted_callback(ACL_USER_BASE *grantee, void *data) +{ + LEX_CSTRING *rolename= static_cast<LEX_CSTRING *>(data); + if (rolename->length == grantee->user.length && + !strcmp(rolename->str, grantee->user.str)) + return -1; // End search, we've found our role. + + /* Keep looking, we haven't found our role yet. */ + return 0; +} /* Modify a privilege table. @@ -11198,7 +11208,6 @@ bool check_grant(THD *, ulong, TABLE_LIST *, bool, uint, bool) } #endif /*NO_EMBEDDED_ACCESS_CHECKS */ - SHOW_VAR acl_statistics[] = { #ifndef NO_EMBEDDED_ACCESS_CHECKS {"column_grants", (char*)show_column_grants, SHOW_SIMPLE_FUNC}, @@ -11214,6 +11223,43 @@ SHOW_VAR acl_statistics[] = { {NullS, NullS, SHOW_LONG}, }; +/* Check if a role is granted to a user/role. We traverse the role graph + and return true if we find a match. + + hostname == NULL means we are looking for a role as a starting point, + otherwise a user. +*/ +bool check_role_is_granted(const char *username, + const char *hostname, + const char *rolename) +{ + DBUG_ENTER("check_role_is_granted"); + bool result= false; +#ifndef NO_EMBEDDED_ACCESS_CHECKS + ACL_USER_BASE *root; + mysql_mutex_lock(&acl_cache->lock); + if (hostname) + root= find_user_exact(username, hostname); + else + root= find_acl_role(username); + + LEX_CSTRING role_lex; + role_lex.str= rolename; + role_lex.length= strlen(rolename); + + if (root && /* No grantee, nothing to search. */ + traverse_role_graph_down(root, &role_lex, check_role_is_granted_callback, + NULL) == -1) + { + /* We have found the role during our search. */ + result= true; + } + + /* We haven't found the role or we had no initial grantee to start from. */ + mysql_mutex_unlock(&acl_cache->lock); +#endif + DBUG_RETURN(result); +} int fill_schema_enabled_roles(THD *thd, TABLE_LIST *tables, COND *cond) { @@ -13599,4 +13645,3 @@ maria_declare_plugin(mysql_password) MariaDB_PLUGIN_MATURITY_STABLE /* Maturity */ } maria_declare_plugin_end; - diff --git a/sql/sql_acl.h b/sql/sql_acl.h index daa36f6c32a..8d233fd3d0a 100644 --- a/sql/sql_acl.h +++ b/sql/sql_acl.h @@ -409,6 +409,14 @@ int acl_set_default_role(THD *thd, const char *host, const char *user, extern SHOW_VAR acl_statistics[]; +/* Check if a role is granted to a user/role. + + If hostname == NULL, search for a role as the starting grantee. +*/ +bool check_role_is_granted(const char *username, + const char *hostname, + const char *rolename); + #ifndef DBUG_OFF extern ulong role_global_merges, role_db_merges, role_table_merges, role_column_merges, role_routine_merges; diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index dd3c2694202..5222381270a 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -66,7 +66,6 @@ static bool admin_recreate_table(THD *thd, TABLE_LIST *table_list) if (thd->get_stmt_da()->is_ok()) thd->get_stmt_da()->reset_diagnostics_area(); table_list->table= NULL; - result_code= result_code ? HA_ADMIN_FAILED : HA_ADMIN_OK; DBUG_RETURN(result_code); } diff --git a/sql/sql_base.cc b/sql/sql_base.cc index ea57e1d19c9..3f5af2985db 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -6994,13 +6994,15 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields, bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array, List<Item> &fields, enum_mark_columns mark_used_columns, - List<Item> *sum_func_list, bool allow_sum_func) + List<Item> *sum_func_list, List<Item> *pre_fix, + bool allow_sum_func) { reg2 Item *item; enum_mark_columns save_mark_used_columns= thd->mark_used_columns; nesting_map save_allow_sum_func= thd->lex->allow_sum_func; List_iterator<Item> it(fields); bool save_is_item_list_lookup; + bool make_pre_fix= (pre_fix && (pre_fix->elements == 0)); DBUG_ENTER("setup_fields"); DBUG_PRINT("enter", ("ref_pointer_array: %p", ref_pointer_array.array())); @@ -7050,6 +7052,9 @@ bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array, thd->lex->current_select->cur_pos_in_select_list= 0; while ((item= it++)) { + if (make_pre_fix) + pre_fix->push_back(item, thd->stmt_arena->mem_root); + if ((!item->fixed && item->fix_fields(thd, it.ref())) || (item= *(it.ref()))->check_cols(1)) { diff --git a/sql/sql_base.h b/sql/sql_base.h index 374ac56c3d8..9fb94e92d09 100644 --- a/sql/sql_base.h +++ b/sql/sql_base.h @@ -159,7 +159,8 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields, List<Item> *sum_func_list, uint wild_num); bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array, List<Item> &item, enum_mark_columns mark_used_columns, - List<Item> *sum_func_list, bool allow_sum_func); + List<Item> *sum_func_list, List<Item> *pre_fix, + bool allow_sum_func); void unfix_fields(List<Item> &items); bool fill_record(THD * thd, TABLE *table_arg, List<Item> &fields, List<Item> &values, bool ignore_errors, bool update); @@ -364,7 +365,7 @@ inline bool setup_fields_with_no_wrap(THD *thd, Ref_ptr_array ref_pointer_array, bool res; thd->lex->select_lex.no_wrap_view_item= TRUE; res= setup_fields(thd, ref_pointer_array, item, mark_used_columns, - sum_func_list, allow_sum_func); + sum_func_list, NULL, allow_sum_func); thd->lex->select_lex.no_wrap_view_item= FALSE; return res; } diff --git a/sql/sql_const.h b/sql/sql_const.h index 95960ac131a..c91992a9029 100644 --- a/sql/sql_const.h +++ b/sql/sql_const.h @@ -45,7 +45,18 @@ #define MAX_MBWIDTH 3 /* Max multibyte sequence */ #define MAX_FILENAME_MBWIDTH 5 #define MAX_FIELD_CHARLENGTH 255 -#define MAX_FIELD_VARCHARLENGTH 65535 +/* + In MAX_FIELD_VARCHARLENGTH we reserve extra bytes for the overhead: + - 2 bytes for the length + - 1 byte for NULL bits + to avoid the "Row size too large" error for these three corner definitions: + CREATE TABLE t1 (c VARBINARY(65533)); + CREATE TABLE t1 (c VARBINARY(65534)); + CREATE TABLE t1 (c VARBINARY(65535)); + Like VARCHAR(65536), they will be converted to BLOB automatically + in non-sctict mode. +*/ +#define MAX_FIELD_VARCHARLENGTH (65535-2-1) #define MAX_FIELD_BLOBLENGTH UINT_MAX32 /* cf field_blob::get_length() */ #define CONVERT_IF_BIGGER_TO_BLOB 512 /* Threshold *in characters* */ diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index a30f9ae2a32..7b7a7e3f804 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -762,7 +762,7 @@ l DBUG_RETURN(TRUE); if ((wild_num && setup_wild(thd, table_list, field_list, NULL, wild_num)) || setup_fields(thd, Ref_ptr_array(), - field_list, MARK_COLUMNS_READ, NULL, 0) || + field_list, MARK_COLUMNS_READ, NULL, NULL, 0) || setup_conds(thd, table_list, select_lex->leaf_tables, conds) || setup_ftfuncs(select_lex)) DBUG_RETURN(TRUE); diff --git a/sql/sql_do.cc b/sql/sql_do.cc index 6d86ece6a9f..da7dfe0c137 100644 --- a/sql/sql_do.cc +++ b/sql/sql_do.cc @@ -29,7 +29,7 @@ bool mysql_do(THD *thd, List<Item> &values) List_iterator<Item> li(values); Item *value; DBUG_ENTER("mysql_do"); - if (setup_fields(thd, Ref_ptr_array(), values, MARK_COLUMNS_NONE, 0, 0)) + if (setup_fields(thd, Ref_ptr_array(), values, MARK_COLUMNS_NONE, 0, NULL, 0)) DBUG_RETURN(TRUE); while ((value = li++)) (void) value->is_null(); diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index a226ea17eb3..a94349527bf 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -268,7 +268,8 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list, if (table_list->is_view()) unfix_fields(fields); - res= setup_fields(thd, Ref_ptr_array(), fields, MARK_COLUMNS_WRITE, 0, 0); + res= setup_fields(thd, Ref_ptr_array(), + fields, MARK_COLUMNS_WRITE, 0, NULL, 0); /* Restore the current context. */ ctx_state.restore_state(context, table_list); @@ -378,7 +379,7 @@ static int check_update_fields(THD *thd, TABLE_LIST *insert_table_list, /* Check the fields we are going to modify */ if (setup_fields(thd, Ref_ptr_array(), - update_fields, MARK_COLUMNS_WRITE, 0, 0)) + update_fields, MARK_COLUMNS_WRITE, 0, NULL, 0)) return -1; if (insert_table_list->is_view() && @@ -804,7 +805,8 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), counter); goto abort; } - if (setup_fields(thd, Ref_ptr_array(), *values, MARK_COLUMNS_READ, 0, 0)) + if (setup_fields(thd, Ref_ptr_array(), + *values, MARK_COLUMNS_READ, 0, NULL, 0)) goto abort; switch_to_nullable_trigger_fields(*values, table); } @@ -1529,13 +1531,13 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, context->resolve_in_table_list_only(table_list); res= (setup_fields(thd, Ref_ptr_array(), - *values, MARK_COLUMNS_READ, 0, 0) || + *values, MARK_COLUMNS_READ, 0, NULL, 0) || check_insert_fields(thd, context->table_list, fields, *values, !insert_into_view, 0, &map)); if (!res) res= setup_fields(thd, Ref_ptr_array(), - update_values, MARK_COLUMNS_READ, 0, 0); + update_values, MARK_COLUMNS_READ, 0, NULL, 0); if (!res && duplic == DUP_UPDATE) { @@ -3525,7 +3527,8 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u) */ lex->current_select= &lex->select_lex; - res= (setup_fields(thd, Ref_ptr_array(), values, MARK_COLUMNS_READ, 0, 0) || + res= (setup_fields(thd, Ref_ptr_array(), + values, MARK_COLUMNS_READ, 0, NULL, 0) || check_insert_fields(thd, table_list, *fields, values, !insert_into_view, 1, &map)); @@ -3578,7 +3581,7 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u) ctx_state.get_first_name_resolution_table(); res= res || setup_fields(thd, Ref_ptr_array(), *info.update_values, - MARK_COLUMNS_READ, 0, 0); + MARK_COLUMNS_READ, 0, NULL, 0); if (!res) { /* diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 9ab09c9fe7e..9ec9b5cdf95 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -783,6 +783,7 @@ public: Group_list_ptrs *group_list_ptrs; List<Item> item_list; /* list of fields & expressions */ + List<Item> pre_fix; /* above list before fix_fields */ bool is_item_list_lookup; /* Usualy it is pointer to ftfunc_list_alloc, but in union used to create fake diff --git a/sql/sql_load.cc b/sql/sql_load.cc index ea05d42673f..fbdc00433a6 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -387,21 +387,23 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, in this case. */ if (setup_fields(thd, Ref_ptr_array(), - set_fields, MARK_COLUMNS_WRITE, 0, 0) || - setup_fields(thd, Ref_ptr_array(), set_values, MARK_COLUMNS_READ, 0, 0)) + set_fields, MARK_COLUMNS_WRITE, 0, NULL, 0) || + setup_fields(thd, Ref_ptr_array(), + set_values, MARK_COLUMNS_READ, 0, NULL, 0)) DBUG_RETURN(TRUE); } else { // Part field list /* TODO: use this conds for 'WITH CHECK OPTIONS' */ if (setup_fields(thd, Ref_ptr_array(), - fields_vars, MARK_COLUMNS_WRITE, 0, 0) || + fields_vars, MARK_COLUMNS_WRITE, 0, NULL, 0) || setup_fields(thd, Ref_ptr_array(), - set_fields, MARK_COLUMNS_WRITE, 0, 0) || + set_fields, MARK_COLUMNS_WRITE, 0, NULL, 0) || check_that_all_fields_are_given_values(thd, table, table_list)) DBUG_RETURN(TRUE); /* Fix the expressions in SET clause */ - if (setup_fields(thd, Ref_ptr_array(), set_values, MARK_COLUMNS_READ, 0, 0)) + if (setup_fields(thd, Ref_ptr_array(), + set_values, MARK_COLUMNS_READ, 0, NULL, 0)) DBUG_RETURN(TRUE); } switch_to_nullable_trigger_fields(fields_vars, table); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 7662cc404a7..bf5144bfda6 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1414,8 +1414,7 @@ out: @retval FALSE The statement isn't updating any relevant tables. */ -static my_bool deny_updates_if_read_only_option(THD *thd, - TABLE_LIST *all_tables) +static bool deny_updates_if_read_only_option(THD *thd, TABLE_LIST *all_tables) { DBUG_ENTER("deny_updates_if_read_only_option"); @@ -1424,11 +1423,7 @@ static my_bool deny_updates_if_read_only_option(THD *thd, LEX *lex= thd->lex; - const my_bool user_is_super= - ((ulong)(thd->security_ctx->master_access & SUPER_ACL) == - (ulong)SUPER_ACL); - - if (user_is_super) + if (thd->security_ctx->master_access & SUPER_ACL) DBUG_RETURN(FALSE); if (!(sql_command_flags[lex->sql_command] & CF_CHANGES_DATA)) @@ -1438,28 +1433,26 @@ static my_bool deny_updates_if_read_only_option(THD *thd, if (lex->sql_command == SQLCOM_UPDATE_MULTI) DBUG_RETURN(FALSE); + if (lex->sql_command == SQLCOM_CREATE_DB || + lex->sql_command == SQLCOM_DROP_DB) + DBUG_RETURN(TRUE); + /* a table-to-be-created is not in the temp table list yet, so CREATE TABLE needs a special treatment */ - const bool update_real_tables= lex->sql_command == SQLCOM_CREATE_TABLE ? - !lex->tmp_table() : some_non_temp_table_to_be_updated(thd, all_tables); - - const bool create_or_drop_databases= - (lex->sql_command == SQLCOM_CREATE_DB) || - (lex->sql_command == SQLCOM_DROP_DB); - - if (update_real_tables || create_or_drop_databases) - { - /* - An attempt was made to modify one or more non-temporary tables. - */ - DBUG_RETURN(TRUE); - } + if (lex->sql_command == SQLCOM_CREATE_TABLE) + DBUG_RETURN(!lex->tmp_table()); + /* + a table-to-be-dropped might not exist (DROP TEMPORARY TABLE IF EXISTS), + cannot use the temp table list either. + */ + if (lex->sql_command == SQLCOM_DROP_TABLE && lex->tmp_table()) + DBUG_RETURN(FALSE); - /* Assuming that only temporary tables are modified. */ - DBUG_RETURN(FALSE); + /* Now, check thd->temporary_tables list */ + DBUG_RETURN(some_non_temp_table_to_be_updated(thd, all_tables)); } @@ -3794,7 +3787,7 @@ mysql_execute_command(THD *thd) #ifdef WITH_PARTITION_STORAGE_ENGINE { partition_info *part_info= thd->lex->part_info; - if (part_info && !(part_info= thd->lex->part_info->get_clone(thd))) + if (part_info && !(part_info= part_info->get_clone(thd))) { res= -1; goto end_with_restore_list; @@ -4271,7 +4264,7 @@ end_with_restore_list: if (up_result != 2) break; } - /* Fall through */ + /* fall through */ case SQLCOM_UPDATE_MULTI: { DBUG_ASSERT(first_table == all_tables && first_table != 0); @@ -4382,7 +4375,7 @@ end_with_restore_list: DBUG_PRINT("debug", ("Just after generate_incident()")); } #endif - /* fall through */ + /* fall through */ case SQLCOM_INSERT: { WSREP_SYNC_WAIT(thd, WSREP_SYNC_WAIT_BEFORE_INSERT_REPLACE); diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 6e4da0fbbf2..3f06c950472 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -1,5 +1,5 @@ -/* Copyright (c) 2005, 2014, Oracle and/or its affiliates. - Copyright (c) 2009, 2014, SkySQL Ab. +/* Copyright (c) 2005, 2017, Oracle and/or its affiliates. + Copyright (c) 2009, 2017, SkySQL Ab. 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 @@ -6561,7 +6561,8 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, lpt->alter_info= alter_info; lpt->create_info= create_info; lpt->db_options= create_info->table_options; - if (create_info->row_type == ROW_TYPE_DYNAMIC) + if (create_info->row_type != ROW_TYPE_FIXED && + create_info->row_type != ROW_TYPE_DEFAULT) lpt->db_options|= HA_OPTION_PACK_RECORD; lpt->table= table; lpt->key_info_buffer= 0; @@ -8073,6 +8074,7 @@ int create_partition_name(char *out, size_t outlen, const char *in1, } else transl_part= in2; + if (name_variant == NORMAL_PART_NAME) end= strxnmov(out, outlen-1, in1, "#P#", transl_part, NullS); else if (name_variant == TEMP_PART_NAME) @@ -8087,25 +8089,19 @@ int create_partition_name(char *out, size_t outlen, const char *in1, return 0; } - -/* - Create subpartition name - - SYNOPSIS - create_subpartition_name() - out:out The buffer for the created partition name string - must be *at least* of FN_REFLEN+1 bytes - in1 First part - in2 Second part - in3 Third part - name_variant Normal, temporary or renamed partition name - - RETURN VALUE - 0 if ok, error if name too long - - DESCRIPTION - This method is used to calculate the subpartition name, service routine to - the del_ren_cre_table method. +/** + Create subpartition name. This method is used to calculate the + subpartition name, service routine to the del_ren_cre_table method. + The output buffer size should be FN_REFLEN + 1(terminating '\0'). + + @param [out] out Created partition name string + @param in1 First part + @param in2 Second part + @param in3 Third part + @param name_variant Normal, temporary or renamed partition name + + @retval true Error. + @retval false Success. */ int create_subpartition_name(char *out, size_t outlen, @@ -8117,6 +8113,7 @@ int create_subpartition_name(char *out, size_t outlen, tablename_to_filename(in2, transl_part_name, FN_REFLEN); tablename_to_filename(in3, transl_subpart_name, FN_REFLEN); + if (name_variant == NORMAL_PART_NAME) end= strxnmov(out, outlen-1, in1, "#P#", transl_part_name, "#SP#", transl_subpart_name, NullS); diff --git a/sql/sql_partition.h b/sql/sql_partition.h index 2d0ec788332..acca6f61f01 100644 --- a/sql/sql_partition.h +++ b/sql/sql_partition.h @@ -1,7 +1,8 @@ #ifndef SQL_PARTITION_INCLUDED #define SQL_PARTITION_INCLUDED -/* Copyright (c) 2006, 2013, Oracle and/or its affiliates. +/* Copyright (c) 2006, 2017, Oracle and/or its affiliates. + Copyright (c) 2011, 2017, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 17b68750bc6..2f0a5eaf9c9 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -228,7 +228,6 @@ static DYNAMIC_ARRAY plugin_array; static HASH plugin_hash[MYSQL_MAX_PLUGIN_TYPE_NUM]; static MEM_ROOT plugin_mem_root; static bool reap_needed= false; -static int plugin_array_version=0; static bool initialized= 0; ulong dlopen_count; @@ -323,7 +322,6 @@ static void unlock_variables(THD *thd, struct system_variables *vars); static void cleanup_variables(struct system_variables *vars); static void plugin_vars_free_values(sys_var *vars); static void restore_ptr_backup(uint n, st_ptr_backup *backup); -static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref plugin); static void intern_plugin_unlock(LEX *lex, plugin_ref plugin); static void reap_plugins(void); @@ -944,15 +942,17 @@ SHOW_COMP_OPTION plugin_status(const char *name, size_t len, int type) } -static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref rc) +static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref rc, + uint state_mask= PLUGIN_IS_READY | + PLUGIN_IS_UNINITIALIZED | + PLUGIN_IS_DELETED) { st_plugin_int *pi= plugin_ref_to_int(rc); DBUG_ENTER("intern_plugin_lock"); mysql_mutex_assert_owner(&LOCK_plugin); - if (pi->state & (PLUGIN_IS_READY | PLUGIN_IS_UNINITIALIZED | - PLUGIN_IS_DELETED)) + if (pi->state & state_mask) { plugin_ref plugin; #ifdef DBUG_OFF @@ -1147,7 +1147,6 @@ static bool plugin_add(MEM_ROOT *tmp_root, if (!(tmp_plugin_ptr= plugin_insert_or_reuse(&tmp))) goto err; - plugin_array_version++; if (my_hash_insert(&plugin_hash[plugin->type], (uchar*)tmp_plugin_ptr)) tmp_plugin_ptr->state= PLUGIN_IS_FREED; init_alloc_root(&tmp_plugin_ptr->mem_root, 4096, 4096, MYF(0)); @@ -1247,7 +1246,6 @@ static void plugin_del(struct st_plugin_int *plugin) my_hash_delete(&plugin_hash[plugin->plugin->type], (uchar*)plugin); plugin_dl_del(plugin->plugin_dl); plugin->state= PLUGIN_IS_FREED; - plugin_array_version++; free_root(&plugin->mem_root, MYF(0)); } else @@ -1865,11 +1863,11 @@ static bool plugin_load_list(MEM_ROOT *tmp_root, const char *list) switch ((*(p++)= *(list++))) { case '\0': list= NULL; /* terminate the loop */ -#ifndef __WIN__ /* fall through */ + case ';': +#ifndef __WIN__ case ':': /* can't use this as delimiter as it may be drive letter */ #endif - case ';': str->str[str->length]= '\0'; if (str == &name) // load all plugins in named module { @@ -2341,64 +2339,55 @@ error: bool plugin_foreach_with_mask(THD *thd, plugin_foreach_func *func, int type, uint state_mask, void *arg) { - uint idx, total; - struct st_plugin_int *plugin, **plugins; - int version=plugin_array_version; + uint idx, total= 0; + struct st_plugin_int *plugin; + plugin_ref *plugins; + my_bool res= FALSE; DBUG_ENTER("plugin_foreach_with_mask"); if (!initialized) DBUG_RETURN(FALSE); - state_mask= ~state_mask; // do it only once - mysql_mutex_lock(&LOCK_plugin); - total= type == MYSQL_ANY_PLUGIN ? plugin_array.elements - : plugin_hash[type].records; /* Do the alloca out here in case we do have a working alloca: - leaving the nested stack frame invalidates alloca allocation. + leaving the nested stack frame invalidates alloca allocation. */ - plugins=(struct st_plugin_int **)my_alloca(total*sizeof(plugin)); if (type == MYSQL_ANY_PLUGIN) { - for (idx= 0; idx < total; idx++) + plugins= (plugin_ref*) my_alloca(plugin_array.elements * sizeof(plugin_ref)); + for (idx= 0; idx < plugin_array.elements; idx++) { plugin= *dynamic_element(&plugin_array, idx, struct st_plugin_int **); - plugins[idx]= !(plugin->state & state_mask) ? plugin : NULL; + if ((plugins[total]= intern_plugin_lock(0, plugin_int_to_ref(plugin), + state_mask))) + total++; } } else { HASH *hash= plugin_hash + type; - for (idx= 0; idx < total; idx++) + plugins= (plugin_ref*) my_alloca(hash->records * sizeof(plugin_ref)); + for (idx= 0; idx < hash->records; idx++) { plugin= (struct st_plugin_int *) my_hash_element(hash, idx); - plugins[idx]= !(plugin->state & state_mask) ? plugin : NULL; + if ((plugins[total]= intern_plugin_lock(0, plugin_int_to_ref(plugin), + state_mask))) + total++; } } mysql_mutex_unlock(&LOCK_plugin); for (idx= 0; idx < total; idx++) { - if (unlikely(version != plugin_array_version)) - { - mysql_mutex_lock(&LOCK_plugin); - for (uint i=idx; i < total; i++) - if (plugins[i] && plugins[i]->state & state_mask) - plugins[i]=0; - mysql_mutex_unlock(&LOCK_plugin); - } - plugin= plugins[idx]; /* It will stop iterating on first engine error when "func" returns TRUE */ - if (plugin && func(thd, plugin_int_to_ref(plugin), arg)) - goto err; + if ((res= func(thd, plugins[idx], arg))) + break; } + plugin_unlock_list(0, plugins, total); my_afree(plugins); - DBUG_RETURN(FALSE); -err: - my_afree(plugins); - DBUG_RETURN(TRUE); + DBUG_RETURN(res); } @@ -3525,7 +3514,6 @@ bool sys_var_pluginvar::global_update(THD *thd, set_var *var) options->max_value= getopt_double2ulonglong((opt)->max_val); \ options->block_size= (long) (opt)->blk_sz; - void plugin_opt_set_limits(struct my_option *options, const struct st_mysql_sys_var *opt) { diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 6724346a490..19c714cfc01 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1379,7 +1379,8 @@ static bool mysql_test_insert(Prepared_statement *stmt, my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), counter); goto error; } - if (setup_fields(thd, Ref_ptr_array(), *values, MARK_COLUMNS_NONE, 0, 0)) + if (setup_fields(thd, Ref_ptr_array(), + *values, MARK_COLUMNS_NONE, 0, NULL, 0)) goto error; } } @@ -1470,7 +1471,7 @@ static int mysql_test_update(Prepared_statement *stmt, #endif thd->lex->select_lex.no_wrap_view_item= TRUE; res= setup_fields(thd, Ref_ptr_array(), - select->item_list, MARK_COLUMNS_READ, 0, 0); + select->item_list, MARK_COLUMNS_READ, 0, NULL, 0); thd->lex->select_lex.no_wrap_view_item= FALSE; if (res) goto error; @@ -1482,7 +1483,7 @@ static int mysql_test_update(Prepared_statement *stmt, table_list->register_want_access(SELECT_ACL); #endif if (setup_fields(thd, Ref_ptr_array(), - stmt->lex->value_list, MARK_COLUMNS_NONE, 0, 0) || + stmt->lex->value_list, MARK_COLUMNS_NONE, 0, NULL, 0) || check_unique_table(thd, table_list)) goto error; /* TODO: here we should send types of placeholders to the client. */ @@ -1655,7 +1656,7 @@ static bool mysql_test_do_fields(Prepared_statement *stmt, DT_PREPARE | DT_CREATE)) DBUG_RETURN(TRUE); DBUG_RETURN(setup_fields(thd, Ref_ptr_array(), - *values, MARK_COLUMNS_NONE, 0, 0)); + *values, MARK_COLUMNS_NONE, 0, NULL, 0)); } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index f4f0e46afed..46e1a912250 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -804,7 +804,7 @@ JOIN::prepare(TABLE_LIST *tables_init, thd->lex->current_select->context_analysis_place; thd->lex->current_select->context_analysis_place= SELECT_LIST; if (setup_fields(thd, ref_ptrs, fields_list, MARK_COLUMNS_READ, - &all_fields, 1)) + &all_fields, &select_lex->pre_fix, 1)) DBUG_RETURN(-1); thd->lex->current_select->context_analysis_place= save_place; @@ -14708,10 +14708,23 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top, nested_join= table->nested_join; if (table->sj_on_expr && !in_sj) { - /* - If this is a semi-join that is not contained within another semi-join, - leave it intact (otherwise it is flattened) - */ + /* + If this is a semi-join that is not contained within another semi-join + leave it intact (otherwise it is flattened) + */ + /* + Make sure that any semi-join appear in + the join->select_lex->sj_nests list only once + */ + List_iterator_fast<TABLE_LIST> sj_it(join->select_lex->sj_nests); + TABLE_LIST *sj_nest; + while ((sj_nest= sj_it++)) + { + if (table == sj_nest) + break; + } + if (sj_nest) + continue; join->select_lex->sj_nests.push_back(table, join->thd->mem_root); /* diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 579cbcd878e..c7ba6705cb0 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -139,6 +139,12 @@ bool get_lookup_field_values(THD *, COND *, TABLE_LIST *, LOOKUP_FIELD_VALUES *) ** List all table types supported ***************************************************************************/ + +static bool is_show_command(THD *thd) +{ + return sql_command_flags[thd->lex->sql_command] & CF_STATUS_COMMAND; +} + static int make_version_string(char *buf, int buf_length, uint version) { return my_snprintf(buf, buf_length, "%d.%d", version>>8,version&0xff); @@ -278,7 +284,7 @@ int fill_plugins(THD *thd, TABLE_LIST *tables, COND *cond) TABLE *table= tables->table; if (plugin_foreach_with_mask(thd, show_plugins, MYSQL_ANY_PLUGIN, - ~PLUGIN_IS_FREED, table)) + ~(PLUGIN_IS_FREED | PLUGIN_IS_DYING), table)) DBUG_RETURN(1); DBUG_RETURN(0); @@ -986,13 +992,20 @@ find_files(THD *thd, Dynamic_array<LEX_STRING*> *files, LEX_STRING *db, if (tl.add_file(file->name)) goto err; } - tl.sort(); } else { if (ha_discover_table_names(thd, db, dirp, &tl, false)) goto err; } +#if MYSQL_VERSION_ID < 100300 + /* incomplete optimization, but a less drastic change in GA version */ + if (!thd->lex->select_lex.order_list.elements && + !thd->lex->select_lex.group_list.elements) +#else + if (is_show_command(thd)) +#endif + tl.sort(); DBUG_PRINT("info",("found: %zu files", files->elements())); my_dirend(dirp); @@ -4137,7 +4150,7 @@ make_table_name_list(THD *thd, Dynamic_array<LEX_STRING*> *table_names, */ if (res == FIND_FILES_DIR) { - if (sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND) + if (is_show_command(thd)) return 1; thd->clear_error(); return 2; @@ -5685,7 +5698,8 @@ int fill_schema_engines(THD *thd, TABLE_LIST *tables, COND *cond) DBUG_ENTER("fill_schema_engines"); if (plugin_foreach_with_mask(thd, iter_schema_engines, MYSQL_STORAGE_ENGINE_PLUGIN, - ~PLUGIN_IS_FREED, tables->table)) + ~(PLUGIN_IS_FREED | PLUGIN_IS_DYING), + tables->table)) DBUG_RETURN(1); DBUG_RETURN(0); } @@ -5957,13 +5971,13 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table, val_int() == TYPE_ENUM_PROCEDURE)) return 0; - if ((lex->sql_command == SQLCOM_SHOW_STATUS_PROC && + if (!is_show_command(thd) || + (lex->sql_command == SQLCOM_SHOW_STATUS_PROC && proc_table->field[MYSQL_PROC_MYSQL_TYPE]->val_int() == TYPE_ENUM_PROCEDURE) || (lex->sql_command == SQLCOM_SHOW_STATUS_FUNC && proc_table->field[MYSQL_PROC_MYSQL_TYPE]->val_int() == - TYPE_ENUM_FUNCTION) || - (sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND) == 0) + TYPE_ENUM_FUNCTION)) { restore_record(table, s->default_values); if (!wild || !wild[0] || !wild_case_compare(system_charset_info, @@ -6088,6 +6102,10 @@ int fill_schema_proc(THD *thd, TABLE_LIST *tables, COND *cond) DBUG_RETURN(1); } + /* Disable padding temporarily so it doesn't break the query */ + ulonglong sql_mode_was = thd->variables.sql_mode; + thd->variables.sql_mode &= ~MODE_PAD_CHAR_TO_FULL_LENGTH; + if (proc_table->file->ha_index_init(0, 1)) { res= 1; @@ -6123,6 +6141,7 @@ err: (void) proc_table->file->ha_index_end(); close_system_tables(thd, &open_tables_state_backup); + thd->variables.sql_mode = sql_mode_was; DBUG_RETURN(res); } @@ -7706,7 +7725,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list) tmp_table_param->field_count= field_count; tmp_table_param->schema_table= 1; SELECT_LEX *select_lex= thd->lex->current_select; - bool keep_row_order= sql_command_flags[thd->lex->sql_command] & CF_STATUS_COMMAND; + bool keep_row_order= is_show_command(thd); if (!(table= create_tmp_table(thd, tmp_table_param, field_list, (ORDER*) 0, 0, 0, (select_lex->options | thd->variables.option_bits | diff --git a/sql/sql_table.cc b/sql/sql_table.cc index db9340d7977..c112b01ba36 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -4141,7 +4141,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, if (!sql_field->default_value && !sql_field->has_default_function() && (sql_field->flags & NOT_NULL_FLAG) && - !is_timestamp_type(sql_field->sql_type)) + (!is_timestamp_type(sql_field->sql_type) || + opt_explicit_defaults_for_timestamp)) { sql_field->flags|= NO_DEFAULT_VALUE_FLAG; sql_field->pack_flag|= FIELDFLAG_NO_DEFAULT; @@ -4150,6 +4151,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, if (thd->variables.sql_mode & MODE_NO_ZERO_DATE && !sql_field->default_value && !sql_field->vcol_info && is_timestamp_type(sql_field->sql_type) && + !opt_explicit_defaults_for_timestamp && (sql_field->flags & NOT_NULL_FLAG) && (type == Field::NONE || type == Field::TIMESTAMP_UN_FIELD)) { @@ -7051,7 +7053,6 @@ bool alter_table_manage_keys(TABLE *table, int indexes_were_disabled, case Alter_info::LEAVE_AS_IS: if (!indexes_were_disabled) break; - /* disabled indexes */ /* fall through */ case Alter_info::DISABLE: error= table->file->ha_disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE); diff --git a/sql/sql_update.cc b/sql/sql_update.cc index b1069efbbc8..a2cfcbabc95 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -359,7 +359,7 @@ int mysql_update(THD *thd, table_list->grant.want_privilege= table->grant.want_privilege= (SELECT_ACL & ~table->grant.privilege); #endif - if (setup_fields(thd, Ref_ptr_array(), values, MARK_COLUMNS_READ, 0, 0)) + if (setup_fields(thd, Ref_ptr_array(), values, MARK_COLUMNS_READ, 0, NULL, 0)) { free_underlaid_joins(thd, select_lex); DBUG_RETURN(1); /* purecov: inspected */ @@ -1691,7 +1691,7 @@ int multi_update::prepare(List<Item> ¬_used_values, */ int error= setup_fields(thd, Ref_ptr_array(), - *values, MARK_COLUMNS_READ, 0, 0); + *values, MARK_COLUMNS_READ, 0, NULL, 0); ti.rewind(); while ((table_ref= ti++)) diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index ded0332bc53..434cd10d1b9 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -4772,17 +4772,11 @@ size_number: switch (end_ptr[0]) { case 'g': - case 'G': - text_shift_number+=10; - /* fall through */ + case 'G': text_shift_number+=30; break; case 'm': - case 'M': - text_shift_number+=10; - /* fall through */ + case 'M': text_shift_number+=20; break; case 'k': - case 'K': - text_shift_number+=10; - break; + case 'K': text_shift_number+=10; break; default: my_yyabort_error((ER_WRONG_SIZE_NUMBER, MYF(0))); } diff --git a/sql/table.h b/sql/table.h index 22846e05bde..7e3f94a60ff 100644 --- a/sql/table.h +++ b/sql/table.h @@ -36,6 +36,7 @@ /* Structs that defines the TABLE */ class Item; /* Needed by ORDER */ +typedef Item (*Item_ptr); class Item_subselect; class Item_field; class GRANT_TABLE; @@ -2560,7 +2561,7 @@ typedef struct st_nested_join table_map sj_depends_on; /* Outer non-trivially correlated tables */ table_map sj_corr_tables; - List<Item> sj_outer_expr_list; + List<Item_ptr> sj_outer_expr_list; /** True if this join nest node is completely covered by the query execution plan. This means two things. diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt index dc1f61d0d26..46710fd64e6 100644 --- a/storage/connect/CMakeLists.txt +++ b/storage/connect/CMakeLists.txt @@ -45,34 +45,17 @@ add_definitions( -DNEW_MAR -DHUGE_SUPPORT -DGZ_SUPPORT -DPIVOT_SUPPORT ) # OS specific C flags, definitions and source files. # IF(UNIX) - if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") - # Bar: -Wfatal-errors removed (does not present in gcc on solaris10) - if(WITH_WARNINGS) - add_definitions(-Wall -Wextra -Wmissing-declarations) - #message(STATUS "CONNECT: GCC: All warnings enabled") - else() - add_definitions(-Wall -Wmissing-declarations) - add_definitions(-Wno-write-strings) - add_definitions(-Wno-unused-variable) - # Bar: -Wno-unused-but-set-variables commented (does not present on sol10) - # add_definitions(-Wno-unused-but-set-variable) - add_definitions(-Wno-unused-value) - add_definitions(-Wno-unused-function) - add_definitions(-Wno-parentheses) - #add_definitions(-Wno-missing-declarations) - # Bar: -Wno-int-to-pointer-cast commended (does not present in gcc on sol10) - # add_definitions(-Wno-int-to-pointer-cast) - # Bar: -Wno-narrowing commented (does not present in gcc on solaris10) - # add_definitions(-Wno-narrowing) - -# This switch is for pure C only: -# add_definitions(-Wno-implicit-function-declaration) -# These switches are for C++ only -# add_definitions(-Wno-reorder) - - #message(STATUS "CONNECT: GCC: Some warnings disabled") - endif(WITH_WARNINGS) - endif() + MY_CHECK_AND_SET_COMPILER_FLAG("-Wall -Wmissing-declarations") + if(NOT WITH_WARNINGS) + MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-function") + MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-variable") + MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-value") + MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-parentheses") + MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-strict-aliasing") + MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-misleading-indentation") + MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-format-truncation") + MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-implicit-fallthrough") + endif(NOT WITH_WARNINGS) add_definitions( -DUNIX -DLINUX -DUBUNTU ) diff --git a/storage/connect/fmdlex.c b/storage/connect/fmdlex.c index 4bf075acf42..729b1b883c1 100644 --- a/storage/connect/fmdlex.c +++ b/storage/connect/fmdlex.c @@ -417,10 +417,10 @@ static PDTP pp; static void MakeParm(int n); static void MakeMMDD(int n); static void MakeAMPM(int n); -static void MakeIn(char *); -static void MakeOut(char *); -static void Quotin(char *); -static void Quotout(char *); +static void MakeIn(const char *); +static void MakeOut(const char *); +static void Quotin(const char *); +static void Quotout(const char *); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -1492,7 +1492,7 @@ void MakeAMPM(int n) } /* end of MakeAMPM */ -void MakeIn(char *text) +void MakeIn(const char *text) { if (!pp->InFmt) return; @@ -1500,14 +1500,14 @@ void MakeIn(char *text) strncat(pp->InFmt, text, (pp->Outsize - 1) - strlen(pp->InFmt)); } /* end of MakeIn */ -void MakeOut(char *text) +void MakeOut(const char *text) { if (!pp->OutFmt) return; strncat(pp->OutFmt, text, (pp->Outsize - 1) - strlen(pp->OutFmt)); } /* end of MakeOut */ -void Quotin(char *text) +void Quotin(const char *text) { if (!pp->InFmt) return; @@ -1516,7 +1516,7 @@ void Quotin(char *text) pp->InFmt[strlen(pp->InFmt)-1] = '\0'; } /* end of Quotin */ -void Quotout(char *text) +void Quotout(const char *text) { if (!pp->OutFmt) return; diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp index a7052188a5d..5c8896d1bc9 100644 --- a/storage/connect/jsonudf.cpp +++ b/storage/connect/jsonudf.cpp @@ -1512,7 +1512,7 @@ static my_bool CheckMemory(PGLOBAL g, UDF_INIT *initid, UDF_ARGS *args, uint n, if (!(g->Sarea = PlugAllocMem(g, ml))) { char errmsg[MAX_STR]; - sprintf(errmsg, MSG(WORK_AREA), g->Message); + snprintf(errmsg, sizeof(errmsg)-1, MSG(WORK_AREA), g->Message); strcpy(g->Message, errmsg); g->Sarea_Size = 0; return true; diff --git a/storage/connect/plugutil.cpp b/storage/connect/plugutil.cpp index dbf90fb5599..0367aacd050 100644 --- a/storage/connect/plugutil.cpp +++ b/storage/connect/plugutil.cpp @@ -162,7 +162,7 @@ PGLOBAL PlugInit(LPCSTR Language, uint worksize) /*******************************************************************/ if (worksize && !(g->Sarea = PlugAllocMem(g, worksize))) { char errmsg[MAX_STR]; - sprintf(errmsg, MSG(WORK_AREA), g->Message); + snprintf(errmsg, sizeof(errmsg) - 1, MSG(WORK_AREA), g->Message); strcpy(g->Message, errmsg); g->Sarea_Size = 0; } else diff --git a/storage/connect/rcmsg.c b/storage/connect/rcmsg.c index 75759e03314..895f8f5862b 100644 --- a/storage/connect/rcmsg.c +++ b/storage/connect/rcmsg.c @@ -27,9 +27,9 @@ char *msglang(void); -char *GetMsgid(int id) +const char *GetMsgid(int id) { - char *p = NULL; + const char *p = NULL; // This conditional until a real fix is found for MDEV-7304 #if defined(FRENCH) @@ -55,7 +55,8 @@ char *GetMsgid(int id) int GetRcString(int id, char *buf, int bufsize) { - char *p = NULL, msg[32]; + const char *p = NULL; + char msg[32]; if (!(p = GetMsgid(id))) { sprintf(msg, "ID=%d unknown", id); diff --git a/storage/connect/rcmsg.h b/storage/connect/rcmsg.h index b22e77f5175..499ca3b2dd4 100644 --- a/storage/connect/rcmsg.h +++ b/storage/connect/rcmsg.h @@ -5,7 +5,7 @@ extern "C" { #endif -char *GetMsgid(int id); +const char *GetMsgid(int id); int GetRcString(int id, char *buf, int bufsize); #ifdef __cplusplus diff --git a/storage/connect/tabmul.cpp b/storage/connect/tabmul.cpp index 5c41f9094ac..0967afca6cd 100644 --- a/storage/connect/tabmul.cpp +++ b/storage/connect/tabmul.cpp @@ -203,12 +203,12 @@ bool TDBMUL::InitFileNames(PGLOBAL g) // Data files can be imported from Windows (having CRLF) if (*p == '\n' || *p == '\r') { // is this enough for Unix ??? - *p--; // Eliminate ending CR or LF character + p--; // Eliminate ending CR or LF character if (p >= filename) // is this enough for Unix ??? if (*p == '\n' || *p == '\r') - *p--; // Eliminate ending CR or LF character + p--; // Eliminate ending CR or LF character } // endif p diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp index eae72984ca6..372ee2541ac 100644 --- a/storage/connect/value.cpp +++ b/storage/connect/value.cpp @@ -1374,7 +1374,7 @@ bool TYPVAL<PSZ>::SetValue_char(const char *cp, int n) } else if (cp != Strp) { const char *p = cp + n - 1; - for (p; p >= cp; p--, n--) + for (; p >= cp; p--, n--) if (*p && *p != ' ') break; diff --git a/storage/federatedx/federatedx_io_mysql.cc b/storage/federatedx/federatedx_io_mysql.cc index 54059c0ecff..2068716eeba 100644 --- a/storage/federatedx/federatedx_io_mysql.cc +++ b/storage/federatedx/federatedx_io_mysql.cc @@ -265,9 +265,8 @@ ulong federatedx_io_mysql::savepoint_release(ulong sp) savept= dynamic_element(&savepoints, savepoints.elements - 1, SAVEPT *); if (savept->level < sp) break; - if ((savept->flags & (SAVEPOINT_REALIZED | - SAVEPOINT_RESTRICT)) == SAVEPOINT_REALIZED) - last= savept; + if ((savept->flags & (SAVEPOINT_REALIZED | SAVEPOINT_RESTRICT)) == SAVEPOINT_REALIZED) + last= savept; savepoints.elements--; } @@ -293,8 +292,8 @@ ulong federatedx_io_mysql::savepoint_rollback(ulong sp) while (savepoints.elements) { savept= dynamic_element(&savepoints, savepoints.elements - 1, SAVEPT *); - if (savept->level <= sp) - break; + if (savept->level <= sp) + break; savepoints.elements--; } diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index b95592d43d4..87334954cf8 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -501,15 +501,14 @@ dict_table_close( ut_ad(mutex_own(&dict_sys->mutex)); ut_a(table->get_ref_count() > 0); - table->release(); + const bool last_handle = table->release(); /* Force persistent stats re-read upon next open of the table so that FLUSH TABLE can be used to forcibly fetch stats from disk if they have been manually modified. We reset table->stat_initialized only if table reference count is 0 because we do not want too frequent stats re-reads (e.g. in other cases than FLUSH TABLE). */ - if (strchr(table->name.m_name, '/') != NULL - && table->get_ref_count() == 0 + if (last_handle && strchr(table->name.m_name, '/') != NULL && dict_stats_is_persistent_enabled(table)) { dict_stats_deinit(table); @@ -529,11 +528,8 @@ dict_table_close( if (!dict_locked) { table_id_t table_id = table->id; - ibool drop_aborted; - - drop_aborted = try_drop + const bool drop_aborted = last_handle && try_drop && table->drop_aborted - && table->get_ref_count() == 1 && dict_table_get_first_index(table); mutex_exit(&dict_sys->mutex); @@ -2067,8 +2063,9 @@ dict_table_remove_from_cache_low( ut_ad(dict_lru_validate()); if (lru_evict && table->drop_aborted) { - /* Do as dict_table_try_drop_aborted() does. */ - + /* When evicting the table definition, + drop the orphan indexes from the data dictionary + and free the index pages. */ trx_t* trx = trx_allocate_for_background(); ut_ad(mutex_own(&dict_sys->mutex)); @@ -2078,12 +2075,7 @@ dict_table_remove_from_cache_low( trx->dict_operation_lock_mode = RW_X_LATCH; trx_set_dict_operation(trx, TRX_DICT_OP_INDEX); - - /* Silence a debug assertion in row_merge_drop_indexes(). */ - ut_d(table->acquire()); - row_merge_drop_indexes(trx, table, TRUE); - ut_d(table->release()); - ut_ad(table->get_ref_count() == 0); + row_merge_drop_indexes_dict(trx, table->id); trx_commit_for_mysql(trx); trx->dict_operation_lock_mode = 0; trx_free_for_background(trx); diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index 09012ad4101..0b1218ed076 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -2629,8 +2629,9 @@ fts_get_next_doc_id( return(DB_SUCCESS); } + DEBUG_SYNC_C("get_next_FTS_DOC_ID"); mutex_enter(&cache->doc_id_lock); - *doc_id = ++cache->next_doc_id; + *doc_id = cache->next_doc_id++; mutex_exit(&cache->doc_id_lock); return(DB_SUCCESS); @@ -3013,52 +3014,6 @@ fts_modify( } /*********************************************************************//** -Create a new document id. -@return DB_SUCCESS if all went well else error */ -dberr_t -fts_create_doc_id( -/*==============*/ - dict_table_t* table, /*!< in: row is of this table. */ - dtuple_t* row, /* in/out: add doc id value to this - row. This is the current row that is - being inserted. */ - mem_heap_t* heap) /*!< in: heap */ -{ - doc_id_t doc_id; - dberr_t error = DB_SUCCESS; - - ut_a(table->fts->doc_col != ULINT_UNDEFINED); - - if (!DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_HAS_DOC_ID)) { - if (table->fts->cache->first_doc_id == FTS_NULL_DOC_ID) { - error = fts_get_next_doc_id(table, &doc_id); - } - return(error); - } - - error = fts_get_next_doc_id(table, &doc_id); - - if (error == DB_SUCCESS) { - dfield_t* dfield; - doc_id_t* write_doc_id; - - ut_a(doc_id > 0); - - dfield = dtuple_get_nth_field(row, table->fts->doc_col); - write_doc_id = static_cast<doc_id_t*>( - mem_heap_alloc(heap, sizeof(*write_doc_id))); - - ut_a(doc_id != FTS_NULL_DOC_ID); - ut_a(sizeof(doc_id) == dfield->type.len); - fts_write_doc_id((byte*) write_doc_id, doc_id); - - dfield_set_data(dfield, write_doc_id, sizeof(*write_doc_id)); - } - - return(error); -} - -/*********************************************************************//** The given transaction is about to be committed; do whatever is necessary from the FTS system's POV. @return DB_SUCCESS or error code */ diff --git a/storage/innobase/fts/fts0que.cc b/storage/innobase/fts/fts0que.cc index 858d84f1a5e..84b1cbe32cb 100644 --- a/storage/innobase/fts/fts0que.cc +++ b/storage/innobase/fts/fts0que.cc @@ -3795,6 +3795,10 @@ fts_query_free( fts_doc_ids_free(query->deleted); } + if (query->intersection) { + fts_query_free_doc_ids(query, query->intersection); + } + if (query->doc_ids) { fts_query_free_doc_ids(query, query->doc_ids); } diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 1463deb6e14..d7b68885aa6 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -19838,7 +19838,7 @@ buffer_pool_load_now( const void* save) /*!< in: immediate result from check function */ { - if (*(my_bool*) save) { + if (*(my_bool*) save && !srv_read_only_mode) { buf_load_start(); } } @@ -19861,7 +19861,7 @@ buffer_pool_load_abort( const void* save) /*!< in: immediate result from check function */ { - if (*(my_bool*) save) { + if (*(my_bool*) save && !srv_read_only_mode) { buf_load_abort(); } } diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index f270a61e54e..3cbfbceb41e 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -416,34 +416,6 @@ innobase_need_rebuild( return(false); } - /* If alter table changes column name and adds a new - index, we need to check is this new index created - to new column name. This is because column name - changes are done normally after creating indexes. */ - if ((ha_alter_info->handler_flags - & Alter_inplace_info::ALTER_COLUMN_NAME) && - ((ha_alter_info->handler_flags - & Alter_inplace_info::ADD_INDEX) || - (ha_alter_info->handler_flags - & Alter_inplace_info::ADD_FOREIGN_KEY))) { - for (ulint i = 0; i < ha_alter_info->index_add_count; i++) { - const KEY* key = &ha_alter_info->key_info_buffer[ - ha_alter_info->index_add_buffer[i]]; - - for (ulint j = 0; j < key->user_defined_key_parts; j++) { - const KEY_PART_INFO* key_part = &(key->key_part[j]); - const Field* field = altered_table->field[key_part->fieldnr]; - - /* Field used on added index is renamed on - this same alter table. We need table - rebuild. */ - if (field && field->flags & FIELD_IS_RENAMED) { - return (true); - } - } - } - } - return(!!(ha_alter_info->handler_flags & INNOBASE_ALTER_REBUILD)); } @@ -2131,19 +2103,18 @@ name_ok: } /** Create index field definition for key part -@param[in] altered_table MySQL table that is being altered, - or NULL if a new clustered index - is not being created -@param[in] key_part MySQL key definition -@param[in,out] index_field index field -@param[in] new_clustered new cluster */ -static +@param[in] new_clustered true if alter is generating a new clustered +index +@param[in] altered_table MySQL table that is being altered +@param[in] key_part MySQL key definition +@param[out] index_field index field defition for key_part */ +static MY_ATTRIBUTE((nonnull(2,3))) void innobase_create_index_field_def( + bool new_clustered, const TABLE* altered_table, const KEY_PART_INFO* key_part, - index_field_t* index_field, - bool new_clustered) + index_field_t* index_field) { const Field* field; ibool is_unsigned; @@ -2154,11 +2125,11 @@ innobase_create_index_field_def( ut_ad(key_part); ut_ad(index_field); + ut_ad(altered_table); field = new_clustered ? altered_table->field[key_part->fieldnr] : key_part->field; - ut_a(field); for (ulint i = 0; i < key_part->fieldnr; i++) { if (innobase_is_v_fld(altered_table->field[i])) { @@ -2219,9 +2190,10 @@ innobase_create_index_def( DBUG_ENTER("innobase_create_index_def"); DBUG_ASSERT(!key_clustered || new_clustered); + ut_ad(altered_table); + index->fields = static_cast<index_field_t*>( mem_heap_alloc(heap, n_fields * sizeof *index->fields)); - memset(index->fields, 0, n_fields * sizeof *index->fields); index->parser = NULL; index->key_number = key_number; @@ -2299,8 +2271,8 @@ innobase_create_index_def( if (!(key->flags & HA_SPATIAL)) { for (i = 0; i < n_fields; i++) { innobase_create_index_field_def( - altered_table, &key->key_part[i], - &index->fields[i], new_clustered); + new_clustered, altered_table, + &key->key_part[i], &index->fields[i]); if (index->fields[i].is_v_col) { index->ind_type |= DICT_VIRTUAL; @@ -2713,7 +2685,6 @@ created_clustered: index->fields = static_cast<index_field_t*>( mem_heap_alloc(heap, sizeof *index->fields)); - memset(index->fields, 0, sizeof *index->fields); index->n_fields = 1; index->fields->col_no = fts_doc_id_col; index->fields->prefix_len = 0; @@ -4849,8 +4820,7 @@ new_clustered_failed: } ctx->add_index[a] = row_merge_create_index( - ctx->trx, ctx->new_table, - &index_defs[a], add_v); + ctx->trx, ctx->new_table, &index_defs[a], add_v); add_key_nums[a] = index_defs[a].key_number; diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 8880d21aafb..19f3fbc4dd9 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -6424,6 +6424,7 @@ i_s_sys_tables_fill_table_stats( } heap = mem_heap_create(1000); + rw_lock_s_lock(dict_operation_lock); mutex_enter(&dict_sys->mutex); mtr_start(&mtr); @@ -6466,9 +6467,11 @@ i_s_sys_tables_fill_table_stats( err_msg); } + rw_lock_s_unlock(dict_operation_lock); mem_heap_empty(heap); /* Get the next record */ + rw_lock_s_lock(dict_operation_lock); mutex_enter(&dict_sys->mutex); if (table_rec != NULL) { @@ -6481,6 +6484,7 @@ i_s_sys_tables_fill_table_stats( mtr_commit(&mtr); mutex_exit(&dict_sys->mutex); + rw_lock_s_unlock(dict_operation_lock); mem_heap_free(heap); DBUG_RETURN(0); @@ -8045,20 +8049,17 @@ i_s_dict_fill_sys_tablespaces( ulint flags, /*!< in: tablespace flags */ TABLE* table_to_fill) /*!< in/out: fill this table */ { - Field** fields; - ulint atomic_blobs = FSP_FLAGS_HAS_ATOMIC_BLOBS(flags); - bool is_compressed = FSP_FLAGS_GET_ZIP_SSIZE(flags); - const char* file_format; - const char* row_format; - const page_size_t page_size(flags); - const char* space_type; + Field** fields; + ulint atomic_blobs = FSP_FLAGS_HAS_ATOMIC_BLOBS(flags); + const char* file_format; + const char* row_format; DBUG_ENTER("i_s_dict_fill_sys_tablespaces"); file_format = trx_sys_file_format_id_to_name(atomic_blobs); if (is_system_tablespace(space)) { - row_format = "Compact or Redundant"; - } else if (is_compressed) { + row_format = "Compact, Redundant or Dynamic"; + } else if (FSP_FLAGS_GET_ZIP_SSIZE(flags)) { row_format = "Compressed"; } else if (atomic_blobs) { row_format = "Dynamic"; @@ -8066,12 +8067,6 @@ i_s_dict_fill_sys_tablespaces( row_format = "Compact or Redundant"; } - if (is_system_tablespace(space)) { - space_type = "System"; - } else { - space_type = "Single"; - } - fields = table_to_fill->field; OK(fields[SYS_TABLESPACES_SPACE]->store(space, true)); @@ -8085,19 +8080,32 @@ i_s_dict_fill_sys_tablespaces( OK(field_store_string(fields[SYS_TABLESPACES_ROW_FORMAT], row_format)); + OK(field_store_string(fields[SYS_TABLESPACES_SPACE_TYPE], + is_system_tablespace(space) + ? "System" : "Single")); + + ulint cflags = fsp_flags_is_valid(flags, space) + ? flags : fsp_flags_convert_from_101(flags); + if (cflags == ULINT_UNDEFINED) { + fields[SYS_TABLESPACES_PAGE_SIZE]->set_null(); + fields[SYS_TABLESPACES_ZIP_PAGE_SIZE]->set_null(); + fields[SYS_TABLESPACES_FS_BLOCK_SIZE]->set_null(); + fields[SYS_TABLESPACES_FILE_SIZE]->set_null(); + fields[SYS_TABLESPACES_ALLOC_SIZE]->set_null(); + OK(schema_table_store_record(thd, table_to_fill)); + DBUG_RETURN(0); + } + + const page_size_t page_size(cflags); + OK(fields[SYS_TABLESPACES_PAGE_SIZE]->store( - univ_page_size.physical(), true)); + page_size.logical(), true)); OK(fields[SYS_TABLESPACES_ZIP_PAGE_SIZE]->store( - page_size.is_compressed() - ? page_size.physical() - : 0, true)); - - OK(field_store_string(fields[SYS_TABLESPACES_SPACE_TYPE], - space_type)); + page_size.physical(), true)); char* filepath = NULL; - if (FSP_FLAGS_HAS_DATA_DIR(flags)) { + if (FSP_FLAGS_HAS_DATA_DIR(cflags)) { mutex_enter(&dict_sys->mutex); filepath = dict_get_first_path(space); mutex_exit(&dict_sys->mutex); diff --git a/storage/innobase/include/data0type.ic b/storage/innobase/include/data0type.ic index 3d2f46ed877..a68f4829561 100644 --- a/storage/innobase/include/data0type.ic +++ b/storage/innobase/include/data0type.ic @@ -527,7 +527,7 @@ dtype_get_fixed_size_low( } } /* Treat as variable-length. */ - /* Fall through */ + /* fall through */ case DATA_VARCHAR: case DATA_BINARY: case DATA_DECIMAL: diff --git a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dict0dict.ic index 243a4541067..6810f0821bd 100644 --- a/storage/innobase/include/dict0dict.ic +++ b/storage/innobase/include/dict0dict.ic @@ -1560,14 +1560,15 @@ dict_table_t::acquire() ++n_ref_count; } -/** Release the table handle. */ +/** Release the table handle. +@return whether the last handle was released */ inline -void +bool dict_table_t::release() { ut_ad(mutex_own(&dict_sys->mutex)); ut_ad(n_ref_count > 0); - --n_ref_count; + return !--n_ref_count; } /** Encode the number of columns and number of virtual columns in a diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index e4b682a41ad..227d4d9dc7e 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -1308,8 +1308,9 @@ struct dict_table_t { /** Acquire the table handle. */ inline void acquire(); - /** Release the table handle. */ - inline void release(); + /** Release the table handle. + @return whether the last handle was released */ + inline bool release(); /** @return whether this is a temporary table */ bool is_temporary() const diff --git a/storage/innobase/include/fts0fts.h b/storage/innobase/include/fts0fts.h index 30b8b66b83b..813e34b43d3 100644 --- a/storage/innobase/include/fts0fts.h +++ b/storage/innobase/include/fts0fts.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, MariaDB Corporation. All Rights reserved. +Copyright (c) 2016, 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -456,20 +456,6 @@ fts_update_next_doc_id( doc_id_t doc_id); /*!< in: DOC ID to set */ /******************************************************************//** -Create a new document id . -@return DB_SUCCESS if all went well else error */ -dberr_t -fts_create_doc_id( -/*==============*/ - dict_table_t* table, /*!< in: row is of this - table. */ - dtuple_t* row, /*!< in/out: add doc id - value to this row. This is the - current row that is being - inserted. */ - mem_heap_t* heap); /*!< in: heap */ - -/******************************************************************//** Create a new fts_doc_ids_t. @return new fts_doc_ids_t. */ fts_doc_ids_t* @@ -1031,4 +1017,3 @@ fts_check_corrupt( #endif /*!< fts0fts.h */ - diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index 48eaa8c675e..eeea12aacee 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -715,11 +715,33 @@ next_column: /* If there is a FTS doc id column and it is not user supplied ( generated by server) then assign it a new doc id. */ - if (prebuilt->table->fts) { + if (!prebuilt->table->fts) { + return; + } + + ut_a(prebuilt->table->fts->doc_col != ULINT_UNDEFINED); - ut_a(prebuilt->table->fts->doc_col != ULINT_UNDEFINED); + doc_id_t doc_id; - fts_create_doc_id(prebuilt->table, row, prebuilt->heap); + if (!DICT_TF2_FLAG_IS_SET(prebuilt->table, DICT_TF2_FTS_HAS_DOC_ID)) { + if (prebuilt->table->fts->cache->first_doc_id + == FTS_NULL_DOC_ID) { + fts_get_next_doc_id(prebuilt->table, &doc_id); + } + return; + } + + dfield_t* fts_doc_id = dtuple_get_nth_field( + row, prebuilt->table->fts->doc_col); + + if (fts_get_next_doc_id(prebuilt->table, &doc_id) == DB_SUCCESS) { + ut_a(doc_id != FTS_NULL_DOC_ID); + ut_ad(sizeof(doc_id) == fts_doc_id->type.len); + dfield_set_data(fts_doc_id, prebuilt->ins_upd_rec_buff + + prebuilt->mysql_row_len, 8); + fts_write_doc_id(fts_doc_id->data, doc_id); + } else { + dfield_set_null(fts_doc_id); } } @@ -1168,7 +1190,10 @@ row_get_prebuilt_insert_row( prebuilt->ins_upd_rec_buff = static_cast<byte*>( mem_heap_alloc( prebuilt->heap, - prebuilt->mysql_row_len)); + DICT_TF2_FLAG_IS_SET(prebuilt->table, + DICT_TF2_FTS_HAS_DOC_ID) + ? prebuilt->mysql_row_len + 8/* FTS_DOC_ID */ + : prebuilt->mysql_row_len)); } dtuple_t* row; diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index f81b2e68159..d38538a4ac2 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -2933,6 +2933,7 @@ row_sel_field_store_in_mysql_format_func( case DATA_SYS: /* These column types should never be shipped to MySQL. */ ut_ad(0); + /* fall through */ case DATA_CHAR: case DATA_FIXBINARY: diff --git a/storage/maria/ma_extra.c b/storage/maria/ma_extra.c index 1db81a0ee1b..41261b1422e 100644 --- a/storage/maria/ma_extra.c +++ b/storage/maria/ma_extra.c @@ -314,7 +314,7 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function, share->state.open_count= 1; share->changed= 1; _ma_mark_file_changed_now(share); - /* Fall through */ + /* fall through */ case HA_EXTRA_PREPARE_FOR_RENAME: { my_bool do_flush= MY_TEST(function != HA_EXTRA_PREPARE_FOR_DROP); @@ -661,4 +661,3 @@ my_bool ma_killed_standalone(MARIA_HA *info __attribute__((unused))) { return 0; } - diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index ce254c5f631..bc30adad43a 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -2727,7 +2727,7 @@ static my_bool translog_recover_page_up_to_sector(uchar *page, uint16 offset) DBUG_PRINT("enter", ("offset: %u first chunk: %u", (uint) offset, (uint) chunk_offset)); - while (page[chunk_offset] != TRANSLOG_FILLER && chunk_offset < offset) + while (chunk_offset < offset && page[chunk_offset] != TRANSLOG_FILLER) { uint16 chunk_length; if ((chunk_length= diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c index 256cb2b45b2..ad1df75f19e 100644 --- a/storage/maria/ma_recovery.c +++ b/storage/maria/ma_recovery.c @@ -3058,7 +3058,7 @@ static MARIA_HA *get_MARIA_HA_from_REDO_record(const case LOGREC_REDO_INDEX: case LOGREC_REDO_INDEX_FREE_PAGE: index_page_redo_entry= 1; - /* Fall through */ + /* fall through*/ case LOGREC_REDO_INSERT_ROW_HEAD: case LOGREC_REDO_INSERT_ROW_TAIL: case LOGREC_REDO_PURGE_ROW_HEAD: diff --git a/storage/mroonga/CMakeLists.txt b/storage/mroonga/CMakeLists.txt index 39dad9ce16b..a9f9d7cc8b2 100644 --- a/storage/mroonga/CMakeLists.txt +++ b/storage/mroonga/CMakeLists.txt @@ -343,6 +343,7 @@ else() MY_CHECK_AND_SET_COMPILER_FLAG("-fno-exceptions") MY_CHECK_AND_SET_COMPILER_FLAG("-fno-rtti") MY_CHECK_AND_SET_COMPILER_FLAG("-felide-constructors") + MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-implicit-fallthrough") endif() set_source_files_properties(${MRN_SOURCES} PROPERTIES COMPILE_FLAGS "${MYSQL_CFLAGS} ${MRN_CXX_COMPILE_FLAGS}") diff --git a/storage/mroonga/vendor/groonga/CMakeLists.txt b/storage/mroonga/vendor/groonga/CMakeLists.txt index 2d8a59fa664..6c448a4e606 100644 --- a/storage/mroonga/vendor/groonga/CMakeLists.txt +++ b/storage/mroonga/vendor/groonga/CMakeLists.txt @@ -154,7 +154,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGCXX) MY_CHECK_AND_SET_COMPILER_FLAG("-Wformat=2") MY_CHECK_AND_SET_COMPILER_FLAG("-Wstrict-aliasing=2") MY_CHECK_AND_SET_COMPILER_FLAG("-fno-strict-aliasing") - MY_CHECK_AND_SET_COMPILER_FLAG("-Wdisabled-optimization") + MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-disabled-optimization") MY_CHECK_AND_SET_COMPILER_FLAG("-Wfloat-equal") MY_CHECK_AND_SET_COMPILER_FLAG("-Wpointer-arith") MY_CHECK_AND_SET_COMPILER_FLAG("-Wdeclaration-after-statement") @@ -165,6 +165,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGCXX) MY_CHECK_AND_SET_COMPILER_FLAG("-fexceptions") MY_CHECK_AND_SET_COMPILER_FLAG("-fimplicit-templates") MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-clobbered") + MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-implicit-fallthrough") endif() if(NOT DEFINED CMAKE_C_COMPILE_OPTIONS_PIC) diff --git a/storage/mroonga/vendor/groonga/lib/dat/cursor-factory.cpp b/storage/mroonga/vendor/groonga/lib/dat/cursor-factory.cpp index 6dab51a2978..7276c148796 100644 --- a/storage/mroonga/vendor/groonga/lib/dat/cursor-factory.cpp +++ b/storage/mroonga/vendor/groonga/lib/dat/cursor-factory.cpp @@ -32,7 +32,6 @@ Cursor *CursorFactory::open(const Trie &trie, UInt32 offset, UInt32 limit, UInt32 flags) { - GRN_DAT_THROW_IF(PARAM_ERROR, &trie == NULL); const UInt32 cursor_type = flags & CURSOR_TYPE_MASK; switch (cursor_type) { diff --git a/storage/mroonga/vendor/groonga/lib/tokenizers.c b/storage/mroonga/vendor/groonga/lib/tokenizers.c index 28fd13c33c4..c5f112fa8cd 100644 --- a/storage/mroonga/vendor/groonga/lib/tokenizers.c +++ b/storage/mroonga/vendor/groonga/lib/tokenizers.c @@ -544,7 +544,7 @@ regexp_next(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data) grn_obj *buffer = &(tokenizer->buffer); const char *current = tokenizer->next; const char *end = tokenizer->end; - const const uint_least8_t *char_types = tokenizer->char_types; + const uint_least8_t *char_types = tokenizer->char_types; grn_tokenize_mode mode = tokenizer->query->tokenize_mode; grn_bool is_begin = tokenizer->is_begin; grn_bool is_start_token = tokenizer->is_start_token; diff --git a/storage/myisam/mi_extra.c b/storage/myisam/mi_extra.c index 1487592d2d6..39b28d95759 100644 --- a/storage/myisam/mi_extra.c +++ b/storage/myisam/mi_extra.c @@ -263,7 +263,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) //share->deleting= TRUE; share->global_changed= FALSE; /* force writing changed flag */ _mi_mark_file_changed(info); - /* Fall through */ + /* fall through */ case HA_EXTRA_PREPARE_FOR_RENAME: DBUG_ASSERT(!share->temporary); mysql_mutex_lock(&THR_LOCK_myisam); diff --git a/storage/oqgraph/graphcore.cc b/storage/oqgraph/graphcore.cc index fb2b105f2fd..bf454aa3333 100644 --- a/storage/oqgraph/graphcore.cc +++ b/storage/oqgraph/graphcore.cc @@ -891,18 +891,18 @@ namespace open_query boost::unordered_map<Vertex, Vertex> p; boost::unordered_map<Vertex, EdgeWeight> d; boost::queue<Vertex> Q; - reverse_graph<Graph> r(share->g); + const reverse_graph<Graph> r(share->g); p[ *dest ]= *dest; d[ *dest ] = EdgeWeight(); switch (ALGORITHM & op) { case DIJKSTRAS: - dijkstra_shortest_paths_no_init(share->g, *dest, + dijkstra_shortest_paths_no_init(r, *dest, make_lazy_property_map(p, identity_initializer<Vertex>()), make_lazy_property_map(d, value_initializer<EdgeWeight>( (std::numeric_limits<EdgeWeight>::max)())), - get(edge_weight, share->g), - get(vertex_index, share->g), + get(edge_weight, r), + get(vertex_index, r), std::less<EdgeWeight>(), closed_plus<EdgeWeight>(), EdgeWeight(), @@ -913,10 +913,10 @@ namespace open_query static_cast<stack_cursor*>(cursor) ) ), - make_two_bit_judy_map(get(vertex_index, share->g))); + make_two_bit_judy_map(get(vertex_index, r))); break; case BREADTH_FIRST: - breadth_first_visit(share->g, *dest, Q, + breadth_first_visit(r, *dest, Q, make_bfs_visitor( std::make_pair( record_predecessors( @@ -935,7 +935,7 @@ namespace open_query ) )) ), - make_two_bit_judy_map(get(vertex_index, share->g))); + make_two_bit_judy_map(get(vertex_index, r))); break; default: abort(); diff --git a/storage/oqgraph/mysql-test/oqgraph/general-Aria.result b/storage/oqgraph/mysql-test/oqgraph/general-Aria.result index a35b5182611..e527705045f 100644 --- a/storage/oqgraph/mysql-test/oqgraph/general-Aria.result +++ b/storage/oqgraph/mysql-test/oqgraph/general-Aria.result @@ -455,16 +455,16 @@ breadth_first NULL 4 1 2 3 breadth_first NULL 4 0 1 4 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5; latch origid destid weight seq linkid -breadth_first NULL 5 1 3 7 breadth_first NULL 5 1 2 6 breadth_first NULL 5 0 1 5 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6; latch origid destid weight seq linkid -breadth_first NULL 6 2 3 7 breadth_first NULL 6 1 2 5 breadth_first NULL 6 0 1 6 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7; latch origid destid weight seq linkid +breadth_first NULL 7 2 3 6 +breadth_first NULL 7 1 2 5 breadth_first NULL 7 0 1 7 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8; latch origid destid weight seq linkid @@ -473,18 +473,18 @@ latch origid destid weight seq linkid breadth_first NULL 9 0 1 9 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10; latch origid destid weight seq linkid -breadth_first NULL 10 2 3 12 -breadth_first NULL 10 1 2 11 +breadth_first NULL 10 2 3 11 +breadth_first NULL 10 1 2 12 breadth_first NULL 10 0 1 10 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11; latch origid destid weight seq linkid -breadth_first NULL 11 2 3 10 -breadth_first NULL 11 1 2 12 +breadth_first NULL 11 2 3 12 +breadth_first NULL 11 1 2 10 breadth_first NULL 11 0 1 11 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12; latch origid destid weight seq linkid -breadth_first NULL 12 2 3 11 -breadth_first NULL 12 1 2 10 +breadth_first NULL 12 2 3 10 +breadth_first NULL 12 1 2 11 breadth_first NULL 12 0 1 12 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 1; latch origid destid weight seq linkid @@ -502,26 +502,26 @@ latch origid destid weight seq linkid breadth_first NULL 4 1 2 3 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 1; latch origid destid weight seq linkid -breadth_first NULL 5 1 3 7 breadth_first NULL 5 1 2 6 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 1; latch origid destid weight seq linkid breadth_first NULL 6 1 2 5 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 1; latch origid destid weight seq linkid +breadth_first NULL 7 1 2 5 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 1; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 1; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 1; latch origid destid weight seq linkid -breadth_first NULL 10 1 2 11 +breadth_first NULL 10 1 2 12 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 1; latch origid destid weight seq linkid -breadth_first NULL 11 1 2 12 +breadth_first NULL 11 1 2 10 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 1; latch origid destid weight seq linkid -breadth_first NULL 12 1 2 10 +breadth_first NULL 12 1 2 11 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 2; latch origid destid weight seq linkid breadth_first NULL 1 2 4 4 @@ -538,22 +538,22 @@ SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 2; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 2; latch origid destid weight seq linkid -breadth_first NULL 6 2 3 7 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 2; latch origid destid weight seq linkid +breadth_first NULL 7 2 3 6 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 2; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 2; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 2; latch origid destid weight seq linkid -breadth_first NULL 10 2 3 12 +breadth_first NULL 10 2 3 11 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 2; latch origid destid weight seq linkid -breadth_first NULL 11 2 3 10 +breadth_first NULL 11 2 3 12 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 2; latch origid destid weight seq linkid -breadth_first NULL 12 2 3 11 +breadth_first NULL 12 2 3 10 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 3; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2 and weight = 3; @@ -847,16 +847,16 @@ latch origid destid weight seq linkid 2 NULL 4 0 1 4 SELECT * FROM graph WHERE latch = '2' AND destid = 5; latch origid destid weight seq linkid -2 NULL 5 1 3 7 2 NULL 5 1 2 6 2 NULL 5 0 1 5 SELECT * FROM graph WHERE latch = '2' AND destid = 6; latch origid destid weight seq linkid -2 NULL 6 2 3 7 2 NULL 6 1 2 5 2 NULL 6 0 1 6 SELECT * FROM graph WHERE latch = '2' AND destid = 7; latch origid destid weight seq linkid +2 NULL 7 2 3 6 +2 NULL 7 1 2 5 2 NULL 7 0 1 7 SELECT * FROM graph WHERE latch = '2' AND destid = 8; latch origid destid weight seq linkid @@ -865,18 +865,18 @@ latch origid destid weight seq linkid 2 NULL 9 0 1 9 SELECT * FROM graph WHERE latch = '2' AND destid = 10; latch origid destid weight seq linkid -2 NULL 10 2 3 12 -2 NULL 10 1 2 11 +2 NULL 10 2 3 11 +2 NULL 10 1 2 12 2 NULL 10 0 1 10 SELECT * FROM graph WHERE latch = '2' AND destid = 11; latch origid destid weight seq linkid -2 NULL 11 2 3 10 -2 NULL 11 1 2 12 +2 NULL 11 2 3 12 +2 NULL 11 1 2 10 2 NULL 11 0 1 11 SELECT * FROM graph WHERE latch = '2' AND destid = 12; latch origid destid weight seq linkid -2 NULL 12 2 3 11 -2 NULL 12 1 2 10 +2 NULL 12 2 3 10 +2 NULL 12 1 2 11 2 NULL 12 0 1 12 SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 1; latch origid destid weight seq linkid @@ -894,26 +894,26 @@ latch origid destid weight seq linkid 2 NULL 4 1 2 3 SELECT * FROM graph WHERE latch = '2' AND destid = 5 and weight = 1; latch origid destid weight seq linkid -2 NULL 5 1 3 7 2 NULL 5 1 2 6 SELECT * FROM graph WHERE latch = '2' AND destid = 6 and weight = 1; latch origid destid weight seq linkid 2 NULL 6 1 2 5 SELECT * FROM graph WHERE latch = '2' AND destid = 7 and weight = 1; latch origid destid weight seq linkid +2 NULL 7 1 2 5 SELECT * FROM graph WHERE latch = '2' AND destid = 8 and weight = 1; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = '2' AND destid = 9 and weight = 1; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = '2' AND destid = 10 and weight = 1; latch origid destid weight seq linkid -2 NULL 10 1 2 11 +2 NULL 10 1 2 12 SELECT * FROM graph WHERE latch = '2' AND destid = 11 and weight = 1; latch origid destid weight seq linkid -2 NULL 11 1 2 12 +2 NULL 11 1 2 10 SELECT * FROM graph WHERE latch = '2' AND destid = 12 and weight = 1; latch origid destid weight seq linkid -2 NULL 12 1 2 10 +2 NULL 12 1 2 11 SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 2; latch origid destid weight seq linkid 2 NULL 1 2 4 4 @@ -930,22 +930,22 @@ SELECT * FROM graph WHERE latch = '2' AND destid = 5 and weight = 2; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = '2' AND destid = 6 and weight = 2; latch origid destid weight seq linkid -2 NULL 6 2 3 7 SELECT * FROM graph WHERE latch = '2' AND destid = 7 and weight = 2; latch origid destid weight seq linkid +2 NULL 7 2 3 6 SELECT * FROM graph WHERE latch = '2' AND destid = 8 and weight = 2; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = '2' AND destid = 9 and weight = 2; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = '2' AND destid = 10 and weight = 2; latch origid destid weight seq linkid -2 NULL 10 2 3 12 +2 NULL 10 2 3 11 SELECT * FROM graph WHERE latch = '2' AND destid = 11 and weight = 2; latch origid destid weight seq linkid -2 NULL 11 2 3 10 +2 NULL 11 2 3 12 SELECT * FROM graph WHERE latch = '2' AND destid = 12 and weight = 2; latch origid destid weight seq linkid -2 NULL 12 2 3 11 +2 NULL 12 2 3 10 SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 3; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = '2' AND destid = 2 and weight = 3; @@ -1124,16 +1124,16 @@ dijkstras NULL 4 1 2 3 dijkstras NULL 4 0 1 4 SELECT * FROM graph WHERE latch='dijkstras' AND destid=5; latch origid destid weight seq linkid -dijkstras NULL 5 1 3 7 dijkstras NULL 5 1 2 6 dijkstras NULL 5 0 1 5 SELECT * FROM graph WHERE latch='dijkstras' AND destid=6; latch origid destid weight seq linkid -dijkstras NULL 6 2 3 7 dijkstras NULL 6 1 2 5 dijkstras NULL 6 0 1 6 SELECT * FROM graph WHERE latch='dijkstras' AND destid=7; latch origid destid weight seq linkid +dijkstras NULL 7 2 3 6 +dijkstras NULL 7 1 2 5 dijkstras NULL 7 0 1 7 SELECT * FROM graph WHERE latch='dijkstras' AND destid=8; latch origid destid weight seq linkid @@ -1142,18 +1142,18 @@ latch origid destid weight seq linkid dijkstras NULL 9 0 1 9 SELECT * FROM graph WHERE latch='dijkstras' AND destid=10; latch origid destid weight seq linkid -dijkstras NULL 10 2 3 12 -dijkstras NULL 10 1 2 11 +dijkstras NULL 10 2 3 11 +dijkstras NULL 10 1 2 12 dijkstras NULL 10 0 1 10 SELECT * FROM graph WHERE latch='dijkstras' AND destid=11; latch origid destid weight seq linkid -dijkstras NULL 11 2 3 10 -dijkstras NULL 11 1 2 12 +dijkstras NULL 11 2 3 12 +dijkstras NULL 11 1 2 10 dijkstras NULL 11 0 1 11 SELECT * FROM graph WHERE latch='dijkstras' AND destid=12; latch origid destid weight seq linkid -dijkstras NULL 12 2 3 11 -dijkstras NULL 12 1 2 10 +dijkstras NULL 12 2 3 10 +dijkstras NULL 12 1 2 11 dijkstras NULL 12 0 1 12 # legacy string number SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=1; @@ -1299,16 +1299,16 @@ latch origid destid weight seq linkid 1 NULL 4 0 1 4 SELECT * FROM graph WHERE latch='1' AND destid=5; latch origid destid weight seq linkid -1 NULL 5 1 3 7 1 NULL 5 1 2 6 1 NULL 5 0 1 5 SELECT * FROM graph WHERE latch='1' AND destid=6; latch origid destid weight seq linkid -1 NULL 6 2 3 7 1 NULL 6 1 2 5 1 NULL 6 0 1 6 SELECT * FROM graph WHERE latch='1' AND destid=7; latch origid destid weight seq linkid +1 NULL 7 2 3 6 +1 NULL 7 1 2 5 1 NULL 7 0 1 7 SELECT * FROM graph WHERE latch='1' AND destid=8; latch origid destid weight seq linkid @@ -1317,18 +1317,18 @@ latch origid destid weight seq linkid 1 NULL 9 0 1 9 SELECT * FROM graph WHERE latch='1' AND destid=10; latch origid destid weight seq linkid -1 NULL 10 2 3 12 -1 NULL 10 1 2 11 +1 NULL 10 2 3 11 +1 NULL 10 1 2 12 1 NULL 10 0 1 10 SELECT * FROM graph WHERE latch='1' AND destid=11; latch origid destid weight seq linkid -1 NULL 11 2 3 10 -1 NULL 11 1 2 12 +1 NULL 11 2 3 12 +1 NULL 11 1 2 10 1 NULL 11 0 1 11 SELECT * FROM graph WHERE latch='1' AND destid=12; latch origid destid weight seq linkid -1 NULL 12 2 3 11 -1 NULL 12 1 2 10 +1 NULL 12 2 3 10 +1 NULL 12 1 2 11 1 NULL 12 0 1 12 INSERT INTO graph_base(from_id, to_id) VALUES (11,13); INSERT INTO graph_base(from_id, to_id) VALUES (10,14); @@ -1395,9 +1395,6 @@ dijkstras 1 NULL 1 2 2 dijkstras 1 NULL 0 1 1 SELECT * FROM graph WHERE latch='dijkstras' AND destid=1; latch origid destid weight seq linkid -dijkstras NULL 1 4 7 18 -dijkstras NULL 1 3 6 17 -dijkstras NULL 1 3 5 16 dijkstras NULL 1 2 4 4 dijkstras NULL 1 1 3 3 dijkstras NULL 1 1 2 2 diff --git a/storage/oqgraph/mysql-test/oqgraph/general-MyISAM.result b/storage/oqgraph/mysql-test/oqgraph/general-MyISAM.result index f12e160a2b7..bbf660e7db4 100644 --- a/storage/oqgraph/mysql-test/oqgraph/general-MyISAM.result +++ b/storage/oqgraph/mysql-test/oqgraph/general-MyISAM.result @@ -455,16 +455,16 @@ breadth_first NULL 4 1 2 3 breadth_first NULL 4 0 1 4 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5; latch origid destid weight seq linkid -breadth_first NULL 5 1 3 7 breadth_first NULL 5 1 2 6 breadth_first NULL 5 0 1 5 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6; latch origid destid weight seq linkid -breadth_first NULL 6 2 3 7 breadth_first NULL 6 1 2 5 breadth_first NULL 6 0 1 6 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7; latch origid destid weight seq linkid +breadth_first NULL 7 2 3 6 +breadth_first NULL 7 1 2 5 breadth_first NULL 7 0 1 7 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8; latch origid destid weight seq linkid @@ -473,18 +473,18 @@ latch origid destid weight seq linkid breadth_first NULL 9 0 1 9 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10; latch origid destid weight seq linkid -breadth_first NULL 10 2 3 12 -breadth_first NULL 10 1 2 11 +breadth_first NULL 10 2 3 11 +breadth_first NULL 10 1 2 12 breadth_first NULL 10 0 1 10 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11; latch origid destid weight seq linkid -breadth_first NULL 11 2 3 10 -breadth_first NULL 11 1 2 12 +breadth_first NULL 11 2 3 12 +breadth_first NULL 11 1 2 10 breadth_first NULL 11 0 1 11 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12; latch origid destid weight seq linkid -breadth_first NULL 12 2 3 11 -breadth_first NULL 12 1 2 10 +breadth_first NULL 12 2 3 10 +breadth_first NULL 12 1 2 11 breadth_first NULL 12 0 1 12 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 1; latch origid destid weight seq linkid @@ -502,26 +502,26 @@ latch origid destid weight seq linkid breadth_first NULL 4 1 2 3 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 1; latch origid destid weight seq linkid -breadth_first NULL 5 1 3 7 breadth_first NULL 5 1 2 6 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 1; latch origid destid weight seq linkid breadth_first NULL 6 1 2 5 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 1; latch origid destid weight seq linkid +breadth_first NULL 7 1 2 5 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 1; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 1; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 1; latch origid destid weight seq linkid -breadth_first NULL 10 1 2 11 +breadth_first NULL 10 1 2 12 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 1; latch origid destid weight seq linkid -breadth_first NULL 11 1 2 12 +breadth_first NULL 11 1 2 10 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 1; latch origid destid weight seq linkid -breadth_first NULL 12 1 2 10 +breadth_first NULL 12 1 2 11 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 2; latch origid destid weight seq linkid breadth_first NULL 1 2 4 4 @@ -538,22 +538,22 @@ SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 2; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 2; latch origid destid weight seq linkid -breadth_first NULL 6 2 3 7 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 2; latch origid destid weight seq linkid +breadth_first NULL 7 2 3 6 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 2; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 2; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 2; latch origid destid weight seq linkid -breadth_first NULL 10 2 3 12 +breadth_first NULL 10 2 3 11 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 2; latch origid destid weight seq linkid -breadth_first NULL 11 2 3 10 +breadth_first NULL 11 2 3 12 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 2; latch origid destid weight seq linkid -breadth_first NULL 12 2 3 11 +breadth_first NULL 12 2 3 10 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 3; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2 and weight = 3; @@ -847,16 +847,16 @@ latch origid destid weight seq linkid 2 NULL 4 0 1 4 SELECT * FROM graph WHERE latch = '2' AND destid = 5; latch origid destid weight seq linkid -2 NULL 5 1 3 7 2 NULL 5 1 2 6 2 NULL 5 0 1 5 SELECT * FROM graph WHERE latch = '2' AND destid = 6; latch origid destid weight seq linkid -2 NULL 6 2 3 7 2 NULL 6 1 2 5 2 NULL 6 0 1 6 SELECT * FROM graph WHERE latch = '2' AND destid = 7; latch origid destid weight seq linkid +2 NULL 7 2 3 6 +2 NULL 7 1 2 5 2 NULL 7 0 1 7 SELECT * FROM graph WHERE latch = '2' AND destid = 8; latch origid destid weight seq linkid @@ -865,18 +865,18 @@ latch origid destid weight seq linkid 2 NULL 9 0 1 9 SELECT * FROM graph WHERE latch = '2' AND destid = 10; latch origid destid weight seq linkid -2 NULL 10 2 3 12 -2 NULL 10 1 2 11 +2 NULL 10 2 3 11 +2 NULL 10 1 2 12 2 NULL 10 0 1 10 SELECT * FROM graph WHERE latch = '2' AND destid = 11; latch origid destid weight seq linkid -2 NULL 11 2 3 10 -2 NULL 11 1 2 12 +2 NULL 11 2 3 12 +2 NULL 11 1 2 10 2 NULL 11 0 1 11 SELECT * FROM graph WHERE latch = '2' AND destid = 12; latch origid destid weight seq linkid -2 NULL 12 2 3 11 -2 NULL 12 1 2 10 +2 NULL 12 2 3 10 +2 NULL 12 1 2 11 2 NULL 12 0 1 12 SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 1; latch origid destid weight seq linkid @@ -894,26 +894,26 @@ latch origid destid weight seq linkid 2 NULL 4 1 2 3 SELECT * FROM graph WHERE latch = '2' AND destid = 5 and weight = 1; latch origid destid weight seq linkid -2 NULL 5 1 3 7 2 NULL 5 1 2 6 SELECT * FROM graph WHERE latch = '2' AND destid = 6 and weight = 1; latch origid destid weight seq linkid 2 NULL 6 1 2 5 SELECT * FROM graph WHERE latch = '2' AND destid = 7 and weight = 1; latch origid destid weight seq linkid +2 NULL 7 1 2 5 SELECT * FROM graph WHERE latch = '2' AND destid = 8 and weight = 1; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = '2' AND destid = 9 and weight = 1; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = '2' AND destid = 10 and weight = 1; latch origid destid weight seq linkid -2 NULL 10 1 2 11 +2 NULL 10 1 2 12 SELECT * FROM graph WHERE latch = '2' AND destid = 11 and weight = 1; latch origid destid weight seq linkid -2 NULL 11 1 2 12 +2 NULL 11 1 2 10 SELECT * FROM graph WHERE latch = '2' AND destid = 12 and weight = 1; latch origid destid weight seq linkid -2 NULL 12 1 2 10 +2 NULL 12 1 2 11 SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 2; latch origid destid weight seq linkid 2 NULL 1 2 4 4 @@ -930,22 +930,22 @@ SELECT * FROM graph WHERE latch = '2' AND destid = 5 and weight = 2; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = '2' AND destid = 6 and weight = 2; latch origid destid weight seq linkid -2 NULL 6 2 3 7 SELECT * FROM graph WHERE latch = '2' AND destid = 7 and weight = 2; latch origid destid weight seq linkid +2 NULL 7 2 3 6 SELECT * FROM graph WHERE latch = '2' AND destid = 8 and weight = 2; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = '2' AND destid = 9 and weight = 2; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = '2' AND destid = 10 and weight = 2; latch origid destid weight seq linkid -2 NULL 10 2 3 12 +2 NULL 10 2 3 11 SELECT * FROM graph WHERE latch = '2' AND destid = 11 and weight = 2; latch origid destid weight seq linkid -2 NULL 11 2 3 10 +2 NULL 11 2 3 12 SELECT * FROM graph WHERE latch = '2' AND destid = 12 and weight = 2; latch origid destid weight seq linkid -2 NULL 12 2 3 11 +2 NULL 12 2 3 10 SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 3; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = '2' AND destid = 2 and weight = 3; @@ -1124,16 +1124,16 @@ dijkstras NULL 4 1 2 3 dijkstras NULL 4 0 1 4 SELECT * FROM graph WHERE latch='dijkstras' AND destid=5; latch origid destid weight seq linkid -dijkstras NULL 5 1 3 7 dijkstras NULL 5 1 2 6 dijkstras NULL 5 0 1 5 SELECT * FROM graph WHERE latch='dijkstras' AND destid=6; latch origid destid weight seq linkid -dijkstras NULL 6 2 3 7 dijkstras NULL 6 1 2 5 dijkstras NULL 6 0 1 6 SELECT * FROM graph WHERE latch='dijkstras' AND destid=7; latch origid destid weight seq linkid +dijkstras NULL 7 2 3 6 +dijkstras NULL 7 1 2 5 dijkstras NULL 7 0 1 7 SELECT * FROM graph WHERE latch='dijkstras' AND destid=8; latch origid destid weight seq linkid @@ -1142,18 +1142,18 @@ latch origid destid weight seq linkid dijkstras NULL 9 0 1 9 SELECT * FROM graph WHERE latch='dijkstras' AND destid=10; latch origid destid weight seq linkid -dijkstras NULL 10 2 3 12 -dijkstras NULL 10 1 2 11 +dijkstras NULL 10 2 3 11 +dijkstras NULL 10 1 2 12 dijkstras NULL 10 0 1 10 SELECT * FROM graph WHERE latch='dijkstras' AND destid=11; latch origid destid weight seq linkid -dijkstras NULL 11 2 3 10 -dijkstras NULL 11 1 2 12 +dijkstras NULL 11 2 3 12 +dijkstras NULL 11 1 2 10 dijkstras NULL 11 0 1 11 SELECT * FROM graph WHERE latch='dijkstras' AND destid=12; latch origid destid weight seq linkid -dijkstras NULL 12 2 3 11 -dijkstras NULL 12 1 2 10 +dijkstras NULL 12 2 3 10 +dijkstras NULL 12 1 2 11 dijkstras NULL 12 0 1 12 # legacy string number SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=1; @@ -1299,16 +1299,16 @@ latch origid destid weight seq linkid 1 NULL 4 0 1 4 SELECT * FROM graph WHERE latch='1' AND destid=5; latch origid destid weight seq linkid -1 NULL 5 1 3 7 1 NULL 5 1 2 6 1 NULL 5 0 1 5 SELECT * FROM graph WHERE latch='1' AND destid=6; latch origid destid weight seq linkid -1 NULL 6 2 3 7 1 NULL 6 1 2 5 1 NULL 6 0 1 6 SELECT * FROM graph WHERE latch='1' AND destid=7; latch origid destid weight seq linkid +1 NULL 7 2 3 6 +1 NULL 7 1 2 5 1 NULL 7 0 1 7 SELECT * FROM graph WHERE latch='1' AND destid=8; latch origid destid weight seq linkid @@ -1317,18 +1317,18 @@ latch origid destid weight seq linkid 1 NULL 9 0 1 9 SELECT * FROM graph WHERE latch='1' AND destid=10; latch origid destid weight seq linkid -1 NULL 10 2 3 12 -1 NULL 10 1 2 11 +1 NULL 10 2 3 11 +1 NULL 10 1 2 12 1 NULL 10 0 1 10 SELECT * FROM graph WHERE latch='1' AND destid=11; latch origid destid weight seq linkid -1 NULL 11 2 3 10 -1 NULL 11 1 2 12 +1 NULL 11 2 3 12 +1 NULL 11 1 2 10 1 NULL 11 0 1 11 SELECT * FROM graph WHERE latch='1' AND destid=12; latch origid destid weight seq linkid -1 NULL 12 2 3 11 -1 NULL 12 1 2 10 +1 NULL 12 2 3 10 +1 NULL 12 1 2 11 1 NULL 12 0 1 12 INSERT INTO graph_base(from_id, to_id) VALUES (11,13); INSERT INTO graph_base(from_id, to_id) VALUES (10,14); @@ -1395,9 +1395,6 @@ dijkstras 1 NULL 1 2 2 dijkstras 1 NULL 0 1 1 SELECT * FROM graph WHERE latch='dijkstras' AND destid=1; latch origid destid weight seq linkid -dijkstras NULL 1 4 7 18 -dijkstras NULL 1 3 6 17 -dijkstras NULL 1 3 5 16 dijkstras NULL 1 2 4 4 dijkstras NULL 1 1 3 3 dijkstras NULL 1 1 2 2 diff --git a/storage/oqgraph/mysql-test/oqgraph/general-innodb.result b/storage/oqgraph/mysql-test/oqgraph/general-innodb.result index b390dd38e34..927d856bc84 100644 --- a/storage/oqgraph/mysql-test/oqgraph/general-innodb.result +++ b/storage/oqgraph/mysql-test/oqgraph/general-innodb.result @@ -455,16 +455,16 @@ breadth_first NULL 4 1 2 3 breadth_first NULL 4 0 1 4 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5; latch origid destid weight seq linkid -breadth_first NULL 5 1 3 7 breadth_first NULL 5 1 2 6 breadth_first NULL 5 0 1 5 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6; latch origid destid weight seq linkid -breadth_first NULL 6 2 3 7 breadth_first NULL 6 1 2 5 breadth_first NULL 6 0 1 6 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7; latch origid destid weight seq linkid +breadth_first NULL 7 2 3 6 +breadth_first NULL 7 1 2 5 breadth_first NULL 7 0 1 7 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8; latch origid destid weight seq linkid @@ -473,18 +473,18 @@ latch origid destid weight seq linkid breadth_first NULL 9 0 1 9 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10; latch origid destid weight seq linkid -breadth_first NULL 10 2 3 12 -breadth_first NULL 10 1 2 11 +breadth_first NULL 10 2 3 11 +breadth_first NULL 10 1 2 12 breadth_first NULL 10 0 1 10 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11; latch origid destid weight seq linkid -breadth_first NULL 11 2 3 10 -breadth_first NULL 11 1 2 12 +breadth_first NULL 11 2 3 12 +breadth_first NULL 11 1 2 10 breadth_first NULL 11 0 1 11 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12; latch origid destid weight seq linkid -breadth_first NULL 12 2 3 11 -breadth_first NULL 12 1 2 10 +breadth_first NULL 12 2 3 10 +breadth_first NULL 12 1 2 11 breadth_first NULL 12 0 1 12 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 1; latch origid destid weight seq linkid @@ -502,26 +502,26 @@ latch origid destid weight seq linkid breadth_first NULL 4 1 2 3 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 1; latch origid destid weight seq linkid -breadth_first NULL 5 1 3 7 breadth_first NULL 5 1 2 6 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 1; latch origid destid weight seq linkid breadth_first NULL 6 1 2 5 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 1; latch origid destid weight seq linkid +breadth_first NULL 7 1 2 5 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 1; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 1; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 1; latch origid destid weight seq linkid -breadth_first NULL 10 1 2 11 +breadth_first NULL 10 1 2 12 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 1; latch origid destid weight seq linkid -breadth_first NULL 11 1 2 12 +breadth_first NULL 11 1 2 10 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 1; latch origid destid weight seq linkid -breadth_first NULL 12 1 2 10 +breadth_first NULL 12 1 2 11 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 2; latch origid destid weight seq linkid breadth_first NULL 1 2 4 4 @@ -538,22 +538,22 @@ SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 2; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 2; latch origid destid weight seq linkid -breadth_first NULL 6 2 3 7 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 2; latch origid destid weight seq linkid +breadth_first NULL 7 2 3 6 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 2; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 2; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 2; latch origid destid weight seq linkid -breadth_first NULL 10 2 3 12 +breadth_first NULL 10 2 3 11 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 2; latch origid destid weight seq linkid -breadth_first NULL 11 2 3 10 +breadth_first NULL 11 2 3 12 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 2; latch origid destid weight seq linkid -breadth_first NULL 12 2 3 11 +breadth_first NULL 12 2 3 10 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 3; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2 and weight = 3; @@ -847,16 +847,16 @@ latch origid destid weight seq linkid 2 NULL 4 0 1 4 SELECT * FROM graph WHERE latch = '2' AND destid = 5; latch origid destid weight seq linkid -2 NULL 5 1 3 7 2 NULL 5 1 2 6 2 NULL 5 0 1 5 SELECT * FROM graph WHERE latch = '2' AND destid = 6; latch origid destid weight seq linkid -2 NULL 6 2 3 7 2 NULL 6 1 2 5 2 NULL 6 0 1 6 SELECT * FROM graph WHERE latch = '2' AND destid = 7; latch origid destid weight seq linkid +2 NULL 7 2 3 6 +2 NULL 7 1 2 5 2 NULL 7 0 1 7 SELECT * FROM graph WHERE latch = '2' AND destid = 8; latch origid destid weight seq linkid @@ -865,18 +865,18 @@ latch origid destid weight seq linkid 2 NULL 9 0 1 9 SELECT * FROM graph WHERE latch = '2' AND destid = 10; latch origid destid weight seq linkid -2 NULL 10 2 3 12 -2 NULL 10 1 2 11 +2 NULL 10 2 3 11 +2 NULL 10 1 2 12 2 NULL 10 0 1 10 SELECT * FROM graph WHERE latch = '2' AND destid = 11; latch origid destid weight seq linkid -2 NULL 11 2 3 10 -2 NULL 11 1 2 12 +2 NULL 11 2 3 12 +2 NULL 11 1 2 10 2 NULL 11 0 1 11 SELECT * FROM graph WHERE latch = '2' AND destid = 12; latch origid destid weight seq linkid -2 NULL 12 2 3 11 -2 NULL 12 1 2 10 +2 NULL 12 2 3 10 +2 NULL 12 1 2 11 2 NULL 12 0 1 12 SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 1; latch origid destid weight seq linkid @@ -894,26 +894,26 @@ latch origid destid weight seq linkid 2 NULL 4 1 2 3 SELECT * FROM graph WHERE latch = '2' AND destid = 5 and weight = 1; latch origid destid weight seq linkid -2 NULL 5 1 3 7 2 NULL 5 1 2 6 SELECT * FROM graph WHERE latch = '2' AND destid = 6 and weight = 1; latch origid destid weight seq linkid 2 NULL 6 1 2 5 SELECT * FROM graph WHERE latch = '2' AND destid = 7 and weight = 1; latch origid destid weight seq linkid +2 NULL 7 1 2 5 SELECT * FROM graph WHERE latch = '2' AND destid = 8 and weight = 1; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = '2' AND destid = 9 and weight = 1; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = '2' AND destid = 10 and weight = 1; latch origid destid weight seq linkid -2 NULL 10 1 2 11 +2 NULL 10 1 2 12 SELECT * FROM graph WHERE latch = '2' AND destid = 11 and weight = 1; latch origid destid weight seq linkid -2 NULL 11 1 2 12 +2 NULL 11 1 2 10 SELECT * FROM graph WHERE latch = '2' AND destid = 12 and weight = 1; latch origid destid weight seq linkid -2 NULL 12 1 2 10 +2 NULL 12 1 2 11 SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 2; latch origid destid weight seq linkid 2 NULL 1 2 4 4 @@ -930,22 +930,22 @@ SELECT * FROM graph WHERE latch = '2' AND destid = 5 and weight = 2; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = '2' AND destid = 6 and weight = 2; latch origid destid weight seq linkid -2 NULL 6 2 3 7 SELECT * FROM graph WHERE latch = '2' AND destid = 7 and weight = 2; latch origid destid weight seq linkid +2 NULL 7 2 3 6 SELECT * FROM graph WHERE latch = '2' AND destid = 8 and weight = 2; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = '2' AND destid = 9 and weight = 2; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = '2' AND destid = 10 and weight = 2; latch origid destid weight seq linkid -2 NULL 10 2 3 12 +2 NULL 10 2 3 11 SELECT * FROM graph WHERE latch = '2' AND destid = 11 and weight = 2; latch origid destid weight seq linkid -2 NULL 11 2 3 10 +2 NULL 11 2 3 12 SELECT * FROM graph WHERE latch = '2' AND destid = 12 and weight = 2; latch origid destid weight seq linkid -2 NULL 12 2 3 11 +2 NULL 12 2 3 10 SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 3; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = '2' AND destid = 2 and weight = 3; @@ -1124,16 +1124,16 @@ dijkstras NULL 4 1 2 3 dijkstras NULL 4 0 1 4 SELECT * FROM graph WHERE latch='dijkstras' AND destid=5; latch origid destid weight seq linkid -dijkstras NULL 5 1 3 7 dijkstras NULL 5 1 2 6 dijkstras NULL 5 0 1 5 SELECT * FROM graph WHERE latch='dijkstras' AND destid=6; latch origid destid weight seq linkid -dijkstras NULL 6 2 3 7 dijkstras NULL 6 1 2 5 dijkstras NULL 6 0 1 6 SELECT * FROM graph WHERE latch='dijkstras' AND destid=7; latch origid destid weight seq linkid +dijkstras NULL 7 2 3 6 +dijkstras NULL 7 1 2 5 dijkstras NULL 7 0 1 7 SELECT * FROM graph WHERE latch='dijkstras' AND destid=8; latch origid destid weight seq linkid @@ -1142,18 +1142,18 @@ latch origid destid weight seq linkid dijkstras NULL 9 0 1 9 SELECT * FROM graph WHERE latch='dijkstras' AND destid=10; latch origid destid weight seq linkid -dijkstras NULL 10 2 3 12 -dijkstras NULL 10 1 2 11 +dijkstras NULL 10 2 3 11 +dijkstras NULL 10 1 2 12 dijkstras NULL 10 0 1 10 SELECT * FROM graph WHERE latch='dijkstras' AND destid=11; latch origid destid weight seq linkid -dijkstras NULL 11 2 3 10 -dijkstras NULL 11 1 2 12 +dijkstras NULL 11 2 3 12 +dijkstras NULL 11 1 2 10 dijkstras NULL 11 0 1 11 SELECT * FROM graph WHERE latch='dijkstras' AND destid=12; latch origid destid weight seq linkid -dijkstras NULL 12 2 3 11 -dijkstras NULL 12 1 2 10 +dijkstras NULL 12 2 3 10 +dijkstras NULL 12 1 2 11 dijkstras NULL 12 0 1 12 # legacy string number SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=1; @@ -1299,16 +1299,16 @@ latch origid destid weight seq linkid 1 NULL 4 0 1 4 SELECT * FROM graph WHERE latch='1' AND destid=5; latch origid destid weight seq linkid -1 NULL 5 1 3 7 1 NULL 5 1 2 6 1 NULL 5 0 1 5 SELECT * FROM graph WHERE latch='1' AND destid=6; latch origid destid weight seq linkid -1 NULL 6 2 3 7 1 NULL 6 1 2 5 1 NULL 6 0 1 6 SELECT * FROM graph WHERE latch='1' AND destid=7; latch origid destid weight seq linkid +1 NULL 7 2 3 6 +1 NULL 7 1 2 5 1 NULL 7 0 1 7 SELECT * FROM graph WHERE latch='1' AND destid=8; latch origid destid weight seq linkid @@ -1317,18 +1317,18 @@ latch origid destid weight seq linkid 1 NULL 9 0 1 9 SELECT * FROM graph WHERE latch='1' AND destid=10; latch origid destid weight seq linkid -1 NULL 10 2 3 12 -1 NULL 10 1 2 11 +1 NULL 10 2 3 11 +1 NULL 10 1 2 12 1 NULL 10 0 1 10 SELECT * FROM graph WHERE latch='1' AND destid=11; latch origid destid weight seq linkid -1 NULL 11 2 3 10 -1 NULL 11 1 2 12 +1 NULL 11 2 3 12 +1 NULL 11 1 2 10 1 NULL 11 0 1 11 SELECT * FROM graph WHERE latch='1' AND destid=12; latch origid destid weight seq linkid -1 NULL 12 2 3 11 -1 NULL 12 1 2 10 +1 NULL 12 2 3 10 +1 NULL 12 1 2 11 1 NULL 12 0 1 12 INSERT INTO graph_base(from_id, to_id) VALUES (11,13); INSERT INTO graph_base(from_id, to_id) VALUES (10,14); @@ -1395,9 +1395,6 @@ dijkstras 1 NULL 1 2 2 dijkstras 1 NULL 0 1 1 SELECT * FROM graph WHERE latch='dijkstras' AND destid=1; latch origid destid weight seq linkid -dijkstras NULL 1 4 7 18 -dijkstras NULL 1 3 6 17 -dijkstras NULL 1 3 5 16 dijkstras NULL 1 2 4 4 dijkstras NULL 1 1 3 3 dijkstras NULL 1 1 2 2 diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_1196036.result b/storage/oqgraph/mysql-test/oqgraph/regression_1196036.result index 45bbccfa87e..c372a0c088f 100644 --- a/storage/oqgraph/mysql-test/oqgraph/regression_1196036.result +++ b/storage/oqgraph/mysql-test/oqgraph/regression_1196036.result @@ -41,19 +41,19 @@ dijkstras 3 NULL 256 2 2 dijkstras 3 NULL 0 1 3 SELECT * FROM graph WHERE latch = 'dijkstras' AND destid = 1; latch origid destid weight seq linkid -dijkstras NULL 1 784 4 4 +dijkstras NULL 1 65808 4 4 dijkstras NULL 1 272 3 3 dijkstras NULL 1 16 2 2 dijkstras NULL 1 0 1 1 SELECT * FROM graph WHERE latch = 'dijkstras' AND destid = 2; latch origid destid weight seq linkid -dijkstras NULL 2 768 4 4 +dijkstras NULL 2 65792 4 4 dijkstras NULL 2 256 3 3 dijkstras NULL 2 16 2 1 dijkstras NULL 2 0 1 2 SELECT * FROM graph WHERE latch = 'dijkstras' AND destid = 3; latch origid destid weight seq linkid -dijkstras NULL 3 1024 4 4 +dijkstras NULL 3 65536 4 4 dijkstras NULL 3 272 3 1 dijkstras NULL 3 256 2 2 dijkstras NULL 3 0 1 3 diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_1213120.result b/storage/oqgraph/mysql-test/oqgraph/regression_1213120.result index b6cd53ab673..642c0aa3b5d 100644 --- a/storage/oqgraph/mysql-test/oqgraph/regression_1213120.result +++ b/storage/oqgraph/mysql-test/oqgraph/regression_1213120.result @@ -464,16 +464,16 @@ breadth_first NULL 4 1 2 3 breadth_first NULL 4 0 1 4 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5; latch origid destid weight seq linkid -breadth_first NULL 5 1 3 7 breadth_first NULL 5 1 2 6 breadth_first NULL 5 0 1 5 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6; latch origid destid weight seq linkid -breadth_first NULL 6 2 3 7 breadth_first NULL 6 1 2 5 breadth_first NULL 6 0 1 6 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7; latch origid destid weight seq linkid +breadth_first NULL 7 2 3 6 +breadth_first NULL 7 1 2 5 breadth_first NULL 7 0 1 7 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8; latch origid destid weight seq linkid @@ -482,18 +482,18 @@ latch origid destid weight seq linkid breadth_first NULL 9 0 1 9 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10; latch origid destid weight seq linkid -breadth_first NULL 10 2 3 12 -breadth_first NULL 10 1 2 11 +breadth_first NULL 10 2 3 11 +breadth_first NULL 10 1 2 12 breadth_first NULL 10 0 1 10 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11; latch origid destid weight seq linkid -breadth_first NULL 11 2 3 10 -breadth_first NULL 11 1 2 12 +breadth_first NULL 11 2 3 12 +breadth_first NULL 11 1 2 10 breadth_first NULL 11 0 1 11 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12; latch origid destid weight seq linkid -breadth_first NULL 12 2 3 11 -breadth_first NULL 12 1 2 10 +breadth_first NULL 12 2 3 10 +breadth_first NULL 12 1 2 11 breadth_first NULL 12 0 1 12 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 1; latch origid destid weight seq linkid @@ -511,26 +511,26 @@ latch origid destid weight seq linkid breadth_first NULL 4 1 2 3 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 1; latch origid destid weight seq linkid -breadth_first NULL 5 1 3 7 breadth_first NULL 5 1 2 6 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 1; latch origid destid weight seq linkid breadth_first NULL 6 1 2 5 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 1; latch origid destid weight seq linkid +breadth_first NULL 7 1 2 5 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 1; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 1; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 1; latch origid destid weight seq linkid -breadth_first NULL 10 1 2 11 +breadth_first NULL 10 1 2 12 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 1; latch origid destid weight seq linkid -breadth_first NULL 11 1 2 12 +breadth_first NULL 11 1 2 10 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 1; latch origid destid weight seq linkid -breadth_first NULL 12 1 2 10 +breadth_first NULL 12 1 2 11 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 2; latch origid destid weight seq linkid breadth_first NULL 1 2 4 4 @@ -547,22 +547,22 @@ SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 2; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 2; latch origid destid weight seq linkid -breadth_first NULL 6 2 3 7 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 2; latch origid destid weight seq linkid +breadth_first NULL 7 2 3 6 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 2; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 2; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 2; latch origid destid weight seq linkid -breadth_first NULL 10 2 3 12 +breadth_first NULL 10 2 3 11 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 2; latch origid destid weight seq linkid -breadth_first NULL 11 2 3 10 +breadth_first NULL 11 2 3 12 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 2; latch origid destid weight seq linkid -breadth_first NULL 12 2 3 11 +breadth_first NULL 12 2 3 10 SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 3; latch origid destid weight seq linkid SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2 and weight = 3; @@ -838,8 +838,8 @@ latch origid destid weight seq linkid 2 NULL 1 0 1 1 SELECT * FROM graph WHERE latch = '2' AND destid = 12; latch origid destid weight seq linkid -2 NULL 12 2 3 11 -2 NULL 12 1 2 10 +2 NULL 12 2 3 10 +2 NULL 12 1 2 11 2 NULL 12 0 1 12 SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 1; latch origid destid weight seq linkid @@ -997,16 +997,16 @@ dijkstras NULL 4 1 2 3 dijkstras NULL 4 0 1 4 SELECT * FROM graph WHERE latch='dijkstras' AND destid=5; latch origid destid weight seq linkid -dijkstras NULL 5 1 3 7 dijkstras NULL 5 1 2 6 dijkstras NULL 5 0 1 5 SELECT * FROM graph WHERE latch='dijkstras' AND destid=6; latch origid destid weight seq linkid -dijkstras NULL 6 2 3 7 dijkstras NULL 6 1 2 5 dijkstras NULL 6 0 1 6 SELECT * FROM graph WHERE latch='dijkstras' AND destid=7; latch origid destid weight seq linkid +dijkstras NULL 7 2 3 6 +dijkstras NULL 7 1 2 5 dijkstras NULL 7 0 1 7 SELECT * FROM graph WHERE latch='dijkstras' AND destid=8; latch origid destid weight seq linkid @@ -1015,18 +1015,18 @@ latch origid destid weight seq linkid dijkstras NULL 9 0 1 9 SELECT * FROM graph WHERE latch='dijkstras' AND destid=10; latch origid destid weight seq linkid -dijkstras NULL 10 2 3 12 -dijkstras NULL 10 1 2 11 +dijkstras NULL 10 2 3 11 +dijkstras NULL 10 1 2 12 dijkstras NULL 10 0 1 10 SELECT * FROM graph WHERE latch='dijkstras' AND destid=11; latch origid destid weight seq linkid -dijkstras NULL 11 2 3 10 -dijkstras NULL 11 1 2 12 +dijkstras NULL 11 2 3 12 +dijkstras NULL 11 1 2 10 dijkstras NULL 11 0 1 11 SELECT * FROM graph WHERE latch='dijkstras' AND destid=12; latch origid destid weight seq linkid -dijkstras NULL 12 2 3 11 -dijkstras NULL 12 1 2 10 +dijkstras NULL 12 2 3 10 +dijkstras NULL 12 1 2 11 dijkstras NULL 12 0 1 12 # legacy string number SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=1; @@ -1172,16 +1172,16 @@ latch origid destid weight seq linkid 1 NULL 4 0 1 4 SELECT * FROM graph WHERE latch='1' AND destid=5; latch origid destid weight seq linkid -1 NULL 5 1 3 7 1 NULL 5 1 2 6 1 NULL 5 0 1 5 SELECT * FROM graph WHERE latch='1' AND destid=6; latch origid destid weight seq linkid -1 NULL 6 2 3 7 1 NULL 6 1 2 5 1 NULL 6 0 1 6 SELECT * FROM graph WHERE latch='1' AND destid=7; latch origid destid weight seq linkid +1 NULL 7 2 3 6 +1 NULL 7 1 2 5 1 NULL 7 0 1 7 SELECT * FROM graph WHERE latch='1' AND destid=8; latch origid destid weight seq linkid @@ -1190,18 +1190,18 @@ latch origid destid weight seq linkid 1 NULL 9 0 1 9 SELECT * FROM graph WHERE latch='1' AND destid=10; latch origid destid weight seq linkid -1 NULL 10 2 3 12 -1 NULL 10 1 2 11 +1 NULL 10 2 3 11 +1 NULL 10 1 2 12 1 NULL 10 0 1 10 SELECT * FROM graph WHERE latch='1' AND destid=11; latch origid destid weight seq linkid -1 NULL 11 2 3 10 -1 NULL 11 1 2 12 +1 NULL 11 2 3 12 +1 NULL 11 1 2 10 1 NULL 11 0 1 11 SELECT * FROM graph WHERE latch='1' AND destid=12; latch origid destid weight seq linkid -1 NULL 12 2 3 11 -1 NULL 12 1 2 10 +1 NULL 12 2 3 10 +1 NULL 12 1 2 11 1 NULL 12 0 1 12 SELECT count(*) FROM graph; count(*) @@ -1280,9 +1280,6 @@ dijkstras 1 NULL 1 2 2 dijkstras 1 NULL 0 1 1 SELECT * FROM graph WHERE latch='dijkstras' AND destid=1; latch origid destid weight seq linkid -dijkstras NULL 1 4 7 18 -dijkstras NULL 1 3 6 17 -dijkstras NULL 1 3 5 16 dijkstras NULL 1 2 4 4 dijkstras NULL 1 1 3 3 dijkstras NULL 1 1 2 2 diff --git a/storage/oqgraph/oqgraph_shim.h b/storage/oqgraph/oqgraph_shim.h index c0a9dbb2b40..f24732af4ef 100644 --- a/storage/oqgraph/oqgraph_shim.h +++ b/storage/oqgraph/oqgraph_shim.h @@ -154,12 +154,12 @@ namespace oqgraph3 typedef std::input_iterator_tag iterator_category; in_edge_iterator() { } in_edge_iterator(const cursor_ptr& cursor) : _cursor(cursor) { } - value_type operator*() { return value_type(_cursor); } + value_type operator*() const { return value_type(_cursor); } self& operator++() { _cursor->seek_next(); return *this; } self operator++(int) { cursor_ptr t(new cursor(*_cursor)); ++(*this); return in_edge_iterator(t); } - bool operator==(const self& x) { return _cursor == x._cursor; } - bool operator!=(const self& x) { return _cursor != x._cursor; } + bool operator==(const self& x) const { return _cursor == x._cursor; } + bool operator!=(const self& x) const { return _cursor != x._cursor; } cursor_ptr _cursor; }; diff --git a/storage/sphinx/ha_sphinx.cc b/storage/sphinx/ha_sphinx.cc index 121cf41a3fe..41d68645fc6 100644 --- a/storage/sphinx/ha_sphinx.cc +++ b/storage/sphinx/ha_sphinx.cc @@ -1712,13 +1712,16 @@ bool CSphSEQuery::ParseField ( char * sField ) char * sLat = sValue; char * p = sValue; - if (!( p = strchr ( p, ',' ) )) break; *p++ = '\0'; + if (!( p = strchr ( p, ',' ) )) break; + *p++ = '\0'; char * sLong = p; - if (!( p = strchr ( p, ',' ) )) break; *p++ = '\0'; + if (!( p = strchr ( p, ',' ) )) break; + *p++ = '\0'; char * sLatVal = p; - if (!( p = strchr ( p, ',' ) )) break; *p++ = '\0'; + if (!( p = strchr ( p, ',' ) )) break; + *p++ = '\0'; char * sLongVal = p; m_sGeoLatAttr = chop(sLat); @@ -1787,7 +1790,8 @@ bool CSphSEQuery::ParseField ( char * sField ) while ( sRest ) { char * sId = sRest; - if (!( sRest = strchr ( sRest, ':' ) )) break; *sRest++ = '\0'; + if (!( sRest = strchr ( sRest, ':' ) )) break; + *sRest++ = '\0'; if (!( sRest - sId )) break; sValue = sRest; diff --git a/storage/tokudb/CMakeLists.txt b/storage/tokudb/CMakeLists.txt index 73e4bf37a06..b0ed6e41188 100644 --- a/storage/tokudb/CMakeLists.txt +++ b/storage/tokudb/CMakeLists.txt @@ -38,6 +38,7 @@ IF(NOT LIBJEMALLOC) ENDIF() MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-vla" DEBUG) +MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-implicit-fallthrough") ############################################ MARK_AS_ADVANCED(BUILDNAME) diff --git a/storage/tokudb/PerconaFT/third_party/snappy-1.1.2/CMakeLists.txt b/storage/tokudb/PerconaFT/third_party/snappy-1.1.2/CMakeLists.txt index f9d93917627..c241f7918ee 100644 --- a/storage/tokudb/PerconaFT/third_party/snappy-1.1.2/CMakeLists.txt +++ b/storage/tokudb/PerconaFT/third_party/snappy-1.1.2/CMakeLists.txt @@ -1,3 +1,4 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) set(snappy_srcs diff --git a/storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/configure b/storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/configure index 2d3e2062f0d..bfa3d4ad4df 100755 --- a/storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/configure +++ b/storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/configure @@ -19870,98 +19870,6 @@ if test -n "$CFLAG_VISIBILITY" && test "$is_w32" = no; then AM_CFLAGS="$AM_CFLAGS $CFLAG_VISIBILITY" fi -if test "$GCC" = yes ; then - # Enable as much warnings as possible. These commented warnings won't - # work for this package though: - # * -Wunreachable-code breaks several assert(0) cases, which are - # backed up with "return LZMA_PROG_ERROR". - # * -Wcast-qual would break various things where we need a non-const - # pointer although we don't modify anything through it. - # * -Wcast-align breaks optimized CRC32 and CRC64 implementation - # on some architectures (not on x86), where this warning is bogus, - # because we take care of correct alignment. - # * -Winline, -Wdisabled-optimization, -Wunsafe-loop-optimizations - # don't seem so useful here; at least the last one gives some - # warnings which are not bugs. - for NEW_FLAG in \ - -Wall \ - -Wextra \ - -Wformat=2 \ - -Winit-self \ - -Wmissing-include-dirs \ - -Wstrict-aliasing \ - -Wfloat-equal \ - -Wundef \ - -Wshadow \ - -Wpointer-arith \ - -Wbad-function-cast \ - -Wwrite-strings \ - -Wlogical-op \ - -Waggregate-return \ - -Wstrict-prototypes \ - -Wold-style-definition \ - -Wmissing-prototypes \ - -Wmissing-declarations \ - -Wmissing-noreturn \ - -Wredundant-decls - do - { $as_echo "$as_me:$LINENO: checking if $CC accepts $NEW_FLAG" >&5 -$as_echo_n "checking if $CC accepts $NEW_FLAG... " >&6; } - OLD_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $NEW_FLAG" - cat >conftest.$ac_ext <<_ACEOF -void foo(void) { } -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - - AM_CFLAGS="$AM_CFLAGS $NEW_FLAG" - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } - -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS="$OLD_CFLAGS" - done - - # Check whether --enable-werror was given. -if test "${enable_werror+set}" = set; then - enableval=$enable_werror; -else - enable_werror=no -fi - - if test "x$enable_werror" = "xyes"; then - AM_CFLAGS="$AM_CFLAGS -Werror" - fi -fi - - ############################################################################### # Create the makefiles and config.h ############################################################################### diff --git a/storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/configure.ac b/storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/configure.ac index 148f174169e..e2bb87781c8 100644 --- a/storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/configure.ac +++ b/storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/configure.ac @@ -569,63 +569,6 @@ if test -n "$CFLAG_VISIBILITY" && test "$is_w32" = no; then AM_CFLAGS="$AM_CFLAGS $CFLAG_VISIBILITY" fi -if test "$GCC" = yes ; then - # Enable as much warnings as possible. These commented warnings won't - # work for this package though: - # * -Wunreachable-code breaks several assert(0) cases, which are - # backed up with "return LZMA_PROG_ERROR". - # * -Wcast-qual would break various things where we need a non-const - # pointer although we don't modify anything through it. - # * -Wcast-align breaks optimized CRC32 and CRC64 implementation - # on some architectures (not on x86), where this warning is bogus, - # because we take care of correct alignment. - # * -Winline, -Wdisabled-optimization, -Wunsafe-loop-optimizations - # don't seem so useful here; at least the last one gives some - # warnings which are not bugs. - for NEW_FLAG in \ - -Wall \ - -Wextra \ - -Wformat=2 \ - -Winit-self \ - -Wmissing-include-dirs \ - -Wstrict-aliasing \ - -Wfloat-equal \ - -Wundef \ - -Wshadow \ - -Wpointer-arith \ - -Wbad-function-cast \ - -Wwrite-strings \ - -Wlogical-op \ - -Waggregate-return \ - -Wstrict-prototypes \ - -Wold-style-definition \ - -Wmissing-prototypes \ - -Wmissing-declarations \ - -Wmissing-noreturn \ - -Wredundant-decls - do - AC_MSG_CHECKING([if $CC accepts $NEW_FLAG]) - OLD_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $NEW_FLAG" - AC_COMPILE_IFELSE([void foo(void) { }], [ - AM_CFLAGS="$AM_CFLAGS $NEW_FLAG" - AC_MSG_RESULT([yes]) - ], [ - AC_MSG_RESULT([no]) - ]) - CFLAGS="$OLD_CFLAGS" - done - - AC_ARG_ENABLE([werror], - AC_HELP_STRING([--enable-werror], [Enable -Werror to abort - compilation on all compiler warnings.]), - [], [enable_werror=no]) - if test "x$enable_werror" = "xyes"; then - AM_CFLAGS="$AM_CFLAGS -Werror" - fi -fi - - ############################################################################### # Create the makefiles and config.h ############################################################################### diff --git a/storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/m4/libtool.m4 b/storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/m4/libtool.m4 index 39ba996cb96..faec0c309e8 100644 --- a/storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/m4/libtool.m4 +++ b/storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/m4/libtool.m4 @@ -1021,7 +1021,7 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES], # to the aix ld manual. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl -AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { @@ -4826,9 +4826,9 @@ _LT_EOF # implicitly export all symbols. save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - AC_LINK_IFELSE(int foo(void) {}, + AC_LINK_IFELSE([AC_LANG_SOURCE([int foo(void) {}]), _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - ) + ]) LDFLAGS="$save_LDFLAGS" else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' diff --git a/storage/xtradb/dict/dict0dict.cc b/storage/xtradb/dict/dict0dict.cc index 7550943de7a..1558c6d50ac 100644 --- a/storage/xtradb/dict/dict0dict.cc +++ b/storage/xtradb/dict/dict0dict.cc @@ -570,15 +570,14 @@ dict_table_close( ut_ad(mutex_own(&dict_sys->mutex)); ut_a(table->n_ref_count > 0); - --table->n_ref_count; + const bool last_handle = !--table->n_ref_count; /* Force persistent stats re-read upon next open of the table so that FLUSH TABLE can be used to forcibly fetch stats from disk if they have been manually modified. We reset table->stat_initialized only if table reference count is 0 because we do not want too frequent stats re-reads (e.g. in other cases than FLUSH TABLE). */ - if (strchr(table->name, '/') != NULL - && table->n_ref_count == 0 + if (last_handle && strchr(table->name, '/') != NULL && dict_stats_is_persistent_enabled(table)) { dict_stats_deinit(table); @@ -598,11 +597,8 @@ dict_table_close( if (!dict_locked) { table_id_t table_id = table->id; - ibool drop_aborted; - - drop_aborted = try_drop + const bool drop_aborted = last_handle && try_drop && table->drop_aborted - && table->n_ref_count == 1 && dict_table_get_first_index(table); mutex_exit(&dict_sys->mutex); @@ -642,40 +638,6 @@ dict_table_get_col_name( return(s); } -/**********************************************************************//** -Returns a column's name. -@return column name. NOTE: not guaranteed to stay valid if table is -modified in any way (columns added, etc.). */ -UNIV_INTERN -const char* -dict_table_get_col_name_for_mysql( -/*==============================*/ - const dict_table_t* table, /*!< in: table */ - const char* col_name)/*! in: MySQL table column name */ -{ - ulint i; - const char* s; - - ut_ad(table); - ut_ad(col_name); - ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); - - s = table->col_names; - if (s) { - /* If we have many virtual columns MySQL key_part->fieldnr - could be larger than number of columns in InnoDB table - when creating new indexes. */ - for (i = 0; i < table->n_def; i++) { - - if (!innobase_strcasecmp(s, col_name)) { - break; /* Found */ - } - s += strlen(s) + 1; - } - } - - return(s); -} #ifndef UNIV_HOTBACKUP /** Allocate and init the autoinc latch of a given table. This function must not be called concurrently on the same table object. @@ -2151,8 +2113,9 @@ dict_table_remove_from_cache_low( } if (lru_evict && table->drop_aborted) { - /* Do as dict_table_try_drop_aborted() does. */ - + /* When evicting the table definition, + drop the orphan indexes from the data dictionary + and free the index pages. */ trx_t* trx = trx_allocate_for_background(); ut_ad(mutex_own(&dict_sys->mutex)); @@ -2163,12 +2126,8 @@ dict_table_remove_from_cache_low( trx->dict_operation_lock_mode = RW_X_LATCH; trx_set_dict_operation(trx, TRX_DICT_OP_INDEX); + row_merge_drop_indexes_dict(trx, table->id); - /* Silence a debug assertion in row_merge_drop_indexes(). */ - ut_d(table->n_ref_count++); - row_merge_drop_indexes(trx, table, TRUE); - ut_d(table->n_ref_count--); - ut_ad(table->n_ref_count == 0); trx_commit_for_mysql(trx); trx->dict_operation_lock_mode = 0; trx_free_for_background(trx); diff --git a/storage/xtradb/fts/fts0fts.cc b/storage/xtradb/fts/fts0fts.cc index e1a95bcd427..88b5ad97277 100644 --- a/storage/xtradb/fts/fts0fts.cc +++ b/storage/xtradb/fts/fts0fts.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, MariaDB Corporation. All Rights reserved. +Copyright (c) 2016, 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -2644,22 +2644,23 @@ fts_get_next_doc_id( will consult the CONFIG table and user table to re-establish the initial value of the Doc ID */ - if (cache->first_doc_id != 0 || !fts_init_doc_id(table)) { - if (!DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_HAS_DOC_ID)) { - *doc_id = FTS_NULL_DOC_ID; - return(DB_SUCCESS); + if (!DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_HAS_DOC_ID)) { + if (cache->first_doc_id == FTS_NULL_DOC_ID) { + fts_init_doc_id(table); } + *doc_id = FTS_NULL_DOC_ID; + return(DB_SUCCESS); + } - /* Otherwise, simply increment the value in cache */ - mutex_enter(&cache->doc_id_lock); - *doc_id = ++cache->next_doc_id; - mutex_exit(&cache->doc_id_lock); - } else { - mutex_enter(&cache->doc_id_lock); - *doc_id = cache->next_doc_id; - mutex_exit(&cache->doc_id_lock); + if (cache->first_doc_id == FTS_NULL_DOC_ID) { + fts_init_doc_id(table); } + DEBUG_SYNC_C("get_next_FTS_DOC_ID"); + mutex_enter(&cache->doc_id_lock); + *doc_id = cache->next_doc_id++; + mutex_exit(&cache->doc_id_lock); + return(DB_SUCCESS); } @@ -3033,53 +3034,6 @@ fts_modify( } /*********************************************************************//** -Create a new document id. -@return DB_SUCCESS if all went well else error */ -UNIV_INTERN -dberr_t -fts_create_doc_id( -/*==============*/ - dict_table_t* table, /*!< in: row is of this table. */ - dtuple_t* row, /* in/out: add doc id value to this - row. This is the current row that is - being inserted. */ - mem_heap_t* heap) /*!< in: heap */ -{ - doc_id_t doc_id; - dberr_t error = DB_SUCCESS; - - ut_a(table->fts->doc_col != ULINT_UNDEFINED); - - if (!DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_HAS_DOC_ID)) { - if (table->fts->cache->first_doc_id == FTS_NULL_DOC_ID) { - error = fts_get_next_doc_id(table, &doc_id); - } - return(error); - } - - error = fts_get_next_doc_id(table, &doc_id); - - if (error == DB_SUCCESS) { - dfield_t* dfield; - doc_id_t* write_doc_id; - - ut_a(doc_id > 0); - - dfield = dtuple_get_nth_field(row, table->fts->doc_col); - write_doc_id = static_cast<doc_id_t*>( - mem_heap_alloc(heap, sizeof(*write_doc_id))); - - ut_a(doc_id != FTS_NULL_DOC_ID); - ut_a(sizeof(doc_id) == dfield->type.len); - fts_write_doc_id((byte*) write_doc_id, doc_id); - - dfield_set_data(dfield, write_doc_id, sizeof(*write_doc_id)); - } - - return(error); -} - -/*********************************************************************//** The given transaction is about to be committed; do whatever is necessary from the FTS system's POV. @return DB_SUCCESS or error code */ diff --git a/storage/xtradb/fts/fts0que.cc b/storage/xtradb/fts/fts0que.cc index f24973e26fb..358d979fff6 100644 --- a/storage/xtradb/fts/fts0que.cc +++ b/storage/xtradb/fts/fts0que.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -3653,6 +3654,10 @@ fts_query_free( fts_doc_ids_free(query->deleted); } + if (query->intersection) { + fts_query_free_doc_ids(query, query->intersection); + } + if (query->doc_ids) { fts_query_free_doc_ids(query, query->doc_ids); } @@ -3677,8 +3682,6 @@ fts_query_free( rbt_free(query->word_freqs); } - ut_a(!query->intersection); - if (query->word_map) { rbt_free(query->word_map); } diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 412c386a20b..8d4cfbb29ff 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -5952,8 +5952,6 @@ innobase_match_index_columns( if (innodb_idx_fld >= innodb_idx_fld_end) { DBUG_RETURN(FALSE); } - - mtype = innodb_idx_fld->col->mtype; } if (col_type != mtype) { @@ -19421,7 +19419,7 @@ buffer_pool_load_now( const void* save) /*!< in: immediate result from check function */ { - if (*(my_bool*) save) { + if (*(my_bool*) save && !srv_read_only_mode) { buf_load_start(); } } @@ -19444,7 +19442,7 @@ buffer_pool_load_abort( const void* save) /*!< in: immediate result from check function */ { - if (*(my_bool*) save) { + if (*(my_bool*) save && !srv_read_only_mode) { buf_load_abort(); } } diff --git a/storage/xtradb/handler/handler0alter.cc b/storage/xtradb/handler/handler0alter.cc index 32ad4844c34..ca3c4648af3 100644 --- a/storage/xtradb/handler/handler0alter.cc +++ b/storage/xtradb/handler/handler0alter.cc @@ -237,34 +237,6 @@ innobase_need_rebuild( return(false); } - /* If alter table changes column name and adds a new - index, we need to check is this new index created - to new column name. This is because column name - changes are done normally after creating indexes. */ - if ((ha_alter_info->handler_flags - & Alter_inplace_info::ALTER_COLUMN_NAME) && - ((ha_alter_info->handler_flags - & Alter_inplace_info::ADD_INDEX) || - (ha_alter_info->handler_flags - & Alter_inplace_info::ADD_FOREIGN_KEY))) { - for (ulint i = 0; i < ha_alter_info->index_add_count; i++) { - const KEY* key = &ha_alter_info->key_info_buffer[ - ha_alter_info->index_add_buffer[i]]; - - for (ulint j = 0; j < key->user_defined_key_parts; j++) { - const KEY_PART_INFO* key_part = &(key->key_part[j]); - const Field* field = altered_table->field[key_part->fieldnr]; - - /* Field used on added index is renamed on - this same alter table. We need table - rebuild. */ - if (field && field->flags & FIELD_IS_RENAMED) { - return (true); - } - } - } - } - return(!!(ha_alter_info->handler_flags & INNOBASE_ALTER_REBUILD)); } @@ -1551,38 +1523,49 @@ name_ok: return(0); } -/*******************************************************************//** -Create index field definition for key part */ +/** Create index field definition for key part +@param[in] new_clustered true if alter is generating a new clustered +index +@param[in] altered_table MySQL table that is being altered +@param[in] key_part MySQL key definition +@param[out] index_field index field defition for key_part */ static MY_ATTRIBUTE((nonnull(2,3))) void innobase_create_index_field_def( -/*============================*/ - const TABLE* altered_table, /*!< in: MySQL table that is - being altered, or NULL - if a new clustered index is - not being created */ - const KEY_PART_INFO* key_part, /*!< in: MySQL key definition */ - index_field_t* index_field, /*!< out: index field - definition for key_part */ - const Field** fields) /*!< in: MySQL table fields */ + bool new_clustered, + const TABLE* altered_table, + const KEY_PART_INFO* key_part, + index_field_t* index_field) { const Field* field; ibool is_unsigned; ulint col_type; + ulint innodb_fieldnr=0; DBUG_ENTER("innobase_create_index_field_def"); ut_ad(key_part); ut_ad(index_field); + ut_ad(altered_table); + + /* Virtual columns are not stored in InnoDB data dictionary, thus + if there is virtual columns we need to skip them to find the + correct field. */ + for(ulint i = 0; i < key_part->fieldnr; i++) { + const Field* table_field = altered_table->field[i]; + if (!table_field->stored_in_db) { + continue; + } + innodb_fieldnr++; + } - field = altered_table - ? altered_table->field[key_part->fieldnr] + field = new_clustered ? + altered_table->field[key_part->fieldnr] : key_part->field; - ut_a(field); - index_field->col_no = key_part->fieldnr; - index_field->col_name = altered_table ? field->field_name : fields[key_part->fieldnr]->field_name; + ut_a(field); + index_field->col_no = innodb_fieldnr; col_type = get_innobase_type_from_mysql_type(&is_unsigned, field); if (DATA_BLOB == col_type @@ -1616,10 +1599,8 @@ innobase_create_index_def( bool key_clustered, /*!< in: true if this is the new clustered index */ index_def_t* index, /*!< out: index definition */ - mem_heap_t* heap, /*!< in: heap where memory + mem_heap_t* heap) /*!< in: heap where memory is allocated */ - const Field** fields) /*!< in: MySQL table fields - */ { const KEY* key = &keys[key_number]; ulint i; @@ -1630,11 +1611,10 @@ innobase_create_index_def( DBUG_ENTER("innobase_create_index_def"); DBUG_ASSERT(!key_clustered || new_clustered); + ut_ad(altered_table); + index->fields = static_cast<index_field_t*>( mem_heap_alloc(heap, n_fields * sizeof *index->fields)); - - memset(index->fields, 0, n_fields * sizeof *index->fields); - index->ind_type = 0; index->key_number = key_number; index->n_fields = n_fields; @@ -1665,13 +1645,12 @@ innobase_create_index_def( index->ind_type |= DICT_FTS; } - if (!new_clustered) { - altered_table = NULL; - } - for (i = 0; i < n_fields; i++) { innobase_create_index_field_def( - altered_table, &key->key_part[i], &index->fields[i], fields); + new_clustered, + altered_table, + &key->key_part[i], + &index->fields[i]); } DBUG_VOID_RETURN; @@ -1997,7 +1976,7 @@ innobase_create_key_defs( /* Create the PRIMARY key index definition */ innobase_create_index_def( altered_table, key_info, primary_key_number, - TRUE, TRUE, indexdef++, heap, (const Field **)altered_table->field); + TRUE, TRUE, indexdef++, heap); created_clustered: n_add = 1; @@ -2009,7 +1988,7 @@ created_clustered: /* Copy the index definitions. */ innobase_create_index_def( altered_table, key_info, i, TRUE, FALSE, - indexdef, heap, (const Field **)altered_table->field); + indexdef, heap); if (indexdef->ind_type & DICT_FTS) { n_fts_add++; @@ -2054,7 +2033,7 @@ created_clustered: for (ulint i = 0; i < n_add; i++) { innobase_create_index_def( altered_table, key_info, add[i], FALSE, FALSE, - indexdef, heap, (const Field **)altered_table->field); + indexdef, heap); if (indexdef->ind_type & DICT_FTS) { n_fts_add++; @@ -2071,7 +2050,6 @@ created_clustered: index->fields = static_cast<index_field_t*>( mem_heap_alloc(heap, sizeof *index->fields)); - memset(index->fields, 0, sizeof *index->fields); index->n_fields = 1; index->fields->col_no = fts_doc_id_col; index->fields->prefix_len = 0; @@ -2161,7 +2139,7 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx /** mapping of old column numbers to new ones, or NULL */ const ulint* col_map; /** new column names, or NULL if nothing was renamed */ - const char** col_names; + const char** col_names; /** added AUTO_INCREMENT column position, or ULINT_UNDEFINED */ const ulint add_autoinc; /** default values of ADD COLUMN, or NULL */ @@ -3122,8 +3100,7 @@ prepare_inplace_alter_table_dict( for (ulint a = 0; a < ctx->num_to_add_index; a++) { ctx->add_index[a] = row_merge_create_index( - ctx->trx, ctx->new_table, - &index_defs[a], ctx->col_names); + ctx->trx, ctx->new_table, &index_defs[a]); add_key_nums[a] = index_defs[a].key_number; diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc index ca2c76c31ad..94cd6f29558 100644 --- a/storage/xtradb/handler/i_s.cc +++ b/storage/xtradb/handler/i_s.cc @@ -6363,6 +6363,7 @@ i_s_sys_tables_fill_table_stats( } heap = mem_heap_create(1000); + rw_lock_s_lock(&dict_operation_lock); mutex_enter(&dict_sys->mutex); mtr_start(&mtr); @@ -6389,9 +6390,11 @@ i_s_sys_tables_fill_table_stats( err_msg); } + rw_lock_s_unlock(&dict_operation_lock); mem_heap_empty(heap); /* Get the next record */ + rw_lock_s_lock(&dict_operation_lock); mutex_enter(&dict_sys->mutex); mtr_start(&mtr); rec = dict_getnext_system(&pcur, &mtr); @@ -6399,6 +6402,7 @@ i_s_sys_tables_fill_table_stats( mtr_commit(&mtr); mutex_exit(&dict_sys->mutex); + rw_lock_s_unlock(&dict_operation_lock); mem_heap_free(heap); DBUG_RETURN(0); @@ -7690,8 +7694,6 @@ i_s_dict_fill_sys_tablespaces( { Field** fields; ulint atomic_blobs = FSP_FLAGS_HAS_ATOMIC_BLOBS(flags); - ulint page_size = fsp_flags_get_page_size(flags); - ulint zip_size = fsp_flags_get_zip_size(flags); const char* file_format; const char* row_format; @@ -7708,13 +7710,11 @@ i_s_dict_fill_sys_tablespaces( fields = table_to_fill->field; - OK(fields[SYS_TABLESPACES_SPACE]->store( - static_cast<double>(space))); + OK(fields[SYS_TABLESPACES_SPACE]->store(space, true)); OK(field_store_string(fields[SYS_TABLESPACES_NAME], name)); - OK(fields[SYS_TABLESPACES_FLAGS]->store( - static_cast<double>(flags))); + OK(fields[SYS_TABLESPACES_FLAGS]->store(flags, true)); OK(field_store_string(fields[SYS_TABLESPACES_FILE_FORMAT], file_format)); @@ -7722,11 +7722,18 @@ i_s_dict_fill_sys_tablespaces( OK(field_store_string(fields[SYS_TABLESPACES_ROW_FORMAT], row_format)); - OK(fields[SYS_TABLESPACES_PAGE_SIZE]->store( - static_cast<double>(page_size))); + ulint cflags = fsp_flags_is_valid(flags, space) + ? flags : fsp_flags_convert_from_101(flags); + if (cflags != ULINT_UNDEFINED) { + OK(fields[SYS_TABLESPACES_PAGE_SIZE]->store( + fsp_flags_get_page_size(cflags), true)); - OK(fields[SYS_TABLESPACES_ZIP_PAGE_SIZE]->store( - static_cast<double>(zip_size))); + OK(fields[SYS_TABLESPACES_ZIP_PAGE_SIZE]->store( + fsp_flags_get_zip_size(cflags), true)); + } else { + fields[SYS_TABLESPACES_PAGE_SIZE]->set_null(); + fields[SYS_TABLESPACES_ZIP_PAGE_SIZE]->set_null(); + } OK(schema_table_store_record(thd, table_to_fill)); diff --git a/storage/xtradb/include/data0type.ic b/storage/xtradb/include/data0type.ic index 8f5cee0fd5f..ff72f6ed20f 100644 --- a/storage/xtradb/include/data0type.ic +++ b/storage/xtradb/include/data0type.ic @@ -577,7 +577,7 @@ dtype_get_fixed_size_low( return(len); #endif /* !UNIV_HOTBACKUP */ /* Treat as variable-length. */ - /* Fall through */ + /* fall through */ case DATA_VARCHAR: case DATA_BINARY: case DATA_DECIMAL: diff --git a/storage/xtradb/include/dict0dict.h b/storage/xtradb/include/dict0dict.h index a43b04d9d1e..dda8f4d2714 100644 --- a/storage/xtradb/include/dict0dict.h +++ b/storage/xtradb/include/dict0dict.h @@ -619,17 +619,6 @@ dict_table_get_col_name( ulint col_nr) /*!< in: column number */ MY_ATTRIBUTE((nonnull, warn_unused_result)); /**********************************************************************//** -Returns a column's name. -@return column name. NOTE: not guaranteed to stay valid if table is -modified in any way (columns added, etc.). */ -UNIV_INTERN -const char* -dict_table_get_col_name_for_mysql( -/*==============================*/ - const dict_table_t* table, /*!< in: table */ - const char* col_name)/*!< in: MySQL table column name */ - __attribute__((nonnull, warn_unused_result)); -/**********************************************************************//** Prints a table data. */ UNIV_INTERN void diff --git a/storage/xtradb/include/fts0fts.h b/storage/xtradb/include/fts0fts.h index 7aa7055640c..cd94956dc55 100644 --- a/storage/xtradb/include/fts0fts.h +++ b/storage/xtradb/include/fts0fts.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, MariaDB Corporation. All Rights reserved. +Copyright (c) 2016, 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -429,21 +429,6 @@ fts_update_next_doc_id( MY_ATTRIBUTE((nonnull(2))); /******************************************************************//** -Create a new document id . -@return DB_SUCCESS if all went well else error */ -UNIV_INTERN -dberr_t -fts_create_doc_id( -/*==============*/ - dict_table_t* table, /*!< in: row is of this - table. */ - dtuple_t* row, /*!< in/out: add doc id - value to this row. This is the - current row that is being - inserted. */ - mem_heap_t* heap) /*!< in: heap */ - MY_ATTRIBUTE((nonnull)); -/******************************************************************//** Create a new fts_doc_ids_t. @return new fts_doc_ids_t. */ UNIV_INTERN diff --git a/storage/xtradb/include/row0merge.h b/storage/xtradb/include/row0merge.h index 152a51dafc6..af21ef49cb7 100644 --- a/storage/xtradb/include/row0merge.h +++ b/storage/xtradb/include/row0merge.h @@ -108,7 +108,6 @@ struct index_field_t { ulint col_no; /*!< column offset */ ulint prefix_len; /*!< column prefix length, or 0 if indexing the whole column */ - const char* col_name; /*!< column name or NULL */ }; /** Definition of an index being created */ @@ -265,11 +264,7 @@ row_merge_create_index( /*===================*/ trx_t* trx, /*!< in/out: trx (sets error_state) */ dict_table_t* table, /*!< in: the index is on this table */ - const index_def_t* index_def, - /*!< in: the index definition */ - const char** col_names); - /*! in: column names if columns are - renamed or NULL */ + const index_def_t* index_def); /*!< in: the index definition */ /*********************************************************************//** Check if a transaction can use an index. @return TRUE if index can be used by the transaction else FALSE */ diff --git a/storage/xtradb/row/row0merge.cc b/storage/xtradb/row/row0merge.cc index 4eb6534161d..22ad34e5e35 100644 --- a/storage/xtradb/row/row0merge.cc +++ b/storage/xtradb/row/row0merge.cc @@ -3736,11 +3736,7 @@ row_merge_create_index( /*===================*/ trx_t* trx, /*!< in/out: trx (sets error_state) */ dict_table_t* table, /*!< in: the index is on this table */ - const index_def_t* index_def, - /*!< in: the index definition */ - const char** col_names) - /*! in: column names if columns are - renamed or NULL */ + const index_def_t* index_def) /*!< in: the index definition */ { dict_index_t* index; dberr_t err; @@ -3760,28 +3756,10 @@ row_merge_create_index( for (i = 0; i < n_fields; i++) { index_field_t* ifield = &index_def->fields[i]; - const char * col_name; - - /* - Alter table renaming a column and then adding a index - to this new name e.g ALTER TABLE t - CHANGE COLUMN b c INT NOT NULL, ADD UNIQUE INDEX (c); - requires additional check as column names are not yet - changed when new index definitions are created. Table's - new column names are on a array of column name pointers - if any of the column names are changed. */ - - if (col_names && col_names[i]) { - col_name = col_names[i]; - } else { - col_name = ifield->col_name ? - dict_table_get_col_name_for_mysql(table, ifield->col_name) : - dict_table_get_col_name(table, ifield->col_no); - } dict_mem_index_add_field( index, - col_name, + dict_table_get_col_name(table, ifield->col_no), ifield->prefix_len); } diff --git a/storage/xtradb/row/row0mysql.cc b/storage/xtradb/row/row0mysql.cc index 0079fc79a0e..67eb1d7de94 100644 --- a/storage/xtradb/row/row0mysql.cc +++ b/storage/xtradb/row/row0mysql.cc @@ -569,11 +569,33 @@ next_column: /* If there is a FTS doc id column and it is not user supplied ( generated by server) then assign it a new doc id. */ - if (prebuilt->table->fts) { + if (!prebuilt->table->fts) { + return; + } + + ut_a(prebuilt->table->fts->doc_col != ULINT_UNDEFINED); - ut_a(prebuilt->table->fts->doc_col != ULINT_UNDEFINED); + doc_id_t doc_id; - fts_create_doc_id(prebuilt->table, row, prebuilt->heap); + if (!DICT_TF2_FLAG_IS_SET(prebuilt->table, DICT_TF2_FTS_HAS_DOC_ID)) { + if (prebuilt->table->fts->cache->first_doc_id + == FTS_NULL_DOC_ID) { + fts_get_next_doc_id(prebuilt->table, &doc_id); + } + return; + } + + dfield_t* fts_doc_id = dtuple_get_nth_field( + row, prebuilt->table->fts->doc_col); + + if (fts_get_next_doc_id(prebuilt->table, &doc_id) == DB_SUCCESS) { + ut_a(doc_id != FTS_NULL_DOC_ID); + ut_ad(sizeof(doc_id) == fts_doc_id->type.len); + dfield_set_data(fts_doc_id, prebuilt->ins_upd_rec_buff + + prebuilt->mysql_row_len, 8); + fts_write_doc_id(fts_doc_id->data, doc_id); + } else { + dfield_set_null(fts_doc_id); } } @@ -1048,7 +1070,10 @@ row_get_prebuilt_insert_row( prebuilt->ins_upd_rec_buff = static_cast<byte*>( mem_heap_alloc( prebuilt->heap, - prebuilt->mysql_row_len)); + DICT_TF2_FLAG_IS_SET(prebuilt->table, + DICT_TF2_FTS_HAS_DOC_ID) + ? prebuilt->mysql_row_len + 8/* FTS_DOC_ID */ + : prebuilt->mysql_row_len)); } dtuple_t* row; diff --git a/storage/xtradb/row/row0sel.cc b/storage/xtradb/row/row0sel.cc index d96d6d37844..9cbadc305c0 100644 --- a/storage/xtradb/row/row0sel.cc +++ b/storage/xtradb/row/row0sel.cc @@ -2737,6 +2737,7 @@ row_sel_field_store_in_mysql_format_func( case DATA_SYS: /* These column types should never be shipped to MySQL. */ ut_ad(0); + /* fall through */ case DATA_CHAR: case DATA_FIXBINARY: diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index 56330bd68cb..a73de37bbd7 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -5112,7 +5112,6 @@ static int my_uni_utf8_no_range(CHARSET_INFO *cs __attribute__((unused)), switch (count) { - /* Fall through all cases!!! */ case 3: r[2]= (uchar) (0x80 | (wc & 0x3f)); wc= wc >> 6; wc |= 0x800; /* fall through */ case 2: r[1]= (uchar) (0x80 | (wc & 0x3f)); wc= wc >> 6; wc |= 0xc0; @@ -7497,7 +7496,6 @@ my_wc_mb_utf8mb4(CHARSET_INFO *cs __attribute__((unused)), return MY_CS_TOOSMALLN(count); switch (count) { - /* Fall through all cases!!! */ case 4: r[3] = (uchar) (0x80 | (wc & 0x3f)); wc = wc >> 6; wc |= 0x10000; /* fall through */ case 3: r[2] = (uchar) (0x80 | (wc & 0x3f)); wc = wc >> 6; wc |= 0x800; @@ -7532,7 +7530,6 @@ my_wc_mb_utf8mb4_no_range(CHARSET_INFO *cs __attribute__((unused)), switch (count) { - /* Fall through all cases!!! */ case 4: r[3]= (uchar) (0x80 | (wc & 0x3f)); wc= wc >> 6; wc |= 0x10000; /* fall through */ case 3: r[2]= (uchar) (0x80 | (wc & 0x3f)); wc= wc >> 6; wc |= 0x800; diff --git a/strings/dtoa.c b/strings/dtoa.c index 0da850bd1ca..9e0f7f4f43d 100644 --- a/strings/dtoa.c +++ b/strings/dtoa.c @@ -1466,11 +1466,9 @@ static double my_strtod_int(const char *s00, char **se, int *error, char *buf, s esign= 0; if (++s < end) switch (c= *s) { - case '-': - esign= 1; - /* fall through */ - case '+': - c= *++s; + case '-': esign= 1; + /* fall through */ + case '+': c= *++s; } if (s < end && c >= '0' && c <= '9') { diff --git a/win/packaging/ca/CustomAction.cpp b/win/packaging/ca/CustomAction.cpp index 9281ce27d34..c0062ddcdd1 100644 --- a/win/packaging/ca/CustomAction.cpp +++ b/win/packaging/ca/CustomAction.cpp @@ -767,6 +767,49 @@ extern "C" UINT __stdcall PresetDatabaseProperties(MSIHANDLE hInstall) LExit: return WcaFinalize(er); } + +static BOOL FindErrorLog(const wchar_t *dir, wchar_t * ErrorLogFile, size_t ErrorLogLen) +{ + WIN32_FIND_DATA FindFileData; + HANDLE hFind; + wchar_t name[MAX_PATH]; + wcsncpy_s(name,dir, MAX_PATH); + wcsncat_s(name,L"\\*.err", MAX_PATH); + hFind = FindFirstFileW(name,&FindFileData); + if (hFind != INVALID_HANDLE_VALUE) + { + _snwprintf(ErrorLogFile, ErrorLogLen, + L"%s\\%s",dir, FindFileData.cFileName); + FindClose(hFind); + return TRUE; + } + return FALSE; +} + +static void DumpErrorLog(const wchar_t *dir) +{ + wchar_t filepath[MAX_PATH]; + if (!FindErrorLog(dir, filepath, MAX_PATH)) + return; + FILE *f= _wfopen(filepath, L"r"); + if (!f) + return; + char buf[2048]; + WcaLog(LOGMSG_STANDARD,"=== dumping error log %S === ",filepath); + while (fgets(buf, sizeof(buf), f)) + { + /* Strip off EOL chars. */ + size_t len = strlen(buf); + if (len > 0 && buf[len-1] == '\n') + buf[--len]= 0; + if (len > 0 && buf[len-1] == '\r') + buf[--len]= 0; + WcaLog(LOGMSG_STANDARD,"%s",buf); + } + fclose(f); + WcaLog(LOGMSG_STANDARD,"=== end of error log ==="); +} + /* Remove service and data directory created by CreateDatabase operation */ extern "C" UINT __stdcall CreateDatabaseRollback(MSIHANDLE hInstall) { @@ -774,7 +817,6 @@ extern "C" UINT __stdcall CreateDatabaseRollback(MSIHANDLE hInstall) UINT er = ERROR_SUCCESS; wchar_t* service= 0; wchar_t* dir= 0; - hr = WcaInitialize(hInstall, __FUNCTION__); ExitOnFailure(hr, "Failed to initialize"); WcaLog(LOGMSG_STANDARD, "Initialized."); @@ -804,6 +846,7 @@ extern "C" UINT __stdcall CreateDatabaseRollback(MSIHANDLE hInstall) } if(dir) { + DumpErrorLog(dir); ExecRemoveDataDirectory(dir); } LExit: |