From 1297a9ef19be9e3f3c42316d12a5aaf53a9f4ca1 Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Mon, 25 Nov 2013 13:01:57 -0500 Subject: [PATCH 01/27] Fix for a compiler warning. --- mysys/my_getopt.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index f4a0f58511b..dd16e535eda 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -840,7 +840,6 @@ static int findopt(char *optpat, uint length, { uint count; const struct my_option *opt= *opt_res; - my_bool is_prefix= FALSE; DBUG_ENTER("findopt"); for (count= 0; opt->name; opt++) @@ -856,8 +855,6 @@ static int findopt(char *optpat, uint length, /* We only need to know one prev */ count= 1; *ffname= opt->name; - if (opt->name[length]) - is_prefix= TRUE; } else if (strcmp(*ffname, opt->name)) { From fb2de582941e77830133bde20e439fcad73b9a11 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Mon, 25 Nov 2013 21:38:01 +0400 Subject: [PATCH 02/27] MDEV-5321 Calling mysql_library_end accesses freed memory; dumps memory to display. Don't call the vio_end() in the clean_up() in EMBEDDED mode. Call vio_end() before the end_embedded_server(). --- libmysql/libmysql.c | 4 ++-- sql/mysqld.cc | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index a6b7d2d6c8a..242144abc50 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -204,11 +204,11 @@ void STDCALL mysql_server_end() mysql_client_plugin_deinit(); + finish_client_errs(); + vio_end(); #ifdef EMBEDDED_LIBRARY end_embedded_server(); #endif - finish_client_errs(); - vio_end(); /* If library called my_init(), free memory allocated by it */ if (!org_my_init_done) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 90c1a83b9fc..73995980ffc 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1851,7 +1851,9 @@ void clean_up(bool print_message) delete binlog_filter; delete rpl_filter; end_ssl(); +#ifndef EMBEDDED_LIBRARY vio_end(); +#endif /*!EMBEDDED_LIBRARY*/ my_regex_end(); #if defined(ENABLED_DEBUG_SYNC) /* End the debug sync facility. See debug_sync.cc. */ From 57a70a635a0b1445c4741def1b1d0445c6a5f7b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Wed, 27 Nov 2013 20:24:52 +0200 Subject: [PATCH 03/27] MDEV-5355: InnoDB assertion at shutdown if posix_fallocate is used in ut_a(node->n_pending == 0 || node->space->stop_new_ops); Analysis: When filespace is extended there is first prepare for IO. But if posix_fallocate is used there was no complete IO causing assertion at shutdown indicating that all IO is not finished. Fix: If posix_fallocate is used to extend the filespace, there is no need to wait for IO to complete, thus we treat this operation as a read operation. We need to mark IO as completed or there would be assertion on shutdown at fil_node_close_file() because all pending IO is not finished. --- storage/xtradb/fil/fil0fil.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/storage/xtradb/fil/fil0fil.c b/storage/xtradb/fil/fil0fil.c index 69a151be45f..c62c851bb7d 100644 --- a/storage/xtradb/fil/fil0fil.c +++ b/storage/xtradb/fil/fil0fil.c @@ -5027,10 +5027,16 @@ fil_extend_space_to_desired_size( mem_free(buf2); - fil_node_complete_io(node, fil_system, OS_FILE_WRITE); - #ifdef HAVE_POSIX_FALLOCATE complete_io: + /* If posix_fallocate was used to extent the file space + we need to complete the io. Because no actual writes were + dispatched read operation is enough here. Without this + there will be assertion at shutdown indicating that + all IO is not completed. */ + fil_node_complete_io(node, fil_system, OS_FILE_READ); +#else + fil_node_complete_io(node, fil_system, OS_FILE_WRITE); #endif *actual_size = space->size; From a5e236db54d04c721d2c41fa6e54c8a2007e38f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 28 Nov 2013 11:34:43 +0200 Subject: [PATCH 04/27] Add additional srv_use_fallocate guard for completing the IO with read. --- storage/xtradb/fil/fil0fil.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/storage/xtradb/fil/fil0fil.c b/storage/xtradb/fil/fil0fil.c index c62c851bb7d..19e656dfd92 100644 --- a/storage/xtradb/fil/fil0fil.c +++ b/storage/xtradb/fil/fil0fil.c @@ -5034,7 +5034,11 @@ complete_io: dispatched read operation is enough here. Without this there will be assertion at shutdown indicating that all IO is not completed. */ - fil_node_complete_io(node, fil_system, OS_FILE_READ); + if (srv_use_posix_fallocate) { + fil_node_complete_io(node, fil_system, OS_FILE_READ); + } else { + fil_node_complete_io(node, fil_system, OS_FILE_WRITE); + } #else fil_node_complete_io(node, fil_system, OS_FILE_WRITE); #endif From 253ed701e95a1875b8b50becd1c357b0f468b9fe Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Thu, 28 Nov 2013 19:54:07 +0400 Subject: [PATCH 05/27] A fix for MySQL#65146 introduced a new warning. Minor wording changes in skip messages. --- .../suite/storage_engine/have_engine.inc | 2 +- .../trx/cons_snapshot_serializable.rdiff | 18 ++++++++++++++++++ .../mysql-test/storage_engine/trx/disabled.def | 2 -- .../trx/level_read_committed.rdiff | 11 +++++++++++ .../trx/level_read_uncommitted.rdiff | 11 +++++++++++ .../mysql-test/storage_engine/disabled.def | 2 +- 6 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 storage/innobase/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff delete mode 100644 storage/innobase/mysql-test/storage_engine/trx/disabled.def create mode 100644 storage/innobase/mysql-test/storage_engine/trx/level_read_committed.rdiff create mode 100644 storage/innobase/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff diff --git a/mysql-test/suite/storage_engine/have_engine.inc b/mysql-test/suite/storage_engine/have_engine.inc index 5a6f05f42af..6f95716f488 100644 --- a/mysql-test/suite/storage_engine/have_engine.inc +++ b/mysql-test/suite/storage_engine/have_engine.inc @@ -38,7 +38,7 @@ let $default_char_type = CHAR(8); if (!$ENGINE) { - --skip ERROR: Storage engine under test is not defined, export ENGINE env variable or set it in define_engine.inc + --skip Storage engine under test is not defined, export ENGINE env variable or set it in define_engine.inc } # Check that the storage engine is loaded. Here we don't need to worry about the case, diff --git a/storage/innobase/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff b/storage/innobase/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff new file mode 100644 index 00000000000..e6149be58dc --- /dev/null +++ b/storage/innobase/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff @@ -0,0 +1,18 @@ +--- suite/storage_engine/trx/cons_snapshot_serializable.result 2013-11-27 18:46:36.000000000 +0400 ++++ suite/storage_engine/trx/cons_snapshot_serializable.reject 2013-11-28 19:17:02.000000000 +0400 +@@ -5,12 +5,15 @@ + CREATE TABLE t1 (a ) ENGINE= ; + SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; + START TRANSACTION WITH CONSISTENT SNAPSHOT; ++Warnings: ++Warning 138 InnoDB: WITH CONSISTENT SNAPSHOT was ignored because this phrase can only be used with REPEATABLE READ isolation level. + connection con2; + INSERT INTO t1 (a) VALUES (1); + connection con1; + # If consistent read works on this isolation level (SERIALIZABLE), the following SELECT should not return the value we inserted (1) + SELECT a FROM t1; + a ++1 + COMMIT; + connection default; + disconnect con1; diff --git a/storage/innobase/mysql-test/storage_engine/trx/disabled.def b/storage/innobase/mysql-test/storage_engine/trx/disabled.def deleted file mode 100644 index 7b8a16d0b7a..00000000000 --- a/storage/innobase/mysql-test/storage_engine/trx/disabled.def +++ /dev/null @@ -1,2 +0,0 @@ -cons_snapshot_serializable : MySQL:65146 (CONSISTENT SNAPSHOT does not work with SERIALIZABLE) - diff --git a/storage/innobase/mysql-test/storage_engine/trx/level_read_committed.rdiff b/storage/innobase/mysql-test/storage_engine/trx/level_read_committed.rdiff new file mode 100644 index 00000000000..cb64d32138b --- /dev/null +++ b/storage/innobase/mysql-test/storage_engine/trx/level_read_committed.rdiff @@ -0,0 +1,11 @@ +--- suite/storage_engine/trx/level_read_committed.result 2013-11-28 19:18:48.000000000 +0400 ++++ suite/storage_engine/trx/level_read_committed.reject 2013-11-28 19:18:59.000000000 +0400 +@@ -77,6 +77,8 @@ + CREATE TABLE t1 (a ) ENGINE= ; + SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; + START TRANSACTION WITH CONSISTENT SNAPSHOT; ++Warnings: ++Warning 138 InnoDB: WITH CONSISTENT SNAPSHOT was ignored because this phrase can only be used with REPEATABLE READ isolation level. + connection con2; + INSERT INTO t1 (a) VALUES (1); + connection con1; diff --git a/storage/innobase/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff b/storage/innobase/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff new file mode 100644 index 00000000000..6a79abe3ca5 --- /dev/null +++ b/storage/innobase/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff @@ -0,0 +1,11 @@ +--- suite/storage_engine/trx/level_read_uncommitted.result 2013-11-28 19:18:48.000000000 +0400 ++++ suite/storage_engine/trx/level_read_uncommitted.reject 2013-11-28 19:19:50.000000000 +0400 +@@ -102,6 +102,8 @@ + CREATE TABLE t1 (a ) ENGINE= ; + SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; + START TRANSACTION WITH CONSISTENT SNAPSHOT; ++Warnings: ++Warning 138 InnoDB: WITH CONSISTENT SNAPSHOT was ignored because this phrase can only be used with REPEATABLE READ isolation level. + connection con2; + INSERT INTO t1 (a) VALUES (1); + connection con1; diff --git a/storage/myisammrg/mysql-test/storage_engine/disabled.def b/storage/myisammrg/mysql-test/storage_engine/disabled.def index 9f7569a2d24..86b96c2ba2b 100644 --- a/storage/myisammrg/mysql-test/storage_engine/disabled.def +++ b/storage/myisammrg/mysql-test/storage_engine/disabled.def @@ -1,2 +1,2 @@ -alter_table_online : MySQL:57657 (Temporary MERGE table with temporary underlying is broken by ALTER) +alter_table_online : MDEV-5266 (Temporary MERGE table with temporary underlying is broken by ALTER) From bbda717e9304aa0734dde55b1839cd819875f1cf Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Mon, 2 Dec 2013 22:22:43 +0200 Subject: [PATCH 06/27] Fixed compiler errors and warnings extra/jemalloc/src/ctl.c: Fixed compiler warning include/mysql/service_logger.h: Fixed compile failure with clang compiler storage/maria/ma_check.c: Fixed compiler warning support-files/compiler_warnings.supp: Suppressed warnings in jemalloc tests/bug25714.c: Fixed compiler warning --- extra/jemalloc/src/ctl.c | 2 +- include/mysql/service_logger.h | 2 +- storage/maria/ma_check.c | 2 ++ support-files/compiler_warnings.supp | 5 +++++ tests/bug25714.c | 2 +- 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/extra/jemalloc/src/ctl.c b/extra/jemalloc/src/ctl.c index f2ef4e60611..7ce4fc4d573 100644 --- a/extra/jemalloc/src/ctl.c +++ b/extra/jemalloc/src/ctl.c @@ -1109,7 +1109,7 @@ epoch_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, void *newp, size_t newlen) { int ret; - uint64_t newval; + uint64_t newval __attribute__((unused)); malloc_mutex_lock(&ctl_mtx); WRITE(newval, uint64_t); diff --git a/include/mysql/service_logger.h b/include/mysql/service_logger.h index a84c4a4f2ee..962ab2fbc0b 100644 --- a/include/mysql/service_logger.h +++ b/include/mysql/service_logger.h @@ -80,7 +80,7 @@ extern struct logger_service_st { #define logger_rotate(log) (logger_service->rotate(log)) #define logger_vprintf(log, fmt, argptr) (logger_service->\ vprintf(log, fmt, argptr)) -#define logger_printf logger_service->printf +#define logger_printf (*logger_service->printf) #define logger_write(log, buffer, size) \ (logger_service->write(log, buffer, size)) #else diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index d63ac8be3cb..b7bd08d8bb7 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -1862,6 +1862,8 @@ static int check_block_record(HA_CHECK *param, MARIA_HA *info, int extend, uint UNINIT_VAR(row_count), real_row_count, empty_space, page_type, bitmap_pattern; uint bitmap_for_page; + LINT_INIT(empty_space); + if (_ma_killed_ptr(param)) { _ma_scan_end_block_record(info); diff --git a/support-files/compiler_warnings.supp b/support-files/compiler_warnings.supp index cd39b3f7a9d..315af529149 100644 --- a/support-files/compiler_warnings.supp +++ b/support-files/compiler_warnings.supp @@ -160,6 +160,11 @@ include/pwdbased\.hpp: comparison of unsigned expression /usr/include/sys/feature_tests.h : this is the location of the previous definition .*auth_pam\.c : initialization from incompatible pointer type : 100-200 +# +# jemalloc +# +jemalloc/src/jemalloc\.c: always_inline function might not be inlinable + # # Unexplanable (?) stuff # diff --git a/tests/bug25714.c b/tests/bug25714.c index 40c631d76a5..7e6be13624b 100644 --- a/tests/bug25714.c +++ b/tests/bug25714.c @@ -23,7 +23,7 @@ int main (int argc, char **argv) { MYSQL conn; - int OK; + int OK __attribute__((unused)); const char* query4= "INSERT INTO federated.t1 SET Value=54"; const char* query5= "INSERT INTO federated.t1 SET Value=55"; From 98c609248b421338f7df7eb0327433a9cf638cb0 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 20 Nov 2013 11:50:27 +0100 Subject: [PATCH 07/27] set CMP0022 policy to avoid cmake warnings --- CMakeLists.txt | 6 ++++++ storage/tokudb/ft-index/CMakeLists.txt | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ceaf7d17df9..c63fe3e42f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,6 +20,12 @@ if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.6) CMAKE_POLICY(VERSION 2.8) endif() +# explicitly set the policy to OLD +# (cannot use NEW, not everyone is on cmake-2.8.12 yet) +IF(POLICY CMP0022) + CMAKE_POLICY(SET CMP0022 OLD) +ENDIF() + MESSAGE(STATUS "Running cmake version ${CMAKE_VERSION}") SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake) diff --git a/storage/tokudb/ft-index/CMakeLists.txt b/storage/tokudb/ft-index/CMakeLists.txt index 87c04be75e5..22249b66522 100644 --- a/storage/tokudb/ft-index/CMakeLists.txt +++ b/storage/tokudb/ft-index/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules") project(TokuDB) From 5e812ee03bc39667edc12d171c56080c7a009f71 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 20 Nov 2013 12:18:46 +0100 Subject: [PATCH 08/27] MDEV-5303 rpm post-inst scriptlet creates mysql user with a valid shell create mysql user with /sbin/nologin shell --- support-files/rpm/server-postin.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/support-files/rpm/server-postin.sh b/support-files/rpm/server-postin.sh index b4d63815fe9..91885f73466 100644 --- a/support-files/rpm/server-postin.sh +++ b/support-files/rpm/server-postin.sh @@ -23,9 +23,9 @@ if [ $1 = 1 ] ; then # Create a MySQL user and group. Do not report any problems if it already # exists. groupadd -r %{mysqld_group} 2> /dev/null || true - useradd -M -r -d $datadir -s /bin/bash -c "MySQL server" -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true + useradd -M -r --home $datadir --shell /sbin/nologin --comment "MySQL server" --gid %{mysqld_group} %{mysqld_user} 2> /dev/null || true # The user may already exist, make sure it has the proper group nevertheless (BUG#12823) - usermod -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true + usermod --gid %{mysqld_group} %{mysqld_user} 2> /dev/null || true # Change permissions so that the user that will run the MySQL daemon # owns all database files. From 928543ca6c3f37fb1f401d5fc41c71e597e76927 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Wed, 27 Nov 2013 17:43:16 +0400 Subject: [PATCH 09/27] MDEV-5344: LEFT OUTER JOIN table data is lost in ON DUPLICATE KEY UPDATE section - For INSERT ... SELECT ... ON DUPLICATE KEY UPDATE, table elimination should check which tables are referenced in the ON DUPLICATE KEY UPDATE clause. --- mysql-test/r/table_elim.result | 28 ++++++++++++++++++++++++++++ mysql-test/t/table_elim.test | 29 +++++++++++++++++++++++++++++ sql/opt_table_elimination.cc | 15 +++++++++++++++ 3 files changed, 72 insertions(+) diff --git a/mysql-test/r/table_elim.result b/mysql-test/r/table_elim.result index 35acd30d76d..1ac46a21cce 100644 --- a/mysql-test/r/table_elim.result +++ b/mysql-test/r/table_elim.result @@ -609,4 +609,32 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where; Using index drop view v1; DROP TABLE t1,t2,t3; +# +# MDEV-5344: LEFT OUTER JOIN table data is lost in ON DUPLICATE KEY UPDATE section +# +create table t1 ( +id int(10) unsigned NOT NULL DEFAULT '0', +v int(10) unsigned DEFAULT '0', +PRIMARY KEY (id) +); +create table t2 ( +id int(10) unsigned NOT NULL DEFAULT '0', +PRIMARY KEY (id) +) ; +create table t3 ( +id int(10) unsigned NOT NULL DEFAULT '0', +v int(10) unsigned DEFAULT '0', +PRIMARY KEY (id) +); +insert into t1 values (1, 10), (2, 10); +insert into t2 values (1), (2); +insert into t3 values (1, 20); +insert into t1 +select t2.id, 5 from t2 LEFT OUTER JOIN t3 ON t2.id = t3.id +on duplicate key update t1.v = t3.v; +select * from t1; +id v +1 20 +2 NULL +drop table t1,t2,t3; SET optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/t/table_elim.test b/mysql-test/t/table_elim.test index a957e24e393..5269cb1bda9 100644 --- a/mysql-test/t/table_elim.test +++ b/mysql-test/t/table_elim.test @@ -543,6 +543,35 @@ EXPLAIN SELECT alias1.* FROM t3 LEFT JOIN v1 as alias1 ON ( t3.a = alias1.b ); drop view v1; DROP TABLE t1,t2,t3; +--echo # +--echo # MDEV-5344: LEFT OUTER JOIN table data is lost in ON DUPLICATE KEY UPDATE section +--echo # +create table t1 ( + id int(10) unsigned NOT NULL DEFAULT '0', + v int(10) unsigned DEFAULT '0', + PRIMARY KEY (id) +); +create table t2 ( + id int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (id) +) ; + +create table t3 ( + id int(10) unsigned NOT NULL DEFAULT '0', + v int(10) unsigned DEFAULT '0', + PRIMARY KEY (id) +); + +insert into t1 values (1, 10), (2, 10); +insert into t2 values (1), (2); +insert into t3 values (1, 20); + +insert into t1 +select t2.id, 5 from t2 LEFT OUTER JOIN t3 ON t2.id = t3.id +on duplicate key update t1.v = t3.v; + +select * from t1; +drop table t1,t2,t3; SET optimizer_switch=@save_optimizer_switch; diff --git a/sql/opt_table_elimination.cc b/sql/opt_table_elimination.cc index 545001c9df1..1df35e93e45 100644 --- a/sql/opt_table_elimination.cc +++ b/sql/opt_table_elimination.cc @@ -594,6 +594,21 @@ void eliminate_tables(JOIN *join) /* Find the tables that are referred to from WHERE/HAVING */ used_tables= (join->conds? join->conds->used_tables() : 0) | (join->having? join->having->used_tables() : 0); + + /* + For "INSERT ... SELECT ... ON DUPLICATE KEY UPDATE column = val" + we should also take into account tables mentioned in "val". + */ + if (join->thd->lex->sql_command == SQLCOM_INSERT_SELECT && + join->select_lex == &thd->lex->select_lex) + { + List_iterator val_it(thd->lex->value_list); + while ((item= val_it++)) + { + DBUG_ASSERT(item->fixed); + used_tables |= item->used_tables(); + } + } /* Add tables referred to from the select list */ List_iterator it(join->fields_list); From c2839e2cf2617005d06d9bb14b98d70e2d905225 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 27 Nov 2013 21:58:36 +0100 Subject: [PATCH 10/27] mysql-test: allow suite.pm add its suite to the default list. run tokudb suites by default. mark big and slow tests tokudb.change_column_all_1000_1 and tokudb.change_column_all_1000_10 test as --big --- mysql-test/lib/My/Suite.pm | 1 + mysql-test/lib/mtr_cases.pm | 26 +++++++- mysql-test/mysql-test-run.pl | 64 ++++++++++--------- storage/tokudb/mysql-test/tokudb/suite.pm | 3 + .../tokudb/t/change_column_all_1000_1.test | 1 + .../tokudb/t/change_column_all_1000_10.test | 1 + .../mysql-test/tokudb_add_index/suite.pm | 3 + .../mysql-test/tokudb_alter_table/suite.pm | 3 + .../tokudb/mysql-test/tokudb_bugs/suite.pm | 3 + .../tokudb/mysql-test/tokudb_mariadb/suite.pm | 3 + 10 files changed, 75 insertions(+), 33 deletions(-) diff --git a/mysql-test/lib/My/Suite.pm b/mysql-test/lib/My/Suite.pm index b5870ea1e16..a603008fabe 100644 --- a/mysql-test/lib/My/Suite.pm +++ b/mysql-test/lib/My/Suite.pm @@ -3,6 +3,7 @@ package My::Suite; +sub is_default { 0 } sub config_files { () } sub servers { () } sub skip_combinations { () } diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index 1327afdb426..f1960f6d9de 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -23,7 +23,7 @@ package mtr_cases; use strict; use base qw(Exporter); -our @EXPORT= qw(collect_option collect_test_cases); +our @EXPORT= qw(collect_option collect_test_cases collect_default_suites); use Carp; @@ -315,11 +315,33 @@ sub parse_disabled { } } +# +# load suite.pm files from plugin suites +# collect the list of default plugin suites. +# +sub collect_default_suites(@) +{ + my @dirs = my_find_dir(dirname($::glob_mysql_test_dir), + ['storage/*/mysql-test/*', 'plugin/*/mysql-test/*'], + [], NOT_REQUIRED); + for my $d (@dirs) { + next unless -f "$d/suite.pm"; + my $sname= basename($d); + # ignore overlays here, otherwise we'd need accurate + # duplicate detection with overlay support for the default suite list + next if $sname eq 'main' or -d "$::glob_mysql_test_dir/suite/$sname"; + my $s = load_suite_object($sname, $d); + push @_, $sname if $s->is_default(); + } + return @_; +} + + # # processes one user-specified suite name. # it could contain wildcards, e.g engines/* # -sub collect_suite_name +sub collect_suite_name($$) { my $suitename= shift; # Test suite name my $opt_cases= shift; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index a2c0ce8fb49..d909391f033 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -162,30 +162,30 @@ my $path_config_file; # The generated config file, var/my.cnf # executables will be used by the test suite. our $opt_vs_config = $ENV{'MTR_VS_CONFIG'}; -my $DEFAULT_SUITES= join(',', map { "$_-" } qw( - main - archive - binlog - csv - federated - funcs_1 - funcs_2 - handler - heap - innodb - maria - optimizer_unfixed_bugs - oqgraph - parts - percona - perfschema - plugins - rpl - sphinx - sys_vars - unit - vcol - )); +my @DEFAULT_SUITES= qw( + main- + archive- + binlog- + csv- + federated- + funcs_1- + funcs_2- + handler- + heap- + innodb- + maria- + optimizer_unfixed_bugs- + oqgraph- + parts- + percona- + perfschema- + plugins- + rpl- + sphinx- + sys_vars- + unit- + vcol- + ); my $opt_suites; our $opt_verbose= 0; # Verbose output, enable with --verbose @@ -384,11 +384,6 @@ sub main { } - if (!$opt_suites) { - $opt_suites= $DEFAULT_SUITES; - } - mtr_report("Using suites: $opt_suites") unless @opt_cases; - print "vardir: $opt_vardir\n"; initialize_servers(); init_timers(); @@ -397,6 +392,11 @@ sub main { executable_setup(); + if (!$opt_suites) { + $opt_suites= join ',', collect_default_suites(@DEFAULT_SUITES); + } + mtr_report("Using suites: $opt_suites") unless @opt_cases; + # --debug[-common] implies we run debug server $opt_debug_server= 1 if $opt_debug || $opt_debug_common; @@ -2940,7 +2940,7 @@ sub check_ndbcluster_support { mtr_report(" - enabling ndbcluster"); $ndbcluster_enabled= 1; # Add MySQL Cluster test suites - $DEFAULT_SUITES.=",ndb,ndb_binlog,rpl_ndb,ndb_rpl,ndb_memcache"; + push @DEFAULT_SUITES, qw(ndb ndb_binlog rpl_ndb ndb_rpl ndb_memcache); return; } @@ -6307,6 +6307,8 @@ sub usage ($) { exit; } + local $"= ','; # for @DEFAULT_SUITES below + print < Date: Wed, 27 Nov 2013 21:58:47 +0100 Subject: [PATCH 11/27] install and package plugin suites. --- cmake/install_macros.cmake | 24 ++++++++++++++++++++ cmake/plugin.cmake | 22 +++++------------- mysql-test/CMakeLists.txt | 24 +------------------- mysql-test/lib/mtr_cases.pm | 45 +++++++++++++++++++++++-------------- 4 files changed, 58 insertions(+), 57 deletions(-) diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake index 9f4148342a7..f2e474395dc 100644 --- a/cmake/install_macros.cmake +++ b/cmake/install_macros.cmake @@ -376,3 +376,27 @@ FUNCTION(INSTALL_DEBUG_TARGET target) ENDIF() ENDFUNCTION() + +FUNCTION(INSTALL_MYSQL_TEST from to) + IF(INSTALL_MYSQLTESTDIR) + INSTALL( + DIRECTORY ${from} + DESTINATION "${INSTALL_MYSQLTESTDIR}/${to}" + USE_SOURCE_PERMISSIONS + COMPONENT Test + PATTERN "var/" EXCLUDE + PATTERN "lib/My/SafeProcess" EXCLUDE + PATTERN "lib/t*" EXCLUDE + PATTERN "CPack" EXCLUDE + PATTERN "CMake*" EXCLUDE + PATTERN "mtr.out*" EXCLUDE + PATTERN ".cvsignore" EXCLUDE + PATTERN "*.am" EXCLUDE + PATTERN "*.in" EXCLUDE + PATTERN "*.vcxproj" EXCLUDE + PATTERN "*.vcxproj.filters" EXCLUDE + PATTERN "*.vcxproj.user" EXCLUDE + PATTERN "CTest" EXCLUDE + ) + ENDIF() +ENDFUNCTION() diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index afc359d1d09..83f819836f8 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -27,23 +27,6 @@ INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake) # [LINK_LIBRARIES lib1...libN] # [DEPENDENCIES target1...targetN] -# Append collections files for the plugin to the common files -# Make sure we don't copy twice if running cmake again - -MACRO(PLUGIN_APPEND_COLLECTIONS plugin) - SET(fcopied "${CMAKE_CURRENT_SOURCE_DIR}/tests/collections/FilesCopied") - IF(NOT EXISTS ${fcopied}) - FILE(GLOB collections ${CMAKE_CURRENT_SOURCE_DIR}/tests/collections/*) - FOREACH(cfile ${collections}) - FILE(READ ${cfile} contents) - GET_FILENAME_COMPONENT(fname ${cfile} NAME) - FILE(APPEND ${CMAKE_SOURCE_DIR}/mysql-test/collections/${fname} "${contents}") - FILE(APPEND ${fcopied} "${fname}\n") - MESSAGE(STATUS "Appended ${cfile}") - ENDFOREACH() - ENDIF() -ENDMACRO() - MACRO(MYSQL_ADD_PLUGIN) MYSQL_PARSE_ARGUMENTS(ARG "LINK_LIBRARIES;DEPENDENCIES;MODULE_OUTPUT_NAME;STATIC_OUTPUT_NAME;COMPONENT" @@ -236,6 +219,11 @@ MACRO(MYSQL_ADD_PLUGIN) TARGET_LINK_LIBRARIES (${target} ${ARG_LINK_LIBRARIES}) ENDIF() + GET_FILENAME_COMPONENT(subpath ${CMAKE_CURRENT_SOURCE_DIR} NAME) + IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/mysql-test") + INSTALL_MYSQL_TEST("${CMAKE_CURRENT_SOURCE_DIR}/mysql-test/" "plugin/${subpath}") + ENDIF() + ENDMACRO() diff --git a/mysql-test/CMakeLists.txt b/mysql-test/CMakeLists.txt index 5ffbd78316c..16eb2a6f166 100644 --- a/mysql-test/CMakeLists.txt +++ b/mysql-test/CMakeLists.txt @@ -13,29 +13,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -IF(INSTALL_MYSQLTESTDIR) -INSTALL( - DIRECTORY . - DESTINATION ${INSTALL_MYSQLTESTDIR} - USE_SOURCE_PERMISSIONS - COMPONENT Test - PATTERN "var/" EXCLUDE - PATTERN "lib/My/SafeProcess" EXCLUDE - PATTERN "lib/t*" EXCLUDE - PATTERN "CPack" EXCLUDE - PATTERN "CMake*" EXCLUDE - PATTERN "mtr.out*" EXCLUDE - PATTERN ".cvsignore" EXCLUDE - PATTERN "*.am" EXCLUDE - PATTERN "*.in" EXCLUDE - PATTERN "*.vcxproj" EXCLUDE - PATTERN "*.vcxproj.filters" EXCLUDE - PATTERN "*.vcxproj.user" EXCLUDE - PATTERN "CTest" EXCLUDE -) -ENDIF() - - +INSTALL_MYSQL_TEST("." ".") IF(NOT ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) # Enable running mtr from build directory diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index f1960f6d9de..870df115f58 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -62,6 +62,21 @@ use My::Suite; require "mtr_misc.pl"; +# locate plugin suites, depending on whether it's a build tree or installed +my @plugin_suitedirs; +my $plugin_suitedir_regex; +my $overlay_regex; + +if (-d '../sql') { + @plugin_suitedirs= ('storage/*/mysql-test', 'plugin/*/mysql-test'); + $overlay_regex= '\b(?:storage|plugin)/(\w+)/mysql-test\b'; +} else { + @plugin_suitedirs= ('mysql-test/plugin/*'); + $overlay_regex= '\bmysql-test/plugin/(\w+)\b'; +} +$plugin_suitedir_regex= $overlay_regex; +$plugin_suitedir_regex=~ s/\Q(\w+)\E/\\w+/; + # Precompiled regex's for tests to do or skip my $do_test_reg; my $skip_test_reg; @@ -263,12 +278,11 @@ sub load_suite_object { # returns a pair of (suite, suitedir) -sub load_suite_for_file($) { +sub suite_for_file($) { my ($file) = @_; - return load_suite_object($2, $1) - if $file =~ m@^(.*/(?:storage|plugin)/\w+/mysql-test/(\w+))/@; - return load_suite_object($2, $1) if $file =~ m@^(.*/mysql-test/suite/(\w+))/@; - return load_suite_object('main', $1) if $file =~ m@^(.*/mysql-test)/@; + return ($2, $1) if $file =~ m@^(.*/$plugin_suitedir_regex/(\w+))/@o; + return ($2, $1) if $file =~ m@^(.*/mysql-test/suite/(\w+))/@; + return ('main', $1) if $file =~ m@^(.*/mysql-test)/@; mtr_error("Cannot determine suite for $file"); } @@ -318,12 +332,12 @@ sub parse_disabled { # # load suite.pm files from plugin suites # collect the list of default plugin suites. +# XXX currently it does not support nested suites # sub collect_default_suites(@) { my @dirs = my_find_dir(dirname($::glob_mysql_test_dir), - ['storage/*/mysql-test/*', 'plugin/*/mysql-test/*'], - [], NOT_REQUIRED); + [ @plugin_suitedirs ], '*'); for my $d (@dirs) { next unless -f "$d/suite.pm"; my $sname= basename($d); @@ -361,25 +375,22 @@ sub collect_suite_name($$) else { my @dirs = my_find_dir(dirname($::glob_mysql_test_dir), - ["mysql-test/suite", - "storage/*/mysql-test", - "plugin/*/mysql-test"], - [$suitename]); + ["mysql-test/suite", @plugin_suitedirs ], + $suitename); # # if $suitename contained wildcards, we'll have many suites and # their overlays here. Let's group them appropriately. # for (@dirs) { - m@^.*/mysql-test/(?:suite/)?(.*)$@ or confess $_; + m@^.*/(?:mysql-test/suite|$plugin_suitedir_regex)/(.*)$@o or confess $_; push @{$suites{$1}}, $_; } } } else { $suites{$suitename} = [ $::glob_mysql_test_dir, my_find_dir(dirname($::glob_mysql_test_dir), - ["storage/*/mysql-test", - "plugin/*/mysql-test"], - ['main'], NOT_REQUIRED) ]; + [ @plugin_suitedirs ], + 'main', NOT_REQUIRED) ]; } my @cases; @@ -426,7 +437,7 @@ sub collect_one_suite { local %file_combinations = (); local %file_in_overlay = (); - confess $_ unless m@/(?:storage|plugin)/(\w+)/mysql-test/[\w/]*\w$@; + confess $_ unless m@/$overlay_regex/@o; next unless defined $over and ($over eq '' or $over eq $1); push @cases, # don't add cases that take *all* data from the parent suite @@ -1072,7 +1083,7 @@ sub get_tags_from_file($$) { # for combinations we need to make sure that its suite object is loaded, # even if this file does not belong to a current suite! my $comb_file = "$suffix.combinations"; - $suite = load_suite_for_file($comb_file) if $prefix[0] eq ''; + $suite = load_suite_object(suite_for_file($comb_file)) if $prefix[0] eq ''; my @comb; unless ($suite->{skip}) { my $from = "$prefix[0]$comb_file"; From f534708bd6637da06a0dbeb5192351072a8bbbcd Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 29 Nov 2013 20:21:05 +0100 Subject: [PATCH 12/27] MDEV-5266 MySQL:57657 - Temporary MERGE table with temporary underlying is broken by ALTER Fix ha_myisammrg::update_create_info() to do what ha_myisammrg::append_create_info() does - take sub-table names from TABLE_LIST, not reverse engineer tablefile names. Backport praveenkumar.hulakund@oracle.com-20120127081643-u7dxy23i8yyqarm7 from mysql-5.6 --- mysql-test/r/merge.result | 7 ++++++ mysql-test/t/merge.test | 9 +++++++ storage/myisammrg/ha_myisammrg.cc | 39 +++++++++++++++++-------------- 3 files changed, 38 insertions(+), 17 deletions(-) diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index 937fa77a885..7b50be68281 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -2368,4 +2368,11 @@ FLUSH TABLES; ERROR HY000: Can't reopen table: 'm1' UNLOCK TABLES; DROP TABLE t1, t2, t3, m1; +create temporary table t1_temp(i int); +create temporary table tm_temp_temp (i int) engine=merge union=(t1_temp) insert_method=last; +alter table tm_temp_temp insert_method=first; +check table tm_temp_temp; +Table Op Msg_type Msg_text +test.tm_temp_temp check status OK +drop temporary table t1_temp, tm_temp_temp; End of 5.1 tests diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index eecf892869f..cc26ba35661 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -1863,6 +1863,15 @@ FLUSH TABLES; UNLOCK TABLES; DROP TABLE t1, t2, t3, m1; +# +# MDEV-5266 MySQL:57657 - Temporary MERGE table with temporary underlying is broken by ALTER +# +create temporary table t1_temp(i int); +create temporary table tm_temp_temp (i int) engine=merge union=(t1_temp) insert_method=last; +alter table tm_temp_temp insert_method=first; +check table tm_temp_temp; +drop temporary table t1_temp, tm_temp_temp; + --echo End of 5.1 tests --disable_result_log diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index 28e2a87e3c5..99ee81d2438 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -1111,31 +1111,36 @@ void ha_myisammrg::update_create_info(HA_CREATE_INFO *create_info) if (!(create_info->used_fields & HA_CREATE_USED_UNION)) { - MYRG_TABLE *open_table; + TABLE_LIST *child_table; THD *thd=current_thd; create_info->merge_list.next= &create_info->merge_list.first; create_info->merge_list.elements=0; - for (open_table=file->open_tables ; - open_table != file->end_table ; - open_table++) + if (table->child_l != NULL) { - TABLE_LIST *ptr; - LEX_STRING db, name; - LINT_INIT(db.str); + for (child_table= table->child_l;; + child_table= child_table->next_global) + { + TABLE_LIST *ptr; - if (!(ptr = (TABLE_LIST *) thd->calloc(sizeof(TABLE_LIST)))) - goto err; - split_file_name(open_table->table->filename, &db, &name); - if (!(ptr->table_name= thd->strmake(name.str, name.length))) - goto err; - if (db.length && !(ptr->db= thd->strmake(db.str, db.length))) - goto err; + if (!(ptr= (TABLE_LIST *) thd->calloc(sizeof(TABLE_LIST)))) + goto err; - create_info->merge_list.elements++; - (*create_info->merge_list.next) = ptr; - create_info->merge_list.next= &ptr->next_local; + if (!(ptr->table_name= thd->strmake(child_table->table_name, + child_table->table_name_length))) + goto err; + if (child_table->db && !(ptr->db= thd->strmake(child_table->db, + child_table->db_length))) + goto err; + + create_info->merge_list.elements++; + (*create_info->merge_list.next)= ptr; + create_info->merge_list.next= &ptr->next_local; + + if (&child_table->next_global == table->child_last_l) + break; + } } *create_info->merge_list.next=0; } From b97b9536c71b3ad5ef521a1f21c527057a0a01c6 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 2 Dec 2013 15:09:34 +0400 Subject: [PATCH 13/27] MDEV-4857 Wrong result of HOUR('1 00:00:00') modified: mysql-test/r/func_time.result mysql-test/t/func_time.test sql-common/my_time.c sql/item_func.h sql/item_timefunc.cc sql/mysql_priv.h sql/time.cc --- mysql-test/r/func_time.result | 31 +++++++++++++++++++++++++++++-- mysql-test/t/func_time.test | 12 ++++++++++++ sql-common/my_time.c | 4 ++-- sql/item_func.h | 4 +++- sql/item_timefunc.cc | 4 ++++ sql/mysql_priv.h | 1 + sql/time.cc | 19 +++++++++++++++++++ 7 files changed, 70 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index c1b17948402..7020007f940 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -365,7 +365,7 @@ extract(DAY_MINUTE FROM "02 10:11:12") 21011 select extract(DAY_SECOND FROM "225 10:11:12"); extract(DAY_SECOND FROM "225 10:11:12") -8385959 +34225959 Warnings: Warning 1292 Truncated incorrect time value: '225 10:11:12' select extract(HOUR FROM "1999-01-02 10:11:12"); @@ -1035,7 +1035,7 @@ Warning 1105 Cast to unsigned converted negative integer to it's positive comple Warning 1292 Truncated incorrect time value: '18446744073709551615:00:00' SELECT EXTRACT(HOUR FROM '100000:02:03'); EXTRACT(HOUR FROM '100000:02:03') -838 +22 Warnings: Warning 1292 Truncated incorrect time value: '100000:02:03' CREATE TABLE t1(f1 TIME); @@ -2320,3 +2320,30 @@ DROP TABLE t1; SELECT MAKETIME(0, 0, -0.1); MAKETIME(0, 0, -0.1) NULL +# +# MDEV-4857 Wrong result of HOUR('1 00:00:00') +# +SELECT HOUR('1 02:00:00'), HOUR('26:00:00'); +HOUR('1 02:00:00') HOUR('26:00:00') +26 26 +SELECT HOUR(TIME'1 02:00:00'), HOUR(TIME'26:00:00'); +HOUR(TIME'1 02:00:00') HOUR(TIME'26:00:00') +26 26 +SELECT HOUR(TIME('1 02:00:00')), HOUR(TIME('26:00:00')); +HOUR(TIME('1 02:00:00')) HOUR(TIME('26:00:00')) +26 26 +SELECT DAY(TIME('1 02:00:00')), DAY(TIME('26:00:00')); +DAY(TIME('1 02:00:00')) DAY(TIME('26:00:00')) +0 0 +SELECT EXTRACT(HOUR FROM '1 02:00:00'), EXTRACT(HOUR FROM '26:00:00'); +EXTRACT(HOUR FROM '1 02:00:00') EXTRACT(HOUR FROM '26:00:00') +2 2 +SELECT EXTRACT(HOUR FROM TIME'1 02:00:00'), EXTRACT(HOUR FROM TIME'26:00:00'); +EXTRACT(HOUR FROM TIME'1 02:00:00') EXTRACT(HOUR FROM TIME'26:00:00') +2 2 +SELECT EXTRACT(HOUR FROM TIME('1 02:00:00')), EXTRACT(HOUR FROM TIME('26:00:00')); +EXTRACT(HOUR FROM TIME('1 02:00:00')) EXTRACT(HOUR FROM TIME('26:00:00')) +2 2 +SELECT EXTRACT(DAY FROM TIME('1 02:00:00')), EXTRACT(DAY FROM TIME('26:00:00')); +EXTRACT(DAY FROM TIME('1 02:00:00')) EXTRACT(DAY FROM TIME('26:00:00')) +1 1 diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 72efff02699..91ccb06655e 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -1405,3 +1405,15 @@ DROP TABLE t1; --echo # SELECT MAKETIME(0, 0, -0.1); +--echo # +--echo # MDEV-4857 Wrong result of HOUR('1 00:00:00') +--echo # +SELECT HOUR('1 02:00:00'), HOUR('26:00:00'); +SELECT HOUR(TIME'1 02:00:00'), HOUR(TIME'26:00:00'); +SELECT HOUR(TIME('1 02:00:00')), HOUR(TIME('26:00:00')); +SELECT DAY(TIME('1 02:00:00')), DAY(TIME('26:00:00')); + +SELECT EXTRACT(HOUR FROM '1 02:00:00'), EXTRACT(HOUR FROM '26:00:00'); +SELECT EXTRACT(HOUR FROM TIME'1 02:00:00'), EXTRACT(HOUR FROM TIME'26:00:00'); +SELECT EXTRACT(HOUR FROM TIME('1 02:00:00')), EXTRACT(HOUR FROM TIME('26:00:00')); +SELECT EXTRACT(DAY FROM TIME('1 02:00:00')), EXTRACT(DAY FROM TIME('26:00:00')); diff --git a/sql-common/my_time.c b/sql-common/my_time.c index d3a968ec53f..1f058f89bb7 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -648,8 +648,8 @@ fractional: l_time->year= 0; /* For protocol::store_time */ l_time->month= 0; - l_time->day= date[0]; - l_time->hour= date[1]; + l_time->day= 0; + l_time->hour= date[1] + date[0] * 24; /* Mix days and hours */ l_time->minute= date[2]; l_time->second= date[3]; l_time->second_part= date[4]; diff --git a/sql/item_func.h b/sql/item_func.h index b3ce85b96c4..a176d5781ac 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -158,7 +158,9 @@ public: } inline bool get_arg0_time(MYSQL_TIME *ltime) { - return (null_value=args[0]->get_time(ltime)); + null_value= args[0]->get_time(ltime); + DBUG_ASSERT(ltime->time_type != MYSQL_TIMESTAMP_TIME || ltime->day == 0); + return null_value; } bool is_null() { update_null_value(); diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 3baf583eaa0..b618ec038f2 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -2033,6 +2033,10 @@ longlong Item_extract::val_int() return 0; neg= ltime.neg ? -1 : 1; + DBUG_ASSERT(ltime.time_type != MYSQL_TIMESTAMP_TIME || ltime.day == 0); + if (ltime.time_type == MYSQL_TIMESTAMP_TIME) + time_to_daytime_interval(<ime); + switch (int_type) { case INTERVAL_YEAR: return ltime.year; case INTERVAL_YEAR_MONTH: return ltime.year*100L+ltime.month; diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 913ab66a843..191e6663ff1 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -2527,6 +2527,7 @@ bool str_to_time_with_warn(const char *str,uint length,MYSQL_TIME *l_time, ulong fuzzydate); timestamp_type str_to_datetime_with_warn(const char *str, uint length, MYSQL_TIME *l_time, ulong flags); +void time_to_daytime_interval(MYSQL_TIME *l_time); void localtime_to_TIME(MYSQL_TIME *to, struct tm *from); void calc_time_from_sec(MYSQL_TIME *to, long seconds, long microseconds); diff --git a/sql/time.cc b/sql/time.cc index f106bf1bb5f..dc724e21a16 100644 --- a/sql/time.cc +++ b/sql/time.cc @@ -1045,3 +1045,22 @@ int my_time_compare(MYSQL_TIME *a, MYSQL_TIME *b) return 0; } + +/* + Convert a TIME value to DAY-TIME interval, e.g. for extraction: + EXTRACT(DAY FROM x), EXTRACT(HOUR FROM x), etc. + Moves full days from ltime->hour to ltime->day. + Note, time_type is set to MYSQL_TIMESTAMP_NONE, to make sure that + the structure is not used for anything else other than extraction: + non-extraction TIME functions expect zero day value! +*/ +void time_to_daytime_interval(MYSQL_TIME *ltime) +{ + DBUG_ASSERT(ltime->time_type == MYSQL_TIMESTAMP_TIME); + DBUG_ASSERT(ltime->year == 0); + DBUG_ASSERT(ltime->month == 0); + DBUG_ASSERT(ltime->day == 0); + ltime->day= ltime->hour / 24; + ltime->hour%= 24; + ltime->time_type= MYSQL_TIMESTAMP_NONE; +} From 62e959437ee5bf64e89c7b16233ab2ca0fd8507c Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 3 Dec 2013 15:08:43 +0400 Subject: [PATCH 14/27] MDEV-5374 main.func_time fails with valgrind warning "Conditional jump or move depends on uninitialised" in Item_time_typecast::get_date. Adding "null_value" into the debug assert condition. --- sql/item_func.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/item_func.h b/sql/item_func.h index a176d5781ac..0838bbc2e99 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -159,7 +159,8 @@ public: inline bool get_arg0_time(MYSQL_TIME *ltime) { null_value= args[0]->get_time(ltime); - DBUG_ASSERT(ltime->time_type != MYSQL_TIMESTAMP_TIME || ltime->day == 0); + DBUG_ASSERT(null_value || + ltime->time_type != MYSQL_TIMESTAMP_TIME || ltime->day == 0); return null_value; } bool is_null() { From b78f721460de41e1a749f78e064f42a8e2953247 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 4 Dec 2013 16:54:33 +0200 Subject: [PATCH 15/27] MDEV-5353: server crash on subselect if WHERE applied to some result field Correct processing of view/derived with no tables added. --- mysql-test/r/derived.result | 14 ++++++++++++++ mysql-test/t/derived.test | 10 ++++++++++ sql/item.h | 7 +++++-- sql/table.cc | 6 ++---- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index e68636e0394..3ad9d99651a 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -465,5 +465,19 @@ t1.val=t3.val ; ERROR 42S22: Unknown column 'v.val' in 'field list' drop table t1, t2; +# +# MDEV-5353: server crash on subselect if WHERE applied to some +# result field +# +SELECT * FROM +( SELECT 100 a, subsel.b FROM ( SELECT 200 b ) subsel ) tmp +WHERE tmp.b; +a b +100 200 +SELECT * FROM +( SELECT 100 a, subsel.b FROM ( SELECT 200 b ) subsel ) tmp +WHERE tmp.a; +a b +100 200 # End of 5.3 tests set optimizer_switch=@save_derived_optimizer_switch; diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index 2a5ba77f38e..4f6b8443055 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -383,7 +383,17 @@ set drop table t1, t2; +--echo # +--echo # MDEV-5353: server crash on subselect if WHERE applied to some +--echo # result field +--echo # +SELECT * FROM +( SELECT 100 a, subsel.b FROM ( SELECT 200 b ) subsel ) tmp +WHERE tmp.b; +SELECT * FROM +( SELECT 100 a, subsel.b FROM ( SELECT 200 b ) subsel ) tmp +WHERE tmp.a; --echo # End of 5.3 tests set optimizer_switch=@save_derived_optimizer_switch; diff --git a/sql/item.h b/sql/item.h index 03b333e7997..5e8e4dfc892 100644 --- a/sql/item.h +++ b/sql/item.h @@ -2963,13 +2963,16 @@ class Item_direct_view_ref :public Item_direct_ref TABLE_LIST *view; TABLE *null_ref_table; +#define NO_NULL_TABLE (reinterpret_cast(0x1)) + bool check_null_ref() { if (null_ref_table == NULL) { - null_ref_table= view->get_real_join_table(); + if (!(null_ref_table= view->get_real_join_table())) + null_ref_table= NO_NULL_TABLE; } - if (null_ref_table->null_row) + if (null_ref_table != NO_NULL_TABLE && null_ref_table->null_row) { null_value= 1; return TRUE; diff --git a/sql/table.cc b/sql/table.cc index 9e1c53f7b22..066eb506835 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -4487,10 +4487,8 @@ TABLE *TABLE_LIST::get_real_join_table() */ for (TABLE_LIST *t= ti++; t; t= ti++) tbl= t; - /* - It is impossible that the list is empty - so tbl can't be NULL after above loop. - */ + if (!tbl) + return NULL; // view/derived with no tables if (!tbl->nested_join) break; /* go deeper if we've found nested join */ From ccf5871d7bf8be15fcf9a03842a2f40337a7f72f Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Thu, 5 Dec 2013 11:13:20 -0800 Subject: [PATCH 16/27] Fixed bug mdev-5382 When marking used columns the function find_field_in_table_ref() erroneously called the walk method for the real item behind a view/derived table field with the second parameter set to TRUE. This erroneous code was introduced in 2006. --- mysql-test/r/union.result | 15 +++++++++++++++ mysql-test/t/union.test | 16 ++++++++++++++++ sql/sql_base.cc | 4 ++-- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 05dab9e2874..d4effc8448d 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -1738,4 +1738,19 @@ i 6 DROP VIEW v1; DROP TABLE t1; +# +# mdev-5382: UNION with ORDER BY in subselect +# +CREATE TABLE t1 (a int DEFAULT NULL); +INSERT INTO t1 VALUES (2), (4); +CREATE TABLE t2 (b int DEFAULT NULL); +INSERT INTO t2 VALUES (1), (3); +SELECT c1 FROM (SELECT (SELECT a FROM t1 WHERE t1.a <= t2.b +UNION ALL +SELECT a FROM t1 WHERE t1.a+3<= t2.b +ORDER BY a DESC) AS c1 FROM t2) t3; +c1 +NULL +2 +DROP TABLE t1,t2; End of 5.3 tests diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index bb0e5610a26..bc995aac0a0 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -1227,5 +1227,21 @@ deallocate prepare stmt1; DROP VIEW v1; DROP TABLE t1; +--echo # +--echo # mdev-5382: UNION with ORDER BY in subselect +--echo # + + CREATE TABLE t1 (a int DEFAULT NULL); + INSERT INTO t1 VALUES (2), (4); + CREATE TABLE t2 (b int DEFAULT NULL); + INSERT INTO t2 VALUES (1), (3); + + SELECT c1 FROM (SELECT (SELECT a FROM t1 WHERE t1.a <= t2.b + UNION ALL + SELECT a FROM t1 WHERE t1.a+3<= t2.b + ORDER BY a DESC) AS c1 FROM t2) t3; + + DROP TABLE t1,t2; + --echo End of 5.3 tests diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 130763de76a..3eeb8afef6b 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -6429,9 +6429,9 @@ find_field_in_table_ref(THD *thd, TABLE_LIST *table_list, else { if (thd->mark_used_columns == MARK_COLUMNS_READ) - it->walk(&Item::register_field_in_read_map, 1, (uchar *) 0); + it->walk(&Item::register_field_in_read_map, 0, (uchar *) 0); else - it->walk(&Item::register_field_in_write_map, 1, (uchar *) 0); + it->walk(&Item::register_field_in_write_map, 0, (uchar *) 0); } } else From fe38576064068bd2bb5541bd6efda6abb1879dde Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 6 Dec 2013 15:29:25 +0100 Subject: [PATCH 17/27] install embedded_priv.h in ${INSTALL_INCLUDEDIR}/private --- libmysqld/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index 5af5f5e1807..ee5c8875686 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -136,6 +136,8 @@ ENDFOREACH() MERGE_LIBRARIES(mysqlserver STATIC ${EMBEDDED_LIBS} OUTPUT_NAME ${MYSQLSERVER_OUTPUT_NAME} COMPONENT Development) +INSTALL(FILES embedded_priv.h DESTINATION ${INSTALL_INCLUDEDIR}/private COMPONENT Development) + # Visual Studio users need debug static library IF(MSVC) INSTALL_DEBUG_TARGET(mysqlserver DESTINATION ${INSTALL_LIBDIR}/debug) From d5262a63fcbb13e3c2b1734ada36f3db8c6cb0c3 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Sat, 7 Dec 2013 07:51:02 -0800 Subject: [PATCH 18/27] Fixed bug mdev-5400: a memory leak in save_index() first seen in the test case for mdev-5382. --- sql/sql_select.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 43f70b80557..a66c6bd15d8 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -10533,7 +10533,6 @@ void JOIN::cleanup(bool full) { tab->cleanup(); } - table= 0; } else { From 70f6ac10b3130f14205dbcc56c7089c1c139afd3 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 11 Dec 2013 17:42:33 +0100 Subject: [PATCH 19/27] MDEV-5323 Ctrl-C not working under Ubuntu don't reset interrupted_query after sending the KILL signal, otherwise the client won't know it has to stop fetching and printing the data. --- client/mysql.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/client/mysql.cc b/client/mysql.cc index e3885422563..a37392c7fc5 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1383,7 +1383,6 @@ sig_handler handle_sigint(int sig) mysql_real_query(kill_mysql, kill_buffer, (uint) strlen(kill_buffer)); mysql_close(kill_mysql); tee_fprintf(stdout, "Ctrl-C -- query killed. Continuing normally.\n"); - interrupted_query= 0; if (in_com_source) aborted= 1; // Abort source command return; From fde2777b2722a2b81f995c74e74cc3e47c0f8788 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Wed, 11 Dec 2013 10:13:08 -0800 Subject: [PATCH 20/27] Another attempt to fix the memory leak of mdev-5400. --- sql/sql_select.cc | 1 + sql/sql_union.cc | 1 + 2 files changed, 2 insertions(+) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index a66c6bd15d8..d38363f15d1 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -10533,6 +10533,7 @@ void JOIN::cleanup(bool full) { tab->cleanup(); } + table= 0; } else { diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 5c4a9a8db5f..f82657a837c 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -628,6 +628,7 @@ bool st_select_lex_unit::exec() { ha_rows records_at_start= 0; thd->lex->current_select= sl; + fake_select_lex->uncacheable|= sl->uncacheable; { set_limit(sl); From 976e242c78a76f95ea416f1602b53dcdea961765 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 12 Dec 2013 11:42:00 +0100 Subject: [PATCH 21/27] update tokudb version. mask tests that are broken there. --- storage/tokudb/CMakeLists.txt | 2 +- .../mysql-test/tokudb/t/i_s_tokudb_lock_waits_released.test | 4 ++++ .../mysql-test/tokudb/t/i_s_tokudb_lock_waits_timeout.test | 4 ++++ .../mysql-test/tokudb/t/i_s_tokudb_locks_released.test | 4 ++++ .../tokudb/mysql-test/tokudb_add_index/t/add_index_6.test | 5 +++++ 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/storage/tokudb/CMakeLists.txt b/storage/tokudb/CMakeLists.txt index c5197dd5dc0..91f92c9ef14 100644 --- a/storage/tokudb/CMakeLists.txt +++ b/storage/tokudb/CMakeLists.txt @@ -15,7 +15,7 @@ IF(NOT TOKUDB_OK) ENDIF() ############################################ -SET(ENV{TOKUDB_VERSION} "7.0.4") +SET(ENV{TOKUDB_VERSION} "7.1.0") SET(TOKUDB_DEB_FILES "usr/lib/mysql/plugin/ha_tokudb.so\netc/mysql/conf.d/tokudb.cnf\nusr/bin/tokuftdump\nusr/share/doc/mariadb-server-5.5/README-TOKUDB\nusr/share/doc/mariadb-server-5.5/README.md" PARENT_SCOPE) SET(USE_BDB OFF CACHE BOOL "") SET(USE_VALGRIND OFF CACHE BOOL "") diff --git a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_released.test b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_released.test index 1becf71a80a..b42c2dd9175 100644 --- a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_released.test +++ b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_released.test @@ -1,4 +1,8 @@ # verify that information_schema.tokudb_locks gets populated with locks, information_schema.tokudb_lock_waits gets +if (`select @@tokudb_version <= "7.1.0"`) +{ + --skip Not fixed in TokuDB 7.1.0 or earlier +} # populated with 1 lock_wait and all transactions are present in information_schema.tokudb_trx for 2 clients source include/have_tokudb.inc; diff --git a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_timeout.test b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_timeout.test index 87656f29395..8d21e601380 100644 --- a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_timeout.test +++ b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_timeout.test @@ -1,3 +1,7 @@ +if (`select @@tokudb_version <= "7.1.0"`) +{ + --skip Not fixed in TokuDB 7.1.0 or earlier +} # verify that tokudb_locks and tokudb_lock_waits contents for 2 conflicting transactions with a lock timeout source include/have_tokudb.inc; diff --git a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_locks_released.test b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_locks_released.test index 52c09c1c049..6a1b96c53a2 100644 --- a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_locks_released.test +++ b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_locks_released.test @@ -1,3 +1,7 @@ +if (`select @@tokudb_version <= "7.1.0"`) +{ + --skip Not fixed in TokuDB 7.1.0 or earlier +} # verify that information_schema.tokudb_locks gets populated with locks for 2 clients source include/have_tokudb.inc; diff --git a/storage/tokudb/mysql-test/tokudb_add_index/t/add_index_6.test b/storage/tokudb/mysql-test/tokudb_add_index/t/add_index_6.test index 14b6079acc9..8fa44de9cae 100644 --- a/storage/tokudb/mysql-test/tokudb_add_index/t/add_index_6.test +++ b/storage/tokudb/mysql-test/tokudb_add_index/t/add_index_6.test @@ -1,3 +1,8 @@ +if (`select @@tokudb_version <= "7.1.0"`) +{ + --skip Not fixed in TokuDB 7.1.0 or earlier +} + #--source include/have_tokudb.inc SET DEFAULT_STORAGE_ENGINE='tokudb'; # From 5313e001998a13e02d1ca84a4d6674160b1c58bb Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 12 Dec 2013 14:58:44 +0100 Subject: [PATCH 22/27] fix tokudb tests that fail in --ps-protocol https://github.com/Tokutek/ft-engine/issues/153 --- .../tokudb_bugs/r/checkpoint_lock.result | 9 +++------ .../tokudb_bugs/r/checkpoint_lock_2.result | 18 ++++++------------ .../tokudb_bugs/r/checkpoint_lock_3.result | 9 +++------ .../tokudb_bugs/t/checkpoint_lock.test | 6 +++--- .../tokudb_bugs/t/checkpoint_lock_2.test | 12 ++++++------ .../tokudb_bugs/t/checkpoint_lock_3.test | 6 +++--- 6 files changed, 24 insertions(+), 36 deletions(-) diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/checkpoint_lock.result b/storage/tokudb/mysql-test/tokudb_bugs/r/checkpoint_lock.result index 7532cddd97f..b572ac3b6e1 100644 --- a/storage/tokudb/mysql-test/tokudb_bugs/r/checkpoint_lock.result +++ b/storage/tokudb/mysql-test/tokudb_bugs/r/checkpoint_lock.result @@ -1,20 +1,17 @@ SET DEFAULT_STORAGE_ENGINE = 'tokudb'; set global tokudb_checkpoint_on_flush_logs=ON; # Establish connection conn1 (user = root) -select DB, command, state, info from information_schema.processlist; +select DB, command, state, info from information_schema.processlist where id!= connection_id(); DB command state info test Sleep NULL -test Query executing select DB, command, state, info from information_schema.processlist flush logs; -select DB, command, state, info from information_schema.processlist; +select DB, command, state, info from information_schema.processlist where id!= connection_id(); DB command state info test Sleep NULL -test Query executing select DB, command, state, info from information_schema.processlist set tokudb_checkpoint_lock=1; flush logs;; -select DB, command, state, info from information_schema.processlist; +select DB, command, state, info from information_schema.processlist where id!= connection_id(); DB command state info -test Query executing select DB, command, state, info from information_schema.processlist test Query NULL flush logs set tokudb_checkpoint_lock=0; set global tokudb_checkpoint_on_flush_logs=OFF; diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/checkpoint_lock_2.result b/storage/tokudb/mysql-test/tokudb_bugs/r/checkpoint_lock_2.result index 63a688ef11b..5ef3c001935 100644 --- a/storage/tokudb/mysql-test/tokudb_bugs/r/checkpoint_lock_2.result +++ b/storage/tokudb/mysql-test/tokudb_bugs/r/checkpoint_lock_2.result @@ -2,45 +2,39 @@ SET DEFAULT_STORAGE_ENGINE = 'tokudb'; set GLOBAL tokudb_checkpoint_on_flush_logs=ON; # Establish connection conn1 (user = root) # should see nothing -select DB, command, state, info from information_schema.processlist; +select DB, command, state, info from information_schema.processlist where id!= connection_id(); DB command state info test Sleep NULL test Sleep NULL -test Query executing select DB, command, state, info from information_schema.processlist flush logs; # should see nothing -select DB, command, state, info from information_schema.processlist; +select DB, command, state, info from information_schema.processlist where id!= connection_id(); DB command state info test Sleep NULL test Sleep NULL -test Query executing select DB, command, state, info from information_schema.processlist set session tokudb_checkpoint_lock=1; flush logs;; # should see a flush logs -select DB, command, state, info from information_schema.processlist; +select DB, command, state, info from information_schema.processlist where id!= connection_id(); DB command state info -test Query executing select DB, command, state, info from information_schema.processlist test Sleep NULL test Query NULL flush logs set session tokudb_checkpoint_lock=1; # should still see a flush logs -select DB, command, state, info from information_schema.processlist; +select DB, command, state, info from information_schema.processlist where id!= connection_id(); DB command state info -test Query executing select DB, command, state, info from information_schema.processlist test Sleep NULL test Query NULL flush logs set session tokudb_checkpoint_lock=0; # should still see a flush logs -select DB, command, state, info from information_schema.processlist; +select DB, command, state, info from information_schema.processlist where id!= connection_id(); DB command state info test Sleep NULL -test Query executing select DB, command, state, info from information_schema.processlist test Query NULL flush logs set session tokudb_checkpoint_lock=0; # should see nothing -select DB, command, state, info from information_schema.processlist; +select DB, command, state, info from information_schema.processlist where id!= connection_id(); DB command state info -test Query executing select DB, command, state, info from information_schema.processlist test Sleep NULL test Sleep NULL set GLOBAL tokudb_checkpoint_on_flush_logs=OFF; diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/checkpoint_lock_3.result b/storage/tokudb/mysql-test/tokudb_bugs/r/checkpoint_lock_3.result index a6c41e08570..968d86e5659 100644 --- a/storage/tokudb/mysql-test/tokudb_bugs/r/checkpoint_lock_3.result +++ b/storage/tokudb/mysql-test/tokudb_bugs/r/checkpoint_lock_3.result @@ -1,18 +1,15 @@ SET DEFAULT_STORAGE_ENGINE = 'tokudb'; # Establish connection conn1 (user = root) -select DB, command, state, info from information_schema.processlist; +select DB, command, state, info from information_schema.processlist where id!= connection_id(); DB command state info test Sleep NULL -test Query executing select DB, command, state, info from information_schema.processlist flush logs; -select DB, command, state, info from information_schema.processlist; +select DB, command, state, info from information_schema.processlist where id!= connection_id(); DB command state info test Sleep NULL -test Query executing select DB, command, state, info from information_schema.processlist set tokudb_checkpoint_lock=1; flush logs;; -select DB, command, state, info from information_schema.processlist; +select DB, command, state, info from information_schema.processlist where id!= connection_id(); DB command state info -test Query executing select DB, command, state, info from information_schema.processlist test Sleep NULL set tokudb_checkpoint_lock=0; diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/checkpoint_lock.test b/storage/tokudb/mysql-test/tokudb_bugs/t/checkpoint_lock.test index be72c26b841..ac39ac569fd 100644 --- a/storage/tokudb/mysql-test/tokudb_bugs/t/checkpoint_lock.test +++ b/storage/tokudb/mysql-test/tokudb_bugs/t/checkpoint_lock.test @@ -8,9 +8,9 @@ connect (conn1,localhost,root,,); connection default; --sleep 2 -select DB, command, state, info from information_schema.processlist; +select DB, command, state, info from information_schema.processlist where id!= connection_id(); flush logs; -select DB, command, state, info from information_schema.processlist; +select DB, command, state, info from information_schema.processlist where id!= connection_id(); connection conn1; set tokudb_checkpoint_lock=1; @@ -20,7 +20,7 @@ connection default; connection conn1; --sleep 2 -select DB, command, state, info from information_schema.processlist; +select DB, command, state, info from information_schema.processlist where id!= connection_id(); set tokudb_checkpoint_lock=0; connection default; diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/checkpoint_lock_2.test b/storage/tokudb/mysql-test/tokudb_bugs/t/checkpoint_lock_2.test index 44db2ca2f7c..c399dc24649 100644 --- a/storage/tokudb/mysql-test/tokudb_bugs/t/checkpoint_lock_2.test +++ b/storage/tokudb/mysql-test/tokudb_bugs/t/checkpoint_lock_2.test @@ -13,11 +13,11 @@ connect (conn2,localhost,root,,); connection default; --sleep 2 --echo # should see nothing -select DB, command, state, info from information_schema.processlist; +select DB, command, state, info from information_schema.processlist where id!= connection_id(); flush logs; --echo # should see nothing -select DB, command, state, info from information_schema.processlist; +select DB, command, state, info from information_schema.processlist where id!= connection_id(); connection conn1; @@ -29,25 +29,25 @@ connection default; connection conn2; --sleep 2 --echo # should see a flush logs -select DB, command, state, info from information_schema.processlist; +select DB, command, state, info from information_schema.processlist where id!= connection_id(); set session tokudb_checkpoint_lock=1; --echo # should still see a flush logs -select DB, command, state, info from information_schema.processlist; +select DB, command, state, info from information_schema.processlist where id!= connection_id(); connection conn1; --sleep 2 set session tokudb_checkpoint_lock=0; --echo # should still see a flush logs -select DB, command, state, info from information_schema.processlist; +select DB, command, state, info from information_schema.processlist where id!= connection_id(); connection conn2; set session tokudb_checkpoint_lock=0; --sleep 2 --echo # should see nothing -select DB, command, state, info from information_schema.processlist; +select DB, command, state, info from information_schema.processlist where id!= connection_id(); connection default; diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/checkpoint_lock_3.test b/storage/tokudb/mysql-test/tokudb_bugs/t/checkpoint_lock_3.test index 1bb70eab163..b21aef1f6bc 100644 --- a/storage/tokudb/mysql-test/tokudb_bugs/t/checkpoint_lock_3.test +++ b/storage/tokudb/mysql-test/tokudb_bugs/t/checkpoint_lock_3.test @@ -7,9 +7,9 @@ connect (conn1,localhost,root,,); connection default; --sleep 2 -select DB, command, state, info from information_schema.processlist; +select DB, command, state, info from information_schema.processlist where id!= connection_id(); flush logs; -select DB, command, state, info from information_schema.processlist; +select DB, command, state, info from information_schema.processlist where id!= connection_id(); connection conn1; set tokudb_checkpoint_lock=1; @@ -19,7 +19,7 @@ connection default; connection conn1; --sleep 2 -select DB, command, state, info from information_schema.processlist; +select DB, command, state, info from information_schema.processlist where id!= connection_id(); set tokudb_checkpoint_lock=0; connection default; From c47dd98f90230b1c08c36c66f87f4d1a45354e13 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 12 Dec 2013 18:14:08 +0100 Subject: [PATCH 23/27] backport from 10.0: "bugfix: MYSQL_THDVAR_STR plugins with PLUGIN_VAR_MEMALLOC didn't work (PLUGIN_VAR_MEMALLOC is 0x8000 and cannot be saved in a char as such)" --- sql/sql_plugin.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index c0b59dcadcb..af4c458fbef 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -2371,8 +2371,14 @@ err: #undef MYSQL_SYSVAR_NAME #define MYSQL_SYSVAR_NAME(name) name -#define PLUGIN_VAR_TYPEMASK 0x007f -#define PLUGIN_VAR_BOOKMARK_KEY (PLUGIN_VAR_TYPEMASK | PLUGIN_VAR_MEMALLOC) +#define PLUGIN_VAR_TYPEMASK 0x7f +#define BOOKMARK_MEMALLOC 0x80 + +static inline char plugin_var_bookmark_key(uint flags) +{ + return (flags & PLUGIN_VAR_TYPEMASK) | + (flags & PLUGIN_VAR_MEMALLOC ? BOOKMARK_MEMALLOC : 0); +} #define EXTRA_OPTIONS 3 /* options for: 'foo', 'plugin-foo' and NULL */ @@ -2752,7 +2758,7 @@ static st_bookmark *find_bookmark(const char *plugin, const char *name, else memcpy(varname + 1, name, namelen + 1); - varname[0]= flags & PLUGIN_VAR_BOOKMARK_KEY; + varname[0]= plugin_var_bookmark_key(flags); result= (st_bookmark*) my_hash_search(&bookmark_hash, (const uchar*) varname, length - 1); @@ -2813,7 +2819,7 @@ static st_bookmark *register_var(const char *plugin, const char *name, { result= (st_bookmark*) alloc_root(&plugin_mem_root, sizeof(struct st_bookmark) + length-1); - varname[0]= flags & PLUGIN_VAR_BOOKMARK_KEY; + varname[0]= plugin_var_bookmark_key(flags); memcpy(result->key, varname, length); result->name_len= length - 2; result->offset= -1; @@ -2935,7 +2941,7 @@ static uchar *intern_sys_var_ptr(THD* thd, int offset, bool global_lock) if (!(var= intern_find_sys_var(v->key + 1, v->name_len)) || !(pi= var->cast_pluginvar()) || - v->key[0] != (pi->plugin_var->flags & PLUGIN_VAR_BOOKMARK_KEY)) + v->key[0] != plugin_var_bookmark_key(pi->plugin_var->flags)) continue; /* Here we do anything special that may be required of the data types */ @@ -3072,7 +3078,7 @@ static void cleanup_variables(THD *thd, struct system_variables *vars) DBUG_ASSERT((uint)v->offset <= vars->dynamic_variables_head); if ((v->key[0] & PLUGIN_VAR_TYPEMASK) == PLUGIN_VAR_STR && - v->key[0] & PLUGIN_VAR_MEMALLOC) + v->key[0] & BOOKMARK_MEMALLOC) { char **ptr= (char**)(vars->dynamic_variables_ptr + v->offset); my_free(*ptr); From ca083a764f14233dfd7f97436629020901bd23a6 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 12 Dec 2013 18:14:14 +0100 Subject: [PATCH 24/27] my_addr_resolve: don't resolve unknown addresses to ??:0(??), but return an error instead (better to have an address in the output than ??:0) --- mysys/my_addr_resolve.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mysys/my_addr_resolve.c b/mysys/my_addr_resolve.c index e5a3a5fe13b..90e6f43f390 100644 --- a/mysys/my_addr_resolve.c +++ b/mysys/my_addr_resolve.c @@ -153,6 +153,10 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc) while (*s != ':') s++; *s++= 0; + + if (strcmp(loc->file, "??") == 0) + return 1; + loc->line= 0; while (isdigit(*s)) loc->line = loc->line * 10 + (*s++ - '0'); From 3ec4296ec413e866c3efabc8dfa94172ad5f7c04 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Thu, 12 Dec 2013 13:55:33 -0800 Subject: [PATCH 25/27] Fixed bug mdev-5410. The fix for bug #27937 was incomplete: it did not handle correctly the queries containing UNION with global ORDER BY in subselects. --- mysql-test/r/ps.result | 23 +++++++++++++++++++++++ mysql-test/t/ps.test | 22 ++++++++++++++++++++++ sql/sql_lex.h | 2 +- sql/sql_union.cc | 17 +++++++++++++---- 4 files changed, 59 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 75aef40b529..e5411b2a210 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -3284,4 +3284,27 @@ Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 deallocate prepare st; drop table t1; +# +# Bug mdev-5410: crash at the execution of PS with subselect +# formed by UNION with global ORDER BY +# +CREATE TABLE t1 (a int DEFAULT NULL); +INSERT INTO t1 VALUES (2), (4); +CREATE TABLE t2 (b int DEFAULT NULL); +INSERT INTO t2 VALUES (1), (3); +PREPARE stmt FROM " +SELECT c1 FROM (SELECT (SELECT a FROM t1 WHERE t1.a <= t2.b + UNION ALL + SELECT a FROM t1 WHERE t1.a+3<= t2.b + ORDER BY a DESC) AS c1 FROM t2) t3; +"; +EXECUTE stmt; +c1 +NULL +2 +EXECUTE stmt; +c1 +NULL +2 +DROP TABLE t1,t2; # End of 5.3 tests diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index f1941337874..4d7c6848da7 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -3308,4 +3308,26 @@ show status like '%Handler_read%'; deallocate prepare st; drop table t1; +--echo # +--echo # Bug mdev-5410: crash at the execution of PS with subselect +--echo # formed by UNION with global ORDER BY +--echo # + +CREATE TABLE t1 (a int DEFAULT NULL); +INSERT INTO t1 VALUES (2), (4); +CREATE TABLE t2 (b int DEFAULT NULL); +INSERT INTO t2 VALUES (1), (3); + +PREPARE stmt FROM " +SELECT c1 FROM (SELECT (SELECT a FROM t1 WHERE t1.a <= t2.b + UNION ALL + SELECT a FROM t1 WHERE t1.a+3<= t2.b + ORDER BY a DESC) AS c1 FROM t2) t3; +"; + +EXECUTE stmt; +EXECUTE stmt; + +DROP TABLE t1,t2; + --echo # End of 5.3 tests diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 4b4496a7df8..d5639724d5f 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -584,7 +584,7 @@ public: void print(String *str, enum_query_type query_type); bool add_fake_select_lex(THD *thd); - void init_prepare_fake_select_lex(THD *thd); + void init_prepare_fake_select_lex(THD *thd, bool first_execution); inline bool is_prepared() { return prepared; } bool change_result(select_result_interceptor *result, select_result_interceptor *old_result); diff --git a/sql/sql_union.cc b/sql/sql_union.cc index f82657a837c..5ca4af8eb0d 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -184,13 +184,15 @@ void select_union::cleanup() SYNOPSIS st_select_lex_unit::init_prepare_fake_select_lex() thd - thread handler + first_execution - TRUE at the first execution of the union RETURN options of SELECT */ void -st_select_lex_unit::init_prepare_fake_select_lex(THD *thd_arg) +st_select_lex_unit::init_prepare_fake_select_lex(THD *thd_arg, + bool first_execution) { thd_arg->lex->current_select= fake_select_lex; fake_select_lex->table_list.link_in_list(&result_table_list, @@ -198,7 +200,13 @@ st_select_lex_unit::init_prepare_fake_select_lex(THD *thd_arg) fake_select_lex->context.table_list= fake_select_lex->context.first_name_resolution_table= fake_select_lex->get_table_list(); - if (!fake_select_lex->first_execution) + /* + The flag fake_select_lex->first_execution indicates whether this is + called at the first execution of the statement, while first_execution + shows whether this is called at the first execution of the union that + may form just a subselect. + */ + if (!fake_select_lex->first_execution && first_execution) { for (ORDER *order= global_parameters->order_list.first; order; @@ -472,7 +480,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, { /* Validate the global parameters of this union */ - init_prepare_fake_select_lex(thd); + init_prepare_fake_select_lex(thd, TRUE); /* Should be done only once (the only item_list per statement) */ DBUG_ASSERT(fake_select_lex->join == 0); if (!(fake_select_lex->join= new JOIN(thd, item_list, thd->options, @@ -612,6 +620,7 @@ bool st_select_lex_unit::exec() SELECT_LEX *select_cursor=first_select(); ulonglong add_rows=0; ha_rows examined_rows= 0; + bool first_execution= !executed; DBUG_ENTER("st_select_lex_unit::exec"); if (executed && !uncacheable && !describe) @@ -714,7 +723,7 @@ bool st_select_lex_unit::exec() if (!thd->is_fatal_error) // Check if EOM { set_limit(global_parameters); - init_prepare_fake_select_lex(thd); + init_prepare_fake_select_lex(thd, first_execution); JOIN *join= fake_select_lex->join; if (!join) { From 47b615d84bd41876d7a0838d8193b5ac31a5ff3d Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 15 Dec 2013 11:31:57 +0100 Subject: [PATCH 26/27] Fix tokudb.hotindex-insert-bigchar failure in buildbot. This test needs at least 320M for tokudb-max-lock-memory. Normally tokudb-max-lock-memory is auto-sized to be 1/16th of the available RAM size, and many our test VMs have 4G of RAM. --- storage/tokudb/mysql-test/tokudb/t/hotindex-insert-bigchar.opt | 1 + 1 file changed, 1 insertion(+) create mode 100644 storage/tokudb/mysql-test/tokudb/t/hotindex-insert-bigchar.opt diff --git a/storage/tokudb/mysql-test/tokudb/t/hotindex-insert-bigchar.opt b/storage/tokudb/mysql-test/tokudb/t/hotindex-insert-bigchar.opt new file mode 100644 index 00000000000..d76fda471ca --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb/t/hotindex-insert-bigchar.opt @@ -0,0 +1 @@ +--loose-tokudb-max-lock-memory=320M From 39a8d7965d912d8fb32436735449ce04e85583d1 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 15 Dec 2013 15:55:15 +0100 Subject: [PATCH 27/27] don't run tokudb tests for --embedded by default --- storage/tokudb/mysql-test/rpl/suite.pm | 1 + storage/tokudb/mysql-test/tokudb/suite.pm | 2 +- storage/tokudb/mysql-test/tokudb_add_index/suite.pm | 5 ++++- storage/tokudb/mysql-test/tokudb_alter_table/suite.pm | 5 ++++- storage/tokudb/mysql-test/tokudb_bugs/suite.pm | 5 ++++- storage/tokudb/mysql-test/tokudb_mariadb/suite.pm | 5 ++++- 6 files changed, 18 insertions(+), 5 deletions(-) diff --git a/storage/tokudb/mysql-test/rpl/suite.pm b/storage/tokudb/mysql-test/rpl/suite.pm index e001340cd14..ba9809a9930 100644 --- a/storage/tokudb/mysql-test/rpl/suite.pm +++ b/storage/tokudb/mysql-test/rpl/suite.pm @@ -7,5 +7,6 @@ $ENV{TOKU_HUGE_PAGES_OK}=1; #return "Not run for embedded server" if $::opt_embedded_server; return "No TokuDB engine" unless $ENV{HA_TOKUDB_SO} or $::mysqld_variables{tokudb}; + bless { }; diff --git a/storage/tokudb/mysql-test/tokudb/suite.pm b/storage/tokudb/mysql-test/tokudb/suite.pm index aebfddb661f..6c52d0110fe 100644 --- a/storage/tokudb/mysql-test/tokudb/suite.pm +++ b/storage/tokudb/mysql-test/tokudb/suite.pm @@ -8,7 +8,7 @@ $ENV{TOKU_HUGE_PAGES_OK}=1; #return "Not run for embedded server" if $::opt_embedded_server; return "No TokuDB engine" unless $ENV{HA_TOKUDB_SO} or $::mysqld_variables{tokudb}; -sub is_default { 1 } +sub is_default { not $::opt_embedded_server } bless { }; diff --git a/storage/tokudb/mysql-test/tokudb_add_index/suite.pm b/storage/tokudb/mysql-test/tokudb_add_index/suite.pm index b318b1fbe33..ee1d1bde06b 100644 --- a/storage/tokudb/mysql-test/tokudb_add_index/suite.pm +++ b/storage/tokudb/mysql-test/tokudb_add_index/suite.pm @@ -2,10 +2,13 @@ package My::Suite::TokuDB_add_index; use File::Basename; @ISA = qw(My::Suite); +# Ensure we can run the TokuDB tests even if hugepages are enabled +$ENV{TOKU_HUGE_PAGES_OK}=1; + #return "Not run for embedded server" if $::opt_embedded_server; return "No TokuDB engine" unless $ENV{HA_TOKUDB_SO} or $::mysqld_variables{tokudb}; -sub is_default { 1 } +sub is_default { not $::opt_embedded_server } bless { }; diff --git a/storage/tokudb/mysql-test/tokudb_alter_table/suite.pm b/storage/tokudb/mysql-test/tokudb_alter_table/suite.pm index 2be9e69d00b..7981fad2c62 100644 --- a/storage/tokudb/mysql-test/tokudb_alter_table/suite.pm +++ b/storage/tokudb/mysql-test/tokudb_alter_table/suite.pm @@ -2,10 +2,13 @@ package My::Suite::TokuDB_alter_table; use File::Basename; @ISA = qw(My::Suite); +# Ensure we can run the TokuDB tests even if hugepages are enabled +$ENV{TOKU_HUGE_PAGES_OK}=1; + #return "Not run for embedded server" if $::opt_embedded_server; return "No TokuDB engine" unless $ENV{HA_TOKUDB_SO} or $::mysqld_variables{tokudb}; -sub is_default { 1 } +sub is_default { not $::opt_embedded_server } bless { }; diff --git a/storage/tokudb/mysql-test/tokudb_bugs/suite.pm b/storage/tokudb/mysql-test/tokudb_bugs/suite.pm index b2a3a8addc1..a6e01cd6dd4 100644 --- a/storage/tokudb/mysql-test/tokudb_bugs/suite.pm +++ b/storage/tokudb/mysql-test/tokudb_bugs/suite.pm @@ -2,10 +2,13 @@ package My::Suite::TokuDB_bugs; use File::Basename; @ISA = qw(My::Suite); +# Ensure we can run the TokuDB tests even if hugepages are enabled +$ENV{TOKU_HUGE_PAGES_OK}=1; + #return "Not run for embedded server" if $::opt_embedded_server; return "No TokuDB engine" unless $ENV{HA_TOKUDB_SO} or $::mysqld_variables{tokudb}; -sub is_default { 1 } +sub is_default { not $::opt_embedded_server } bless { }; diff --git a/storage/tokudb/mysql-test/tokudb_mariadb/suite.pm b/storage/tokudb/mysql-test/tokudb_mariadb/suite.pm index 1522e7c39a4..ab3da8e6b03 100644 --- a/storage/tokudb/mysql-test/tokudb_mariadb/suite.pm +++ b/storage/tokudb/mysql-test/tokudb_mariadb/suite.pm @@ -2,10 +2,13 @@ package My::Suite::TokuDB_mariadb; use File::Basename; @ISA = qw(My::Suite); +# Ensure we can run the TokuDB tests even if hugepages are enabled +$ENV{TOKU_HUGE_PAGES_OK}=1; + #return "Not run for embedded server" if $::opt_embedded_server; return "No TokuDB engine" unless $ENV{HA_TOKUDB_SO} or $::mysqld_variables{tokudb}; -sub is_default { 1 } +sub is_default { not $::opt_embedded_server } bless { };