From 5abec3e3e3b9299b3d3cd857cc144d8bdcaf6890 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Mon, 3 Mar 2014 15:10:30 +0100 Subject: [PATCH 01/52] Raise version number after cloning 5.5.37 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index df053fca509..a519214c0c5 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ MYSQL_VERSION_MAJOR=5 MYSQL_VERSION_MINOR=5 -MYSQL_VERSION_PATCH=37 +MYSQL_VERSION_PATCH=38 MYSQL_VERSION_EXTRA= From a9db74f46ddbecfefa4497989dcfdaf6174b30b9 Mon Sep 17 00:00:00 2001 From: Namit Sharma Date: Tue, 4 Mar 2014 13:48:13 +0530 Subject: [PATCH 02/52] BUG#11754425 - rpl_innodb_bug28430 times out on certain pb2 hosts. Removed rpl_innodb_bug28430 from default.experimental as BUG can't be repeated --- mysql-test/collections/default.experimental | 1 - 1 file changed, 1 deletion(-) diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index 961a93b8741..82f8b49ff45 100644 --- a/mysql-test/collections/default.experimental +++ b/mysql-test/collections/default.experimental @@ -23,7 +23,6 @@ main.query_cache_28249 # Bug#12584161 2009-03-25 main.query_ca ndb.* # joro : NDB tests marked as experimental as agreed with bochklin -rpl.rpl_innodb_bug28430 # Bug#11754425 rpl.rpl_insert # Sven: BUG#12764817 rpl.rpl_row_sp011 @solaris # Joro : Bug #11753919 rpl.rpl_stop_slave # Sven : BUG#12345981 From 5295b21feb2d03a4ae929ce2d94ef86dbded213b Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Tue, 4 Mar 2014 16:41:14 +0100 Subject: [PATCH 03/52] Bug#18305641 SOLARIS SPECIFIIC FILES INSTALLED ON ALL PLATFORMS Don't install solaris specific files on other platforms. --- packaging/solaris/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packaging/solaris/CMakeLists.txt b/packaging/solaris/CMakeLists.txt index 02881e0af8f..899847d0f38 100644 --- a/packaging/solaris/CMakeLists.txt +++ b/packaging/solaris/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. # # 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 @@ -17,6 +17,10 @@ # Any files in this directory are auxiliary files for Solaris "pkg" packages. # They will be configured during "pkg" creation, not during (binary) build. +IF(NOT CMAKE_SYSTEM_NAME MATCHES "SunOS") + RETURN() +ENDIF() + # Currently, this expands to "support-files/" in most layouts, # but to "/usr/share/mysql/" in a RPM. # It is important not to pollute "/usr/bin". From 2d5be2fc20cf13ac093bc379d90f1cb23f2eb67b Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Wed, 5 Mar 2014 13:01:54 +0100 Subject: [PATCH 04/52] Backport of: Bug#17894997 CMAKE WARNING WRT INTERFACE_LINK_LIBRARIES Bug#17905155 CMAKE WARNING WHEN GENERATING MAKEFILE Bug#71089 CMake warning when generating Makefile Use old policy for LINK_INTERFACE_LIBRARIES. --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a0cae57bbf..60ecd3d7149 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,12 @@ if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.6) CMAKE_POLICY(VERSION 2.8) endif() +# We use PROPERTIES LINK_INTERFACE_LIBRARIES. See cmake --help-policy CMP0022 +IF(CMAKE_VERSION VERSION_EQUAL "2.8.12" OR + CMAKE_VERSION VERSION_GREATER "2.8.12") + CMAKE_POLICY(SET CMP0022 OLD) +ENDIF() + MESSAGE(STATUS "Running cmake version ${CMAKE_VERSION}") SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake) From c8b8d00947e4e67ebaa87405dd48b93501c2d67d Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Mon, 17 Mar 2014 17:54:08 +0100 Subject: [PATCH 05/52] Bug#18319790 QUERY TO INFORMATION_SCHEMA CRASHES SERVER Before this fix, specially crafted queries using the INFORMATION_SCHEMA could crash the server. The root cause was a buffer overflow, see the (private) bug comments for details. With this fix, the buffer overflow condition is properly handled, and the queries involved do return the expected result. --- sql/sql_show.cc | 65 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 58 insertions(+), 7 deletions(-) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index b8e8649e1eb..dcae4c63b02 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 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 @@ -2394,10 +2394,38 @@ void calc_sum_of_all_status(STATUS_VAR *to) /* This is only used internally, but we need it here as a forward reference */ extern ST_SCHEMA_TABLE schema_tables[]; +/** + Condition pushdown used for INFORMATION_SCHEMA / SHOW queries. + This structure is to implement an optimization when + accessing data dictionary data in the INFORMATION_SCHEMA + or SHOW commands. + When the query contain a TABLE_SCHEMA or TABLE_NAME clause, + narrow the search for data based on the constraints given. +*/ typedef struct st_lookup_field_values { - LEX_STRING db_value, table_value; - bool wild_db_value, wild_table_value; + /** + Value of a TABLE_SCHEMA clause. + Note that this value length may exceed @c NAME_LEN. + @sa wild_db_value + */ + LEX_STRING db_value; + /** + Value of a TABLE_NAME clause. + Note that this value length may exceed @c NAME_LEN. + @sa wild_table_value + */ + LEX_STRING table_value; + /** + True when @c db_value is a LIKE clause, + false when @c db_value is an '=' clause. + */ + bool wild_db_value; + /** + True when @c table_value is a LIKE clause, + false when @c table_value is an '=' clause. + */ + bool wild_table_value; } LOOKUP_FIELD_VALUES; @@ -2801,14 +2829,22 @@ int make_db_list(THD *thd, List *files, /* - If we have db lookup vaule we just add it to list and + If we have db lookup value we just add it to list and exit from the function. We don't do this for database names longer than the maximum - path length. + name length. */ - if (lookup_field_vals->db_value.str && - lookup_field_vals->db_value.length < FN_REFLEN) + if (lookup_field_vals->db_value.str) { + if (lookup_field_vals->db_value.length > NAME_LEN) + { + /* + Impossible value for a database name, + found in a WHERE DATABASE_NAME = 'xxx' clause. + */ + return 0; + } + if (is_infoschema_db(lookup_field_vals->db_value.str, lookup_field_vals->db_value.length)) { @@ -2945,6 +2981,15 @@ make_table_name_list(THD *thd, List *table_names, LEX *lex, if (!lookup_field_vals->wild_table_value && lookup_field_vals->table_value.str) { + if (lookup_field_vals->table_value.length > NAME_LEN) + { + /* + Impossible value for a table name, + found in a WHERE TABLE_NAME = 'xxx' clause. + */ + return 0; + } + if (with_i_schema) { LEX_STRING *name; @@ -3411,6 +3456,9 @@ static int fill_schema_table_from_frm(THD *thd, TABLE_LIST *tables, bzero((char*) &table_list, sizeof(TABLE_LIST)); bzero((char*) &tbl, sizeof(TABLE)); + DBUG_ASSERT(db_name->length <= NAME_LEN); + DBUG_ASSERT(table_name->length <= NAME_LEN); + if (lower_case_table_names) { /* @@ -3742,6 +3790,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) it.rewind(); /* To get access to new elements in basis list */ while ((db_name= it++)) { + DBUG_ASSERT(db_name->length <= NAME_LEN); #ifndef NO_EMBEDDED_ACCESS_CHECKS if (!(check_access(thd, SELECT_ACL, db_name->str, &thd->col_access, NULL, 0, 1) || @@ -3763,6 +3812,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) List_iterator_fast it_files(table_names); while ((table_name= it_files++)) { + DBUG_ASSERT(table_name->length <= NAME_LEN); restore_record(table, s->default_values); table->field[schema_table->idx_field1]-> store(db_name->str, db_name->length, system_charset_info); @@ -3909,6 +3959,7 @@ int fill_schema_schemata(THD *thd, TABLE_LIST *tables, COND *cond) List_iterator_fast it(db_names); while ((db_name=it++)) { + DBUG_ASSERT(db_name->length <= NAME_LEN); if (with_i_schema) // information schema name is always first in list { if (store_schema_shemata(thd, table, db_name, From 95e99e12639f8cde87bba555dcb72cd8cc6542ad Mon Sep 17 00:00:00 2001 From: Praveenkumar Hulakund Date: Wed, 19 Mar 2014 12:30:30 +0530 Subject: [PATCH 06/52] Bug#11759519 - INFINITE HANG WITH 100% CPU USAGE WITH LOAD DATA LOCAL AND IMPORT ERRORS Description: ----------- This bug happens due to the fact that current algorithm is designed that in the case of LOCAL load of data, in case of the error, the remaining part of the file is read in order to return the proper error message to the client side. But, the problem with current implementation is that data stream for the client side is cleared only in the case where line delimiters exist, which is not a case with, for example fixed width fields. Fix: ---- Ported patch provided by Sinisa Milivojevic n bug report for this issue to 5.5+ versions. As part of this patch code is changed to clear the data stream by calling new member function "READ_INFO::skip_data_till_eof". --- mysql-test/r/loaddata.result | 12 ++++++++++++ mysql-test/t/loaddata.test | 21 +++++++++++++++++++++ sql/sql_load.cc | 19 +++++++++++++------ 3 files changed, 46 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result index 932c1c76027..2d67d24bedd 100644 --- a/mysql-test/r/loaddata.result +++ b/mysql-test/r/loaddata.result @@ -520,3 +520,15 @@ LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug11735141.txt' INTO TABLE t1; ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field drop table t1; End of 5.1 tests +# +# Bug#11759519 INFINITE HANG WITH 100% CPU USAGE WITH LOAD DATA LOCAL AND IMPORT ERRORS +# +SET @old_mode= @@sql_mode; +CREATE TABLE t1 (fld1 INT); +SET sql_mode='strict_all_tables'; +# Without fix, load data hangs forever. +LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/mysql' REPLACE INTO TABLE t1 +FIELDS TERMINATED BY 't' LINES TERMINATED BY ''; +Got one of the listed errors +SET @@sql_mode= @old_mode; +DROP TABLE t1; diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test index 80956aa2cb6..aa7be52484e 100644 --- a/mysql-test/t/loaddata.test +++ b/mysql-test/t/loaddata.test @@ -635,3 +635,24 @@ create table t1(a point); drop table t1; --echo End of 5.1 tests + +--echo # +--echo # Bug#11759519 INFINITE HANG WITH 100% CPU USAGE WITH LOAD DATA LOCAL AND IMPORT ERRORS +--echo # +SET @old_mode= @@sql_mode; +CREATE TABLE t1 (fld1 INT); +--copy_file $EXE_MYSQL $MYSQLTEST_VARDIR/mysql + +SET sql_mode='strict_all_tables'; + +--echo # Without fix, load data hangs forever. +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,1000 +eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/mysql' REPLACE INTO TABLE t1 + FIELDS TERMINATED BY 't' LINES TERMINATED BY ''; + +SET @@sql_mode= @old_mode; + +--remove_file $MYSQLTEST_VARDIR/mysql +DROP TABLE t1; + diff --git a/sql/sql_load.cc b/sql/sql_load.cc index b593412c559..7f962520dd6 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -56,6 +56,9 @@ XML_TAG::XML_TAG(int l, String f, String v) } +#define GET (stack_pos != stack ? *--stack_pos : my_b_get(&cache)) +#define PUSH(A) *(stack_pos++)=(A) + class READ_INFO { File file; uchar *buffer, /* Buffer for read text */ @@ -110,6 +113,15 @@ public: either the table or THD value */ void set_io_cache_arg(void* arg) { cache.arg = arg; } + + /** + skip all data till the eof. + */ + void skip_data_till_eof() + { + while (GET != my_b_EOF) + ; + } }; static int read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, @@ -534,8 +546,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, if (error) { if (read_file_from_client) - while (!read_info.next_line()) - ; + read_info.skip_data_till_eof(); #ifndef EMBEDDED_LIBRARY if (mysql_bin_log.is_open()) @@ -1392,10 +1403,6 @@ READ_INFO::~READ_INFO() } -#define GET (stack_pos != stack ? *--stack_pos : my_b_get(&cache)) -#define PUSH(A) *(stack_pos++)=(A) - - inline int READ_INFO::terminator(char *ptr,uint length) { int chr=0; // Keep gcc happy From 5541d7c656c449a9c97f4f8ed162046d696ea60f Mon Sep 17 00:00:00 2001 From: Thirunarayanan B Date: Tue, 1 Apr 2014 10:46:13 +0530 Subject: [PATCH 07/52] Bug #17858679 TOO MANY TIMES OF MEMSET DECREASE THE PERFORMANCE UNDER HEAVY INSERT Problem: There are three memset call to allocate memory for system fields in each insert. Solution: Instead of calling it in 3 times, we can combine it into one memset call. It will reduce the CPU usage under heavy insert. Approved by Marko rb-4916 --- storage/innobase/row/row0ins.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/storage/innobase/row/row0ins.c b/storage/innobase/row/row0ins.c index 9d5212db6e8..12c4f6dff8c 100644 --- a/storage/innobase/row/row0ins.c +++ b/storage/innobase/row/row0ins.c @@ -151,35 +151,37 @@ row_ins_alloc_sys_fields( ut_ad(row && table && heap); ut_ad(dtuple_get_n_fields(row) == dict_table_get_n_cols(table)); - /* 1. Allocate buffer for row id */ + /* allocate buffer to hold the needed system created hidden columns. */ + uint len = DATA_ROW_ID_LEN + DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN; + ptr = mem_heap_zalloc(heap, len); + /* 1. Populate row-id */ col = dict_table_get_sys_col(table, DATA_ROW_ID); dfield = dtuple_get_nth_field(row, dict_col_get_no(col)); - ptr = mem_heap_zalloc(heap, DATA_ROW_ID_LEN); - dfield_set_data(dfield, ptr, DATA_ROW_ID_LEN); node->row_id_buf = ptr; - /* 3. Allocate buffer for trx id */ + ptr += DATA_ROW_ID_LEN; + /* 2. Populate trx id */ col = dict_table_get_sys_col(table, DATA_TRX_ID); dfield = dtuple_get_nth_field(row, dict_col_get_no(col)); - ptr = mem_heap_zalloc(heap, DATA_TRX_ID_LEN); dfield_set_data(dfield, ptr, DATA_TRX_ID_LEN); node->trx_id_buf = ptr; - /* 4. Allocate buffer for roll ptr */ + ptr += DATA_TRX_ID_LEN; + + /* 3. Populate roll ptr */ col = dict_table_get_sys_col(table, DATA_ROLL_PTR); dfield = dtuple_get_nth_field(row, dict_col_get_no(col)); - ptr = mem_heap_zalloc(heap, DATA_ROLL_PTR_LEN); dfield_set_data(dfield, ptr, DATA_ROLL_PTR_LEN); } From 0df90f2a6f58303fed6e9562963161c090677941 Mon Sep 17 00:00:00 2001 From: Thirunarayanan B Date: Tue, 1 Apr 2014 11:36:58 +0530 Subject: [PATCH 08/52] Bug #17858679 TOO MANY TIMES OF MEMSET DECREASE THE PERFORMANCE UNDER HEAVY INSERT Fixing the build problem in 5.5. --- storage/innobase/row/row0ins.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/storage/innobase/row/row0ins.c b/storage/innobase/row/row0ins.c index 12c4f6dff8c..d9be81e461d 100644 --- a/storage/innobase/row/row0ins.c +++ b/storage/innobase/row/row0ins.c @@ -143,6 +143,7 @@ row_ins_alloc_sys_fields( const dict_col_t* col; dfield_t* dfield; byte* ptr; + uint len; row = node->row; table = node->table; @@ -152,7 +153,7 @@ row_ins_alloc_sys_fields( ut_ad(dtuple_get_n_fields(row) == dict_table_get_n_cols(table)); /* allocate buffer to hold the needed system created hidden columns. */ - uint len = DATA_ROW_ID_LEN + DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN; + len = DATA_ROW_ID_LEN + DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN; ptr = mem_heap_zalloc(heap, len); /* 1. Populate row-id */ From 4747ca1592a5a1c6359c7a086f30db631c1b36bd Mon Sep 17 00:00:00 2001 From: Balasubramanian Kandasamy Date: Thu, 3 Apr 2014 12:56:26 +0200 Subject: [PATCH 09/52] Support for enterprise packages --- packaging/rpm-oel/mysql.spec.in | 73 ++++++++++++++++++++++++++++++--- 1 file changed, 68 insertions(+), 5 deletions(-) diff --git a/packaging/rpm-oel/mysql.spec.in b/packaging/rpm-oel/mysql.spec.in index d9e29317ff5..8744a4616aa 100644 --- a/packaging/rpm-oel/mysql.spec.in +++ b/packaging/rpm-oel/mysql.spec.in @@ -85,7 +85,7 @@ Name: mysql-%{product_suffix} Summary: A very fast and reliable SQL database server Group: Applications/Databases Version: @VERSION@ -Release: 4%{?dist} +Release: 5%{?commercial:.1}%{?dist} License: Copyright (c) 2000, @MYSQL_COPYRIGHT_YEAR@, %{mysql_vendor}. All rights reserved. Under %{?license_type} license as shown in the Description field. Source0: https://cdn.mysql.com/Downloads/MySQL-@MYSQL_BASE_VERSION@/%{src_dir}.tar.gz URL: http://www.mysql.com/ @@ -153,13 +153,17 @@ Requires: procps Requires: shadow-utils Requires: net-tools %if 0%{?commercial} +Provides: MySQL-server-advanced%{?_isa} = %{version}-%{release} +Obsoletes: MySQL-server-advanced < %{version}-%{release} Obsoletes: mysql-community-server < %{version}-%{release} Requires: mysql-enterprise-client%{?_isa} = %{version}-%{release} Requires: mysql-enterprise-common%{?_isa} = %{version}-%{release} %else +Provides: MySQL-server%{?_isa} = %{version}-%{release} Requires: mysql-community-client%{?_isa} = %{version}-%{release} Requires: mysql-community-common%{?_isa} = %{version}-%{release} %endif +Obsoletes: MySQL-server < %{version}-%{release} Obsoletes: mysql-server < %{version}-%{release} Obsoletes: mariadb-server Provides: mysql-server = %{version}-%{release} @@ -199,11 +203,15 @@ to run and administer a MySQL server. Summary: MySQL database client applications and tools Group: Applications/Databases %if 0%{?commercial} +Provides: MySQL-client-advanced%{?_isa} = %{version}-%{release} +Obsoletes: MySQL-client-advanced < %{version}-%{release} Obsoletes: mysql-community-client < %{version}-%{release} Requires: mysql-enterprise-libs%{?_isa} = %{version}-%{release} %else +Provides: MySQL-client%{?_isa} = %{version}-%{release} Requires: mysql-community-libs%{?_isa} = %{version}-%{release} %endif +Obsoletes: MySQL-client < %{version}-%{release} Obsoletes: mariadb %if 0%{?rhel} > 5 Obsoletes: mysql < %{version}-%{release} @@ -234,11 +242,15 @@ MySQL database server, and MySQL embedded server. Summary: Test suite for the MySQL database server Group: Applications/Databases %if 0%{?commercial} +Provides: MySQL-test-advanced%{?_isa} = %{version}-%{release} +Obsoletes: MySQL-test-advanced < %{version}-%{release} Obsoletes: mysql-community-test < %{version}-%{release} Requires: mysql-enterprise-server%{?_isa} = %{version}-%{release} %else +Provides: MySQL-test%{?_isa} = %{version}-%{release} Requires: mysql-community-server%{?_isa} = %{version}-%{release} %endif +Obsoletes: MySQL-test < %{version}-%{release} Obsoletes: mysql-test < %{version}-%{release} Obsoletes: mariadb-test Provides: mysql-test = %{version}-%{release} @@ -254,11 +266,15 @@ database server. Summary: Development header files and libraries for MySQL database client applications Group: Applications/Databases %if 0%{?commercial} +Provides: MySQL-devel-advanced%{?_isa} = %{version}-%{release} +Obsoletes: MySQL-devel-advanced < %{version}-%{release} Obsoletes: mysql-community-devel < %{version}-%{release} Requires: mysql-enterprise-libs%{?_isa} = %{version}-%{release} %else +Provides: MySQL-devel%{?_isa} = %{version}-%{release} Requires: mysql-community-libs%{?_isa} = %{version}-%{release} %endif +Obsoletes: MySQL-devel < %{version}-%{release} Obsoletes: mysql-devel < %{version}-%{release} Obsoletes: mariadb-devel Provides: mysql-devel = %{version}-%{release} @@ -272,11 +288,15 @@ to develop MySQL client applications. Summary: Shared libraries for MySQL database client applications Group: Applications/Databases %if 0%{?commercial} +Provides: MySQL-shared-advanced%{?_isa} = %{version}-%{release} +Obsoletes: MySQL-shared-advanced < %{version}-%{release} Obsoletes: mysql-community-libs < %{version}-%{release} Requires: mysql-enterprise-common%{?_isa} = %{version}-%{release} %else +Provides: MySQL-shared%{?_isa} = %{version}-%{release} Requires: mysql-community-common%{?_isa} = %{version}-%{release} %endif +Obsoletes: MySQL-shared < %{version}-%{release} Obsoletes: mysql-libs < %{version}-%{release} Obsoletes: mariadb-libs Provides: mysql-libs = %{version}-%{release} @@ -294,11 +314,15 @@ Obsoletes: mysql-libs-compat < %{version}-%{release} Provides: mysql-libs-compat = %{version}-%{release} Provides: mysql-libs-compat%{?_isa} = %{version}-%{release} %if 0%{?commercial} +Provides: MySQL-shared-compat-advanced%{?_isa} = %{version}-%{release} +Obsoletes: MySQL-shared-compat-advanced < %{version}-%{release} Obsoletes: mysql-community-libs-compat < %{version}-%{release} Requires: mysql-enterprise-libs%{?_isa} = %{version}-%{release} %else +Provides: MySQL-shared-compat%{?_isa} = %{version}-%{release} Requires: mysql-community-libs%{?_isa} = %{version}-%{release} %endif +Obsoletes: MySQL-shared-compat < %{version}-%{release} %if 0%{?rhel} > 5 Obsoletes: mysql-libs < %{version}-%{release} %endif @@ -312,11 +336,15 @@ applications. Summary: MySQL embedded library Group: Applications/Databases %if 0%{?commercial} +Provides: MySQL-embedded-advanced%{?_isa} = %{version}-%{release} +Obsoletes: MySQL-embedded-advanced < %{version}-%{release} Obsoletes: mysql-community-embedded < %{version}-%{release} Requires: mysql-enterprise-common%{?_isa} = %{version}-%{release} %else +Provides: MySQL-embedded%{?_isa} = %{version}-%{release} Requires: mysql-community-common%{?_isa} = %{version}-%{release} %endif +Obsoletes: MySQL-embedded < %{version}-%{release} Obsoletes: mysql-embedded < %{version}-%{release} Provides: mysql-embedded = %{version}-%{release} Provides: mysql-emdedded%{?_isa} = %{version}-%{release} @@ -435,9 +463,6 @@ popd ) %endif # 0%{?compatlib} -export CFLAGS="%{optflags} %{?el7:-DTAOCRYPT_DISABLE_X86ASM}" -export CXXFLAGS="%{optflags} %{?el7:-DTAOCRYPT_DISABLE_X86ASM}" - # Build debug versions of mysqld and libmysqld.a mkdir debug ( @@ -676,7 +701,41 @@ fi %attr(755, root, root) %{_sbindir}/mysqld %attr(755, root, root) %{_sbindir}/mysqld-debug -%{_libdir}/mysql/plugin +%dir %{_libdir}/mysql/plugin +%attr(755, root, root) %{_libdir}/mysql/plugin/adt_null.so +%attr(755, root, root) %{_libdir}/mysql/plugin/auth_socket.so +%attr(755, root, root) %{_libdir}/mysql/plugin/mypluglib.so +%attr(755, root, root) %{_libdir}/mysql/plugin/semisync_master.so +%attr(755, root, root) %{_libdir}/mysql/plugin/semisync_slave.so +%dir %{_libdir}/mysql/plugin/debug +%attr(755, root, root) %{_libdir}/mysql/plugin/debug/adt_null.so +%attr(755, root, root) %{_libdir}/mysql/plugin/debug/auth_socket.so +%attr(755, root, root) %{_libdir}/mysql/plugin/debug/mypluglib.so +%attr(755, root, root) %{_libdir}/mysql/plugin/debug/semisync_master.so +%attr(755, root, root) %{_libdir}/mysql/plugin/debug/semisync_slave.so + +%attr(755, root, root) %{_libdir}/mysql/plugin/auth.so +%attr(755, root, root) %{_libdir}/mysql/plugin/auth_test_plugin.so +%attr(644, root, root) %{_libdir}/mysql/plugin/daemon_example.ini +%attr(755, root, root) %{_libdir}/mysql/plugin/libdaemon_example.so +%attr(755, root, root) %{_libdir}/mysql/plugin/qa_auth_client.so +%attr(755, root, root) %{_libdir}/mysql/plugin/qa_auth_interface.so +%attr(755, root, root) %{_libdir}/mysql/plugin/qa_auth_server.so +%attr(755, root, root) %{_libdir}/mysql/plugin/debug/auth.so +%attr(755, root, root) %{_libdir}/mysql/plugin/debug/auth_test_plugin.so +%attr(755, root, root) %{_libdir}/mysql/plugin/debug/libdaemon_example.so +%attr(755, root, root) %{_libdir}/mysql/plugin/debug/qa_auth_client.so +%attr(755, root, root) %{_libdir}/mysql/plugin/debug/qa_auth_interface.so +%attr(755, root, root) %{_libdir}/mysql/plugin/debug/qa_auth_server.so + +%if 0%{?commercial} +%attr(755, root, root) %{_libdir}/mysql/plugin/audit_log.so +%attr(755, root, root) %{_libdir}/mysql/plugin/authentication_pam.so +%attr(755, root, root) %{_libdir}/mysql/plugin/thread_pool.so +%attr(755, root, root) %{_libdir}/mysql/plugin/debug/audit_log.so +%attr(755, root, root) %{_libdir}/mysql/plugin/debug/authentication_pam.so +%attr(755, root, root) %{_libdir}/mysql/plugin/debug/thread_pool.so +%endif %attr(644, root, root) %{_datadir}/mysql/fill_help_tables.sql %attr(644, root, root) %{_datadir}/mysql/mysql_system_tables.sql @@ -819,6 +878,10 @@ fi %endif %changelog +* Mon Mar 31 2014 Balasubramanian Kandasamy - 5.5.37-5 +- Support for enterprise packages +- Upgrade from MySQL-* packages + * Fri Mar 14 2014 Balasubramanian Kandasamy - 5.5.37-4 - Resolve mysql conflict with mysql-community-client From 1a9ce19c116154457dd35ebcaf1eb6ee7e74a891 Mon Sep 17 00:00:00 2001 From: Balasubramanian Kandasamy Date: Fri, 4 Apr 2014 05:58:49 +0200 Subject: [PATCH 10/52] Changed permisison for filter-requires.sh and filter-provides.sh --- packaging/rpm-oel/filter-provides.sh | 0 packaging/rpm-oel/filter-requires.sh | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 packaging/rpm-oel/filter-provides.sh mode change 100644 => 100755 packaging/rpm-oel/filter-requires.sh diff --git a/packaging/rpm-oel/filter-provides.sh b/packaging/rpm-oel/filter-provides.sh old mode 100644 new mode 100755 diff --git a/packaging/rpm-oel/filter-requires.sh b/packaging/rpm-oel/filter-requires.sh old mode 100644 new mode 100755 From 7f8fb4509e9dbd7314f899284349556d0b354083 Mon Sep 17 00:00:00 2001 From: Serge Kozlov Date: Fri, 4 Apr 2014 10:42:25 +0400 Subject: [PATCH 11/52] BUG#18506556. Added sync slave with master for clean-up --- mysql-test/suite/rpl/t/rpl_heartbeat_basic.test | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test index 78489449ab8..87939aa3c65 100644 --- a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test +++ b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test @@ -363,13 +363,11 @@ let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_b --connection master DELETE FROM t1; DROP EVENT e1; +--sync_slave_with_master --echo - - # Check received heartbeat events while logs flushed on slave ---connection slave --echo *** Flush logs on slave *** STOP SLAVE; RESET SLAVE; From b2e66814b4ba860f464c9217c5f8c45fb254a089 Mon Sep 17 00:00:00 2001 From: Balasubramanian Kandasamy Date: Mon, 7 Apr 2014 14:51:44 +0200 Subject: [PATCH 12/52] Fix Cflags for el7 --- packaging/rpm-oel/mysql.spec.in | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packaging/rpm-oel/mysql.spec.in b/packaging/rpm-oel/mysql.spec.in index 8744a4616aa..2dc71b4c40d 100644 --- a/packaging/rpm-oel/mysql.spec.in +++ b/packaging/rpm-oel/mysql.spec.in @@ -85,7 +85,7 @@ Name: mysql-%{product_suffix} Summary: A very fast and reliable SQL database server Group: Applications/Databases Version: @VERSION@ -Release: 5%{?commercial:.1}%{?dist} +Release: 6%{?commercial:.1}%{?dist} License: Copyright (c) 2000, @MYSQL_COPYRIGHT_YEAR@, %{mysql_vendor}. All rights reserved. Under %{?license_type} license as shown in the Description field. Source0: https://cdn.mysql.com/Downloads/MySQL-@MYSQL_BASE_VERSION@/%{src_dir}.tar.gz URL: http://www.mysql.com/ @@ -495,6 +495,8 @@ mkdir release -DBUILD_CONFIG=mysql_release \ -DINSTALL_LAYOUT=RPM \ -DCMAKE_BUILD_TYPE=RelWithDebInfo %{?el7:-DENABLE_DTRACE=OFF} \ + -DCMAKE_C_FLAGS="%{optflags}" \ + -DCMAKE_CXX_FLAGS="%{optflags}" \ -DINSTALL_LIBDIR="%{_lib}/mysql" \ -DINSTALL_PLUGINDIR="%{_lib}/mysql/plugin" \ -DMYSQL_UNIX_ADDR="%{mysqldatadir}/mysql.sock" \ @@ -878,6 +880,9 @@ fi %endif %changelog +* Mon Apr 07 2014 Balasubramanian Kandasamy - 5.5.37-6 +- Fix Cflags for el7 + * Mon Mar 31 2014 Balasubramanian Kandasamy - 5.5.37-5 - Support for enterprise packages - Upgrade from MySQL-* packages From c5f8d2587a3e3a38ebe62b08e4cada0e8f84ee4d Mon Sep 17 00:00:00 2001 From: Balasubramanian Kandasamy Date: Mon, 7 Apr 2014 16:36:09 +0200 Subject: [PATCH 13/52] updated optflags variable and cmake option for debug build --- packaging/rpm-oel/mysql.spec.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packaging/rpm-oel/mysql.spec.in b/packaging/rpm-oel/mysql.spec.in index 2dc71b4c40d..44b387bbebf 100644 --- a/packaging/rpm-oel/mysql.spec.in +++ b/packaging/rpm-oel/mysql.spec.in @@ -468,12 +468,13 @@ mkdir debug ( cd debug # Attempt to remove any optimisation flags from the debug build - CFLAGS=$(echo "${CFLAGS}" | sed -e 's/-O2 / /' -e 's/-Wp,-D_FORTIFY_SOURCE=2/ /') - CXXFLAGS=$(echo "${CFLAGS}" | sed -e 's/-O2 / /' -e 's/-Wp,-D_FORTIFY_SOURCE=2/ /') + optflags=$(echo "%{optflags}" | sed -e 's/-O2 / /' -e 's/-Wp,-D_FORTIFY_SOURCE=2/ /') cmake ../%{src_dir} \ -DBUILD_CONFIG=mysql_release \ -DINSTALL_LAYOUT=RPM \ -DCMAKE_BUILD_TYPE=Debug %{?el7:-DENABLE_DTRACE=OFF} \ + -DCMAKE_C_FLAGS="$optflags" \ + -DCMAKE_CXX_FLAGS="$optflags" \ -DINSTALL_LIBDIR="%{_lib}/mysql" \ -DINSTALL_PLUGINDIR="%{_lib}/mysql/plugin" \ -DMYSQL_UNIX_ADDR="%{mysqldatadir}/mysql.sock" \ From 92351c831f7fefcbbd48c7e914225fdc55adad36 Mon Sep 17 00:00:00 2001 From: Arun Kuruvila Date: Thu, 10 Apr 2014 11:10:31 +0530 Subject: [PATCH 14/52] Description: When we execute a correlated subquery on an archive table which is using an auto increment column, the server hangs. In order to recover the mysqld process, it has to be terminated abnormally using SIGKILL. The problem is observed in mysql-5.5. Bug #18065452 "PREPARING" STATE HOGS CPU WITH ARCHIVE + SUBQUERY Analysis: This happens because the server is trapped inside an infinite loop in the function, "subselect_indexsubquery_engine::exec()". This function resolves the correlated suquery by doing an index lookup for the appropriate engine. In case of archive engine, after reaching the end of records, "table->status" is not set to STATUS_NOT_FOUND. As a result the loop is not terminated. Fix: The "table->status" is set to STATUS_NOT_FOUND when the end of records is reached. --- storage/archive/ha_archive.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index 164c59f2426..aafbedf6a07 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -1,5 +1,6 @@ /* - Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights + reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -1078,6 +1079,7 @@ int ha_archive::index_next(uchar * buf) } rc= found ? 0 : HA_ERR_END_OF_FILE; + table->status= rc ? STATUS_NOT_FOUND : 0; MYSQL_INDEX_READ_ROW_DONE(rc); DBUG_RETURN(rc); } From 37b9a31a3095dd8f4a15b957f1c4b28fe4fab4ed Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Thu, 10 Apr 2014 13:18:32 +0300 Subject: [PATCH 15/52] Bug #18359924: INNODB AND MYISAM CORRUPTION ON PREFIX INDEXES The problem was in the validation of the input data for blob types. When assigned binary data, the character blob types were only checking if the length of these data is a multiple of the minimum char length for the destination charset. And since e.g. UTF-8's minimum character length is 1 (becuase it's variable length) even byte sequences that are invalid utf-8 strings (e.g. wrong leading byte etc) were copied verbatim into utf-8 columns when coming from binary strings or fields. Storing invalid data into string columns was having all kinds of ill effects on code that assumed that the encoding data are valid to begin with. Fixed by additionally checking the incoming binary string for validity when assigning it to a non-binary string column. Made sure the conversions to charsets with no known "invalid" ranges are not covered by the extra check. Removed trailing spaces. Test case added. --- sql/field.cc | 8 +++----- sql/sql_string.cc | 30 ++++++++++++++++++++++++++++++ sql/sql_string.h | 3 +++ 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/sql/field.cc b/sql/field.cc index c65346423a0..3069a1ef60b 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -7376,8 +7376,7 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs) If content of the 'from'-address is cached in the 'value'-object it is possible that the content needs a character conversion. */ - uint32 dummy_offset; - if (!String::needs_conversion(length, cs, field_charset, &dummy_offset)) + if (!String::needs_conversion_on_storage(length, cs, field_charset)) { Field_blob::store_length(length); bmove(ptr+packlength, &from, sizeof(char*)); @@ -7980,7 +7979,7 @@ int Field_enum::store(const char *from,uint length,CHARSET_INFO *cs) String tmpstr(buff,sizeof(buff), &my_charset_bin); /* Convert character set if necessary */ - if (String::needs_conversion(length, cs, field_charset, ¬_used)) + if (String::needs_conversion_on_storage(length, cs, field_charset)) { uint dummy_errors; tmpstr.copy(from, length, cs, field_charset, &dummy_errors); @@ -8196,12 +8195,11 @@ int Field_set::store(const char *from,uint length,CHARSET_INFO *cs) int err= 0; char *not_used; uint not_used2; - uint32 not_used_offset; char buff[STRING_BUFFER_USUAL_SIZE]; String tmpstr(buff,sizeof(buff), &my_charset_bin); /* Convert character set if necessary */ - if (String::needs_conversion(length, cs, field_charset, ¬_used_offset)) + if (String::needs_conversion_on_storage(length, cs, field_charset)) { uint dummy_errors; tmpstr.copy(from, length, cs, field_charset, &dummy_errors); diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 07fc7e4ff1d..b9a9ce92cd6 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -223,6 +223,36 @@ bool String::needs_conversion(uint32 arg_length, } +/* + Checks that the source string can just be copied to the destination string + without conversion. + Unlike needs_conversion it will require conversion on incoming binary data + to ensure the data are verified for vailidity first. + + @param arg_length Length of string to copy. + @param from_cs Character set to copy from + @param to_cs Character set to copy to + + @return conversion needed +*/ +bool String::needs_conversion_on_storage(uint32 arg_length, + CHARSET_INFO *cs_from, + CHARSET_INFO *cs_to) +{ + uint32 offset; + return (needs_conversion(arg_length, cs_from, cs_to, &offset) || + (cs_from == &my_charset_bin && /* force conversion when storing a binary string */ + cs_to != &my_charset_bin && /* into a non-binary destination */ + ( /* and any of the following is true :*/ + cs_to->mbminlen != cs_to->mbmaxlen || /* it's a variable length encoding */ + cs_to->mbminlen > 2 || /* longer than 2 bytes : neither 1 byte nor ucs2 */ + 0 != (arg_length % cs_to->mbmaxlen) + ) + ) + ); +} + + /* Copy a multi-byte character sets with adding leading zeros. diff --git a/sql/sql_string.h b/sql/sql_string.h index 234e8272b88..971af9ea91a 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -280,6 +280,9 @@ public: static bool needs_conversion(uint32 arg_length, CHARSET_INFO *cs_from, CHARSET_INFO *cs_to, uint32 *offset); + static bool needs_conversion_on_storage(uint32 arg_length, + CHARSET_INFO *cs_from, + CHARSET_INFO *cs_to); bool copy_aligned(const char *s, uint32 arg_length, uint32 offset, CHARSET_INFO *cs); bool set_or_copy_aligned(const char *s, uint32 arg_length, CHARSET_INFO *cs); From ea38c2658229c45e48bf417168efc85f4768cef4 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 11 Apr 2014 10:42:30 +0300 Subject: [PATCH 16/52] Addendum #1 to the fix for bug #18359924 Removed unused variable. Fixed long (>80 lines) --- sql/field.cc | 1 - sql/sql_string.cc | 16 +++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/sql/field.cc b/sql/field.cc index 3069a1ef60b..abe856a8292 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -7974,7 +7974,6 @@ int Field_enum::store(const char *from,uint length,CHARSET_INFO *cs) { ASSERT_COLUMN_MARKED_FOR_WRITE; int err= 0; - uint32 not_used; char buff[STRING_BUFFER_USUAL_SIZE]; String tmpstr(buff,sizeof(buff), &my_charset_bin); diff --git a/sql/sql_string.cc b/sql/sql_string.cc index b9a9ce92cd6..41725128415 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -241,11 +241,17 @@ bool String::needs_conversion_on_storage(uint32 arg_length, { uint32 offset; return (needs_conversion(arg_length, cs_from, cs_to, &offset) || - (cs_from == &my_charset_bin && /* force conversion when storing a binary string */ - cs_to != &my_charset_bin && /* into a non-binary destination */ - ( /* and any of the following is true :*/ - cs_to->mbminlen != cs_to->mbmaxlen || /* it's a variable length encoding */ - cs_to->mbminlen > 2 || /* longer than 2 bytes : neither 1 byte nor ucs2 */ + /* force conversion when storing a binary string */ + (cs_from == &my_charset_bin && + /* into a non-binary destination */ + cs_to != &my_charset_bin && + /* and any of the following is true :*/ + ( + /* it's a variable length encoding */ + cs_to->mbminlen != cs_to->mbmaxlen || + /* longer than 2 bytes : neither 1 byte nor ucs2 */ + cs_to->mbminlen > 2 || + /* and is not a multiple of the char byte size */ 0 != (arg_length % cs_to->mbmaxlen) ) ) From 1b74f2e3da53dd8b965920fad2ff599df2d1fc89 Mon Sep 17 00:00:00 2001 From: Sujatha Sivakumar Date: Tue, 15 Apr 2014 15:17:25 +0530 Subject: [PATCH 17/52] Bug#17942050:KILL OF TRUNCATE TABLE WILL LEAD TO BINARY LOG WRITTEN WHILE ROWS REMAINS Problem: ======== When truncate table fails while using transactional based engines even though the operation errors out we still continue and log it to binlog. Because of this master has data but the truncate will be written to binary log which will cause inconsistency. Analysis: ======== Truncate table can happen either through drop and create of table or by deleting rows. In the second case the existing code is written in such a way that even if an error occurs the truncate statement will always be binlogged. Which is not correct. Binlogging of TRUNCATE TABLE statement should check whether truncate is executed "transactionally or not". If the table is transaction based we log the TRUNCATE TABLE only on successful completion. If table is non transactional there are possibilities that on error we could have partial changes done hence in such cases we do log in spite of errors as some of the lines might have been removed, so the statement has to be sent to slave. Fix: === Using table handler whether truncate table is being executed in transaction based mode or not is identified and statement is binlogged accordingly. mysql-test/suite/binlog/r/binlog_truncate_kill.result: Added test case to test the fix for Bug#17942050. mysql-test/suite/binlog/t/binlog_truncate_kill.test: Added test case to test the fix for Bug#17942050. sql/sql_truncate.cc: Check if truncation is successful or not and retun appropriate return values so that binlogging can be done based on that. sql/sql_truncate.h: Added a new enum. --- .../binlog/r/binlog_truncate_kill.result | 33 +++++++++++ .../suite/binlog/t/binlog_truncate_kill.test | 56 +++++++++++++++++++ sql/sql_truncate.cc | 51 ++++++++++++----- sql/sql_truncate.h | 10 +++- 4 files changed, 135 insertions(+), 15 deletions(-) create mode 100644 mysql-test/suite/binlog/r/binlog_truncate_kill.result create mode 100644 mysql-test/suite/binlog/t/binlog_truncate_kill.test diff --git a/mysql-test/suite/binlog/r/binlog_truncate_kill.result b/mysql-test/suite/binlog/r/binlog_truncate_kill.result new file mode 100644 index 00000000000..c2ea2e8d404 --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_truncate_kill.result @@ -0,0 +1,33 @@ +RESET MASTER; +connection default; +CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, a INT, b INT) ENGINE=INNODB; +INSERT INTO t1(a, b) VALUES(1,2),(2,4),(3,6),(4,8),(5,10); +SET DEBUG_SYNC = "open_and_process_table signal truncate_before_lock wait_for forever"; +TRUNCATE t1; +connect con1,localhost,root,,; +SET DEBUG_SYNC = "now wait_for truncate_before_lock"; +SELECT ((@id := id) - id) FROM information_schema.processlist WHERE processlist.info LIKE '%TRUNCATE t1%' AND state LIKE '%open_and_process_table%'; +((@id := id) - id) +0 +KILL QUERY @id; +connection default; +ERROR 70100: Query execution was interrupted +connection con1; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, a INT, b INT) ENGINE=INNODB +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Intvar # # INSERT_ID=1 +master-bin.000001 # Query # # use `test`; INSERT INTO t1(a, b) VALUES(1,2),(2,4),(3,6),(4,8),(5,10) +master-bin.000001 # Xid # # COMMIT /* XID */ +disconnect con1; +connection default; +SELECT * FROM t1; +id a b +1 1 2 +2 2 4 +3 3 6 +4 4 8 +5 5 10 +DROP TABLE t1; +SET DEBUG_SYNC= 'RESET'; diff --git a/mysql-test/suite/binlog/t/binlog_truncate_kill.test b/mysql-test/suite/binlog/t/binlog_truncate_kill.test new file mode 100644 index 00000000000..ffbccfa536f --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_truncate_kill.test @@ -0,0 +1,56 @@ +############################################################################### +# Bug#17942050:KILL OF TRUNCATE TABLE WILL LEAD TO BINARY LOG WRITTEN WHILE +# ROWS REMAINS +# +# Problem: +# ======== +# When truncate table fails while using transactional based engines even +# though the operation errors out we still continue and log it to binlog. +# Because of this master has data but the truncate will be written to binary +# log which will cause inconsistency. +# +# Test: +# ===== +# Make master to wait in "open_table" call during the execution of truncate +# table command and kill the truncate table from other connection. This causes +# open table to return an error saying truncate failed during open table. This +# statement should not be binlogged. +############################################################################### +--source include/have_debug_sync.inc +--source include/have_binlog_format_statement.inc +RESET MASTER; +--enable_connect_log +--connection default +CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, a INT, b INT) ENGINE=INNODB; +INSERT INTO t1(a, b) VALUES(1,2),(2,4),(3,6),(4,8),(5,10); +SET DEBUG_SYNC = "open_and_process_table signal truncate_before_lock wait_for forever"; +--send TRUNCATE t1 + +connect(con1,localhost,root,,); +SET DEBUG_SYNC = "now wait_for truncate_before_lock"; +# Wait for one connection to reach open_and_process_table. +--let $show_statement= SHOW PROCESSLIST +--let $field= State +--let $condition= 'debug sync point: open_and_process_table'; +--source include/wait_show_condition.inc + +SELECT ((@id := id) - id) FROM information_schema.processlist WHERE processlist.info LIKE '%TRUNCATE t1%' AND state LIKE '%open_and_process_table%'; +# Test killing from mysql server +KILL QUERY @id; + +connection default; +--ERROR ER_QUERY_INTERRUPTED +--reap + +connection con1; +--source include/show_binlog_events.inc + +disconnect con1; +--source include/wait_until_disconnected.inc +connection default; + +SELECT * FROM t1; + +DROP TABLE t1; +SET DEBUG_SYNC= 'RESET'; +--disable_connect_log diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc index 2285131fade..07bf145c847 100644 --- a/sql/sql_truncate.cc +++ b/sql/sql_truncate.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. 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 @@ -181,12 +181,19 @@ fk_truncate_illegal_if_parent(THD *thd, TABLE *table) @param table_ref Table list element for the table to be truncated. @param is_tmp_table True if element refers to a temp table. - @retval 0 Success. - @retval > 0 Error code. + @retval TRUNCATE_OK Truncate was successful and statement can be safely + binlogged. + @retval TRUNCATE_FAILED_BUT_BINLOG Truncate failed but still go ahead with + binlogging as in case of non transactional tables + partial truncation is possible. + + @retval TRUNCATE_FAILED_SKIP_BINLOG Truncate was not successful hence donot + binlong the statement. */ -int Truncate_statement::handler_truncate(THD *thd, TABLE_LIST *table_ref, - bool is_tmp_table) +enum Truncate_statement::truncate_result +Truncate_statement::handler_truncate(THD *thd, TABLE_LIST *table_ref, + bool is_tmp_table) { int error= 0; uint flags; @@ -228,16 +235,30 @@ int Truncate_statement::handler_truncate(THD *thd, TABLE_LIST *table_ref, /* Open the table as it will handle some required preparations. */ if (open_and_lock_tables(thd, table_ref, FALSE, flags)) - DBUG_RETURN(1); + DBUG_RETURN(TRUNCATE_FAILED_SKIP_BINLOG); /* Whether to truncate regardless of foreign keys. */ if (! (thd->variables.option_bits & OPTION_NO_FOREIGN_KEY_CHECKS)) - error= fk_truncate_illegal_if_parent(thd, table_ref->table); + if (fk_truncate_illegal_if_parent(thd, table_ref->table)) + DBUG_RETURN(TRUNCATE_FAILED_SKIP_BINLOG); - if (!error && (error= table_ref->table->file->ha_truncate())) + error= table_ref->table->file->ha_truncate(); + if (error) + { table_ref->table->file->print_error(error, MYF(0)); - - DBUG_RETURN(error); + /* + If truncate method is not implemented then we don't binlog the + statement. If truncation has failed in a transactional engine then also we + donot binlog the statment. Only in non transactional engine we binlog + inspite of errors. + */ + if (error == HA_ERR_WRONG_COMMAND || + table_ref->table->file->has_transactions()) + DBUG_RETURN(TRUNCATE_FAILED_SKIP_BINLOG); + else + DBUG_RETURN(TRUNCATE_FAILED_BUT_BINLOG); + } + DBUG_RETURN(TRUNCATE_OK); } @@ -470,10 +491,14 @@ bool Truncate_statement::truncate_table(THD *thd, TABLE_LIST *table_ref) /* All effects of a TRUNCATE TABLE operation are committed even if - truncation fails. Thus, the query must be written to the binary - log. The only exception is a unimplemented truncate method. + truncation fails in the case of non transactional tables. Thus, the + query must be written to the binary log. The only exception is a + unimplemented truncate method. */ - binlog_stmt= !error || error != HA_ERR_WRONG_COMMAND; + if (error == TRUNCATE_OK || error == TRUNCATE_FAILED_BUT_BINLOG) + binlog_stmt= true; + else + binlog_stmt= false; } /* diff --git a/sql/sql_truncate.h b/sql/sql_truncate.h index 95a2f35df4f..0280ecc4932 100644 --- a/sql/sql_truncate.h +++ b/sql/sql_truncate.h @@ -1,6 +1,6 @@ #ifndef SQL_TRUNCATE_INCLUDED #define SQL_TRUNCATE_INCLUDED -/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. 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 @@ -47,11 +47,17 @@ public: bool execute(THD *thd); protected: + enum truncate_result{ + TRUNCATE_OK=0, + TRUNCATE_FAILED_BUT_BINLOG, + TRUNCATE_FAILED_SKIP_BINLOG + }; + /** Handle locking a base table for truncate. */ bool lock_table(THD *, TABLE_LIST *, bool *); /** Truncate table via the handler method. */ - int handler_truncate(THD *, TABLE_LIST *, bool); + enum truncate_result handler_truncate(THD *, TABLE_LIST *, bool); /** Optimized delete of all rows by doing a full regenerate of the table. From 22e9aa1c1a9607e56620be93728479331ab90ed5 Mon Sep 17 00:00:00 2001 From: Igor Solodovnikov Date: Thu, 17 Apr 2014 16:33:55 +0300 Subject: [PATCH 18/52] Bug #18053212 MYSQL_GET_SERVER_VERSION() CALL WITHOUT A VALID CONNECTION RESULTS IN SEG FAULT When there is no connection mysql_get_server_version() will return 0 and report CR_COMMANDS_OUT_OF_SYNC error. --- sql-common/client.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/sql-common/client.c b/sql-common/client.c index 16a61d7f53d..f2c091261b4 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -4230,17 +4230,27 @@ const char * STDCALL mysql_error(MYSQL *mysql) RETURN Signed number > 323000 + Zero if there is no connection */ ulong STDCALL mysql_get_server_version(MYSQL *mysql) { - uint major, minor, version; - char *pos= mysql->server_version, *end_pos; - major= (uint) strtoul(pos, &end_pos, 10); pos=end_pos+1; - minor= (uint) strtoul(pos, &end_pos, 10); pos=end_pos+1; - version= (uint) strtoul(pos, &end_pos, 10); - return (ulong) major*10000L+(ulong) (minor*100+version); + ulong major= 0, minor= 0, version= 0; + + if (mysql->server_version) + { + char *pos= mysql->server_version, *end_pos; + major= strtoul(pos, &end_pos, 10); pos=end_pos+1; + minor= strtoul(pos, &end_pos, 10); pos=end_pos+1; + version= strtoul(pos, &end_pos, 10); + } + else + { + set_mysql_error(mysql, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate); + } + + return major*10000 + minor*100 + version; } From 44ff73e9f4b6336eb701a73e41a988e4fa8a503e Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Mon, 21 Apr 2014 18:09:18 +0400 Subject: [PATCH 19/52] MDEV-750 LP:800035 - intermittent rpl_deadlock_innodb failures A typo in include file caused the timeout counter to be 10x less than expected. It was fixed in 5.5.20+ along with a bigger change, now also fixing in 5.1-5.3. --- mysql-test/include/wait_for_slave_param.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/include/wait_for_slave_param.inc b/mysql-test/include/wait_for_slave_param.inc index c9660b0679d..ea319933168 100644 --- a/mysql-test/include/wait_for_slave_param.inc +++ b/mysql-test/include/wait_for_slave_param.inc @@ -79,7 +79,7 @@ if (`SELECT '$_slave_check_configured' = 'No such row'`) # mysqltest doesn't provide any better way to multiply by 10 --let $_wait_for_slave_param_zero= 0 ---let $_slave_timeout_counter= $_slave_timeout$zero +--let $_slave_timeout_counter= $_slave_timeout$_wait_for_slave_param_zero --let $_slave_continue= 1 while ($_slave_continue) { From cfc49f2f993440b8a2ab541b092b3737f2a0c68c Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Wed, 23 Apr 2014 01:16:41 +0400 Subject: [PATCH 20/52] Change in the result file merged from 5.1 did not take into account MariaDB-specific result replacement --- mysql-test/suite/funcs_1/r/is_tables_mysql.result | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/suite/funcs_1/r/is_tables_mysql.result b/mysql-test/suite/funcs_1/r/is_tables_mysql.result index 3d58af72550..97cb0f593d6 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_tables_mysql.result @@ -133,7 +133,7 @@ TABLE_NAME help_category TABLE_TYPE BASE TABLE ENGINE MYISAM_OR_MARIA VERSION 10 -ROW_FORMAT Dynamic +ROW_FORMAT DYNAMIC_OR_PAGE TABLE_ROWS #TBLR# AVG_ROW_LENGTH #ARL# DATA_LENGTH #DL# From 3d73cd23d0e337560b8c044c728af3cf8a192b62 Mon Sep 17 00:00:00 2001 From: Igor Solodovnikov Date: Wed, 23 Apr 2014 12:46:00 +0300 Subject: [PATCH 21/52] Bug #17514920 MYSQL_THREAD_INIT() CALL WITHOUT MYSQL_INIT() IS CRASHING IN WINDOWS It is error to call mysql_thread_init() before libmysql is initialized with mysql_library_init(). Thus to fix this bug we need to detect if library was initialized and return error result if mysql_thread_init() is called with uninitialized library. Fixed by checking my_thread_global_init_done and returning nonzero if the library is not initialized. --- mysys/my_thr_init.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index d213b67377b..5d1376ea3ce 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -313,6 +313,9 @@ my_bool my_thread_init(void) struct st_my_thread_var *tmp; my_bool error=0; + if (!my_thread_global_init_done) + return 1; /* cannot proceed with unintialized library */ + #ifdef EXTRA_DEBUG_THREADS fprintf(stderr,"my_thread_init(): thread_id: 0x%lx\n", (ulong) pthread_self()); From c76e29c88415fbb381893f70cd7a9865cd49ee25 Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Wed, 23 Apr 2014 17:01:35 +0200 Subject: [PATCH 22/52] Backport from trunk: Bug#18396916 MAIN.OUTFILE_LOADDATA TEST FAILS ON ARM, AARCH64, PPC/PPC64 The recorded results for the failing tests were wrong. They were introduced by the patch for Bug#30946 mysqldump silently ignores --default-character-set when used with --tab Correct results were returned for platforms where 'char' is implemented as unsigned. This was reported as Bug#46895 Test "outfile_loaddata" fails (reproducible) Bug#11755168 46895: TEST "OUTFILE_LOADDATA" FAILS (REPRODUCIBLE) The patch for that bug fixed only parts of the problem, leaving the incorrect results in the .result file. Solution: use 'uchar' for field_terminator and line_terminator on all platforms. Also: remove some un-necessary casts, leaving the ones we actually need. --- mysql-test/r/outfile_loaddata.result | 24 ++++++++----- mysql-test/t/outfile_loaddata.test | 4 +++ sql/sql_load.cc | 53 ++++++++++++++++------------ 3 files changed, 51 insertions(+), 30 deletions(-) diff --git a/mysql-test/r/outfile_loaddata.result b/mysql-test/r/outfile_loaddata.result index 36a72fd84ce..ca3a42c087c 100644 --- a/mysql-test/r/outfile_loaddata.result +++ b/mysql-test/r/outfile_loaddata.result @@ -143,15 +143,16 @@ TRUNCATE t2; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary FIELDS TERMINATED BY 'ъ'; Warnings: Warning 1638 Non-ASCII separator arguments are not fully supported -Warning 1265 Data truncated for column 'a' at row 1 -Warning 1261 Row 1 doesn't contain data for all columns -Warning 1261 Row 1 doesn't contain data for all columns -Warning 1265 Data truncated for column 'a' at row 2 -Warning 1261 Row 2 doesn't contain data for all columns -Warning 1261 Row 2 doesn't contain data for all columns SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c; a b c -1 NULL NULL +1 ABC-АБВ DEF-ÂÃÄ +2 NULL NULL +SELECT * FROM t1; +a b c +1 ABC-АБВ DEF-ÂÃÄ +2 NULL NULL +SELECT * FROM t2; +a b c 1 ABC-АБВ DEF-ÂÃÄ 2 NULL NULL SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' LINES STARTING BY 'ъ'; @@ -181,7 +182,14 @@ Warning 1638 Non-ASCII separator arguments are not fully supported SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c; a b c 1 ABC-АБВ DEF-ÂÃÄ -1 ABC-АБВ DEF-ÂÃÄÑŠ2 +2 NULL NULL +SELECT * FROM t1; +a b c +1 ABC-АБВ DEF-ÂÃÄ +2 NULL NULL +SELECT * FROM t2; +a b c +1 ABC-АБВ DEF-ÂÃÄ 2 NULL NULL # Default (binary) charset: SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FROM t1; diff --git a/mysql-test/t/outfile_loaddata.test b/mysql-test/t/outfile_loaddata.test index 26760f9a1b2..745c75cb4de 100644 --- a/mysql-test/t/outfile_loaddata.test +++ b/mysql-test/t/outfile_loaddata.test @@ -169,6 +169,8 @@ TRUNCATE t2; --eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary FIELDS TERMINATED BY 'ъ' --remove_file $file SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c; +SELECT * FROM t1; +SELECT * FROM t2; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval SELECT * FROM t1 INTO OUTFILE '$file' LINES STARTING BY 'ъ' @@ -191,6 +193,8 @@ TRUNCATE t2; --eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary LINES TERMINATED BY 'ъ' --remove_file $file SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c; +SELECT * FROM t1; +SELECT * FROM t2; --echo # Default (binary) charset: diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 7f962520dd6..05571d49cc8 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 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 @@ -65,7 +65,8 @@ class READ_INFO { *end_of_buff; /* Data in bufferts ends here */ uint buff_length, /* Length of buffert */ max_length; /* Max length of row */ - char *field_term_ptr,*line_term_ptr,*line_start_ptr,*line_start_end; + const uchar *field_term_ptr,*line_term_ptr; + const char *line_start_ptr,*line_start_end; uint field_term_length,line_term_length,enclosed_length; int field_term_char,line_term_char,enclosed_char,escape_char; int *stack,*stack_pos; @@ -89,7 +90,7 @@ public: int read_fixed_length(void); int next_line(void); char unescape(char chr); - int terminator(char *ptr,uint length); + int terminator(const uchar *ptr, uint length); bool find_start_of_fields(); /* load xml */ List taglist; @@ -751,7 +752,7 @@ static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex, append_identifier(thd, &pfields, item->name, strlen(item->name)); // Extract exact Item value str->copy(); - pfields.append((char *)str->ptr()); + pfields.append(str->ptr()); str->free(); } /* @@ -767,17 +768,17 @@ static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex, if (!(load_data_query= (char *)thd->alloc(lle.get_query_buffer_length() + 1 + pl))) return TRUE; - lle.print_query(FALSE, (const char *) ex->cs?ex->cs->csname:NULL, + lle.print_query(FALSE, ex->cs ? ex->cs->csname : NULL, load_data_query, &end, - (char **)&fname_start, (char **)&fname_end); + &fname_start, &fname_end); strcpy(end, p); end += pl; Execute_load_query_log_event e(thd, load_data_query, end-load_data_query, - (uint) ((char*) fname_start - load_data_query - 1), - (uint) ((char*) fname_end - load_data_query), + static_cast(fname_start - load_data_query - 1), + static_cast(fname_end - load_data_query), (duplicates == DUP_REPLACE) ? LOAD_DUP_REPLACE : (ignore ? LOAD_DUP_IGNORE : LOAD_DUP_ERROR), transactional_table, FALSE, FALSE, errcode); @@ -1319,10 +1320,18 @@ READ_INFO::READ_INFO(File file_par, uint tot_length, CHARSET_INFO *cs, found_end_of_line(false), eof(false), need_end_io_cache(false), error(false), line_cuted(false), found_null(false), read_charset(cs) { - field_term_ptr=(char*) field_term.ptr(); + /* + Field and line terminators must be interpreted as sequence of unsigned char. + Otherwise, non-ascii terminators will be negative on some platforms, + and positive on others (depending on the implementation of char). + */ + field_term_ptr= + static_cast(static_cast(field_term.ptr())); field_term_length= field_term.length(); - line_term_ptr=(char*) line_term.ptr(); + line_term_ptr= + static_cast(static_cast(line_term.ptr())); line_term_length= line_term.length(); + level= 0; /* for load xml */ if (line_start.length() == 0) { @@ -1331,7 +1340,7 @@ READ_INFO::READ_INFO(File file_par, uint tot_length, CHARSET_INFO *cs, } else { - line_start_ptr=(char*) line_start.ptr(); + line_start_ptr= line_start.ptr(); line_start_end=line_start_ptr+line_start.length(); start_of_line= 1; } @@ -1340,12 +1349,12 @@ READ_INFO::READ_INFO(File file_par, uint tot_length, CHARSET_INFO *cs, !memcmp(field_term_ptr,line_term_ptr,field_term_length)) { line_term_length=0; - line_term_ptr=(char*) ""; + line_term_ptr= NULL; } enclosed_char= (enclosed_length=enclosed_par.length()) ? (uchar) enclosed_par[0] : INT_MAX; - field_term_char= field_term_length ? (uchar) field_term_ptr[0] : INT_MAX; - line_term_char= line_term_length ? (uchar) line_term_ptr[0] : INT_MAX; + field_term_char= field_term_length ? field_term_ptr[0] : INT_MAX; + line_term_char= line_term_length ? line_term_ptr[0] : INT_MAX; /* Set of a stack for unget if long terminators */ @@ -1403,7 +1412,7 @@ READ_INFO::~READ_INFO() } -inline int READ_INFO::terminator(char *ptr,uint length) +inline int READ_INFO::terminator(const uchar *ptr,uint length) { int chr=0; // Keep gcc happy uint i; @@ -1418,7 +1427,7 @@ inline int READ_INFO::terminator(char *ptr,uint length) return 1; PUSH(chr); while (i-- > 1) - PUSH((uchar) *--ptr); + PUSH(*--ptr); return 0; } @@ -1549,7 +1558,7 @@ int READ_INFO::read_field() if (my_mbcharlen(read_charset, chr) > 1 && to + my_mbcharlen(read_charset, chr) <= end_of_buff) { - uchar* p= (uchar*) to; + uchar* p= to; int ml, i; *to++ = chr; @@ -1574,7 +1583,7 @@ int READ_INFO::read_field() (const char *)to)) continue; for (i= 0; i < ml; i++) - PUSH((uchar) *--to); + PUSH(*--to); chr= GET; } #endif @@ -1723,7 +1732,7 @@ bool READ_INFO::find_start_of_fields() return 1; } } while ((char) chr != line_start_ptr[0]); - for (char *ptr=line_start_ptr+1 ; ptr != line_start_end ; ptr++) + for (const char *ptr=line_start_ptr+1 ; ptr != line_start_end ; ptr++) { chr=GET; // Eof will be checked later if ((char) chr != *ptr) @@ -1731,7 +1740,7 @@ bool READ_INFO::find_start_of_fields() PUSH(chr); while (--ptr != line_start_ptr) { // Restart with next char - PUSH((uchar) *ptr); + PUSH( *ptr); } goto try_again; } @@ -1927,7 +1936,7 @@ int READ_INFO::read_xml() // row tag should be in ROWS IDENTIFIED BY '' - stored in line_term if((tag.length() == line_term_length -2) && - (strncmp(tag.c_ptr_safe(), line_term_ptr + 1, tag.length()) == 0)) + (memcmp(tag.ptr(), line_term_ptr + 1, tag.length()) == 0)) { DBUG_PRINT("read_xml", ("start-of-row: %i %s %s", level,tag.c_ptr_safe(), line_term_ptr)); @@ -1989,7 +1998,7 @@ int READ_INFO::read_xml() } if((tag.length() == line_term_length -2) && - (strncmp(tag.c_ptr_safe(), line_term_ptr + 1, tag.length()) == 0)) + (memcmp(tag.ptr(), line_term_ptr + 1, tag.length()) == 0)) { DBUG_PRINT("read_xml", ("found end-of-row %i %s", level, tag.c_ptr_safe())); From 501de3a027f11e33c14136f83e45dabe3d6f3102 Mon Sep 17 00:00:00 2001 From: Nisha Gopalakrishnan Date: Thu, 24 Apr 2014 09:30:21 +0530 Subject: [PATCH 23/52] BUG#18080920: CRASH; MY_REALLOC_STR DEREFERENCES NEGATIVE VALUE INTO CLIENT_ERRORS ARRAY Analysis: -------- The client may crash while executing a statement due to the missing mapping of the server error to it's equivalent client error. When trying to reallocate memory for the packet buffer, if the system is out of memory or the packet buffer is large, the server errors 'ER_OUT_OF_RESOURCES' or 'ER_PACKET_TOO_LARGE' is returned respectively. The client error number calculated is negative and when trying to dereference the array of client error messages with the calculated error number, the client crashes. Fix: ---- Map the server error returned to it's equivalent client error prior to dereferencing the array of client error messages. Note: Test case is not added since it is difficult to simulate the error condition. --- include/errmsg.h | 6 ++++-- libmysql/errmsg.c | 4 +++- libmysql/libmysql.c | 6 +++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/errmsg.h b/include/errmsg.h index 64ec2df395c..5655883466c 100644 --- a/include/errmsg.h +++ b/include/errmsg.h @@ -1,7 +1,7 @@ #ifndef ERRMSG_INCLUDED #define ERRMSG_INCLUDED -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 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 @@ -32,7 +32,9 @@ extern const char *client_errors[]; /* Error messages */ #define CR_MIN_ERROR 2000 /* For easier client code */ #define CR_MAX_ERROR 2999 #if !defined(ER) -#define ER(X) client_errors[(X)-CR_MIN_ERROR] +#define ER(X) (((X) >= CR_ERROR_FIRST && (X) <= CR_ERROR_LAST)? \ + client_errors[(X)-CR_ERROR_FIRST]: client_errors[CR_UNKNOWN_ERROR]) + #endif #define CLIENT_ERRMAP 2 /* Errormap used by my_error() */ diff --git a/libmysql/errmsg.c b/libmysql/errmsg.c index 498ba6e9829..81d2728534a 100644 --- a/libmysql/errmsg.c +++ b/libmysql/errmsg.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 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 @@ -105,6 +105,8 @@ const char** get_client_errmsgs() void init_client_errs(void) { + compile_time_assert(array_elements(client_errors) == + (CR_ERROR_LAST - CR_ERROR_FIRST + 2)); (void) my_error_register(get_client_errmsgs, CR_ERROR_FIRST, CR_ERROR_LAST); } diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index d6bdea3df1f..6e7134ff97c 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 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 @@ -1316,6 +1316,10 @@ static my_bool my_realloc_str(NET *net, ulong length) res= net_realloc(net, buf_length + length); if (res) { + if (net->last_errno == ER_OUT_OF_RESOURCES) + net->last_errno= CR_OUT_OF_MEMORY; + else if (net->last_errno == ER_NET_PACKET_TOO_LARGE) + net->last_errno= CR_NET_PACKET_TOO_LARGE; strmov(net->sqlstate, unknown_sqlstate); strmov(net->last_error, ER(net->last_errno)); } From 5e881cc435370140c38241dc6451f4cb31c0a3b9 Mon Sep 17 00:00:00 2001 From: Nisha Gopalakrishnan Date: Mon, 28 Apr 2014 16:28:09 +0530 Subject: [PATCH 24/52] BUG#17994219: CREATE TABLE .. SELECT PRODUCES INVALID STRUCTURE, BREAKS RBR Analysis: -------- A table created using a query of the format: CREATE TABLE t1 AS SELECT REPEAT('A',1000) DIV 1 AS a; breaks the Row Based Replication. The query above creates a table having a field of datatype 'bigint' with a display width of 3000 which is beyond the maximum acceptable value of 255. In the RBR mode, CREATE TABLE SELECT statement is replicated as a combination of CREATE TABLE statement equivalent to one the returned by SHOW CREATE TABLE and row events for rows inserted. When this CREATE TABLE event is executed on the slave, an error is reported: Display width out of range for column 'a' (max = 255) The following is the output of 'SHOW CREATE TABLE t1': CREATE TABLE t1(`a` bigint(3000) DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1; The problem is due to the combination of two facts: 1) The above CREATE TABLE SELECT statement uses the display width of the result of DIV operation as the display width of the column created without validating the width for out of bound condition. 2) The DIV operation incorrectly returns the length of its first argument as the display width of its result; thus allowing creation of a table with an incorrect display width of 3000 for the field. Fix: ---- This fix changes the DIV operation implementation to correctly evaluate the display width of its result. We check if DIV's results estimated width crosses maximum width for integer value (21) and if yes set it to this maximum value. This patch also fixes fixes maximum display width evaluation for DIV function when its first argument is in UCS2. --- .../suite/rpl/r/rpl_row_create_select.result | 28 +++++++++++++++++++ .../suite/rpl/t/rpl_row_create_select.test | 28 +++++++++++++++++++ sql/item_func.cc | 10 ++++--- 3 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 mysql-test/suite/rpl/r/rpl_row_create_select.result create mode 100644 mysql-test/suite/rpl/t/rpl_row_create_select.test diff --git a/mysql-test/suite/rpl/r/rpl_row_create_select.result b/mysql-test/suite/rpl/r/rpl_row_create_select.result new file mode 100644 index 00000000000..719bfae3f0c --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_row_create_select.result @@ -0,0 +1,28 @@ +include/master-slave.inc +[connection master] +# +# BUG#17994219: CREATE TABLE .. SELECT PRODUCES INVALID STRUCTURE, +# BREAKS RBR +# +#After the patch, the display width is set to a default +#value of 21. +CREATE TABLE t1 AS SELECT REPEAT('A', 1000) DIV 1 AS a; +Warnings: +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(21) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t2 AS SELECT CONVERT(REPEAT('A', 255) USING UCS2) DIV 1 AS a; +Warnings: +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` bigint(21) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +#After the patch, no error is reported. +DROP TABLE t1; +DROP TABLE t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_create_select.test b/mysql-test/suite/rpl/t/rpl_row_create_select.test new file mode 100644 index 00000000000..ca270e92d0c --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_create_select.test @@ -0,0 +1,28 @@ +# Testing table creations for row-based replication. + +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +--echo # +--echo # BUG#17994219: CREATE TABLE .. SELECT PRODUCES INVALID STRUCTURE, +--echo # BREAKS RBR +--echo # + +connection master; +--echo #After the patch, the display width is set to a default +--echo #value of 21. +CREATE TABLE t1 AS SELECT REPEAT('A', 1000) DIV 1 AS a; +SHOW CREATE TABLE t1; + +CREATE TABLE t2 AS SELECT CONVERT(REPEAT('A', 255) USING UCS2) DIV 1 AS a; +SHOW CREATE TABLE t2; + +--echo #After the patch, no error is reported. +sync_slave_with_master; + +connection master; +DROP TABLE t1; +DROP TABLE t2; + +--source include/rpl_end.inc + diff --git a/sql/item_func.cc b/sql/item_func.cc index 39c05d63150..3e3079f317f 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 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 @@ -1649,9 +1649,11 @@ void Item_func_int_div::fix_length_and_dec() { Item_result argtype= args[0]->result_type(); /* use precision ony for the data type it is applicable for and valid */ - max_length=args[0]->max_length - - (argtype == DECIMAL_RESULT || argtype == INT_RESULT ? - args[0]->decimals : 0); + uint32 char_length= args[0]->max_char_length() - + (argtype == DECIMAL_RESULT || argtype == INT_RESULT ? + args[0]->decimals : 0); + fix_char_length(char_length > MY_INT64_NUM_DECIMAL_DIGITS ? + MY_INT64_NUM_DECIMAL_DIGITS : char_length); maybe_null=1; unsigned_flag=args[0]->unsigned_flag | args[1]->unsigned_flag; } From 3d6d85b40dbe8938d8d2972053e0ea714c04a2d4 Mon Sep 17 00:00:00 2001 From: mithun Date: Mon, 28 Apr 2014 21:07:27 +0530 Subject: [PATCH 25/52] Bug #18167356: EXPLAIN W/ EXISTS(SELECT* UNION SELECT*) WHERE ONE OF SELECT* IS DISTINCT FAILS. ISSUE: ------ There are 2 issues related to explain union. 1. If we have subquery with union of selects. And, one of the select need temp table to materialize its results then it will replace its query structure with a simple select from temporary table. Trying to display new internal temporary table scan resulted in crash. But to display the query plan, we should save the original query structure. 2. Multiple execution of prepared explain statement which have union of subqueries resulted in crash. If we have constant subqueries, fake select used in union operation will be evaluated once before using it for explain. During first execution we have set fake select options to SELECT_DESCRIBE, but did not reset after the explain. Hence during next execution of prepared statement during first time evaluation of fake select we had our select options as SELECT_DESCRIBE this resulted in improperly initialized data structures and crash. SOLUTION: --------- 1. If called by explain now we save the original query structure. And this will be used for displaying. 2. Reset the fake select options after it is called for explain of union. sql/sql_select.cc: Reset the fake select options after it is called for explain of union sql/sql_union.cc: If called by explain but not from select_describe and we need a temp table, then we create a temp join to preserve original query structure. --- sql/sql_select.cc | 5 +++++ sql/sql_union.cc | 29 +++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index fbb5d00e7a8..860a4b7f5dc 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -17299,6 +17299,11 @@ bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result) unit->fake_select_lex->options|= SELECT_DESCRIBE; if (!(res= unit->prepare(thd, result, SELECT_NO_UNLOCK | SELECT_DESCRIBE))) res= unit->exec(); + /* + Reset select option. Needed if fake_select_lex is used and not called + from select describe. + */ + unit->fake_select_lex->options&= ~SELECT_DESCRIBE; res|= unit->cleanup(); } else diff --git a/sql/sql_union.cc b/sql/sql_union.cc index b0a25c2df97..d0660e8f117 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -511,6 +511,35 @@ bool st_select_lex_unit::exec() (select_limit_cnt == HA_POS_ERROR || sl->braces) ? sl->options & ~OPTION_FOUND_ROWS : sl->options | found_rows_for_union; saved_error= sl->join->optimize(); + + /* + If called by explain statement then we may need to save the original + JOIN LAYOUT so that we can display the plan. Otherwise original plan + will be replaced by a simple scan on temp table if subquery uses temp + table. + We check for following conditions to force join_tmp creation + 1. This is an EXPLAIN statement, and + 2. JOIN not yet saved in JOIN::optimize(), and + 3. Not called directly from select_describe(), and + 4. Belongs to a subquery that is const, and + 5. Need a temp table. + */ + if (thd->lex->describe && // 1 + !sl->uncacheable && // 2 + !(sl->join->select_options & SELECT_DESCRIBE) && // 3 + item && item->const_item()) // 4 + { + /* + Force join->join_tmp creation, because this subquery will be + replaced by a simple select from the materialization temp table + by optimize() called by EXPLAIN and we need to preserve the + initial query structure so we can display it. + */ + sl->uncacheable|= UNCACHEABLE_EXPLAIN; + sl->master_unit()->uncacheable|= UNCACHEABLE_EXPLAIN; + if (sl->join->need_tmp && sl->join->init_save_join_tab()) // 5 + DBUG_RETURN(1); + } } if (!saved_error) { From d14f191e6b2c1e967b8087f36e09b019cfe20930 Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Wed, 30 Apr 2014 20:48:29 +0400 Subject: [PATCH 26/52] Patch for Bug#18511348 (DDL_I18N_UTF8 AND DDL_I18N_KOI8R ARE PERMANENTLY SKIPPED IN 5.5/5.6). The problem was that some result files were not updated, so the tests were skipped. The fix is to record updated result files. --- mysql-test/r/have_cp1251.require | 2 +- mysql-test/r/have_cp866.require | 2 +- mysql-test/r/have_koi8r.require | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/have_cp1251.require b/mysql-test/r/have_cp1251.require index 465e8338084..a4e66df9eac 100644 --- a/mysql-test/r/have_cp1251.require +++ b/mysql-test/r/have_cp1251.require @@ -1,2 +1,2 @@ Collation Charset Id Default Compiled Sortlen -cp1251_general_ci cp1251 51 Yes 0 +cp1251_general_ci cp1251 51 Yes Yes 1 diff --git a/mysql-test/r/have_cp866.require b/mysql-test/r/have_cp866.require index da2a3e2f05e..7efa36b957c 100644 --- a/mysql-test/r/have_cp866.require +++ b/mysql-test/r/have_cp866.require @@ -1,2 +1,2 @@ Collation Charset Id Default Compiled Sortlen -cp866_general_ci cp866 36 Yes 0 +cp866_general_ci cp866 36 Yes Yes 1 diff --git a/mysql-test/r/have_koi8r.require b/mysql-test/r/have_koi8r.require index b109b9ae520..2df3fdd243d 100644 --- a/mysql-test/r/have_koi8r.require +++ b/mysql-test/r/have_koi8r.require @@ -1,2 +1,2 @@ Collation Charset Id Default Compiled Sortlen -koi8r_general_ci koi8r 7 Yes 0 +koi8r_general_ci koi8r 7 Yes Yes 1 From f6524e496312a6d3b870c74118f921c33201f3d7 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 12 May 2014 12:56:13 +0200 Subject: [PATCH 27/52] MDEV-4925 Wrong result - count(distinct), Using index for group-by (scanning) added the test case --- mysql-test/suite/innodb/r/count_distinct.result | 12 ++++++++++++ mysql-test/suite/innodb/t/count_distinct.test | 15 +++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 mysql-test/suite/innodb/r/count_distinct.result create mode 100644 mysql-test/suite/innodb/t/count_distinct.test diff --git a/mysql-test/suite/innodb/r/count_distinct.result b/mysql-test/suite/innodb/r/count_distinct.result new file mode 100644 index 00000000000..201767b8f42 --- /dev/null +++ b/mysql-test/suite/innodb/r/count_distinct.result @@ -0,0 +1,12 @@ +CREATE TABLE t1 ( +id int NOT NULL AUTO_INCREMENT, +a int NOT NULL, +b int NOT NULL, +PRIMARY KEY (id), +UNIQUE KEY ba (b, a) +) ENGINE=InnoDB; +INSERT INTO t1 (a, b) VALUES(1,101),(1,102),(1,103),(1,104),(1,105),(1,106),(1,107),(1,108),(1,109),(1,110); +SELECT COUNT(DISTINCT b) FROM t1 WHERE a = 1; +COUNT(DISTINCT b) +10 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/count_distinct.test b/mysql-test/suite/innodb/t/count_distinct.test new file mode 100644 index 00000000000..94a70260e23 --- /dev/null +++ b/mysql-test/suite/innodb/t/count_distinct.test @@ -0,0 +1,15 @@ +--source include/have_innodb.inc + +# +# MDEV-4925 Wrong result - count(distinct), Using index for group-by (scanning) +# +CREATE TABLE t1 ( + id int NOT NULL AUTO_INCREMENT, + a int NOT NULL, + b int NOT NULL, + PRIMARY KEY (id), + UNIQUE KEY ba (b, a) +) ENGINE=InnoDB; +INSERT INTO t1 (a, b) VALUES(1,101),(1,102),(1,103),(1,104),(1,105),(1,106),(1,107),(1,108),(1,109),(1,110); +SELECT COUNT(DISTINCT b) FROM t1 WHERE a = 1; +DROP TABLE t1; From a55c159424df1dbc6a61a3c6592ac819d8bb3316 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Sat, 17 May 2014 10:42:59 +0300 Subject: [PATCH 28/52] MDEV-6245 Certain compressed tables with myisampack are corrupted by "CHECK TABLE" - Fixed bug that we where using wrong checksum algorithm when using VARCHAR with fixed lenth rows - Ensure in myisampack that HA_OPTION_NULL_FIELDS is set for tables with null fields. mysql-test/r/myisampack.result: Updated results mysql-test/t/myisampack.test: Added more tests storage/myisam/mi_open.c: Use correct checksum algorithm when we have VARCHAR fields with fixed length records storage/myisam/myisampack.c: Ensure HA_OPTION_NULL_FIELDS is set for tables with null fields. (This was not set by default for not compressed tables without checksums to keep MyISAM tables compatible with MySQL) --- mysql-test/r/myisampack.result | 54 ++++++++++++++++++++++++++++++++++ mysql-test/t/myisampack.test | 47 +++++++++++++++++++++++++++++ storage/myisam/mi_open.c | 7 ++--- storage/myisam/myisampack.c | 11 +++++-- 4 files changed, 113 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/myisampack.result b/mysql-test/r/myisampack.result index 56f61ccdf47..aeb12c1f68e 100644 --- a/mysql-test/r/myisampack.result +++ b/mysql-test/r/myisampack.result @@ -150,3 +150,57 @@ CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK DROP TABLE t1; +create table `t1` (`id` varchar(15) DEFAULT NULL) ENGINE=MyISAM ROW_FORMAT=FIXED; +insert into t1 values ('aaa'),('bbb'),('ccc'),('ddd'),('eee'); +insert into t1 (select * from t1); +insert into t1 (select * from t1); +insert into t1 (select * from t1); +insert into t1 (select * from t1); +checksum table t1; +Table Checksum +test.t1 2696656816 +insert into t1 values(NULL); +checksum table t1; +Table Checksum +test.t1 2679879600 +flush table t1; +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +checksum table t1; +Table Checksum +test.t1 2679879600 +alter table t1 checksum=1 row_format=fixed; +checksum table t1; +Table Checksum +test.t1 2679879600 +flush table t1; +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +checksum table t1; +Table Checksum +test.t1 2679879600 +alter table t1 row_format=dynamic checksum=0; +checksum table t1; +Table Checksum +test.t1 2330021136 +flush table t1; +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +checksum table t1; +Table Checksum +test.t1 2330021136 +alter table t1 checksum=1 row_format=dynamic; +checksum table t1; +Table Checksum +test.t1 2330021136 +flush table t1; +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +checksum table t1; +Table Checksum +test.t1 2330021136 +drop table t1; diff --git a/mysql-test/t/myisampack.test b/mysql-test/t/myisampack.test index afa417822e6..cc9429a1707 100644 --- a/mysql-test/t/myisampack.test +++ b/mysql-test/t/myisampack.test @@ -267,3 +267,50 @@ FLUSH TABLE t1; --exec $MYISAMCHK -soq $MYSQLD_DATADIR/test/t1 CHECK TABLE t1; DROP TABLE t1; + +# +# MDEV-6245 Certain compressed tables with myisampack are corrupted by +# "CHECK TABLE" +# +# Issue was that checksum failed for tables with NULL and VARCHAR fields +# + +create table `t1` (`id` varchar(15) DEFAULT NULL) ENGINE=MyISAM ROW_FORMAT=FIXED; +insert into t1 values ('aaa'),('bbb'),('ccc'),('ddd'),('eee'); +insert into t1 (select * from t1); +insert into t1 (select * from t1); +insert into t1 (select * from t1); +insert into t1 (select * from t1); +checksum table t1; +insert into t1 values(NULL); +checksum table t1; +flush table t1; +--exec $MYISAMPACK -sf $MYSQLD_DATADIR/test/t1 +--exec $MYISAMCHK -srnq $MYSQLD_DATADIR/test/t1 +check table t1; +checksum table t1; +alter table t1 checksum=1 row_format=fixed; +checksum table t1; +flush table t1; +--exec $MYISAMPACK -sf $MYSQLD_DATADIR/test/t1 +--exec $MYISAMCHK -srnq $MYSQLD_DATADIR/test/t1 +check table t1; +checksum table t1; + +# Testing with row_format=dynamic + +alter table t1 row_format=dynamic checksum=0; +checksum table t1; +flush table t1; +--exec $MYISAMPACK -sf $MYSQLD_DATADIR/test/t1 +--exec $MYISAMCHK -srnq $MYSQLD_DATADIR/test/t1 +check table t1; +checksum table t1; +alter table t1 checksum=1 row_format=dynamic; +checksum table t1; +flush table t1; +--exec $MYISAMPACK -sf $MYSQLD_DATADIR/test/t1 +--exec $MYISAMCHK -srnq $MYSQLD_DATADIR/test/t1 +check table t1; +checksum table t1; +drop table t1; diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c index 22225303bae..94bc92088ad 100644 --- a/storage/myisam/mi_open.c +++ b/storage/myisam/mi_open.c @@ -458,13 +458,11 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) share->blobs[j].offset=offset; j++; } -#if MYSQL_VERSION_ID <= 60100 - /* This is to detect old checksum option */ + /* This is to detect how to calculate checksums */ if (share->rec[i].null_bit) share->has_null_fields= 1; if (share->rec[i].type == FIELD_VARCHAR) share->has_varchar_fields= 1; -#endif offset+=share->rec[i].length; } share->rec[i].type=(int) FIELD_LAST; /* End marker */ @@ -754,7 +752,8 @@ void mi_setup_functions(register MYISAM_SHARE *share) share->read_record=_mi_read_pack_record; share->read_rnd=_mi_read_rnd_pack_record; if ((share->options & - (HA_OPTION_PACK_RECORD | HA_OPTION_NULL_FIELDS))) + (HA_OPTION_PACK_RECORD | HA_OPTION_NULL_FIELDS)) || + share->has_varchar_fields) share->calc_checksum= mi_checksum; else share->calc_checksum= mi_static_checksum; diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c index 92ee1dde84c..50622c464ca 100644 --- a/storage/myisam/myisampack.c +++ b/storage/myisam/myisampack.c @@ -415,6 +415,11 @@ static MI_INFO *open_isam_file(char *name,int mode) if (verbose) puts("Recompressing already compressed table"); share->options&= ~HA_OPTION_READ_ONLY_DATA; /* We are modifing it */ + + /* We want to use the new checksums if we have null fields */ + if (share->has_null_fields) + share->options|= HA_OPTION_NULL_FIELDS; + } if (! force_pack && share->state.state.records != 0 && (share->state.state.records <= 1 || @@ -2964,7 +2969,8 @@ static int save_state(MI_INFO *isam_file,PACK_MRG_INFO *mrg,my_off_t new_length, uint key; DBUG_ENTER("save_state"); - options|= HA_OPTION_COMPRESS_RECORD | HA_OPTION_READ_ONLY_DATA; + options|= (HA_OPTION_COMPRESS_RECORD | HA_OPTION_READ_ONLY_DATA | + (share->options & HA_OPTION_NULL_FIELDS)); mi_int2store(share->state.header.options,options); share->state.state.data_file_length=new_length; @@ -3013,7 +3019,8 @@ static int save_state_mrg(File file,PACK_MRG_INFO *mrg,my_off_t new_length, state= isam_file->s->state; options= (mi_uint2korr(state.header.options) | HA_OPTION_COMPRESS_RECORD | - HA_OPTION_READ_ONLY_DATA); + HA_OPTION_READ_ONLY_DATA | + (isam_file->s->options & HA_OPTION_NULL_FIELDS)); mi_int2store(state.header.options,options); state.state.data_file_length=new_length; state.state.del=0; From 75137522b904b611021288f59e51ad0f9c81c255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Wed, 21 May 2014 13:14:43 +0300 Subject: [PATCH 29/52] MDEV-6257: MariaDB 5.5 fails to start with 10.0 InnoDB log files Analysis: By default 10.0 creates 48M log files and 5.5 assumes they are 5M. Fix: Remove the error and do size comparison later. --- storage/innobase/srv/srv0start.c | 7 ++++--- storage/xtradb/srv/srv0start.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c index d64f64fc934..49705712d41 100644 --- a/storage/innobase/srv/srv0start.c +++ b/storage/innobase/srv/srv0start.c @@ -624,16 +624,17 @@ open_or_create_log_file( if (size != srv_calc_low32(srv_log_file_size) || size_high != srv_calc_high32(srv_log_file_size)) { + /* By default 5.6 based InnoDB will create 48M log + file but 5.5 only 5M. Actual size error must be + tested later. */ fprintf(stderr, - "InnoDB: Error: log file %s is" + "InnoDB: Warning: log file %s is" " of different size %lu %lu bytes\n" "InnoDB: than specified in the .cnf" " file %lu %lu bytes!\n", name, (ulong) size_high, (ulong) size, (ulong) srv_calc_high32(srv_log_file_size), (ulong) srv_calc_low32(srv_log_file_size)); - - return(DB_ERROR); } } else { *log_file_created = TRUE; diff --git a/storage/xtradb/srv/srv0start.c b/storage/xtradb/srv/srv0start.c index 1043ccfabae..d07fc6db1b3 100644 --- a/storage/xtradb/srv/srv0start.c +++ b/storage/xtradb/srv/srv0start.c @@ -618,16 +618,17 @@ open_or_create_log_file( if (size != srv_calc_low32(srv_log_file_size) || size_high != srv_calc_high32(srv_log_file_size)) { + /* By default 5.6 based InnoDB will create 48M log + file but 5.5 only 5M. Actual size error must be + tested later. */ fprintf(stderr, - "InnoDB: Error: log file %s is" + "InnoDB: Warning: log file %s is" " of different size %lu %lu bytes\n" "InnoDB: than specified in the .cnf" " file %lu %lu bytes!\n", name, (ulong) size_high, (ulong) size, (ulong) srv_calc_high32(srv_log_file_size), (ulong) srv_calc_low32(srv_log_file_size)); - - return(DB_ERROR); } } else { *log_file_created = TRUE; From 1adf9e7984f053d095bb005601941582323a6998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 22 May 2014 16:20:56 +0300 Subject: [PATCH 30/52] MDEV-6257: MariaDB 5.5 fails to start with 10.0 InnoDB log files Analysis: Can't disable the error message because you may get database started with incorrect log file size. Fix: Thus only improve the error message to give more information to users. --- storage/innobase/srv/srv0start.c | 27 ++++++++++++++++++--------- storage/xtradb/srv/srv0start.c | 26 +++++++++++++++++--------- 2 files changed, 35 insertions(+), 18 deletions(-) diff --git a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c index 49705712d41..ffe18c47e18 100644 --- a/storage/innobase/srv/srv0start.c +++ b/storage/innobase/srv/srv0start.c @@ -625,16 +625,25 @@ open_or_create_log_file( || size_high != srv_calc_high32(srv_log_file_size)) { /* By default 5.6 based InnoDB will create 48M log - file but 5.5 only 5M. Actual size error must be - tested later. */ + file but 5.5 only 5M. Thus give hint to user. */ + fprintf(stderr, + "InnoDB: Error: log file %s is" + " of different size %lu %lu bytes\n" + "InnoDB: than specified in the .cnf" + " file %lu %lu bytes!\n", + name, (ulong) size_high, (ulong) size, + (ulong) srv_calc_high32(srv_log_file_size), + (ulong) srv_calc_low32(srv_log_file_size)); + fprintf(stderr, - "InnoDB: Warning: log file %s is" - " of different size %lu %lu bytes\n" - "InnoDB: than specified in the .cnf" - " file %lu %lu bytes!\n", - name, (ulong) size_high, (ulong) size, - (ulong) srv_calc_high32(srv_log_file_size), - (ulong) srv_calc_low32(srv_log_file_size)); + "InnoDB: Possible causes for this error:\n" + " (a) Incorrect log file is used or log file size is changed\n" + " (b) In case default size is used this log file is from 10.0\n" + " (c) Log file is corrupted or there was not enough disk space\n" + " In case (b) you need to set innodb_log_file_size = 48M\n"); + + return(DB_ERROR); + } } else { *log_file_created = TRUE; diff --git a/storage/xtradb/srv/srv0start.c b/storage/xtradb/srv/srv0start.c index d07fc6db1b3..223a48e5471 100644 --- a/storage/xtradb/srv/srv0start.c +++ b/storage/xtradb/srv/srv0start.c @@ -619,16 +619,24 @@ open_or_create_log_file( || size_high != srv_calc_high32(srv_log_file_size)) { /* By default 5.6 based InnoDB will create 48M log - file but 5.5 only 5M. Actual size error must be - tested later. */ + file but 5.5 only 5M. Thus give hint to user. */ + fprintf(stderr, + "InnoDB: Error: log file %s is" + " of different size %lu %lu bytes\n" + "InnoDB: than specified in the .cnf" + " file %lu %lu bytes!\n", + name, (ulong) size_high, (ulong) size, + (ulong) srv_calc_high32(srv_log_file_size), + (ulong) srv_calc_low32(srv_log_file_size)); + fprintf(stderr, - "InnoDB: Warning: log file %s is" - " of different size %lu %lu bytes\n" - "InnoDB: than specified in the .cnf" - " file %lu %lu bytes!\n", - name, (ulong) size_high, (ulong) size, - (ulong) srv_calc_high32(srv_log_file_size), - (ulong) srv_calc_low32(srv_log_file_size)); + "InnoDB: Possible causes for this error:\n" + " (a) Incorrect log file is used or log file size is changed\n" + " (b) In case default size is used this log file is from 10.0\n" + " (c) Log file is corrupted or there was not enough disk space\n" + " In case (b) you need to set innodb_log_file_size = 48M\n"); + + return(DB_ERROR); } } else { *log_file_created = TRUE; From 2e33a2531ad9cc59b0fa35ed2067db0629b35dd1 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 27 May 2014 09:45:01 +0300 Subject: [PATCH 31/52] 2 typo fixed --- sql/share/errmsg-utf8.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index e8d44071a43..6fcb460e6c6 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -5209,8 +5209,8 @@ ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER ER_VIEW_NO_EXPLAIN eng "EXPLAIN/SHOW can not be issued; lacking privileges for underlying table" ger "EXPLAIN/SHOW kann nicht verlangt werden. Rechte für zugrunde liegende Tabelle fehlen" - rus "EXPLAIN/SHOW не может быть выполненно; недостаточно прав на такблицы запроса" - ukr "EXPLAIN/SHOW не може бути віконано; немає прав на тиблиці запиту" + rus "EXPLAIN/SHOW не может быть выполненно; недостаточно прав на таблицы запроса" + ukr "EXPLAIN/SHOW не може бути виконано; немає прав на тиблиці запиту" ER_FRM_UNKNOWN_TYPE eng "File '%-.192s' has unknown type '%-.64s' in its header" ger "Datei '%-.192s' hat unbekannten Typ '%-.64s' im Header" From 5506768c52965240c3defda9cf673df00c7febe1 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Tue, 6 May 2014 12:13:03 +0400 Subject: [PATCH 32/52] MDEV-6083 - Assertion `! (&(&LOCK_open)->m_mutex)->count || ! pthread_equal(pth read_self(), (&(&LOCK_open)->m_mutex)->thread)' fails in intern_sys_var_ptr on server shutdown after uninstalling TokuDB plugin at runtime This assertion was introduced by patch for MDEV-5089 to ensure proper lock order among LOCK_open and LOCK_global_system_variables: LOCK_open must not be held while acquiring LOCK_global_system_variables. intern_sys_var_ptr() may be called while freeing storage engine variables with PLUGIN_VAR_MEMALLOC flag (when destroying table share after storage engine was uninstalled). In this case LOCK_open is held, which is harmless because we need global value pointer and thus won't acquire LOCK_global_system_variables. Relaxed assertion so it is valid only for session variables. --- sql/sql_plugin.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 56f335c2359..fc856f11a89 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -2900,11 +2900,12 @@ static uchar *intern_sys_var_ptr(THD* thd, int offset, bool global_lock) DBUG_ENTER("intern_sys_var_ptr"); DBUG_ASSERT(offset >= 0); DBUG_ASSERT((uint)offset <= global_system_variables.dynamic_variables_head); - mysql_mutex_assert_not_owner(&LOCK_open); if (!thd) DBUG_RETURN((uchar*) global_system_variables.dynamic_variables_ptr + offset); + mysql_mutex_assert_not_owner(&LOCK_open); + /* dynamic_variables_head points to the largest valid offset */ From c1fd09f3d4848ae59605564ded9628307d59dd27 Mon Sep 17 00:00:00 2001 From: Balasubramanian Kandasamy Date: Sun, 11 May 2014 18:24:12 +0200 Subject: [PATCH 33/52] Increment release version to resolve upgrade conflict issue --- packaging/rpm-oel/mysql.spec.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packaging/rpm-oel/mysql.spec.in b/packaging/rpm-oel/mysql.spec.in index 959bcc0e3e3..d28e89b4216 100644 --- a/packaging/rpm-oel/mysql.spec.in +++ b/packaging/rpm-oel/mysql.spec.in @@ -85,7 +85,7 @@ Name: mysql-%{product_suffix} Summary: A very fast and reliable SQL database server Group: Applications/Databases Version: @VERSION@ -Release: 1%{?commercial:.1}%{?dist} +Release: 2%{?commercial:.1}%{?dist} License: Copyright (c) 2000, @MYSQL_COPYRIGHT_YEAR@, %{mysql_vendor}. All rights reserved. Under %{?license_type} license as shown in the Description field. Source0: https://cdn.mysql.com/Downloads/MySQL-@MYSQL_BASE_VERSION@/%{src_dir}.tar.gz URL: http://www.mysql.com/ @@ -881,6 +881,9 @@ fi %endif %changelog +* Sun May 11 2014 Balasubramanian Kandasamy - 5.5.38-2 +- Increment release version to resolve upgrade conflict issue + * Thu Apr 24 2014 Balasubramanian Kandasamy - 5.5.38-1 - Updated for 5.5.38 From 1e96de926c02e183050e1fc057af7c0b86042c56 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Wed, 28 May 2014 16:51:19 +0500 Subject: [PATCH 34/52] MDEV-6216 sys_vars.completion_type_func fails in --embedded. The bug was in the mysqltest.c. It didn't check the send_query result properly, so when that fails and the thread gets disconnected, it goes unnoticed, so the consequitive read_result call crashes. Fixed by checking the sernd_query return. --- client/mysqltest.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index cb7c18d56da..ddfb52539c4 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -942,9 +942,13 @@ static int do_read_query_result(struct st_connection *cn) { DBUG_ASSERT(cn->has_thread); wait_query_thread_done(cn); + if (cn->result) + goto exit_func; + signal_connection_thd(cn, EMB_READ_QUERY_RESULT); wait_query_thread_done(cn); +exit_func: return cn->result; } From dedc76b7d9c2f0fe27507714e1e3d49de20c23c5 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Wed, 28 May 2014 17:32:43 +0400 Subject: [PATCH 35/52] MDEV-6263: Wrong result when using IN subquery with order by - When the optimizer chose LooseScan, make_join_readinfo() should use the index that was chosen for LooseScan, and should not try to find a better (shortest) index. --- mysql-test/r/subselect_sj2.result | 30 ++++++++++++++++++++++++++ mysql-test/r/subselect_sj2_jcl6.result | 30 ++++++++++++++++++++++++++ mysql-test/r/subselect_sj2_mat.result | 30 ++++++++++++++++++++++++++ mysql-test/t/subselect_sj2.test | 29 +++++++++++++++++++++++++ sql/sql_select.cc | 29 ++++++++++++++----------- 5 files changed, 136 insertions(+), 12 deletions(-) diff --git a/mysql-test/r/subselect_sj2.result b/mysql-test/r/subselect_sj2.result index 2975176c64a..43ba6ead575 100644 --- a/mysql-test/r/subselect_sj2.result +++ b/mysql-test/r/subselect_sj2.result @@ -1148,5 +1148,35 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) 1 PRIMARY t4 index NULL PRIMARY 59 NULL 2 Using where; Using index; End temporary DROP TABLE t1,t2,t3,t4; +# +# MDEV-6263: Wrong result when using IN subquery with order by +# +CREATE TABLE t1 ( +id int(11) NOT NULL, +nombre varchar(255) NOT NULL, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t1 (id, nombre) VALUES +(1, 'row 1'),(2, 'row 2'),(3, 'row 3'), +(4, 'row 4'),(5, 'row 5'),(6, 'row 6'); +CREATE TABLE t2 ( +id_algo int(11) NOT NULL, +id_agente int(11) NOT NULL, +PRIMARY KEY (id_algo,id_agente), +KEY another_data (id_agente) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t2 (id_algo, id_agente) VALUES +(1, 1),(1, 2),(2, 1),(2, 2),(2, 3),(3, 1); +SELECT * FROM t1 WHERE id in (select distinct id_agente from t2) ORDER BY nombre ASC; +id nombre +1 row 1 +2 row 2 +3 row 3 +SELECT * FROM t1 WHERE id in (select distinct id_agente from t2); +id nombre +1 row 1 +2 row 2 +3 row 3 +DROP TABLE t1, t2; # This must be the last in the file: set optimizer_switch=@subselect_sj2_tmp; diff --git a/mysql-test/r/subselect_sj2_jcl6.result b/mysql-test/r/subselect_sj2_jcl6.result index ff97882c469..c45ab02a646 100644 --- a/mysql-test/r/subselect_sj2_jcl6.result +++ b/mysql-test/r/subselect_sj2_jcl6.result @@ -1163,6 +1163,36 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) 1 PRIMARY t4 hash_index NULL #hash#$hj:PRIMARY 55:59 test.t3.t3_c 2 Using where; End temporary; Using join buffer (incremental, BNLH join) DROP TABLE t1,t2,t3,t4; +# +# MDEV-6263: Wrong result when using IN subquery with order by +# +CREATE TABLE t1 ( +id int(11) NOT NULL, +nombre varchar(255) NOT NULL, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t1 (id, nombre) VALUES +(1, 'row 1'),(2, 'row 2'),(3, 'row 3'), +(4, 'row 4'),(5, 'row 5'),(6, 'row 6'); +CREATE TABLE t2 ( +id_algo int(11) NOT NULL, +id_agente int(11) NOT NULL, +PRIMARY KEY (id_algo,id_agente), +KEY another_data (id_agente) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t2 (id_algo, id_agente) VALUES +(1, 1),(1, 2),(2, 1),(2, 2),(2, 3),(3, 1); +SELECT * FROM t1 WHERE id in (select distinct id_agente from t2) ORDER BY nombre ASC; +id nombre +1 row 1 +2 row 2 +3 row 3 +SELECT * FROM t1 WHERE id in (select distinct id_agente from t2); +id nombre +1 row 1 +2 row 2 +3 row 3 +DROP TABLE t1, t2; # This must be the last in the file: set optimizer_switch=@subselect_sj2_tmp; # diff --git a/mysql-test/r/subselect_sj2_mat.result b/mysql-test/r/subselect_sj2_mat.result index f4d7d986a9d..0ff366b0d7a 100644 --- a/mysql-test/r/subselect_sj2_mat.result +++ b/mysql-test/r/subselect_sj2_mat.result @@ -1150,6 +1150,36 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) 1 PRIMARY t4 index NULL PRIMARY 59 NULL 2 Using where; Using index; End temporary DROP TABLE t1,t2,t3,t4; +# +# MDEV-6263: Wrong result when using IN subquery with order by +# +CREATE TABLE t1 ( +id int(11) NOT NULL, +nombre varchar(255) NOT NULL, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t1 (id, nombre) VALUES +(1, 'row 1'),(2, 'row 2'),(3, 'row 3'), +(4, 'row 4'),(5, 'row 5'),(6, 'row 6'); +CREATE TABLE t2 ( +id_algo int(11) NOT NULL, +id_agente int(11) NOT NULL, +PRIMARY KEY (id_algo,id_agente), +KEY another_data (id_agente) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t2 (id_algo, id_agente) VALUES +(1, 1),(1, 2),(2, 1),(2, 2),(2, 3),(3, 1); +SELECT * FROM t1 WHERE id in (select distinct id_agente from t2) ORDER BY nombre ASC; +id nombre +1 row 1 +2 row 2 +3 row 3 +SELECT * FROM t1 WHERE id in (select distinct id_agente from t2); +id nombre +1 row 1 +2 row 2 +3 row 3 +DROP TABLE t1, t2; # This must be the last in the file: set optimizer_switch=@subselect_sj2_tmp; set optimizer_switch=default; diff --git a/mysql-test/t/subselect_sj2.test b/mysql-test/t/subselect_sj2.test index 9d9e7848415..a82baf095c1 100644 --- a/mysql-test/t/subselect_sj2.test +++ b/mysql-test/t/subselect_sj2.test @@ -1291,5 +1291,34 @@ SELECT * FROM t1, t3 WHERE t3_c IN ( SELECT t1_pk2 FROM t4, t2 WHERE t2_c = t1_p DROP TABLE t1,t2,t3,t4; +--echo # +--echo # MDEV-6263: Wrong result when using IN subquery with order by +--echo # +CREATE TABLE t1 ( + id int(11) NOT NULL, + nombre varchar(255) NOT NULL, + PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +INSERT INTO t1 (id, nombre) VALUES +(1, 'row 1'),(2, 'row 2'),(3, 'row 3'), +(4, 'row 4'),(5, 'row 5'),(6, 'row 6'); + +CREATE TABLE t2 ( + id_algo int(11) NOT NULL, + id_agente int(11) NOT NULL, + PRIMARY KEY (id_algo,id_agente), + KEY another_data (id_agente) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +INSERT INTO t2 (id_algo, id_agente) VALUES +(1, 1),(1, 2),(2, 1),(2, 2),(2, 3),(3, 1); + +SELECT * FROM t1 WHERE id in (select distinct id_agente from t2) ORDER BY nombre ASC; + +SELECT * FROM t1 WHERE id in (select distinct id_agente from t2); + +DROP TABLE t1, t2; + --echo # This must be the last in the file: set optimizer_switch=@subselect_sj2_tmp; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 1f591624457..aee6905c5a6 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -10270,20 +10270,25 @@ make_join_readinfo(JOIN *join, ulonglong options, uint no_jbuf_after) else if (!table->covering_keys.is_clear_all() && !(tab->select && tab->select->quick)) { // Only read index tree + if (tab->loosescan_match_tab) + tab->index= tab->loosescan_key; + else + { #ifdef BAD_OPTIMIZATION - /* - It has turned out that the below change, while speeding things - up for disk-bound loads, slows them down for cases when the data - is in disk cache (see BUG#35850): - See bug #26447: "Using the clustered index for a table scan - is always faster than using a secondary index". - */ - if (table->s->primary_key != MAX_KEY && - table->file->primary_key_is_clustered()) - tab->index= table->s->primary_key; - else + /* + It has turned out that the below change, while speeding things + up for disk-bound loads, slows them down for cases when the data + is in disk cache (see BUG#35850): + See bug #26447: "Using the clustered index for a table scan + is always faster than using a secondary index". + */ + if (table->s->primary_key != MAX_KEY && + table->file->primary_key_is_clustered()) + tab->index= table->s->primary_key; + else #endif - tab->index=find_shortest_key(table, & table->covering_keys); + tab->index=find_shortest_key(table, & table->covering_keys); + } tab->read_first_record= join_read_first; /* Read with index_first / index_next */ tab->type= tab->type == JT_ALL ? JT_NEXT : JT_HASH_NEXT; From 926661ac7c6cb9a4b7671b6353db546142b56e5b Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 27 May 2014 20:57:28 +0200 Subject: [PATCH 36/52] MDEV-6273 Export my_progname symbol in libmysqlclient.so --- libmysql/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt index c3be25f7d43..c536b7cefb8 100644 --- a/libmysql/CMakeLists.txt +++ b/libmysql/CMakeLists.txt @@ -138,6 +138,7 @@ my_print_help ) SET(CLIENT_API_FUNCTIONS_5_5 +my_progname mysql_stmt_next_result # Charsets my_charset_bin From 8bdda78c82645921a2d0990100b762808673e43c Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 27 May 2014 21:05:44 +0200 Subject: [PATCH 37/52] MDEV-6271 update MSI installer to include latest Version of HeidiSQL (8.3.x.x) --- win/packaging/heidisql.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/win/packaging/heidisql.cmake b/win/packaging/heidisql.cmake index 124f85bb87e..e429907cb2e 100644 --- a/win/packaging/heidisql.cmake +++ b/win/packaging/heidisql.cmake @@ -1,6 +1,6 @@ -SET(HEIDISQL_BASE_NAME "HeidiSQL_8.0_Portable") +SET(HEIDISQL_BASE_NAME "HeidiSQL_8.3_Portable") SET(HEIDISQL_ZIP "${HEIDISQL_BASE_NAME}.zip") -SET(HEIDISQL_URL "http://heidisql.googlecode.com/files/${HEIDISQL_ZIP}") +SET(HEIDISQL_URL "http://www.heidisql.com/downloads/releases/${HEIDISQL_ZIP}") SET(HEIDISQL_DOWNLOAD_DIR ${THIRD_PARTY_DOWNLOAD_LOCATION}/${HEIDISQL_BASE_NAME}) IF(NOT EXISTS ${HEIDISQL_DOWNLOAD_DIR}/${HEIDISQL_ZIP}) From d533a64bf3ac25278abc33344213fb39e771a54d Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Thu, 29 May 2014 02:25:37 +0400 Subject: [PATCH 38/52] MDEV-6239: Partition pruning is not working as expected in an inner query - Make partition pruning work for tables inside semi-join nests (the new condition is the same that range optimizer uses so it should be ok) --- mysql-test/r/partition_pruning.result | 52 ++++++++++++++++++++++++ mysql-test/t/partition_pruning.test | 57 +++++++++++++++++++++++++++ sql/sql_select.cc | 3 +- 3 files changed, 111 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result index ec7fd798d4c..0a4cf9932c0 100644 --- a/mysql-test/r/partition_pruning.result +++ b/mysql-test/r/partition_pruning.result @@ -3301,3 +3301,55 @@ explain partitions select * from t1 where a between 10 and 10+33; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p0,p1,p2 ALL NULL NULL NULL NULL 100 Using where drop table t0, t1; +# +# MDEV-6239: Partition pruning is not working as expected in an inner query +# +create table t1 +( +company_id bigint(5), +dept_id bigint(5), +emp_id bigint(5), +emp_name varchar(100), +primary key (company_id, emp_id) +) partition by list (company_id) ( +partition p_1000 values in (1000), +partition p_2000 values in (2000), +partition p_3000 values in (3000) +); +create table t2 +( +company_id bigint(5), +dept_id bigint(5), +dept_name varchar(100), +primary key (company_id, dept_id) +) partition by list (company_id) ( +partition p_1000 values in (1000), +partition p_2000 values in (2000), +partition p_3000 values in (3000) +); +insert into t2 values +(1000, 10, 'Engineering'), +(1000, 20, 'Product Management'), +(1000, 30, 'QA'), +(2000, 40, 'Support'), +(2000, 50, 'Professional Services'); +insert into t1 values +(1000, 10, 1, 'John'), +(1000, 10, 2, 'Smith'), +(1000, 20, 3, 'Jacob'), +(1000, 20, 4, 'Brian'), +(1000, 30, 5, 'Chris'), +(1000, 30, 6, 'Ryan'), +(2000, 40, 7, 'Karin'), +(2000, 40, 8, 'Jay'), +(2000, 50, 9, 'Ana'), +(2000, 50, 10, 'Jessica'); +# Table t2 should have only partition p_1000. +explain partitions +select * from t1 +where company_id = 1000 +and dept_id in (select dept_id from t2 where COMPANY_ID = 1000); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 p_1000 ref PRIMARY PRIMARY 8 const 2 Using index +1 PRIMARY t1 p_1000 ALL PRIMARY NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +drop table t1,t2; diff --git a/mysql-test/t/partition_pruning.test b/mysql-test/t/partition_pruning.test index 1c8a4d254a8..69f159e8142 100644 --- a/mysql-test/t/partition_pruning.test +++ b/mysql-test/t/partition_pruning.test @@ -1413,3 +1413,60 @@ explain partitions select * from t1 where a between 10 and 13; explain partitions select * from t1 where a between 10 and 10+33; drop table t0, t1; + +--echo # +--echo # MDEV-6239: Partition pruning is not working as expected in an inner query +--echo # + +create table t1 +( + company_id bigint(5), + dept_id bigint(5), + emp_id bigint(5), + emp_name varchar(100), + primary key (company_id, emp_id) +) partition by list (company_id) ( + partition p_1000 values in (1000), + partition p_2000 values in (2000), + partition p_3000 values in (3000) +); + +create table t2 +( + company_id bigint(5), + dept_id bigint(5), + dept_name varchar(100), + primary key (company_id, dept_id) +) partition by list (company_id) ( + partition p_1000 values in (1000), + partition p_2000 values in (2000), + partition p_3000 values in (3000) +); + +insert into t2 values + (1000, 10, 'Engineering'), + (1000, 20, 'Product Management'), + (1000, 30, 'QA'), + (2000, 40, 'Support'), + (2000, 50, 'Professional Services'); + +insert into t1 values +(1000, 10, 1, 'John'), +(1000, 10, 2, 'Smith'), +(1000, 20, 3, 'Jacob'), +(1000, 20, 4, 'Brian'), +(1000, 30, 5, 'Chris'), +(1000, 30, 6, 'Ryan'), +(2000, 40, 7, 'Karin'), +(2000, 40, 8, 'Jay'), +(2000, 50, 9, 'Ana'), +(2000, 50, 10, 'Jessica'); + +--echo # Table t2 should have only partition p_1000. +explain partitions +select * from t1 +where company_id = 1000 +and dept_id in (select dept_id from t2 where COMPANY_ID = 1000); + +drop table t1,t2; + diff --git a/sql/sql_select.cc b/sql/sql_select.cc index aee6905c5a6..e6ae3b05c1d 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1140,7 +1140,8 @@ JOIN::optimize() part of the nested outer join, and we can't do partition pruning (TODO: check if this limitation can be lifted) */ - if (!tbl->embedding) + if (!tbl->embedding || + (tbl->embedding && tbl->embedding->sj_on_expr)) { Item *prune_cond= tbl->on_expr? tbl->on_expr : conds; tbl->table->no_partitions_used= prune_partitions(thd, tbl->table, From de8cb7a1f3bc38b9cc782886eb17a4e6d1529944 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 30 May 2014 23:19:26 +0200 Subject: [PATCH 39/52] MDEV-5485 Minor man pages formatting issues MDEV-6281 Typo in mysql_install_db scripts and collateral changes: * remove mysql_tableinfo.1 and references to it (there's no mysql_tableinfo) * for debian: create manpages for mysqlrepair, mysqlanalyze, mysqloptimize (as symlinks for mysqlcheck.1, just as executables are symlinks to mysqlcheck) * remove mysqlmanager.8 and references to it * correct "very long line" error in mysqladmin.1 * simplify and fix table formatting in mysqlbinlog.1 and mysqldump.1 * fix a typo in the help text in mysql_install_db * aria_chk: say "for Linux on x86_64", like other tools do (not "for Linux at x86_64") * add simple manpages for aria_* utilities --- debian/additions/msql2mysql.1 | 16 - debian/additions/my_print_defaults.1 | 16 - debian/additions/myisam_ftdump.1 | 16 - debian/additions/myisamchk.1 | 17 - debian/additions/myisamlog.1 | 16 - debian/additions/myisampack.1 | 19 - debian/additions/mysql_config.1 | 17 - debian/additions/mysql_convert_table_format.1 | 17 - debian/additions/mysql_find_rows.1 | 18 - debian/additions/mysql_fix_extensions.1 | 18 - debian/additions/mysql_install_db.1 | 16 - debian/additions/mysql_secure_installation.1 | 17 - debian/additions/mysql_setpermission.1 | 23 - debian/additions/mysql_tableinfo.1 | 322 --- debian/additions/mysql_waitpid.1 | 20 - debian/additions/mysqlbinlog.1 | 17 - debian/additions/mysqlbug.1 | 14 - debian/additions/mysqlcheck.1 | 28 - debian/additions/mysqldumpslow.1 | 50 - debian/additions/mysqlimport.1 | 20 - debian/additions/mysqltest.1 | 16 - debian/additions/pack_isam.1 | 19 - debian/additions/resolve_stack_dump.1 | 16 - debian/additions/resolveip.1 | 16 - debian/dist/Debian/rules | 2 +- debian/dist/Ubuntu/rules | 2 +- debian/mariadb-client-5.5.files | 2 - debian/mariadb-client-5.5.links | 3 + man/CMakeLists.txt | 2 +- man/aria_chk.1 | 245 ++ man/aria_dump_log.1 | 54 + man/aria_ftdump.1 | 29 + man/aria_pack.1 | 76 + man/aria_read_log.1 | 108 + man/mysqladmin.1 | 4 +- man/mysqlbinlog.1 | 103 +- man/mysqldump.1 | 3 - man/mysqlmanager.8 | 2078 ----------------- scripts/mysql_install_db.pl.in | 2 +- scripts/mysql_install_db.sh | 2 +- storage/maria/maria_chk.c | 2 +- 41 files changed, 559 insertions(+), 2922 deletions(-) delete mode 100644 debian/additions/msql2mysql.1 delete mode 100644 debian/additions/my_print_defaults.1 delete mode 100644 debian/additions/myisam_ftdump.1 delete mode 100644 debian/additions/myisamchk.1 delete mode 100644 debian/additions/myisamlog.1 delete mode 100644 debian/additions/myisampack.1 delete mode 100644 debian/additions/mysql_config.1 delete mode 100644 debian/additions/mysql_convert_table_format.1 delete mode 100644 debian/additions/mysql_find_rows.1 delete mode 100644 debian/additions/mysql_fix_extensions.1 delete mode 100644 debian/additions/mysql_install_db.1 delete mode 100644 debian/additions/mysql_secure_installation.1 delete mode 100644 debian/additions/mysql_setpermission.1 delete mode 100644 debian/additions/mysql_tableinfo.1 delete mode 100644 debian/additions/mysql_waitpid.1 delete mode 100644 debian/additions/mysqlbinlog.1 delete mode 100644 debian/additions/mysqlbug.1 delete mode 100644 debian/additions/mysqlcheck.1 delete mode 100644 debian/additions/mysqldumpslow.1 delete mode 100644 debian/additions/mysqlimport.1 delete mode 100644 debian/additions/mysqltest.1 delete mode 100644 debian/additions/pack_isam.1 delete mode 100644 debian/additions/resolve_stack_dump.1 delete mode 100644 debian/additions/resolveip.1 create mode 100644 man/aria_chk.1 create mode 100644 man/aria_dump_log.1 create mode 100644 man/aria_ftdump.1 create mode 100644 man/aria_pack.1 create mode 100644 man/aria_read_log.1 delete mode 100644 man/mysqlmanager.8 diff --git a/debian/additions/msql2mysql.1 b/debian/additions/msql2mysql.1 deleted file mode 100644 index 8fe05e7415d..00000000000 --- a/debian/additions/msql2mysql.1 +++ /dev/null @@ -1,16 +0,0 @@ -.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" -.SH NAME -msql2mysql \- MySQL importer for msql style data. -.SH SYNOPSIS -msql2mysql [options] -.SH DESCRIPTION -This program imports old msql database files. - -For more information start the program with '--help'. -.SH "SEE ALSO" -mysql (1), mysqld (1) -.SH AUTHOR -This manpage was written by Christian Hammers . - -MySQL is available at http://www.mysql.com/. -.\" end of man page diff --git a/debian/additions/my_print_defaults.1 b/debian/additions/my_print_defaults.1 deleted file mode 100644 index ebef4157016..00000000000 --- a/debian/additions/my_print_defaults.1 +++ /dev/null @@ -1,16 +0,0 @@ -.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" -.SH NAME -my_print_defaults \- MySQL helper script that prints defaults. -.SH SYNOPSIS -my_print_defaults [options] -.SH DESCRIPTION -Prints all arguments that is give to some program using the default files. - -For more information start the program with '--help'. -.SH "SEE ALSO" -mysql (1), mysqld (1) -.SH AUTHOR -This manpage was written by Christian Hammers . - -MySQL is available at http://www.mysql.com/. -.\" end of man page diff --git a/debian/additions/myisam_ftdump.1 b/debian/additions/myisam_ftdump.1 deleted file mode 100644 index e2de358efcc..00000000000 --- a/debian/additions/myisam_ftdump.1 +++ /dev/null @@ -1,16 +0,0 @@ -.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" -.SH NAME -myisam_ftdump \- Dumps full text tables. -.SH SYNOPSIS -myisam_ftdump [options] -.SH DESCRIPTION -Dumps information and contents of full text tables. - -For more information start the program with '--help'. -.SH "SEE ALSO" -mysql (1), mysqld (1) -.SH AUTHOR -This manpage was written by Christian Hammers . - -MySQL is available at http://www.mysql.com/. -.\" end of man page diff --git a/debian/additions/myisamchk.1 b/debian/additions/myisamchk.1 deleted file mode 100644 index fe7f34961e0..00000000000 --- a/debian/additions/myisamchk.1 +++ /dev/null @@ -1,17 +0,0 @@ -.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" -.SH NAME -myisamchk \- Checks MySQL myisam type databases. -.SH SYNOPSIS -myisamchk [options] -.SH DESCRIPTION -Description, check and repair of ISAM tables. -Used without options all tables on the command will be checked for errors - -For more information start the program with '--help'. -.SH "SEE ALSO" -mysql (1), mysqld (1) -.SH AUTHOR -This manpage was written by Christian Hammers . - -MySQL is available at http://www.mysql.com/. -.\" end of man page diff --git a/debian/additions/myisamlog.1 b/debian/additions/myisamlog.1 deleted file mode 100644 index 959d547df94..00000000000 --- a/debian/additions/myisamlog.1 +++ /dev/null @@ -1,16 +0,0 @@ -.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" -.SH NAME -myisamlog \- MySQL helper script. -.SH SYNOPSIS -myisamlog [options] -.SH DESCRIPTION -Function unknown. Mail to ch@debian.org. - -For more information start the program with '--help'. -.SH "SEE ALSO" -mysql (1), mysqld (1) -.SH AUTHOR -This manpage was written by Christian Hammers . - -MySQL is available at http://www.mysql.com/. -.\" end of man page diff --git a/debian/additions/myisampack.1 b/debian/additions/myisampack.1 deleted file mode 100644 index 93168304a17..00000000000 --- a/debian/additions/myisampack.1 +++ /dev/null @@ -1,19 +0,0 @@ -.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" -.SH NAME -myisampack \- Compresses MySQL database files. -.SH SYNOPSIS -myisampack [options] -.SH DESCRIPTION -Pack a MyISAM-table to take much less space. -Keys are not updated, you must run myisamchk -rq on the datafile -afterwards to update the keys. -You should give the .MYI file as the filename argument. - -For more information start the program with '--help'. -.SH "SEE ALSO" -mysql (1), mysqld (1) -.SH AUTHOR -This manpage was written by Christian Hammers . - -MySQL is available at http://www.mysql.com/. -.\" end of man page diff --git a/debian/additions/mysql_config.1 b/debian/additions/mysql_config.1 deleted file mode 100644 index 88095e22b9e..00000000000 --- a/debian/additions/mysql_config.1 +++ /dev/null @@ -1,17 +0,0 @@ -.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" -.SH NAME -mysqlconfig \- MySQL compile settings. -.SH SYNOPSIS -mysqlconfig [options] -.SH DESCRIPTION -This program is only useful for people who want to compile agains -libmysqlclient. - -For more information start the program with '--help'. -.SH "SEE ALSO" -mysql (1), mysqld (1) -.SH AUTHOR -This manpage was written by Christian Hammers . - -MySQL is available at http://www.mysql.com/. -.\" end of man page diff --git a/debian/additions/mysql_convert_table_format.1 b/debian/additions/mysql_convert_table_format.1 deleted file mode 100644 index 3c23581df43..00000000000 --- a/debian/additions/mysql_convert_table_format.1 +++ /dev/null @@ -1,17 +0,0 @@ -.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" -.SH NAME -mysql_convert_table_format \- MySQL table converter. -.SH SYNOPSIS -mysql_convert_table_format [options] -.SH DESCRIPTION -Conversion of a MySQL tables to other table types. -If no tables has been specifed, all tables in the database will be converted. - -For more information start the program with '--help'. -.SH "SEE ALSO" -mysql (1), mysqld (1) -.SH AUTHOR -This manpage was written by Christian Hammers . - -MySQL is available at http://www.mysql.com/. -.\" end of man page diff --git a/debian/additions/mysql_find_rows.1 b/debian/additions/mysql_find_rows.1 deleted file mode 100644 index 35a70b1f960..00000000000 --- a/debian/additions/mysql_find_rows.1 +++ /dev/null @@ -1,18 +0,0 @@ -.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" -.SH NAME -mysql_find_rows \- MySQL shell skript for searching in update logs. -.SH SYNOPSIS -mysql_find_rows [options] -.SH DESCRIPTION -Prints all SQL queries that matches a regexp or contains a 'use -database' or 'set ..' command to stdout. A SQL query may contain -newlines. This is useful to find things in a MySQL update log. - -For more information start the program with '--help'. -.SH "SEE ALSO" -mysql (1), mysqld (1) -.SH AUTHOR -This manpage was written by Christian Hammers . - -MySQL is available at http://www.mysql.com/. -.\" end of man page diff --git a/debian/additions/mysql_fix_extensions.1 b/debian/additions/mysql_fix_extensions.1 deleted file mode 100644 index 3f0a028ca3f..00000000000 --- a/debian/additions/mysql_fix_extensions.1 +++ /dev/null @@ -1,18 +0,0 @@ -.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" -.SH NAME -mysql_fix_extensions \- Corrects MySQL database file names. -.SH SYNOPSIS -mysql_fix_extensions -.SH DESCRIPTION -Makes .frm lowercase and .MYI/MYD/ISM/ISD uppercase -useful when datafiles are copied from windows. -Does not work with RAID, with InnoDB or BDB tables. - -For more information start the program with '--help'. -.SH "SEE ALSO" -mysql (1), mysqld (8) -.SH AUTHOR -This manpage was written by Christian Hammers . - -MySQL is available at http://www.mysql.com/. -.\" end of man page diff --git a/debian/additions/mysql_install_db.1 b/debian/additions/mysql_install_db.1 deleted file mode 100644 index 11f1f2967a2..00000000000 --- a/debian/additions/mysql_install_db.1 +++ /dev/null @@ -1,16 +0,0 @@ -.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" -.SH NAME -mysql_install_db \- MySQL helper program. -.SH SYNOPSIS -mysql_install_db [options] -.SH DESCRIPTION -This program is normally not needed by any user. - -For more information start the program with '--help'. -.SH "SEE ALSO" -mysql (1), mysqld (1) -.SH AUTHOR -This manpage was written by Christian Hammers . - -MySQL is available at http://www.mysql.com/. -.\" end of man page diff --git a/debian/additions/mysql_secure_installation.1 b/debian/additions/mysql_secure_installation.1 deleted file mode 100644 index d65b7f5d09d..00000000000 --- a/debian/additions/mysql_secure_installation.1 +++ /dev/null @@ -1,17 +0,0 @@ -.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" -.SH NAME -mysql_secure_installation \- Secures the MySQL access control lists. -.SH SYNOPSIS -mysql_secure_installation [options] -.SH DESCRIPTION -This interactive programm suggests changes like removing anonymous users that -are supposed to make your installation more secure. - -For more information start the program with '--help'. -.SH "SEE ALSO" -mysql (1), mysqld (8) -.SH AUTHOR -This manpage was written by Christian Hammers . - -MySQL is available at http://www.mysql.com/. -.\" end of man page diff --git a/debian/additions/mysql_setpermission.1 b/debian/additions/mysql_setpermission.1 deleted file mode 100644 index 77167e0d58f..00000000000 --- a/debian/additions/mysql_setpermission.1 +++ /dev/null @@ -1,23 +0,0 @@ -.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" -.SH NAME -mysql_setpermission \- Adds MySQL users or changes passwords. -.SH SYNOPSIS -mysql_setpermission [options] -.SH DESCRIPTION -The permission setter is a little program which can help you add users -or databases or change passwords in MySQL. Keep in mind that we don't -check permissions which already been set in MySQL. So if you can't -connect to MySQL using the permission you just added, take a look at -the permissions which have already been set in MySQL. - -The permission setter first reads your .my.cnf file in your Home -directory if it exists. - -For more information start the program with '--help'. -.SH "SEE ALSO" -mysql (1), mysqld (1) -.SH AUTHOR -This manpage was written by Christian Hammers . - -MySQL is available at http://www.mysql.com/. -.\" end of man page diff --git a/debian/additions/mysql_tableinfo.1 b/debian/additions/mysql_tableinfo.1 deleted file mode 100644 index 1de4f5d5943..00000000000 --- a/debian/additions/mysql_tableinfo.1 +++ /dev/null @@ -1,322 +0,0 @@ -.\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 -.\" -.\" Standard preamble: -.\" ======================================================================== -.de Sh \" Subsection heading -.br -.if t .Sp -.ne 5 -.PP -\fB\\$1\fR -.PP -.. -.de Sp \" Vertical space (when we can't use .PP) -.if t .sp .5v -.if n .sp -.. -.de Vb \" Begin verbatim text -.ft CW -.nf -.ne \\$1 -.. -.de Ve \" End verbatim text -.ft R -.fi -.. -.\" Set up some character translations and predefined strings. \*(-- will -.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to -.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' -.\" expand to `' in nroff, nothing in troff, for use with C<>. -.tr \(*W-|\(bv\*(Tr -.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' -.ie n \{\ -. ds -- \(*W- -. ds PI pi -. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch -. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch -. ds L" "" -. ds R" "" -. ds C` "" -. ds C' "" -'br\} -.el\{\ -. ds -- \|\(em\| -. ds PI \(*p -. ds L" `` -. ds R" '' -'br\} -.\" -.\" If the F register is turned on, we'll generate index entries on stderr for -.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index -.\" entries marked with X<> in POD. Of course, you'll have to process the -.\" output yourself in some meaningful fashion. -.if \nF \{\ -. de IX -. tm Index:\\$1\t\\n%\t"\\$2" -.. -. nr % 0 -. rr F -.\} -.\" -.\" For nroff, turn off justification. Always turn off hyphenation; it makes -.\" way too many mistakes in technical documents. -.hy 0 -.if n .na -.\" -.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). -.\" Fear. Run. Save yourself. No user-serviceable parts. -. \" fudge factors for nroff and troff -.if n \{\ -. ds #H 0 -. ds #V .8m -. ds #F .3m -. ds #[ \f1 -. ds #] \fP -.\} -.if t \{\ -. ds #H ((1u-(\\\\n(.fu%2u))*.13m) -. ds #V .6m -. ds #F 0 -. ds #[ \& -. ds #] \& -.\} -. \" simple accents for nroff and troff -.if n \{\ -. ds ' \& -. ds ` \& -. ds ^ \& -. ds , \& -. ds ~ ~ -. ds / -.\} -.if t \{\ -. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" -. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' -. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' -. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' -. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' -. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' -.\} -. \" troff and (daisy-wheel) nroff accents -.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' -.ds 8 \h'\*(#H'\(*b\h'-\*(#H' -.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] -.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' -.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' -.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] -.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] -.ds ae a\h'-(\w'a'u*4/10)'e -.ds Ae A\h'-(\w'A'u*4/10)'E -. \" corrections for vroff -.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' -.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' -. \" for low resolution devices (crt and lpr) -.if \n(.H>23 .if \n(.V>19 \ -\{\ -. ds : e -. ds 8 ss -. ds o a -. ds d- d\h'-1'\(ga -. ds D- D\h'-1'\(hy -. ds th \o'bp' -. ds Th \o'LP' -. ds ae ae -. ds Ae AE -.\} -.rm #[ #] #H #V #F C -.\" ======================================================================== -.\" -.IX Title "MYSQL_TABLEINFO 1" -.TH MYSQL_TABLEINFO 1 "2003-04-05" "perl v5.8.0" "User Contributed Perl Documentation" -.SH "NAME" -mysql_tableinfo \- creates and populates information tables with -the output of SHOW DATABASES, SHOW TABLES (or SHOW TABLE STATUS), -SHOW COLUMNS and SHOW INDEX. -.PP -This is version 1.1. -.SH "SYNOPSIS" -.IX Header "SYNOPSIS" -.Vb 1 -\& mysql_tableinfo [OPTIONS] database_to_write [database_like_wild] [table_like_wild] -.Ve -.PP -.Vb 2 -\& Do not backquote (``) database_to_write, -\& and do not quote ('') database_like_wild or table_like_wild -.Ve -.PP -.Vb 1 -\& Examples: -.Ve -.PP -.Vb 1 -\& mysql_tableinfo info -.Ve -.PP -.Vb 1 -\& mysql_tableinfo info this_db -.Ve -.PP -.Vb 1 -\& mysql_tableinfo info %a% b% -.Ve -.PP -.Vb 1 -\& mysql_tableinfo info --clear-only -.Ve -.PP -.Vb 1 -\& mysql_tableinfo info --col --idx --table-status -.Ve -.SH "DESCRIPTION" -.IX Header "DESCRIPTION" -mysql_tableinfo asks a MySQL server information about its -databases, tables, table columns and index, and stores this -in tables called `db`, `tbl` (or `tbl_status`), `col`, `idx` -(with an optional prefix specified with \-\-prefix). -After that, you can query these information tables, for example -to build your admin scripts with \s-1SQL\s0 queries, like -.PP -\&\s-1SELECT\s0 \s-1CONCAT\s0(\*(L"\s-1CHECK\s0 \s-1TABLE\s0 \*(R",`database`,\*(L".\*(R",`table`,\*(L" \s-1EXTENDED\s0;\*(R") -\&\s-1FROM\s0 info.tbl \s-1WHERE\s0 ... ; -.PP -as people usually do with some other \s-1RDBMS\s0 -(note: to increase the speed of your queries on the info tables, -you may add some index on them). -.PP -The database_like_wild and table_like_wild instructs the program -to gather information only about databases and tables -whose names match these patterns. If the info -tables already exist, their rows matching the patterns are simply -deleted and replaced by the new ones. That is, -old rows not matching the patterns are not touched. -If the database_like_wild and table_like_wild arguments -are not specified on the command-line they default to \*(L"%\*(R". -.PP -The program : -.PP -\&\- does \s-1CREATE\s0 \s-1DATABASE\s0 \s-1IF\s0 \s-1NOT\s0 \s-1EXISTS\s0 database_to_write -where database_to_write is the database name specified on the command\-line. -.PP -\&\- does \s-1CREATE\s0 \s-1TABLE\s0 \s-1IF\s0 \s-1NOT\s0 \s-1EXISTS\s0 database_to_write.`db` -.PP -\&\- fills database_to_write.`db` with the output of -\&\s-1SHOW\s0 \s-1DATABASES\s0 \s-1LIKE\s0 database_like_wild -.PP -\&\- does \s-1CREATE\s0 \s-1TABLE\s0 \s-1IF\s0 \s-1NOT\s0 \s-1EXISTS\s0 database_to_write.`tbl` -(respectively database_to_write.`tbl_status` -if the \-\-tbl\-status option is on) -.PP -\&\- for every found database, -fills database_to_write.`tbl` (respectively database_to_write.`tbl_status`) -with the output of -\&\s-1SHOW\s0 \s-1TABLES\s0 \s-1FROM\s0 found_db \s-1LIKE\s0 table_like_wild -(respectively \s-1SHOW\s0 \s-1TABLE\s0 \s-1STATUS\s0 \s-1FROM\s0 found_db \s-1LIKE\s0 table_like_wild) -.PP -\&\- if the \-\-col option is on, - * does \s-1CREATE\s0 \s-1TABLE\s0 \s-1IF\s0 \s-1NOT\s0 \s-1EXISTS\s0 database_to_write.`col` - * for every found table, - fills database_to_write.`col` with the output of - \s-1SHOW\s0 \s-1COLUMNS\s0 \s-1FROM\s0 found_tbl \s-1FROM\s0 found_db -.PP -\&\- if the \-\-idx option is on, - * does \s-1CREATE\s0 \s-1TABLE\s0 \s-1IF\s0 \s-1NOT\s0 \s-1EXISTS\s0 database_to_write.`idx` - * for every found table, - fills database_to_write.`idx` with the output of - \s-1SHOW\s0 \s-1INDEX\s0 \s-1FROM\s0 found_tbl \s-1FROM\s0 found_db -.PP -Some options may modify this general scheme (see below). -.PP -As mentioned, the contents of the info tables are the output of -\&\s-1SHOW\s0 commands. In fact the contents are slightly more complete : -.PP -\&\- the `tbl` (or `tbl_status`) info table - has an extra column which contains the database name, -.PP -\&\- the `col` info table - has an extra column which contains the table name, - and an extra column which contains, for each described column, - the number of this column in the table owning it (this extra column - is called `Seq_in_table`). `Seq_in_table` makes it possible for you - to retrieve your columns in sorted order, when you are querying - the `col` table. -.PP -\&\- the `index` info table - has an extra column which contains the database name. -.PP -Caution: info tables contain certain columns (e.g. -Database, Table, Null...) whose names, as they are MySQL reserved words, -need to be backquoted (`...`) when used in \s-1SQL\s0 statements. -.PP -Caution: as information fetching and info tables filling happen at the -same time, info tables may contain inaccurate information about -themselves. -.SH "OPTIONS" -.IX Header "OPTIONS" -.IP "\-\-clear" 4 -.IX Item "--clear" -Does \s-1DROP\s0 \s-1TABLE\s0 on the info tables (only those that the program is -going to fill, for example if you do not use \-\-col it won't drop -the `col` table) and processes normally. Does not drop database_to_write. -.IP "\-\-clear\-only" 4 -.IX Item "--clear-only" -Same as \-\-clear but exits after the DROPs. -.IP "\-\-col" 4 -.IX Item "--col" -Adds columns information (into table `col`). -.IP "\-\-idx" 4 -.IX Item "--idx" -Adds index information (into table `idx`). -.IP "\-\-prefix prefix" 4 -.IX Item "--prefix prefix" -The info tables are named from the concatenation of prefix and, -respectively, db, tbl (or tbl_status), col, idx. Do not quote ('') -or backquote (``) prefix. -.IP "\-q, \-\-quiet" 4 -.IX Item "-q, --quiet" -Does not warn you about what the script is going to do (\s-1DROP\s0 \s-1TABLE\s0 etc) -and does not ask for a confirmation before starting. -.IP "\-\-tbl\-status" 4 -.IX Item "--tbl-status" -Instead of using \s-1SHOW\s0 \s-1TABLES\s0, uses \s-1SHOW\s0 \s-1TABLE\s0 \s-1STATUS\s0 -(much more complete information, but slower). -.IP "\-\-help" 4 -.IX Item "--help" -Display helpscreen and exit -.IP "\-u, \-\-user=#" 4 -.IX Item "-u, --user=#" -user for database login if not current user. Give a user -who has sufficient privileges (\s-1CREATE\s0, ...). -.IP "\-p, \-\-password=# (INSECURE)" 4 -.IX Item "-p, --password=# (INSECURE)" -password to use when connecting to server. -WARNING: Providing a password on command line is insecure as it is visible through /proc to anyone for a short time. -.IP "\-h, \-\-host=#" 4 -.IX Item "-h, --host=#" -host to connect to -.IP "\-P, \-\-port=#" 4 -.IX Item "-P, --port=#" -port to use when connecting to server -.IP "\-S, \-\-socket=#" 4 -.IX Item "-S, --socket=#" -\&\s-1UNIX\s0 domain socket to use when connecting to server -.SH "WARRANTY" -.IX Header "WARRANTY" -This software is free and comes without warranty of any kind. You -should never trust backup software without studying the code yourself. -Study the code inside this script and only rely on it if \fIyou\fR believe -that it does the right thing for you. -.Sp -Patches adding bug fixes, documentation and new features are welcome. -.SH "TO DO" -.IX Header "TO DO" -Use extended inserts to be faster (for servers with many databases -or tables). But to do that, must care about net\-buffer\-length. -.SH "AUTHOR" -.IX Header "AUTHOR" -2002\-06\-18 Guilhem Bichot (guilhem.bichot@mines\-paris.org) -.Sp -And all the authors of mysqlhotcopy, which served as a model for -the structure of the program. diff --git a/debian/additions/mysql_waitpid.1 b/debian/additions/mysql_waitpid.1 deleted file mode 100644 index f6877865ba8..00000000000 --- a/debian/additions/mysql_waitpid.1 +++ /dev/null @@ -1,20 +0,0 @@ -.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" -.SH NAME -mysql_waitpid \- Waits a specified amount of seconds for a PID to terminate. -.SH SYNOPSIS -mysql_waitpid [options] -.SH DESCRIPTION -Description: Waits for a program, which program id is #pid, to -terminate within #time seconds. If the program terminates within -this time, or if the #pid no longer exists, value 0 is returned. -Otherwise 1 is returned. Both #pid and #time must be positive -integer arguments. - -See mysql_waitpid for options. -.SH "SEE ALSO" -mysql (1), mysqld (1) -.SH AUTHOR -This manpage was written by Christian Hammers . - -MySQL is available at http://www.mysql.com/. -.\" end of man page diff --git a/debian/additions/mysqlbinlog.1 b/debian/additions/mysqlbinlog.1 deleted file mode 100644 index fcdf2a083f4..00000000000 --- a/debian/additions/mysqlbinlog.1 +++ /dev/null @@ -1,17 +0,0 @@ -.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" -.SH NAME -mysqlbinlog \- Dumps MySQL binary logs. -.SH SYNOPSIS -mysqlbinlog [options] -.SH DESCRIPTION -Dumps a MySQL binary log in a format usable for viewing or for pipeing to -the mysql command line client - -For more information start the program with '--help'. -.SH "SEE ALSO" -mysql (1), mysqld (1) -.SH AUTHOR -This manpage was written by Christian Hammers . - -MySQL is available at http://www.mysql.com/. -.\" end of man page diff --git a/debian/additions/mysqlbug.1 b/debian/additions/mysqlbug.1 deleted file mode 100644 index 133330dd897..00000000000 --- a/debian/additions/mysqlbug.1 +++ /dev/null @@ -1,14 +0,0 @@ -.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" -.SH NAME -mysqlbug \- MySQL bug reporting tool. -.SH SYNOPSIS -mysqlbug [options] -.SH DESCRIPTION -Interactive bug reporting tool. Use reportbug on Debian systems. -.SH "SEE ALSO" -mysql (1), mysqld (1) -.SH AUTHOR -This manpage was written by Christian Hammers . - -MySQL is available at http://www.mysql.com/. -.\" end of man page diff --git a/debian/additions/mysqlcheck.1 b/debian/additions/mysqlcheck.1 deleted file mode 100644 index b36ba2d1eb1..00000000000 --- a/debian/additions/mysqlcheck.1 +++ /dev/null @@ -1,28 +0,0 @@ -.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" -.SH NAME -mysqlcheck \- MySQL program for repairing, checking and optimizing tables. -.SH SYNOPSIS -mysqlcheck | mysqlanalyze | mysqloptimize [options] -.SH DESCRIPTION -This program can be used to CHECK (-c,-m,-C), REPAIR (-r), ANALYZE (-a) -or OPTIMIZE (-o) tables. Some of the options (like -e or -q) can be -used same time. It works on MyISAM and in some cases on BDB tables. -Please consult the MySQL manual for latest information about the -above. The options -c,-r,-a and -o are exclusive to each other, which -means that the last option will be used, if several was specified. - -The option -c will be used by default, if none was specified. You -can change the default behavior by making a symbolic link, or -copying this file somewhere with another name, the alternatives are: -mysqlrepair: The default option will be -r -mysqlanalyze: The default option will be -a -mysqloptimize: The default option will be -o - -For more information start the program with '--help'. -.SH "SEE ALSO" -mysql (1), mysqld (8) -.SH AUTHOR -This manpage was written by Christian Hammers . - -MySQL is available at http://www.mysql.com/. -.\" end of man page diff --git a/debian/additions/mysqldumpslow.1 b/debian/additions/mysqldumpslow.1 deleted file mode 100644 index 0431ef04cbb..00000000000 --- a/debian/additions/mysqldumpslow.1 +++ /dev/null @@ -1,50 +0,0 @@ -.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" -.SH NAME -mysqldumpslow \- Parse and summarize the MySQL slow query log. -.SH SYNOPSIS -mysqldumpslow [options] -.SH DESCRIPTION -This program parses and summarizes a 'slow query log'. - -.TP -\fB\-v\fR -verbose -.TP -\fB\-d\fR -debug -.TP -\fB\-s=WORD\fR -what to sort by (t, at, l, al, r, ar etc) -.TP -\fB\-r\fR -reverse the sort order (largest last instead of first) -.TP -\fB\-t=NUMBER\fR -just show the top n queries -.TP -\fB\-a\fR -don't abstract all numbers to N and strings to 'S' -.TP -\fB\-n=NUMBER\fR -abstract numbers with at least n digits within names -.TP -\fB\-g=WORD\fR -grep: only consider stmts that include this string -.TP -\fB\-h=WORD\fR -hostname of db server for *-slow.log filename (can be wildcard) -.TP -\fB\-i=WORD\fR -name of server instance (if using mysql.server startup script) -.TP -\fB\-l\fR -don't subtract lock time from total time - -.SH "SEE ALSO" -mysql (1), mysqld (1) -.SH AUTHOR -This manpage was written by Christian Hammers based on -the commends in the code. - -MySQL is available at http://www.mysql.com/. -.\" end of man page diff --git a/debian/additions/mysqlimport.1 b/debian/additions/mysqlimport.1 deleted file mode 100644 index 9007307a328..00000000000 --- a/debian/additions/mysqlimport.1 +++ /dev/null @@ -1,20 +0,0 @@ -.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" -.SH NAME -mysqlimport \- Imports text files with MySQL database queries. -.SH SYNOPSIS -mysqlimport [options] -.SH DESCRIPTION -Loads tables from text files in various formats. The base name of the -text file must be the name of the table that should be used. -If one uses sockets to connect to the MySQL server, the server will open and -read the text file directly. In other cases the client will open the text -file. The SQL command 'LOAD DATA INFILE' is used to import the rows. - -For more information start the program with '--help'. -.SH "SEE ALSO" -mysql (1), mysqld (1) -.SH AUTHOR -This manpage was written by Christian Hammers . - -MySQL is available at http://www.mysql.com/. -.\" end of man page diff --git a/debian/additions/mysqltest.1 b/debian/additions/mysqltest.1 deleted file mode 100644 index 3469765fe3b..00000000000 --- a/debian/additions/mysqltest.1 +++ /dev/null @@ -1,16 +0,0 @@ -.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" -.SH NAME -mysqltest \- Regressiontest program for MySQL. -.SH SYNOPSIS -mysqltest [options] -.SH DESCRIPTION -Runs a test against the mysql server and compares output with a results file. - -For more information start the program with '--help'. -.SH "SEE ALSO" -mysql (1), mysqld (1) -.SH AUTHOR -This manpage was written by Christian Hammers . - -MySQL is available at http://www.mysql.com/. -.\" end of man page diff --git a/debian/additions/pack_isam.1 b/debian/additions/pack_isam.1 deleted file mode 100644 index cad153eedee..00000000000 --- a/debian/additions/pack_isam.1 +++ /dev/null @@ -1,19 +0,0 @@ -.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" -.SH NAME -myisampack \- Compresses MySQL database files. -.SH SYNOPSIS -myisampack [options] -.SH DESCRIPTION -Pack a ISAM-table to take much smaller space -Keys are not updated, so you must run isamchk -rq on any table -that has keys after you have compressed it -You should give the .ISM file as the filename argument - -For more information start the program with '--help'. -.SH "SEE ALSO" -mysql (1), mysqld (1) -.SH AUTHOR -This manpage was written by Christian Hammers . - -MySQL is available at http://www.mysql.com/. -.\" end of man page diff --git a/debian/additions/resolve_stack_dump.1 b/debian/additions/resolve_stack_dump.1 deleted file mode 100644 index 2a1e2770275..00000000000 --- a/debian/additions/resolve_stack_dump.1 +++ /dev/null @@ -1,16 +0,0 @@ -.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" -.SH NAME -resolve_stack_dump \- MySQL helper program for reporting bugs. -.SH SYNOPSIS -resolve_stack_dump [options] -.SH DESCRIPTION -Resolve numeric stack strace dump into symbols. - -For more information start the program with '--help'. -.SH "SEE ALSO" -mysql (1), mysqld (1) -.SH AUTHOR -This manpage was written by Christian Hammers . - -MySQL is available at http://www.mysql.com/. -.\" end of man page diff --git a/debian/additions/resolveip.1 b/debian/additions/resolveip.1 deleted file mode 100644 index 7aa9439394d..00000000000 --- a/debian/additions/resolveip.1 +++ /dev/null @@ -1,16 +0,0 @@ -.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" -.SH NAME -resolveip \- MySQL helper program to retrive IP addresses. -.SH SYNOPSIS -resolveip [options] -.SH DESCRIPTION -Get hostname based on IP-address or IP-address based on hostname. - -For more information start the program with '--help'. -.SH "SEE ALSO" -mysql (1), mysqld (1) -.SH AUTHOR -This manpage was written by Christian Hammers . - -MySQL is available at http://www.mysql.com/. -.\" end of man page diff --git a/debian/dist/Debian/rules b/debian/dist/Debian/rules index f82b9ee3344..9b98c507e8e 100755 --- a/debian/dist/Debian/rules +++ b/debian/dist/Debian/rules @@ -64,7 +64,7 @@ ifneq ($(ARCH_OS),hurd) endif ( test -d $(builddir) || mkdir $(builddir) ) && cd $(builddir) && \ - sh -c 'PATH=$${MYSQL_BUILD_PATH:-"/bin:/usr/bin:/usr/local/bin"} \ + sh -c 'PATH=$${MYSQL_BUILD_PATH:-"/usr/local/bin:/usr/bin:/bin"} \ CC=$${MYSQL_BUILD_CC:-gcc} \ CFLAGS=$${MYSQL_BUILD_CFLAGS:-"-O2 -fno-omit-frame-pointer -g -pipe -Wall -Wno-uninitialized $$(case `lsb_release -sc` in (lenny) echo -DWORKAROUND_GCC_4_3_2_BUG ;; esac)"} \ CXX=$${MYSQL_BUILD_CXX:-g++} \ diff --git a/debian/dist/Ubuntu/rules b/debian/dist/Ubuntu/rules index 493381b019b..5f3ea672770 100755 --- a/debian/dist/Ubuntu/rules +++ b/debian/dist/Ubuntu/rules @@ -64,7 +64,7 @@ ifneq ($(ARCH_OS),hurd) endif ( test -d $(builddir) || mkdir $(builddir) ) && cd $(builddir) && \ - sh -c 'PATH=$${MYSQL_BUILD_PATH:-"/bin:/usr/bin:/usr/local/bin"} \ + sh -c 'PATH=$${MYSQL_BUILD_PATH:-"/usr/local/bin:/usr/bin:/bin"} \ CC=$${MYSQL_BUILD_CC:-gcc} \ CFLAGS=$${MYSQL_BUILD_CFLAGS:-"-O2 -fno-omit-frame-pointer -g -pipe -Wall -Wno-uninitialized"} \ CXX=$${MYSQL_BUILD_CXX:-g++} \ diff --git a/debian/mariadb-client-5.5.files b/debian/mariadb-client-5.5.files index 9cb949ea53e..f15a47157a2 100644 --- a/debian/mariadb-client-5.5.files +++ b/debian/mariadb-client-5.5.files @@ -26,6 +26,4 @@ usr/share/man/man1/mysqlman.1 usr/share/man/man1/mysqlreport.1 usr/share/man/man1/mysqlshow.1 usr/share/man/man1/mysqlslap.1 -usr/share/man/man1/mysql_tableinfo.1 usr/share/man/man1/mysql_waitpid.1 -usr/share/man/man8/mysqlmanager.8 diff --git a/debian/mariadb-client-5.5.links b/debian/mariadb-client-5.5.links index 247369fa218..0b86e87f2e9 100644 --- a/debian/mariadb-client-5.5.links +++ b/debian/mariadb-client-5.5.links @@ -1,3 +1,6 @@ usr/bin/mysqlcheck usr/bin/mysqlrepair usr/bin/mysqlcheck usr/bin/mysqlanalyze usr/bin/mysqlcheck usr/bin/mysqloptimize +usr/share/man/man1/mysqlcheck.1.gz usr/share/man/man1/mysqlrepair.1.gz +usr/share/man/man1/mysqlcheck.1.gz usr/share/man/man1/mysqlanalyze.1.gz +usr/share/man/man1/mysqlcheck.1.gz usr/share/man/man1/mysqloptimize.1.gz diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt index 38048263b34..a20aa7b91b5 100644 --- a/man/CMakeLists.txt +++ b/man/CMakeLists.txt @@ -22,7 +22,7 @@ SET(MAN1_SERVER innochecksum.1 my_print_defaults.1 myisam_ftdump.1 myisamchk.1 mysqld_multi.1 mysqld_safe.1 mysqldumpslow.1 mysqlhotcopy.1 mysqlman.1 mysqltest.1 perror.1 replace.1 resolve_stack_dump.1 resolveip.1 mysqlbug.1) -SET(MAN8_SERVER mysqld.8 mysqlmanager.8) +SET(MAN8_SERVER mysqld.8) SET(MAN1_CLIENT msql2mysql.1 mysql.1 mysql_find_rows.1 mysql_waitpid.1 mysqlaccess.1 mysqladmin.1 mysqlbinlog.1 mysqlcheck.1 mysqldump.1 mysqlimport.1 mysqlshow.1 mysqlslap.1 diff --git a/man/aria_chk.1 b/man/aria_chk.1 new file mode 100644 index 00000000000..4dc5bf8c78f --- /dev/null +++ b/man/aria_chk.1 @@ -0,0 +1,245 @@ +.TH ARIA_CHK "1" "May 2014" "aria_chk Ver 1.2" "User Commands" +.SH NAME +aria_chk \- Aria table\-maintenance utility +.SH SYNOPSIS +.B aria_chk +[\fIOPTIONS\fR] \fItables\fR[\fI.MAI\fR] +.SH DESCRIPTION +Describe, check and repair of Aria tables. +Used without options all tables on the command will be checked for errors +.SS "Global options" +.TP +\fB\-#\fR, \fB\-\-debug=\fR... +Output debug log. Often this is 'd:t:o,filename'. +.TP +\fB\-H\fR, \fB\-\-HELP\fR +Print all argument options sorted alphabetically. +.TP +\fB\-?\fR, \fB\-\-help\fR +Print all options by groups +.TP +\fB\-\-datadir\fR=\fIpath\fR +Path for control file (and logs if \fB\-\-logdir\fR not used) +.TP +\fB\-\-logdir\fR=\fIpath\fR +Path for log files +.TP +\fB\-\-ignore\-control\-file\fR +Don't open the control file. Only use this if you +are sure the tables are not in use by another +program! +.TP +\fB\-\-require\-control\-file\fR +Abort if we can't find/read the maria_log_control +file +.TP +\fB\-s\fR, \fB\-\-silent\fR +Only print errors. One can use two \fB\-s\fR to make +maria_chk very silent. +.TP +\fB\-t\fR, \fB\-\-tmpdir\fR=\fIpath\fR +Path for temporary files. Multiple paths can be +specified, separated by colon (:), they will be used +in a round\-robin fashion. +.TP +\fB\-v\fR, \fB\-\-verbose\fR +Print more information. This can be used with +\fB\-\-description\fR and \fB\-\-check\fR. Use many \fB\-v\fR for more verbosity. +.TP +\fB\-V\fR, \fB\-\-version\fR +Print version and exit. +.TP +\fB\-w\fR, \fB\-\-wait\fR +Wait if table is locked. +.SS "Check options (check is the default action for aria_chk)" +.TP +\fB\-c\fR, \fB\-\-check\fR +Check table for errors. +.TP +\fB\-e\fR, \fB\-\-extend\-check\fR +Check the table VERY throughly. Only use this in +extreme cases as aria_chk should normally be able to +find out if the table is ok even without this switch. +.TP +\fB\-F\fR, \fB\-\-fast\fR +Check only tables that haven't been closed properly. +.TP +\fB\-C\fR, \fB\-\-check\-only\-changed\fR +Check only tables that have changed since last check. +.TP +\fB\-f\fR, \fB\-\-force\fR +Restart with '\-r' if there are any errors in the table. +States will be updated as with '\-\-update\-state'. +.TP +\fB\-i\fR, \fB\-\-information\fR +Print statistics information about table that is checked. +.TP +\fB\-m\fR, \fB\-\-medium\-check\fR +Faster than extend\-check, but only finds 99.99% of +all errors. Should be good enough for most cases. +.TP +\fB\-T\fR, \fB\-\-read\-only\fR +Don't mark table as checked. +.TP +\fB\-U\fR, \fB\-\-update\-state\fR +Mark tables as crashed if any errors were found and +clean if check didn't find any errors but table was +marked as 'not clean' before. This allows one to get +rid of warnings like 'table not properly closed'. If +table was updated, update also the timestamp for when +the check was made. This option is on by default! +Use \fB\-\-skip\-update\-state\fR to disable. +.HP +\fB\-\-warning\-for\-wrong\-transaction\-id\fR +.IP +Give a warning if we find a transaction id in the table that is bigger +than what exists in the control file. Use \fB\-\-skip\-\fR... to disable warning +.SS "Recover (repair)/ options (When using '--recover' or '--safe-recover')" +.TP +\fB\-B\fR, \fB\-\-backup\fR +Make a backup of the .MAD file as 'filename\-time.BAK'. +.TP +\fB\-\-correct\-checksum\fR +Correct checksum information for table. +.TP +\fB\-D\fR, \fB\-\-data\-file\-length=\fR# +Max length of data file (when recreating data +file when it's full). +.TP +\fB\-e\fR, \fB\-\-extend\-check\fR +Try to recover every possible row from the data file +Normally this will also find a lot of garbage rows; +Don't use this option if you are not totally desperate. +.TP +\fB\-f\fR, \fB\-\-force\fR +Overwrite old temporary files. +.TP +\fB\-k\fR, \fB\-\-keys\-used=\fR# +Tell Aria to update only some specific keys. # is a +bit mask of which keys to use. This can be used to +get faster inserts. +.TP +\fB\-\-max\-record\-length=\fR# +Skip rows bigger than this if aria_chk can't allocate +memory to hold it. +.TP +\fB\-r\fR, \fB\-\-recover\fR +Can fix almost anything except unique keys that aren't +unique. +.TP +\fB\-n\fR, \fB\-\-sort\-recover\fR +Forces recovering with sorting even if the temporary +file would be very big. +.TP +\fB\-p\fR, \fB\-\-parallel\-recover\fR +Uses the same technique as '\-r' and '\-n', but creates +all the keys in parallel, in different threads. +.TP +\fB\-o\fR, \fB\-\-safe\-recover\fR +Uses old recovery method; Slower than '\-r' but can +handle a couple of cases where '\-r' reports that it +can't fix the data file. +.TP +\fB\-\-transaction\-log\fR +Log repair command to transaction log. This is needed +if one wants to use the aria_read_log to repeat the +repair +.TP +\fB\-\-character\-sets\-dir=\fR... +Directory where character sets are. +.TP +\fB\-\-set\-collation\fR=\fIname\fR +Change the collation used by the index. +.TP +\fB\-q\fR, \fB\-\-quick\fR +Faster repair by not modifying the data file. +One can give a second '\-q' to force aria_chk to +modify the original datafile in case of duplicate keys. +NOTE: Tables where the data file is currupted can't be +fixed with this option. +.TP +\fB\-u\fR, \fB\-\-unpack\fR +Unpack file packed with ariapack. +.SS "Other actions" +.TP +\fB\-a\fR, \fB\-\-analyze\fR +Analyze distribution of keys. Will make some joins in +MariaDB faster. You can check the calculated distribution +by using '\-\-description \fB\-\-verbose\fR table_name'. +.TP +\fB\-\-stats_method\fR=\fIname\fR +Specifies how index statistics collection code should +treat NULLs. Possible values of name are "nulls_unequal" +(default for 4.1/5.0), "nulls_equal" (emulate 4.0), and +"nulls_ignored". +.TP +\fB\-d\fR, \fB\-\-description\fR +Prints some information about table. +.TP +\fB\-A\fR, \fB\-\-set\-auto\-increment\fR[=\fIvalue\fR] +Force auto_increment to start at this or higher value +If no value is given, then sets the next auto_increment +value to the highest used value for the auto key + 1. +.TP +\fB\-S\fR, \fB\-\-sort\-index\fR +Sort index blocks. This speeds up 'read\-next' in +applications. +.TP +\fB\-R\fR, \fB\-\-sort\-records=\fR# +Sort records according to an index. This makes your +data much more localized and may speed up things +(It may be VERY slow to do a sort the first time!). +.TP +\fB\-b\fR, \fB\-\-block\-search=\fR# +Find a record, a block at given offset belongs to. +.TP +\fB\-z\fR, \fB\-\-zerofill\fR +Fill empty space in data and index files with zeroes. +This makes the data file movable between different +servers. +.TP +\fB\-\-zerofill\-keep\-lsn\fR +Like \fB\-\-zerofill\fR but does not zero out LSN of +data/index pages. +.PP +.SS "Variables" +.TP +\fB\-\-page_buffer_size=\fR# +Size of page buffer. Used by \fB\-\-safe\-repair\fR +.TP +\fB\-\-read_buffer_size=\fR# +Read buffer size for sequential reads during scanning +.TP +\fB\-\-sort_buffer_size=\fR# +Size of sort buffer. Used by \fB\-\-recover\fR +.TP +\fB\-\-sort_key_blocks=\fR# +Internal buffer for sorting keys; Don't touch. +.TP +\fB\-\-write_buffer_size=\fR# +Write buffer size for sequential writes during repair +.PP +Default options are read from the following files in the given order: +\fB/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf\fR +.PP +The following groups are read: \fBaria_chk\fR +.PP +The following options may be given as the first argument: +.TP +\fB\-\-print\-defaults\fR +Print the program argument list and exit. +.TP +\fB\-\-no\-defaults\fR +Don't read default options from any option file. +.TP +\fB\-\-defaults\-file=\fR# +Only read default options from the given file #. +.TP +\fB\-\-defaults\-extra\-file=\fR# +Read this file after the global files are read. +.PP +.SH "SEE ALSO" +\fBmyisamchk(1)\fR +.PP +For more information, please refer to the MariaDB Knowledge Base, +which is available online at http://mariadb.com/kb/ diff --git a/man/aria_dump_log.1 b/man/aria_dump_log.1 new file mode 100644 index 00000000000..41318d97f7a --- /dev/null +++ b/man/aria_dump_log.1 @@ -0,0 +1,54 @@ +.TH ARIA_DUMP_LOG "1" "May 2014" "aria_dump_log Ver 1.0" "User Commands" +.SH NAME +aria_dump_log \- Dump content of Aria log pages. +.SH SYNOPSIS +.B aria_dump_log +\fI-f file OPTIONS\fR +.SH DESCRIPTION +Dump content of Aria log pages. +.TP +\fB\-#\fR, \fB\-\-debug\fR[=\fIname\fR] +Output debug log. Often the argument is 'd:t:o,filename'. +.TP +\fB\-f\fR, \fB\-\-file\fR=\fIname\fR +Path to file which will be read +.TP +\fB\-?\fR, \fB\-\-help\fR +Display this help and exit. +.TP +\fB\-o\fR, \fB\-\-offset=\fR# +Start reading log from this offset +.TP +\fB\-n\fR, \fB\-\-pages=\fR# +Number of pages to read +.TP +\fB\-U\fR, \fB\-\-unit\-test\fR +Use unit test record table (for logs created by unittests +.TP +\fB\-V\fR, \fB\-\-version\fR +Print version and exit. +.PP +Default options are read from the following files in the given order: +\fB/etc/my.cnf\fB +\fB/etc/mysql/my.cnf\fB +\fB~/.my.cnf\fB +.PP +The following groups are read: \fBaria_dump_log\fR +.PP +The following options may be given as the first argument: +.TP +\fB\-\-print\-defaults\fR +Print the program argument list and exit. +.TP +\fB\-\-no\-defaults\fR +Don't read default options from any option file. +.TP +\fB\-\-defaults\-file=\fR# +Only read default options from the given file #. +.TP +\fB\-\-defaults\-extra\-file=\fR# +Read this file after the global files are read. +.PP +.SH "SEE ALSO" +For more information, please refer to the MariaDB Knowledge Base, +which is available online at http://mariadb.com/kb/ diff --git a/man/aria_ftdump.1 b/man/aria_ftdump.1 new file mode 100644 index 00000000000..4d6c1373e31 --- /dev/null +++ b/man/aria_ftdump.1 @@ -0,0 +1,29 @@ +.TH ARIA_FTDUMP "1" "May 2014" "aria_ftdump Ver 1.0" "User Commands" +.SH NAME +aria_ftdump \- display full\-text index information +.SH DESCRIPTION +Use: aria_ft_dump +.TP +\fB\-?\fR, \fB\-h\fR, \fB\-\-help\fR +Display help and exit. +.TP +\fB\-c\fR, \fB\-\-count\fR +Calculate per\-word stats (counts and global weights). +.TP +\fB\-d\fR, \fB\-\-dump\fR +Dump index (incl. data offsets and word weights). +.TP +\fB\-l\fR, \fB\-\-length\fR +Report length distribution. +.TP +\fB\-s\fR, \fB\-\-stats\fR +Report global stats. +.TP +\fB\-v\fR, \fB\-\-verbose\fR +Be verbose. +.PP +.SH "SEE ALSO" +\fBmyisam_ftdump(1)\fR +.PP +For more information, please refer to the MariaDB Knowledge Base, +which is available online at http://mariadb.com/kb/ diff --git a/man/aria_pack.1 b/man/aria_pack.1 new file mode 100644 index 00000000000..9cec33a3818 --- /dev/null +++ b/man/aria_pack.1 @@ -0,0 +1,76 @@ +.TH ARIA_PACK "1" "May 2014" "aria_pack Ver 1.0" "User Commands" +.SH NAME +aria_pack \- manual page for aria_pack Ver 1.0 +.SH SYNOPSIS +.B aria_pack +[\fIOPTIONS\fR] \fIfilename\fR... +.SH DESCRIPTION +Pack a Aria\-table to take much less space. +Keys are not updated, you must run \fBaria_chk \-rq\fR on the index (.MAI) file +afterwards to update the keys. +You should give the .MAI file as the filename argument. +To unpack a packed table, run \fBaria_chk \-u\fR on the table +.TP +\fB\-b\fR, \fB\-\-backup\fR +Make a backup of the table as table_name.OLD. +.TP +\fB\-\-character\-sets\-dir\fR=\fIname\fR +Directory where character sets are. +.TP +\fB\-#\fR, \fB\-\-debug\fR[=\fIname\fR] +Output debug log. Often this is 'd:t:o,filename'. +.TP +\fB\-f\fR, \fB\-\-force\fR +Force packing of table even if it gets bigger or if +tempfile exists. +.TP +\fB\-j\fR, \fB\-\-join\fR=\fIname\fR +Join all given tables into 'new_table_name'. All tables +MUST have identical layouts. +.TP +\fB\-?\fR, \fB\-\-help\fR +Display this help and exit. +.TP +\fB\-s\fR, \fB\-\-silent\fR +Be more silent. +.TP +\fB\-T\fR, \fB\-\-tmpdir\fR=\fIname\fR +Use temporary directory to store temporary table. +.TP +\fB\-t\fR, \fB\-\-test\fR +Don't pack table, only test packing it. +.TP +\fB\-v\fR, \fB\-\-verbose\fR +Write info about progress and packing result. Use many \fB\-v\fR +for more verbosity! +.TP +\fB\-V\fR, \fB\-\-version\fR +Output version information and exit. +.TP +\fB\-w\fR, \fB\-\-wait\fR +Wait and retry if table is in use. +.PP +Default options are read from the following files in the given order: +\fB/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf\fR +.PP +The following groups are read: \fBariapack\fR +.PP +The following options may be given as the first argument: +.TP +\fB\-\-print\-defaults\fR +Print the program argument list and exit. +.TP +\fB\-\-no\-defaults\fR +Don't read default options from any option file. +.TP +\fB\-\-defaults\-file=\fR# +Only read default options from the given file #. +.TP +\fB\-\-defaults\-extra\-file=\fR# +Read this file after the global files are read. +.PP +.SH "SEE ALSO" +\fBmyisampack(1)\fR +.PP +For more information, please refer to the MariaDB Knowledge Base, +which is available online at http://mariadb.com/kb/ diff --git a/man/aria_read_log.1 b/man/aria_read_log.1 new file mode 100644 index 00000000000..701104fe047 --- /dev/null +++ b/man/aria_read_log.1 @@ -0,0 +1,108 @@ +.TH ARIA_READ_LOG "1" "May 2014" "aria_read_log Ver 1.3" "User Commands" +.SH NAME +aria_read_log \- display Aria log file contents +.SH SYNOPSIS +.B aria_read_log +\fIOPTIONS\fR +.SH DESCRIPTION +Display and apply log records from a Aria transaction log +found in the current directory (for now) +.PP +Note: Aria is compiled without \fB\-DIDENTICAL_PAGES_AFTER_RECOVERY\fR +which means that the table files are not byte\-to\-byte identical to +files created during normal execution. This should be ok, except for +test scripts that tries to compare files before and after recovery. +.PP +You need to use one of \fB\-d\fR or \fB\-a\fR +.TP +\fB\-a\fR, \fB\-\-apply\fR +Apply log to tables: modifies tables! you should make a +backup first! Displays a lot of information if not run +with \fB\-\-silent\fR +.TP +\fB\-\-character\-sets\-dir\fR=\fIname\fR +Directory where character sets are. +.TP +\fB\-c\fR, \fB\-\-check\fR +if \fB\-\-display\-only\fR, check if record is fully readable (for +debugging) +.TP +\fB\-#\fR, \fB\-\-debug\fR[=\fIname\fR] +Output debug log. Often the argument is 'd:t:o,filename'. +.TP +\fB\-\-force\-crash=\fR# +Force crash after # recovery events +.TP +\fB\-?\fR, \fB\-\-help\fR +Display this help and exit. +.TP +\fB\-d\fR, \fB\-\-display\-only\fR +display brief info read from records' header +.TP +\fB\-e\fR, \fB\-\-end\-lsn=\fR# +Stop applying at this lsn. If end\-lsn is used, UNDO:s +will not be applied +.TP +\fB\-h\fR, \fB\-\-aria\-log\-dir\-path\fR=\fIname\fR +Path to the directory where to store transactional log +.TP +\fB\-P\fR, \fB\-\-page\-buffer\-size=\fR# +The size of the buffer used for index blocks for Aria +tables +.TP +\fB\-o\fR, \fB\-\-start\-from\-lsn=\fR# +Start reading log from this lsn +.TP +\fB\-C\fR, \fB\-\-start\-from\-checkpoint\fR +Start applying from last checkpoint +.TP +\fB\-s\fR, \fB\-\-silent\fR +Print less information during apply/undo phase +.TP +\fB\-T\fR, \fB\-\-tables\-to\-redo\fR=\fIname\fR +List of tables sepearated with , that we should apply +REDO on. Use this if you only want to recover some tables +.TP +\fB\-t\fR, \fB\-\-tmpdir\fR=\fIname\fR +Path for temporary files. Multiple paths can be +specified, separated by colon (:) +.TP +\fB\-\-translog\-buffer\-size=\fR# +The size of the buffer used for transaction log for Aria +tables +.TP +\fB\-u\fR, \fB\-\-undo\fR +Apply UNDO records to tables. (disable with +\fB\-\-disable\-undo\fR) +(Defaults to on; use \fB\-\-skip\-undo\fR to disable.) +.TP +\fB\-v\fR, \fB\-\-verbose\fR +Print more information during apply/undo phase +.TP +\fB\-V\fR, \fB\-\-version\fR +Print version and exit. +.PP +Default options are read from the following files in the given order: +\fB/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf\fR +.PP +The following groups are read: \fBaria_read_log\fR +.PP +The following options may be given as the first argument: +.TP +\fB\-\-print\-defaults\fR +Print the program argument list and exit. +.TP +\fB\-\-no\-defaults\fR +Don't read default options from any option file. +.TP +\fB\-\-defaults\-file=\fR# +Only read default options from the given file #. +.TP +\fB\-\-defaults\-extra\-file=\fR# +Read this file after the global files are read. +.PP +.SH "SEE ALSO" +\fBmyisamlog(1)\fR +.PP +For more information, please refer to the MariaDB Knowledge Base, +which is available online at http://mariadb.com/kb/ diff --git a/man/mysqladmin.1 b/man/mysqladmin.1 index 738ecef418d..25b561ffdce 100644 --- a/man/mysqladmin.1 +++ b/man/mysqladmin.1 @@ -24,8 +24,8 @@ .SH "NAME" mysqladmin \- client for administering a MySQL server .SH "SYNOPSIS" -.HP \w'\fBmysqladmin\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIcommand\fR\fR\fB\ [\fR\fB\fIcommand\-options\fR\fR\fB]\ [\fR\fB\fIcommand\fR\fR\fB\ [\fR\fB\fIcommand\-options\fR\fR\fB]]\ \&.\&.\&.\fR\ 'u -\fBmysqladmin [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIcommand\fR\fR\fB [\fR\fB\fIcommand\-options\fR\fR\fB] [\fR\fB\fIcommand\fR\fR\fB [\fR\fB\fIcommand\-options\fR\fR\fB]] \&.\&.\&.\fR +.HP \w'\fBmysqladmin\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIcommand\fR\fR\fB\ [\fR\fB\fIcommand\-arg\fR\fR\fB]\ [\fR\fB\fIcommand\fR\fR\fB\ [\fR\fB\fIcommand\-arg\fR\fR\fB]]\ \&.\&.\&.\fR\ 'u +\fBmysqladmin [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIcommand\fR\fR\fB [\fR\fB\fIcommand\-arg\fR\fR\fB] [\fR\fB\fIcommand\fR\fR\fB [\fR\fB\fIcommand\-arg\fR\fR\fB]] \&.\&.\&.\fR .SH "DESCRIPTION" .PP \fBmysqladmin\fR diff --git a/man/mysqlbinlog.1 b/man/mysqlbinlog.1 index 20f80fd8f6e..cc0f62485b5 100644 --- a/man/mysqlbinlog.1 +++ b/man/mysqlbinlog.1 @@ -1255,33 +1255,6 @@ indicates a FORMAT_DESCRIPTION_EVENT\&. The following table lists the possible type codes\&. .TS allbox tab(:); -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l l l l. T{ Type @@ -1310,7 +1283,7 @@ T}:T{ QUERY_EVENT T}:T{ The most common type of events\&. These contain statements executed on the - master\&. +master\&. T} T{ 03 @@ -1332,8 +1305,8 @@ T}:T{ INTVAR_EVENT T}:T{ Used for AUTO_INCREMENT values or when the - LAST_INSERT_ID() - function is used in the statement\&. +LAST_INSERT_ID() +function is used in the statement\&. T} T{ 06 @@ -1341,7 +1314,7 @@ T}:T{ LOAD_EVENT T}:T{ Used for LOAD DATA - INFILE in MySQL 3\&.23\&. +INFILE in MySQL 3\&.23\&. T} T{ 07 @@ -1356,9 +1329,9 @@ T}:T{ CREATE_FILE_EVENT T}:T{ Used for LOAD DATA - INFILE statements\&. This indicates the - start of execution of such a statement\&. A temporary - file is created on the slave\&. Used in MySQL 4 only\&. +INFILE statements\&. This indicates the +start of execution of such a statement\&. A temporary +file is created on the slave\&. Used in MySQL 4 only\&. T} T{ 09 @@ -1366,9 +1339,9 @@ T}:T{ APPEND_BLOCK_EVENT T}:T{ Contains data for use in a - LOAD DATA - INFILE statement\&. The data is stored in - the temporary file on the slave\&. +LOAD DATA +INFILE statement\&. The data is stored in +the temporary file on the slave\&. T} T{ 0a @@ -1376,9 +1349,9 @@ T}:T{ EXEC_LOAD_EVENT T}:T{ Used for LOAD DATA - INFILE statements\&. The contents of the - temporary file is stored in the table on the slave\&. - Used in MySQL 4 only\&. +INFILE statements\&. The contents of the +temporary file is stored in the table on the slave\&. +Used in MySQL 4 only\&. T} T{ 0b @@ -1386,8 +1359,8 @@ T}:T{ DELETE_FILE_EVENT T}:T{ Rollback of a LOAD DATA - INFILE statement\&. The temporary file - should be deleted on the slave\&. +INFILE statement\&. The temporary file +should be deleted on the slave\&. T} T{ 0c @@ -1395,7 +1368,7 @@ T}:T{ NEW_LOAD_EVENT T}:T{ Used for LOAD DATA - INFILE in MySQL 4 and earlier\&. +INFILE in MySQL 4 and earlier\&. T} T{ 0d @@ -1403,8 +1376,8 @@ T}:T{ RAND_EVENT T}:T{ Used to send information about random values if the - RAND() function is - used in the statement\&. +RAND() function is +used in the statement\&. T} T{ 0e @@ -1433,7 +1406,7 @@ T}:T{ BEGIN_LOAD_QUERY_EVENT T}:T{ Used for LOAD DATA - INFILE statements in MySQL 5 and later\&. +INFILE statements in MySQL 5 and later\&. T} T{ 12 @@ -1441,7 +1414,7 @@ T}:T{ EXECUTE_LOAD_QUERY_EVENT T}:T{ Used for LOAD DATA - INFILE statements in MySQL 5 and later\&. +INFILE statements in MySQL 5 and later\&. T} T{ 13 @@ -1456,7 +1429,7 @@ T}:T{ PRE_GA_WRITE_ROWS_EVENT T}:T{ Row data for a single table that should be created\&. Used in MySQL 5\&.1\&.5 - to 5\&.1\&.17\&. +to 5\&.1\&.17\&. T} T{ 15 @@ -1464,7 +1437,7 @@ T}:T{ PRE_GA_UPDATE_ROWS_EVENT T}:T{ Row data for a single table that needs to be updated\&. Used in MySQL - 5\&.1\&.5 to 5\&.1\&.17\&. +5\&.1\&.5 to 5\&.1\&.17\&. T} T{ 16 @@ -1472,7 +1445,7 @@ T}:T{ PRE_GA_DELETE_ROWS_EVENT T}:T{ Row data for a single table that should be deleted\&. Used in MySQL 5\&.1\&.5 - to 5\&.1\&.17\&. +to 5\&.1\&.17\&. T} T{ 17 @@ -1480,7 +1453,7 @@ T}:T{ WRITE_ROWS_EVENT T}:T{ Row data for a single table that should be created\&. Used in MySQL 5\&.1\&.18 - and later\&. +and later\&. T} T{ 18 @@ -1488,7 +1461,7 @@ T}:T{ UPDATE_ROWS_EVENT T}:T{ Row data for a single table that needs to be updated\&. Used in MySQL - 5\&.1\&.18 and later\&. +5\&.1\&.18 and later\&. T} T{ 19 @@ -1496,7 +1469,7 @@ T}:T{ DELETE_ROWS_EVENT T}:T{ Row data for a single table that should be deleted\&. Used in MySQL 5\&.1\&.18 - and later\&. +and later\&. T} T{ 1a @@ -1553,10 +1526,6 @@ Master Pos: The position of the next event in the original master log file\&. Flags: 16 flags\&. Currently, the following flags are used\&. The others are reserved for future use\&. .TS allbox tab(:); -l l l -l l l -l l l -l l l l l l. T{ Flag @@ -1571,13 +1540,13 @@ T}:T{ LOG_EVENT_BINLOG_IN_USE_F T}:T{ Log file correctly closed\&. (Used only in - FORMAT_DESCRIPTION_EVENT\&.) If - this flag is set (if the flags are, for example, - \'01 00\') in a - FORMAT_DESCRIPTION_EVENT, the log - file has not been properly closed\&. Most probably - this is because of a master crash (for example, due - to power failure)\&. +FORMAT_DESCRIPTION_EVENT\&.) If +this flag is set (if the flags are, for example, +\'01 00\') in a +FORMAT_DESCRIPTION_EVENT, the log +file has not been properly closed\&. Most probably +this is because of a master crash (for example, due +to power failure)\&. T} T{ 02 @@ -1592,8 +1561,8 @@ T}:T{ LOG_EVENT_THREAD_SPECIFIC_F T}:T{ Set if the event is dependent on the connection it was executed in (for - example, \'04 00\'), for example, - if the event uses temporary tables\&. +example, \'04 00\'), for example, +if the event uses temporary tables\&. T} T{ 08 @@ -1601,7 +1570,7 @@ T}:T{ LOG_EVENT_SUPPRESS_USE_F T}:T{ Set in some circumstances when the event is not dependent on the default - database\&. +database\&. T} .TE .sp 1 diff --git a/man/mysqldump.1 b/man/mysqldump.1 index f27e1552313..59d2416b25e 100644 --- a/man/mysqldump.1 +++ b/man/mysqldump.1 @@ -2027,9 +2027,6 @@ value, an empty string, and the string value are distinguished from one another in the output generated by this option as follows\&. .TS allbox tab(:); -l l -l l -l l l l. T{ \fBValue\fR: diff --git a/man/mysqlmanager.8 b/man/mysqlmanager.8 deleted file mode 100644 index 8d3e6efd85e..00000000000 --- a/man/mysqlmanager.8 +++ /dev/null @@ -1,2078 +0,0 @@ -'\" t -.\" Title: \fBmysqlmanager\fR -.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] -.\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/06/2010 -.\" Manual: MySQL Database System -.\" Source: MySQL 5.1 -.\" Language: English -.\" -.TH "\FBMYSQLMANAGER\FR" "8" "04/06/2010" "MySQL 5\&.1" "MySQL Database System" -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.\" mysqlmanager -.\" MySQL Instance Manager -.SH "NAME" -mysqlmanager \- the MySQL Instance Manager -.SH "SYNOPSIS" -.HP \w'\fBmysqlmanager\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u -\fBmysqlmanager [\fR\fB\fIoptions\fR\fR\fB]\fR -.SH "DESCRIPTION" -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBImportant\fR -.ps -1 -.br -.PP -MySQL Instance Manager has been deprecated and is removed in MySQL 5\&.4\&. -.sp .5v -.RE -.PP -\fBmysqlmanager\fR -is the MySQL Instance Manager (IM)\&. This program monitors and manages MySQL Database Server instances\&. MySQL Instance Manager is available for Unix\-like operating systems, as well as Windows\&. It runs as a daemon that listens on a TCP/IP port\&. On Unix, it also listens on a Unix socket file\&. -.PP -MySQL Instance Manager can be used in place of the -mysqld_safe -script to start and stop one or more instances of MySQL Server\&. Because Instance Manager can manage multiple server instances, it can also be used in place of the -\fBmysqld_multi\fR -script\&. Instance Manager offers these capabilities: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Instance Manager can start and stop instances, and report on the status of instances\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Server instances can be treated as guarded or unguarded: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -When Instance Manager starts, it starts each guarded instance\&. If the instance crashes, Instance Manager detects this and restarts it\&. When Instance Manager stops, it stops the instance\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -A nonguarded instance is not started when Instance Manager starts or monitored by it\&. If the instance crashes after being started, Instance Manager does not restart it\&. When Instance Manager exits, it does not stop the instance if it is running\&. -.RE -.RS 4 -Instances are guarded by default\&. An instance can be designated as nonguarded by including the -\fBnonguarded\fR -option in the configuration file\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Instance Manager provides an interactive interface for configuring instances, so that the need to edit the configuration file manually is reduced or eliminated\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Instance Manager provides remote instance management\&. That is, it runs on the host where you want to control MySQL Server instances, but you can connect to it from a remote host to perform instance\-management operations\&. -.RE -.PP -The following sections describe MySQL Instance Manager operation in more detail\&. -.SH "MYSQL INSTANCE MANAGER COMMAND OPTIONS" -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBImportant\fR -.ps -1 -.br -.PP -MySQL Instance Manager has been deprecated and is removed in MySQL 5\&.4\&. -.sp .5v -.RE -.PP -The MySQL Instance Manager supports a number of command options\&. For a brief listing, invoke -\fBmysqlmanager\fR -with the -\fB\-\-help\fR -option\&. Options may be given on the command line or in the Instance Manager configuration file\&. On Windows, the standard configuration file is -my\&.ini -in the directory where Instance Manager is installed\&. On Unix, the standard file is -/etc/my\&.cnf\&. To specify a different configuration file, start Instance Manager with the -\fB\-\-defaults\-file\fR -option\&. -.PP -\fBmysqlmanager\fR -supports the following options\&. The options for managing entries in the password file are described further in -the section called \(lqINSTANCE MANAGER USER AND PASSWORD MANAGEMENT\(rq\&. -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: help option -.\" help option: mysqlmanager -\fB\-\-help\fR, -\fB\-?\fR -.sp -Display a help message and exit\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: add-user option -.\" add-user option: mysqlmanager -\fB\-\-add\-user\fR -.sp -Add a new user (specified with the -\fB\-\-username\fR -option) to the password file\&. This option was added in MySQL 5\&.1\&.12\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: angel-pid-file option -.\" angel-pid-file option: mysqlmanager -\fB\-\-angel\-pid\-file=\fR\fB\fIfile_name\fR\fR -.sp -The file in which the angel process records its process ID when -\fBmysqlmanager\fR -runs in daemon mode (that is, when the -\fB\-\-run\-as\-service\fR -option is given)\&. The default file name is -mysqlmanager\&.angel\&.pid\&. -.sp -If the -\fB\-\-angel\-pid\-file\fR -option is not given, the default angel PID file has the same name as the PID file except that any PID file extension is replaced with an extension of -\&.angel\&.pid\&. (For example, -mysqlmanager\&.pid -becomes -mysqlmanager\&.angel\&.pid\&.) -.sp -This option was added in MySQL 5\&.1\&.11\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: bind-address option -.\" bind-address option: mysqlmanager -\fB\-\-bind\-address=\fR\fB\fIIP\fR\fR -.sp -The IP address to bind to\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: check-password-file option -.\" check-password-file option: mysqlmanager -\fB\-\-check\-password\-file\fR -.sp -Check the validity and consistency of the password file\&. This option was added in MySQL 5\&.1\&.12\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: clean-password-file option -.\" clean-password-file option: mysqlmanager -\fB\-\-clean\-password\-file\fR -.sp -Drop all users from the password file\&. This option was added in MySQL 5\&.1\&.12\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: debug option -.\" debug option: mysqlmanager -\fB\-\-debug=\fR\fB\fIdebug_options\fR\fR, -\fB\-# \fR\fB\fIdebug_options\fR\fR -.sp -Write a debugging log\&. A typical -\fIdebug_options\fR -string is -\'d:t:o,\fIfile_name\fR\'\&. This option was added in MySQL 5\&.1\&.10\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: default-mysqld-path option -.\" default-mysqld-path option: mysqlmanager -\fB\-\-default\-mysqld\-path=\fR\fB\fIpath\fR\fR -.sp -The path name of the MySQL Server binary\&. This path name is used for all server instance sections in the configuration file for which no -\fBmysqld\-path\fR -option is present\&. The default value of this option is the compiled\-in path name, which depends on how the MySQL distribution was configured\&. Example: -\fB\-\-default\-mysqld\-path=/usr/sbin/mysqld\fR -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: defaults-file option -.\" defaults-file option: mysqlmanager -\fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR -.sp -Read Instance Manager and MySQL Server settings from the given file\&. All configuration changes made by the Instance Manager will be written to this file\&. This must be the first option on the command line if it is used, and the file must exist\&. -.sp -If this option is not given, Instance Manager uses its standard configuration file\&. On Windows, the standard file is -my\&.ini -in the directory where Instance Manager is installed\&. On Unix, the standard file is -/etc/my\&.cnf\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: drop-user option -.\" drop-user option: mysqlmanager -\fB\-\-drop\-user\fR -.sp -Drop a user (specified with the -\fB\-\-username\fR -option) from the password file\&. This option was added in MySQL 5\&.1\&.12\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: edit-user option -.\" edit-user option: mysqlmanager -\fB\-\-edit\-user\fR -.sp -Change an entry for an existing user (specified with the -\fB\-\-username\fR -option) in the password file\&. This option was added in MySQL 5\&.1\&.12\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: install option -.\" install option: mysqlmanager -\fB\-\-install\fR -.sp -On Windows, install Instance Manager as a Windows service\&. The service name is -MySQL Manager\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: list-users option -.\" list-users option: mysqlmanager -\fB\-\-list\-users\fR -.sp -List the users in the password file\&. This option was added in MySQL 5\&.1\&.12\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: log option -.\" log option: mysqlmanager -\fB\-\-log=\fR\fB\fIfile_name\fR\fR -.sp -The path to the Instance Manager log file\&. This option has no effect unless the -\fB\-\-run\-as\-service\fR -option is also given\&. If the file name specified for the option is a relative name, the log file is created under the directory from which Instance Manager is started\&. To ensure that the file is created in a specific directory, specify it as a full path name\&. -.sp -If -\fB\-\-run\-as\-service\fR -is given without -\fB\-\-log\fR, the log file is -mysqlmanager\&.log -in the data directory\&. -.sp -If -\fB\-\-run\-as\-service\fR -is not given, log messages go to the standard output\&. To capture log output, you can redirect Instance Manager output to a file: -.sp -.if n \{\ -.RS 4 -.\} -.nf -mysqlmanager > im\&.log -.fi -.if n \{\ -.RE -.\} -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: monitoring-interval option -.\" monitoring-interval option: mysqlmanager -\fB\-\-monitoring\-interval=\fR\fB\fIseconds\fR\fR -.sp -The interval in seconds for monitoring server instances\&. The default value is 20 seconds\&. Instance Manager tries to connect to each monitored (guarded) instance using the nonexisting -MySQL_Instance_Manager -user account to check whether it is alive/not hanging\&. If the result of the connection attempt indicates that the instance is unavailable, Instance Manager performs several attempts to restart the instance\&. -.sp -Normally, the -MySQL_Instance_Manager -account does not exist, so the connection attempts by Instance Manager cause the monitored instance to produce messages in its general query log similar to the following: -.sp -.if n \{\ -.RS 4 -.\} -.nf -Access denied for user \'MySQL_Instance_M\'@\'localhost\' \(Fc - (using password: YES) -.fi -.if n \{\ -.RE -.\} -.sp -The -nonguarded -option in the appropriate server instance section disables monitoring for a particular instance\&. If the instance dies after being started, Instance Manager will not restart it\&. Instance Manager tries to connect to a nonguarded instance only when you request the instance\'s status (for example, with the -SHOW INSTANCES -status\&. -.sp -See -the section called \(lqMYSQL SERVER INSTANCE STATUS MONITORING\(rq, for more information\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: mysqld-safe-compatible option -.\" mysqld-safe-compatible option: mysqlmanager -\fB\-\-mysqld\-safe\-compatible\fR -.sp -Run in a -\fBmysqld_safe\fR\-compatible manner\&. For details, see -the section called \(lqSTARTING THE MYSQL SERVER WITH MYSQL INSTANCE MANAGER\(rq\&. This option was added in MySQL 5\&.1\&.12\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: password option -.\" password option: mysqlmanager -\fB\-\-password=\fR\fB\fIpassword\fR\fR, -\fB\-p \fR\fB\fIpassword\fR\fR -.sp -Specify the password for an entry to be added to or modified in the password file\&. Unlike the -\fB\-\-password\fR/\fB\-P\fR -option for most MySQL programs, the password value is required, not optional\&. See also -the section called \(lqINSTANCE MANAGER USER AND PASSWORD MANAGEMENT\(rq\&. This option was added in MySQL 5\&.1\&.12\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: password-file option -.\" password-file option: mysqlmanager -\fB\-\-password\-file=\fR\fB\fIfile_name\fR\fR -.sp -The name of the file where the Instance Manager looks for users and passwords\&. On Windows, the default is -mysqlmanager\&.passwd -in the directory where Instance Manager is installed\&. On Unix, the default file is -/etc/mysqlmanager\&.passwd\&. See also -the section called \(lqINSTANCE MANAGER USER AND PASSWORD MANAGEMENT\(rq\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: pid-file option -.\" pid-file option: mysqlmanager -\fB\-\-pid\-file=\fR\fB\fIfile_name\fR\fR -.sp -The process ID file to use\&. On Windows, the default file is -mysqlmanager\&.pid -in the directory where Instance Manager is installed\&. On Unix, the default is -mysqlmanager\&.pid -in the data directory\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: port option -.\" port option: mysqlmanager -\fB\-\-port=\fR\fB\fIport_num\fR\fR -.sp -The port number to use when listening for TCP/IP connections from clients\&. The default port number (assigned by IANA) is 2273\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: print-defaults option -.\" print-defaults option: mysqlmanager -\fB\-\-print\-defaults\fR -.sp -Print the current defaults and exit\&. This must be the first option on the command line if it is used\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: print-password-line option -.\" print-password-line option: mysqlmanager -\fB\-\-print\-password\-line\fR -.sp -Prepare an entry for the password file, print it to the standard output, and exit\&. You can redirect the output from Instance Manager to a file to save the entry in the file\&. -.sp -Prior to MySQL 5\&.1\&.12, this option was named -\fB\-\-passwd\fR\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: remove option -.\" remove option: mysqlmanager -\fB\-\-remove\fR -.sp -On Windows, removes Instance Manager as a Windows service\&. This assumes that Instance Manager has been run with -\fB\-\-install\fR -previously\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: run-as-service option -.\" run-as-service option: mysqlmanager -\fB\-\-run\-as\-service\fR -.sp -On Unix, daemonize and start an angel process\&. The angel process monitors Instance Manager and restarts it if it crashes\&. (The angel process itself is simple and unlikely to crash\&.) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: socket option -.\" socket option: mysqlmanager -\fB\-\-socket=\fR\fB\fIpath\fR\fR -.sp -On Unix, the socket file to use for incoming connections\&. The default file is named -/tmp/mysqlmanager\&.sock\&. This option has no meaning on Windows\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: standalone option -.\" standalone option: mysqlmanager -\fB\-\-standalone\fR -.sp -This option is used on Windows to run Instance Manager in standalone mode\&. You should specify it when you start Instance Manager from the command line\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: user option -.\" user option: mysqlmanager -\fB\-\-user=\fR\fB\fIuser_name\fR\fR -.sp -On Unix, the user name of the system account to use for starting and running -\fBmysqlmanager\fR\&. This option generates a warning and has no effect unless you start -\fBmysqlmanager\fR -as -root -(so that it can change its effective user ID), or as the named user\&. It is recommended that you configure -\fBmysqlmanager\fR -to run using the same account used to run the -\fBmysqld\fR -server\&. (\(lqUser\(rq -in this context refers to a system login account, not a MySQL user listed in the grant tables\&.) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: username option -.\" username option: mysqlmanager -\fB\-\-username=\fR\fB\fIuser_name\fR\fR, -\fB\-u \fR\fB\fIuser_name\fR\fR -.sp -Specify the user name for an entry to be added to or modified in the password file\&. This option was added in MySQL 5\&.1\&.12\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: version option -.\" version option: mysqlmanager -\fB\-\-version\fR, -\fB\-V\fR -.sp -Display version information and exit\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysqlmanager: wait-timeout option -.\" wait-timeout option: mysqlmanager -\fB\-\-wait\-timeout=\fR\fB\fIN\fR\fR -.sp -The number of seconds to wait for activity on an incoming connection before closing it\&. The default is 28800 seconds (8 hours)\&. -.sp -This option was added in MySQL 5\&.1\&.7\&. Before that, the timeout is 30 seconds and cannot be changed\&. -.RE -.SH "MYSQL INSTANCE MANAGER CONFIGURATION FILES" -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBImportant\fR -.ps -1 -.br -.PP -MySQL Instance Manager has been deprecated and is removed in MySQL 5\&.4\&. -.sp .5v -.RE -.PP -Instance Manager uses its standard configuration file unless it is started with a -\fB\-\-defaults\-file\fR -option that specifies a different file\&. On Windows, the standard file is -my\&.ini -in the directory where Instance Manager is installed\&. On Unix, the standard file is -/etc/my\&.cnf\&. -.PP -Instance Manager reads options for itself from the -[manager] -section of the configuration file, and options for server instances from -[mysqld] -or -[mysqld\fIN\fR] -sections\&. The -[manager] -section contains any of the options listed in -the section called \(lqMYSQL INSTANCE MANAGER COMMAND OPTIONS\(rq, except for those specified as having to be given as the first option on the command line\&. Here is a sample -[manager] -section: -.sp -.if n \{\ -.RS 4 -.\} -.nf -# MySQL Instance Manager options section -[manager] -default\-mysqld\-path = /usr/local/mysql/libexec/mysqld -socket=/tmp/manager\&.sock -pid\-file=/tmp/manager\&.pid -password\-file = /home/cps/\&.mysqlmanager\&.passwd -monitoring\-interval = 2 -port = 1999 -bind\-address = 192\&.168\&.1\&.5 -.fi -.if n \{\ -.RE -.\} -.PP -Each -[mysqld] -or -[mysqld\fIN\fR] -instance section specifies options given by Instance Manager to a server instance at startup\&. These are mainly common MySQL Server options (see -Section\ \&5.1.2, \(lqServer Command Options\(rq)\&. In addition, a -[mysqld\fIN\fR] -section can contain the options in the following list, which are specific to Instance Manager\&. These options are interpreted by Instance Manager itself; it does not pass them to the server when it attempts to start that server\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBWarning\fR -.ps -1 -.br -.PP -The Instance Manager\-specific options must not be used in a -[mysqld] -section\&. If a server is started without using Instance Manager, it will not recognize these options and will fail to start properly\&. -.sp .5v -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -mysqld\-path = \fIpath\fR -.sp -The path name of the -\fBmysqld\fR -server binary to use for the server instance\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -nonguarded -.sp -This option disables Instance Manager monitoring functionality for the server instance\&. By default, an instance is guarded: At Instance Manager start time, it starts the instance\&. It also monitors the instance status and attempts to restart it if it fails\&. At Instance Manager exit time, it stops the instance\&. None of these things happen for nonguarded instances\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -shutdown\-delay = \fIseconds\fR -.sp -The number of seconds Instance Manager should wait for the server instance to shut down\&. The default value is 35 seconds\&. After the delay expires, Instance Manager assumes that the instance is hanging and attempts to terminate it\&. If you use -InnoDB -with large tables, you should increase this value\&. -.RE -.PP -Here are some sample instance sections: -.sp -.if n \{\ -.RS 4 -.\} -.nf -[mysqld1] -mysqld\-path=/usr/local/mysql/libexec/mysqld -socket=/tmp/mysql\&.sock -port=3307 -server_id=1 -skip\-stack\-trace -core\-file -log\-bin -log\-error -log=mylog -log\-slow\-queries -[mysqld2] -nonguarded -port=3308 -server_id=2 -mysqld\-path= /home/cps/mysql/trees/mysql\-5\&.1/sql/mysqld -socket = /tmp/mysql\&.sock5 -pid\-file = /tmp/hostname\&.pid5 -datadir= /home/cps/mysql_data/data_dir1 -language=/home/cps/mysql/trees/mysql\-5\&.1/sql/share/english -log\-bin -log=/tmp/fordel\&.log -.fi -.if n \{\ -.RE -.\} -.SH "STARTING THE MYSQL SERVER WITH MYSQL INSTANCE MANAGER" -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBImportant\fR -.ps -1 -.br -.PP -MySQL Instance Manager has been deprecated and is removed in MySQL 5\&.4\&. -.sp .5v -.RE -.PP -This section discusses how Instance Manager starts server instances when it starts\&. However, before you start Instance Manager, you should set up a password file for it\&. Otherwise, you will not be able to connect to Instance Manager to control it after it starts\&. For details about creating Instance Manager accounts, see -the section called \(lqINSTANCE MANAGER USER AND PASSWORD MANAGEMENT\(rq\&. -.PP -On Unix, the -\fBmysqld\fR -MySQL database server normally is started with the -\fBmysql\&.server\fR -script, which usually resides in the -/etc/init\&.d/ -folder\&. That script invokes the -\fBmysqld_safe\fR -script by default\&. However, you can use Instance Manager instead if you modify the -/etc/my\&.cnf -configuration file by adding -use\-manager -to the -[mysql\&.server] -section: -.sp -.if n \{\ -.RS 4 -.\} -.nf -[mysql\&.server] -use\-manager -.fi -.if n \{\ -.RE -.\} -.PP -Before MySQL 5\&.1\&.12, Instance Manager always tries to start at least one server instance: When it starts, it reads its configuration file if it exists to find server instance sections and prepare a list of instances\&. Instance sections have names of the form -[mysqld] -or -[mysqld\fIN\fR], where -\fIN\fR -is an unsigned integer (for example, -[mysqld1], -[mysqld2], and so forth)\&. -.PP -After preparing the list of instances, Instance Manager starts the guarded instances in the list\&. If there are no instances, Instance Manager creates an instance named -mysqld -and attempts to start it with default (compiled\-in) configuration values\&. This means that the Instance Manager cannot find the -\fBmysqld\fR -program if it is not installed in the default location\&. (Section\ \&2.1.5, \(lqInstallation Layouts\(rq, describes default locations for components of MySQL distributions\&.) If you have installed the MySQL server in a nonstandard location, you should create the Instance Manager configuration file\&. -.PP -The startup behavior just described is similar to that of -\fBmysqld_safe\fR, which always attempts to start a server\&. However, it lacks the flexibility required for some operations because it is not possible to run Instance Manager in such a way that it refrains from starting any server instances\&. For example, you cannot invoke Instance Manager for the purpose of configuring an instance without also starting it (a task that a MySQL installer application might want to perform)\&. Consequently, MySQL 5\&.1\&.12 introduces the following changes: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -A new option, -\fB\-\-mysqld\-safe\-compatible\fR, may be used to cause Instance Manager to run with startup behavior similar to that used before MySQL 5\&.1\&.12: If Instance Manager finds a -[mysqld] -instance section in the configuration file, it will start it\&. If Instance Manager finds no -[mysqld] -section, it creates one using default configuration values, writes a -[mysqld] -section to the configuration file if it is accessible, and starts the -mysqld -instance\&. Instance Manager also starts any other guarded instances listed in the configuration file\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Without -\fB\-\-mysqld\-safe\-compatible\fR, Instance Manager reads its configuration file if it exists and starts instances for any guarded instance sections that it finds\&. If there are none, it starts no instances\&. -.RE -.PP -Instance Manager also stops all guarded server instances when it shuts down\&. -.PP -The allowable options for -[mysqld\fIN\fR] -server instance sections are described in -the section called \(lqMYSQL INSTANCE MANAGER CONFIGURATION FILES\(rq\&. In these sections, you can use a special -\fBmysqld\-path=\fR\fB\fIpath\-to\-mysqld\-binary\fR\fR -option that is recognized only by Instance Manager\&. Use this option to let Instance Manager know where the -\fBmysqld\fR -binary resides\&. If there are multiple instances, it may also be necessary to set other options such as -\fBdatadir\fR -and -\fBport\fR, to ensure that each instance has a different data directory and TCP/IP port number\&. -Section\ \&5.6, \(lqRunning Multiple MySQL Servers on the Same Machine\(rq, discusses the configuration values that must differ for each instance when you run multiple instance on the same machine\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBWarning\fR -.ps -1 -.br -.PP -The -[mysqld] -instance section, if it exists, must not contain any Instance Manager\-specific options\&. -.sp .5v -.RE -.PP -The typical Unix startup/shutdown cycle for a MySQL server with the MySQL Instance Manager enabled is as follows: -.sp -.RS 4 -.ie n \{\ -\h'-04' 1.\h'+01'\c -.\} -.el \{\ -.sp -1 -.IP " 1." 4.2 -.\} -The -\fB/etc/init\&.d/mysql\fR -script starts MySQL Instance Manager\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04' 2.\h'+01'\c -.\} -.el \{\ -.sp -1 -.IP " 2." 4.2 -.\} -Instance Manager starts the guarded server instances and monitors them\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04' 3.\h'+01'\c -.\} -.el \{\ -.sp -1 -.IP " 3." 4.2 -.\} -If a server instance fails, Instance Manager restarts it\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04' 4.\h'+01'\c -.\} -.el \{\ -.sp -1 -.IP " 4." 4.2 -.\} -If Instance Manager is shut down (for example, with the -\fB/etc/init\&.d/mysql stop\fR -command), it shuts down all server instances\&. -.RE -.SH "INSTANCE MANAGER USER AND PASSWORD MANAGEMENT" -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBImportant\fR -.ps -1 -.br -.PP -MySQL Instance Manager has been deprecated and is removed in MySQL 5\&.4\&. -.sp .5v -.RE -.PP -The Instance Manager stores its user information in a password file\&. On Windows, the default is -mysqlmanager\&.passwd -in the directory where Instance Manager is installed\&. On Unix, the default file is -/etc/mysqlmanager\&.passwd\&. To specify a different location for the password file, use the -\fB\-\-password\-file\fR -option\&. -.PP -If the password file does not exist or contains no password entries, you cannot connect to the Instance Manager\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.PP -Any Instance Manager process that is running to monitor server instances does not notice changes to the password file\&. You must stop it and restart it after making password entry changes\&. -.sp .5v -.RE -.PP -Entries in the password file have the following format, where the two fields are the account user name and encrypted password, separated by a colon: -.sp -.if n \{\ -.RS 4 -.\} -.nf -petr:*35110DC9B4D8140F5DE667E28C72DD2597B5C848 -.fi -.if n \{\ -.RE -.\} -.PP -Instance Manager password encryption is the same as that used by MySQL Server\&. It is a one\-way operation; no means are provided for decrypting encrypted passwords\&. -.PP -Instance Manager accounts differ somewhat from MySQL Server accounts: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -MySQL Server accounts are associated with a host name, user name, and password (see -Section\ \&5.5.1, \(lqUser Names and Passwords\(rq)\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Instance Manager accounts are associated with a user name and password only\&. -.RE -.PP -This means that a client can connect to Instance Manager with a given user name from any host\&. To limit connections so that clients can connect only from the local host, start Instance Manager with the -\fB\-\-bind\-address=127\&.0\&.0\&.1\fR -option so that it listens only to the local network interface\&. Remote clients will not be able to connect\&. Local clients can connect like this: -.sp -.if n \{\ -.RS 4 -.\} -.nf -shell> \fBmysql \-h 127\&.0\&.0\&.1 \-P 2273\fR -.fi -.if n \{\ -.RE -.\} -.PP -Before MySQL 5\&.1\&.12, the only option for creating password file entries is -\fB\-\-passwd\fR, which causes Instance Manager to prompt for user name and password values and display the resulting entry\&. You can save the output in the -/etc/mysqlmanager\&.passwd -password file to store it\&. Here is an example: -.sp -.if n \{\ -.RS 4 -.\} -.nf -shell> \fBmysqlmanager \-\-passwd >> /etc/mysqlmanager\&.passwd\fR -Creating record for new user\&. -Enter user name: \fBmike\fR -Enter password: \fBmikepass\fR -Re\-type password: \fBmikepass\fR -.fi -.if n \{\ -.RE -.\} -.PP -At the prompts, enter the user name and password for the new Instance Manager user\&. You must enter the password twice\&. It does not echo to the screen, so double entry guards against entering a different password than you intend (if the two passwords do not match, no entry is generated)\&. -.PP -The preceding command causes the following line to be added to -/etc/mysqlmanager\&.passwd: -.sp -.if n \{\ -.RS 4 -.\} -.nf -mike:*BBF1F551DD9DD96A01E66EC7DDC073911BAD17BA -.fi -.if n \{\ -.RE -.\} -.PP -Use of the -\fB\-\-password\fR -option fails if -\fBmysqlmanager\fR -is invoked directly from an IBM 5250 terminal\&. To work around this, use a command like the following from the command line to generate the password entry: -.sp -.if n \{\ -.RS 4 -.\} -.nf -shell> \fBmysql \-B \-\-skip\-column\-name \e\fR - \fB\-e \'SELECT CONCAT("\fR\fB\fIuser_name\fR\fR\fB",":",PASSWORD("\fR\fB\fIpass_val\fR\fR\fB"));\'\fR -.fi -.if n \{\ -.RE -.\} -.PP -The output from the command can be used an entry in the -/etc/mysqlmanager\&.passwd -file\&. -.PP -Beginning with MySQL 5\&.1\&.12, the -\fB\-\-passwd\fR -option is renamed to -\fB\-\-print\-password\-line\fR -and there are several other options for managing user accounts from the command line\&. For example, the -\fB\-\-username\fR -and -\fB\-\-password\fR -options are available on the command line for specifying the user name and password for an account entry\&. You can use them to generate an entry with no prompting like this (type the command on a single line): -.sp -.if n \{\ -.RS 4 -.\} -.nf -shell> \fBmysqlmanager \-\-print\-password\-line\fR - \fB\-\-username=mike \-\-password=mikepass >> /etc/mysqlmanager\&.passwd\fR -.fi -.if n \{\ -.RE -.\} -.PP -If you omit the -\fB\-\-username\fR -or -\fB\-\-password\fR -option, Instance Manager prompts for the required value\&. -.PP -\fB\-\-print\-password\-line\fR -causes Instance Manager to send the resulting account entry to its output, which you can append to the password file\&. The following list describes other account\-management options that cause Instance Manager to operate directly on the password file\&. (These options make Instance Manager scriptable for account\-management purposes\&.) For operations on the password file to succeed, the file must exist and it must be accessible by Instance Manager\&. (The exception is -\fB\-\-clean\-password\-file\fR, which creates the file if it does not exist\&. Alternatively, if there is no password file, manually create it as an empty file and ensure that its ownership and access modes allow it to be read and written by Instance Manager\&.) The default password file is used unless you specify a -\fB\-\-password\-file\fR -option\&. -.PP -To ensure consistent treatment of the password file, it should be owned by the system account that you use for running Instance Manager to manage server instances, and you should invoke it from that account when you use it to manage accounts in the password file\&. -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Create a new user: -.sp -.if n \{\ -.RS 4 -.\} -.nf -mysqlmanager \-\-add\-user \-\-username=\fIuser_name\fR [\-\-password=\fIpassword\fR] -.fi -.if n \{\ -.RE -.\} -.sp -This command adds a new entry with the given user name and password to the password file\&. The -\fB\-\-username\fR -(or -\fB\-u\fR) option is required\&. -\fBmysqlmanager\fR -prompts for the password if it is not given on the command line with the -\fB\-\-password\fR -(or -\fB\-p\fR) option\&. The command fails if the user already exists\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Drop an existing user: -.sp -.if n \{\ -.RS 4 -.\} -.nf -mysqlmanager \-\-drop\-user \-\-username=\fIuser_name\fR -.fi -.if n \{\ -.RE -.\} -.sp -This command removes the entry with the given user name from the password file\&. The user name is required\&. The command fails if the user does not exist\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Change the password for an existing user: -.sp -.if n \{\ -.RS 4 -.\} -.nf -mysqlmanager \-\-edit\-user \-\-username=\fIuser_name\fR [\-\-password=\fIpassword\fR] -.fi -.if n \{\ -.RE -.\} -.sp -This command changes the given user\'s password in the password file\&. The user name is required\&. -\fBmysqlmanager\fR -prompts for the password it is not given on the command line\&. The command fails if the user does not exist\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -List existing users: -.sp -.if n \{\ -.RS 4 -.\} -.nf -mysqlmanager \-\-list\-users -.fi -.if n \{\ -.RE -.\} -.sp -This command lists the user names of the accounts in the password file\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Check the password file: -.sp -.if n \{\ -.RS 4 -.\} -.nf -mysqlmanager \-\-check\-password\-file -.fi -.if n \{\ -.RE -.\} -.sp -This command performs a consistency and validity check of the password file\&. The command fails if there is something wrong with the file\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Empty the password file: -.sp -.if n \{\ -.RS 4 -.\} -.nf -mysqlmanager \-\-clean\-password\-file -.fi -.if n \{\ -.RE -.\} -.sp -This command empties the password file, which has the effect of dropping all users listed in it\&. The option creates the password file if it does not exist, so it can be used to initialize a new password file to be used for other account\-management operations\&. Take care not to use this option to reinitialize a file containing accounts that you do not want to drop\&. -.RE -.SH "MYSQL SERVER INSTANCE STATUS MONITORING" -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBImportant\fR -.ps -1 -.br -.PP -MySQL Instance Manager has been deprecated and is removed in MySQL 5\&.4\&. -.sp .5v -.RE -.PP -To monitor the status of each guarded server instance, the MySQL Instance Manager attempts to connect to the instance at regular intervals using the -MySQL_Instance_Manager@localhost -user account with a password of -check_connection\&. -.PP -You are -\fInot\fR -required to create this account for MySQL Server; in fact, it is expected that it will not exist\&. Instance Manager can tell that a server is operational if the server accepts the connection attempt but refuses access for the account by returning a login error\&. However, these failed connection attempts are logged by the server to its general query log (see -Section\ \&5.2.3, \(lqThe General Query Log\(rq)\&. -.PP -Instance Manager also attempts a connection to nonguarded server instances when you use the -SHOW INSTANCES -or -SHOW INSTANCE STATUS -command\&. This is the only status monitoring done for nonguarded instances\&. -.PP -Instance Manager knows if a server instance fails at startup because it receives a status from the attempt\&. For an instance that starts but later crashes, Instance Manager receives a signal because it is the parent process of the instance\&. -.PP -Beginning with MySQL 5\&.1\&.12, Instance Manager tracks instance states so that it can determine which commands are allowed for each instance\&. For example, commands that modify an instance\'s configuration are allowed only while the instance is offline\&. -.PP -Each instance is in one of the states described in the following table\&. Guarded instances can be in any of the states\&. Nonguarded instances can only be offline or online\&. Instance state information is displayed in the -status -column of the -SHOW INSTANCES -and -SHOW INSTANCE STATUS -commands\&. -.TS -allbox tab(:); -l l -l l -l l -l l -l l -l l -l l -l l. -T{ -\fBState\fR -T}:T{ -\fBMeaning\fR -T} -T{ -offline -T}:T{ -The instance has not been started and is not running\&. -T} -T{ -starting -T}:T{ -The instance is starting (initializing)\&. Nonguarded instances cannot be - in this state\&. A nonguarded instance goes directly from - offline to online\&. -T} -T{ -stopping -T}:T{ -The instance is stopping\&. Nonguarded instances cannot be in this state\&. - A nonguarded instance goes directly from online to - offline, or stays offline if startup fails\&. -T} -T{ -online -T}:T{ -The instance has started and is running\&. -T} -T{ -failed -T}:T{ -The instance was online but it crashed and is being restarted by - Instance Manager, or else the instance failed to start - at all and Instance Manager is again attempting to start - it\&. Nonguarded instances cannot be in this state\&. -T} -T{ -crashed -T}:T{ -Instance Manager failed to start the instance after several attempts\&. - (Instance Manager will try again later\&.) Nonguarded - instances cannot be in this state\&. -T} -T{ -abandoned -T}:T{ -Instance Manager was not able to start the instance, has given up, and - will make no further attempts until instructed - otherwise\&. To tell Instance Manager to try again, you - must first use STOP INSTANCE to put - the instance in offline state, and then use - START INSTANCE to start the instance\&. - If it is necessary to make configuration changes for the - instance, you must do so after putting the instance - offline and before starting it\&. (Instance Manager - accepts configuration\-changing commands only for offline - instances\&.) Nonguarded instances cannot be in this - state\&. -T} -.TE -.sp 1 -.SH "CONNECTING TO MYSQL INSTANCE MANAGER" -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBImportant\fR -.ps -1 -.br -.PP -MySQL Instance Manager has been deprecated and is removed in MySQL 5\&.4\&. -.sp .5v -.RE -.PP -After you set up a password file for the MySQL Instance Manager and Instance Manager is running, you can connect to it\&. The MySQL client\-server protocol is used to communicate with the Instance Manager\&. For example, you can connect to it using the standard -\fBmysql\fR -client program: -.sp -.if n \{\ -.RS 4 -.\} -.nf -shell> \fBmysql \-\-port=2273 \-\-host=im\&.example\&.org \-\-user=mysql \-\-password\fR -.fi -.if n \{\ -.RE -.\} -.PP -Instance Manager supports the version of the MySQL client\-server protocol used by the client tools and libraries distributed with MySQL 4\&.1 or later, so other programs that use the MySQL C API also can connect to it\&. -.SH "MYSQL INSTANCE MANAGER COMMANDS" -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBImportant\fR -.ps -1 -.br -.PP -MySQL Instance Manager has been deprecated and is removed in MySQL 5\&.4\&. -.sp .5v -.RE -.PP -After you connect to MySQL Instance Manager, you can issue commands\&. The following general principles apply to Instance Manager command execution: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Commands that take an instance name fail if the name is not a valid instance name\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Commands that take an instance name (other than -CREATE INSTANCE) fail if the instance does not exist\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -As of MySQL 5\&.1\&.12, commands for an instance require that the instance be in an appropriate state\&. You cannot configure or start an instance that is not offline\&. You cannot start an instance that is online\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Instance Manager maintains information about instance configuration in an internal (in\-memory) cache\&. Initially, this information comes from the configuration file if it exists, but some commands change the configuration of an instance\&. Commands that modify the configuration file fail if the file does not exist or is not accessible to Instance Manager\&. -.sp -As of MySQL 5\&.1\&.12, configuration\-changing commands modify both the in\-memory cache and the server instance section recorded in the configuration file to maintain consistency between them\&. For this to occur, the instance must be offline and the configuration file must be accessible and not malformed\&. If the configuration file cannot be updated, the command fails and the cache remains unchanged\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -On Windows, the standard file is -my\&.ini -in the directory where Instance Manager is installed\&. On Unix, the standard configuration file is -/etc/my\&.cnf\&. To specify a different configuration file, start Instance Manager with the -\fB\-\-defaults\-file\fR -option\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -If a -[mysqld] -instance section exists in the configuration file, it must not contain any Instance Manager\-specific options (see -the section called \(lqMYSQL INSTANCE MANAGER CONFIGURATION FILES\(rq)\&. Therefore, you must not add any of these options if you change the configuration for an instance named -mysqld\&. -.RE -.PP -The following list describes the commands that Instance Manager accepts, with examples\&. -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -CREATE INSTANCE \fIinstance_name\fR [\fIoption_name\fR[=\fIoption_value\fR], \&.\&.\&.] -.sp -This command configures a new instance by creating an -[\fIinstance_name\fR] -section in the configuration file\&. The command fails if -\fIinstance_name\fR -is not a valid instance name or the instance already exists\&. -.sp -The created section instance is empty if no options are given\&. Otherwise, the options are added to the section\&. Options should be given in the same format used when you write options in option files\&. (See -Section\ \&4.2.3.3, \(lqUsing Option Files\(rq -for a description of the allowable syntax\&.) If you specify multiple options, separate them by commas\&. -.sp -For example, to create an instance section named -[mysqld98], you might write something like this were you to modify the configuration file directly: -.sp -.if n \{\ -.RS 4 -.\} -.nf -[mysqld98] -basedir=/var/mysql98 -.fi -.if n \{\ -.RE -.\} -.sp -To achieve the same effect via -CREATE INSTANCE, issue this command to Instance Manager: -.sp -.if n \{\ -.RS 4 -.\} -.nf -mysql> \fBCREATE INSTANCE mysqld98 basedir="/var/mysql98";\fR -Query OK, 0 rows affected (0,00 sec) -.fi -.if n \{\ -.RE -.\} -.sp -CREATE INSTANCE -creates the instance but does not start it\&. -.sp -If the instance name is the (deprecated) name -mysqld, the option list cannot include any options that are specific to Instance Manager, such as -nonguarded -(see -the section called \(lqMYSQL INSTANCE MANAGER CONFIGURATION FILES\(rq)\&. -.sp -This command was added in MySQL 5\&.1\&.12\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -DROP INSTANCE \fIinstance_name\fR -.sp -This command removes the configuration for -\fIinstance_name\fR -from the configuration file\&. -.sp -.if n \{\ -.RS 4 -.\} -.nf -mysql> \fBDROP INSTANCE mysqld98;\fR -Query OK, 0 rows affected (0,00 sec) -.fi -.if n \{\ -.RE -.\} -.sp -The command fails if -\fIinstance_name\fR -is not a valid instance name, the instance does not exist, or is not offline\&. -.sp -This command was added in MySQL 5\&.1\&.12\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -START INSTANCE \fIinstance_name\fR -.sp -This command attempts to start an offline instance\&. The command is asynchronous; it does not wait for the instance to start\&. -.sp -.if n \{\ -.RS 4 -.\} -.nf -mysql> \fBSTART INSTANCE mysqld4;\fR -Query OK, 0 rows affected (0,00 sec) -.fi -.if n \{\ -.RE -.\} -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -STOP INSTANCE \fIinstance_name\fR -.sp -This command attempts to stop an instance\&. The command is synchronous; it waits for the instance to stop\&. -.sp -.if n \{\ -.RS 4 -.\} -.nf -mysql> \fBSTOP INSTANCE mysqld4;\fR -Query OK, 0 rows affected (0,00 sec) -.fi -.if n \{\ -.RE -.\} -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -SHOW INSTANCES -.sp -Shows the names and status of all loaded instances\&. -.sp -.if n \{\ -.RS 4 -.\} -.nf -mysql> \fBSHOW INSTANCES;\fR -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+ -| instance_name | status | -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+ -| mysqld3 | offline | -| mysqld4 | online | -| mysqld2 | offline | -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+ -.fi -.if n \{\ -.RE -.\} -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -SHOW INSTANCE STATUS \fIinstance_name\fR -.sp -Shows status and version information for an instance\&. -.sp -.if n \{\ -.RS 4 -.\} -.nf -mysql> \fBSHOW INSTANCE STATUS mysqld3;\fR -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+ -| instance_name | status | version | -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+ -| mysqld3 | online | unknown | -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+ -.fi -.if n \{\ -.RE -.\} -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -SHOW INSTANCE OPTIONS \fIinstance_name\fR -.sp -Shows the options used by an instance\&. -.sp -.if n \{\ -.RS 4 -.\} -.nf -mysql> \fBSHOW INSTANCE OPTIONS mysqld3;\fR -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ -| option_name | value | -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ -| instance_name | mysqld3 | -| mysqld\-path | /home/cps/mysql/trees/mysql\-4\&.1/sql/mysqld | -| port | 3309 | -| socket | /tmp/mysql\&.sock3 | -| pid\-file | hostname\&.pid3 | -| datadir | /home/cps/mysql_data/data_dir1/ | -| language | /home/cps/mysql/trees/mysql\-4\&.1/sql/share/english | -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ -.fi -.if n \{\ -.RE -.\} -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -SHOW \fIinstance_name\fR LOG FILES -.sp -The command lists all log files used by the instance\&. The result set contains the path to the log file and the log file size\&. If no log file path is specified in the instance section of the configuration file (for example, -log=/var/mysql\&.log), the Instance Manager tries to guess its placement\&. If Instance Manager is unable to guess the log file placement you should specify the log file location explicitly by using a log option in the appropriate instance section of the configuration file\&. -.sp -.if n \{\ -.RS 4 -.\} -.nf -mysql> \fBSHOW mysqld LOG FILES;\fR -+\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+ -| Logfile | Path | Filesize | -+\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+ -| ERROR LOG | /home/cps/var/mysql/owlet\&.err | 9186 | -| GENERAL LOG | /home/cps/var/mysql/owlet\&.log | 471503 | -| SLOW LOG | /home/cps/var/mysql/owlet\-slow\&.log | 4463 | -+\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+ -.fi -.if n \{\ -.RE -.\} -.sp -SHOW \&.\&.\&. LOG FILES -displays information only about log files\&. If a server instance uses log tables (see -Section\ \&5.2.1, \(lqSelecting General Query and Slow Query Log Output Destinations\(rq), no information about those tables is shown\&. -.sp -Log options are described in -Section\ \&5.1.2, \(lqServer Command Options\(rq\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -SHOW \fIinstance_name\fR LOG {ERROR | SLOW | GENERAL} \fIsize\fR[,\fIoffset_from_end\fR] -.sp -This command retrieves a portion of the specified log file\&. Because most users are interested in the latest log messages, the -\fIsize\fR -parameter defines the number of bytes to retrieve from the end of the log\&. To retrieve data from the middle of the log file, specify the optional -\fIoffset_from_end\fR -parameter\&. The following example retrieves 21 bytes of data, starting 23 bytes before the end of the log file and ending 2 bytes before the end: -.sp -.if n \{\ -.RS 4 -.\} -.nf -mysql> \fBSHOW mysqld LOG GENERAL 21, 2;\fR -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ -| Log | -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ -| using password: YES | -+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ -.fi -.if n \{\ -.RE -.\} -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -SET \fIinstance_name\fR\&.\fIoption_name\fR[=\fIoption_value\fR] -.sp -This command edits the specified instance\'s configuration section to change or add instance options\&. The option is added to the section is it is not already present\&. Otherwise, the new setting replaces the existing one\&. -.sp -.if n \{\ -.RS 4 -.\} -.nf -mysql> \fBSET mysqld2\&.port=3322;\fR -Query OK, 0 rows affected (0\&.00 sec) -.fi -.if n \{\ -.RE -.\} -.sp -As of MySQL 5\&.1\&.12, you can specify multiple options (separated by commas), and -SET -can be used only for offline instances\&. Each option must indicate the instance name: -.sp -.if n \{\ -.RS 4 -.\} -.nf -mysql> \fBSET mysqld2\&.port=3322, mysqld3\&.nonguarded;\fR -Query OK, 0 rows affected (0\&.00 sec) -.fi -.if n \{\ -.RE -.\} -.sp -Before MySQL 5\&.1\&.12, only a single option can be specified\&. Also, changes made to the configuration file do not take effect until the MySQL server is restarted\&. In addition, these changes are not stored in the instance manager\'s local cache of instance settings until a -FLUSH INSTANCES -command is executed\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -UNSET \fIinstance_name\fR\&.\fIoption_name\fR -.sp -This command removes an option from an instance\'s configuration section\&. -.sp -.if n \{\ -.RS 4 -.\} -.nf -mysql> \fBUNSET mysqld2\&.port;\fR -Query OK, 0 rows affected (0\&.00 sec) -.fi -.if n \{\ -.RE -.\} -.sp -As of MySQL 5\&.1\&.12, you can specify multiple options (separated by commas), and -UNSET -can be used only for offline instances\&. Each option must indicate the instance name: -.sp -.if n \{\ -.RS 4 -.\} -.nf -mysql> \fBUNSET mysqld2\&.port, mysqld4\&.nonguarded;\fR -Query OK, 0 rows affected (0\&.00 sec) -.fi -.if n \{\ -.RE -.\} -.sp -Before MySQL 5\&.1\&.12, only a single option can be specified\&. Also, changes made to the configuration file do not take effect until the MySQL server is restarted\&. In addition, these changes are not stored in the instance manager\'s local cache of instance settings until a -FLUSH INSTANCES -command is executed\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -FLUSH INSTANCES -.sp -As of MySQL 5\&.1\&.12, -FLUSH INSTANCES -cannot be used unless all instances are offline\&. The command causes Instance Manager to reread the configuration file, update its in\-memory configuration cache, and start any guarded instances\&. -.sp -Before MySQL 5\&.1\&.12, this command forces Instance Manager reread the configuration file and to refresh internal structures\&. This command should be performed after editing the configuration file\&. The command does not restart instances\&. -.sp -.if n \{\ -.RS 4 -.\} -.nf -mysql> \fBFLUSH INSTANCES;\fR -Query OK, 0 rows affected (0\&.04 sec) -.fi -.if n \{\ -.RE -.\} -.RE -.SH "COPYRIGHT" -.br -.PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc. -.PP -This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. -.PP -This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -.PP -You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/. -.sp -.SH "SEE ALSO" -For more information, please refer to the MySQL Reference Manual, -which may already be installed locally and which is also available -online at http://dev.mysql.com/doc/. -.SH AUTHOR -Sun Microsystems, Inc. (http://www.mysql.com/). diff --git a/scripts/mysql_install_db.pl.in b/scripts/mysql_install_db.pl.in index 433a412b115..03b79312156 100644 --- a/scripts/mysql_install_db.pl.in +++ b/scripts/mysql_install_db.pl.in @@ -560,7 +560,7 @@ else "database and look at the grant tables:", "", "shell> $bindir/mysql -u root mysql", - "mysql> show tables", + "mysql> show tables;", "", "Try 'mysqld --help' if you have problems with paths. Using --log", "gives you a log in $opt->{ldata} that may be helpful.", diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 6237a6fbedc..fcf264262fd 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -446,7 +446,7 @@ else echo "to connect to the mysql database and look at the grant tables:" echo echo " shell> $bindir/mysql -u root mysql" - echo " mysql> show tables" + echo " mysql> show tables;" echo echo "Try 'mysqld --help' if you have problems with paths. Using" echo "--general-log gives you a log in $ldata that may be helpful." diff --git a/storage/maria/maria_chk.c b/storage/maria/maria_chk.c index 57c958b4b6d..cfc8a604118 100644 --- a/storage/maria/maria_chk.c +++ b/storage/maria/maria_chk.c @@ -428,7 +428,7 @@ static struct my_option my_long_options[] = static void print_version(void) { - printf("%s Ver 1.2 for %s at %s\n", my_progname, SYSTEM_TYPE, + printf("%s Ver 1.2 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE); } From 69bb48b89ba076ce657118522a19b2eff3b431d8 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 31 May 2014 10:16:25 +0200 Subject: [PATCH 40/52] disable unstable tokudb tests --- .../mysql-test/tokudb/t/i_s_tokudb_lock_waits_released.test | 4 ++-- .../mysql-test/tokudb/t/i_s_tokudb_lock_waits_timeout.test | 4 ---- .../tokudb/mysql-test/tokudb/t/i_s_tokudb_locks_released.test | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) 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 658becb0b12..6b4e5d88673 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,7 +1,7 @@ # verify that information_schema.tokudb_locks gets populated with locks, information_schema.tokudb_lock_waits gets -if (`select @@tokudb_version <= "7.1.0"`) +if (`select @@tokudb_version <= "7.1.6"`) { - --skip Not fixed in TokuDB 7.1.0 or earlier + --skip Race condition in the test in TokuDB 7.1.6 or earlier } # populated with 1 lock_wait and all transactions are present in information_schema.tokudb_trx for 2 clients 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 f3ace4aa63f..ea7eb9a2c89 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,7 +1,3 @@ -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 cc393367148..3a1cf2023da 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,6 +1,6 @@ -if (`select @@tokudb_version <= "7.1.0"`) +if (`select @@tokudb_version <= "7.1.6"`) { - --skip Not fixed in TokuDB 7.1.0 or earlier + --skip Race condition in the test in TokuDB 7.1.6 or earlier } # verify that information_schema.tokudb_locks gets populated with locks for 2 clients From 44ce364ac2b84b1c1e56515cdb1a8613a52cec72 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 31 May 2014 13:18:56 +0200 Subject: [PATCH 41/52] MDEV-5645 MariaDB-5.5.35 - references are made to an "EXCEPTIONS-CLIENT" file but it does not exist Added the EXCEPTIONS-CLIENT (that was lost in the merge), as the ascii version of http://www.mysql.com/about/legal/licensing/foss-exception/ --- CMakeLists.txt | 2 +- EXCEPTIONS-CLIENT | 136 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 EXCEPTIONS-CLIENT diff --git a/CMakeLists.txt b/CMakeLists.txt index 48e5f2f72e4..54a93ed3791 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -465,7 +465,7 @@ ADD_CUSTOM_TARGET(INFO_BIN ALL WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) -INSTALL_DOCUMENTATION(README COPYING COPYING.LESSER +INSTALL_DOCUMENTATION(README COPYING COPYING.LESSER EXCEPTIONS-CLIENT COMPONENT Readme) INSTALL_DOCUMENTATION(${CMAKE_BINARY_DIR}/Docs/INFO_SRC ${CMAKE_BINARY_DIR}/Docs/INFO_BIN) diff --git a/EXCEPTIONS-CLIENT b/EXCEPTIONS-CLIENT new file mode 100644 index 00000000000..11ba42c422f --- /dev/null +++ b/EXCEPTIONS-CLIENT @@ -0,0 +1,136 @@ + FOSS License Exception + + http://www.mysql.com/about/legal/licensing/foss-exception/ + Updated February 23, 2012 + +What is the FOSS License Exception? + + Oracle's Free and Open Source Software ("FOSS") License Exception + (formerly known as the FLOSS License Exception) allows developers of FOSS + applications to include Oracle's MySQL Client Libraries (also referred to + as "MySQL Drivers" or "MySQL Connectors") with their FOSS applications. + MySQL Client Libraries are typically licensed pursuant to version 2 of the + General Public License ("GPL"), but this exception permits distribution of + certain MySQL Client Libraries with a developer's FOSS applications + licensed under the terms of another FOSS license listed below, even though + such other FOSS license may be incompatible with the GPL. + + The following terms and conditions describe the circumstances under which + Oracle's FOSS License Exception applies. + +Oracle's FOSS License Exception Terms and Conditions + + 1. Definitions. "Derivative Work" means a derivative work, as defined + under applicable copyright law, formed entirely from the Program and + one or more FOSS Applications. + + "FOSS Application" means a free and open source software application + distributed subject to a license listed in the section below titled + "FOSS License List." + + "FOSS Notice" means a notice placed by Oracle or MySQL in a copy of + the MySQL Client Libraries stating that such copy of the MySQL Client + Libraries may be distributed under Oracle's or MySQL's FOSS (or FLOSS) + License Exception. + + "Independent Work" means portions of the Derivative Work that are not + derived from the Program and can reasonably be considered independent + and separate works. + + "Program" means a copy of Oracle's MySQL Client Libraries that + contains a FOSS Notice. + + 2. A FOSS application developer ("you" or "your") may distribute a + Derivative Work provided that you and the Derivative Work meet all of + the following conditions: + + a. You obey the GPL in all respects for the Program and all portions + (including modifications) of the Program included in the + Derivative Work (provided that this condition does not apply to + Independent Works); + b. The Derivative Work does not include any work licensed under the + GPL other than the Program; + c. You distribute Independent Works subject to a license listed in + the section below titled "FOSS License List"; + d. You distribute Independent Works in object code or executable + form with the complete corresponding machine-readable source code + on the same medium and under the same FOSS license applying to + the object code or executable forms; + e. All works that are aggregated with the Program or the Derivative + Work on a medium or volume of storage are not derivative works of + the Program, Derivative Work or FOSS Application, and must + reasonably be considered independent and separate works. + + 3. Oracle reserves all rights not expressly granted in these terms and + conditions. If all of the above conditions are not met, then this FOSS + License Exception does not apply to you or your Derivative Work. + +FOSS License List + ++------------------------------------------------------------------------+ +|License Name |Version(s)/Copyright Date| +|----------------------------------------------+-------------------------| +|Academic Free License |2.0 | +|----------------------------------------------+-------------------------| +|Apache Software License |1.0/1.1/2.0 | +|----------------------------------------------+-------------------------| +|Apple Public Source License |2.0 | +|----------------------------------------------+-------------------------| +|Artistic license |From Perl 5.8.0 | +|----------------------------------------------+-------------------------| +|BSD license |"July 22 1999" | +|----------------------------------------------+-------------------------| +|Common Development and Distribution License |1.0 | +|(CDDL) | | +|----------------------------------------------+-------------------------| +|Common Public License |1.0 | +|----------------------------------------------+-------------------------| +|Eclipse Public License |1.0 | +|----------------------------------------------+-------------------------| +|European Union Public License (EUPL)¹ |1.1 | +|----------------------------------------------+-------------------------| +|GNU Affero General Public License (AGPL) |3.0 | +|----------------------------------------------+-------------------------| +|GNU Library or "Lesser" General Public License|2.0/2.1/3.0 | +|(LGPL) | | +|----------------------------------------------+-------------------------| +|GNU General Public License (GPL) |3.0 | +|----------------------------------------------+-------------------------| +|IBM Public License |1.0 | +|----------------------------------------------+-------------------------| +|Jabber Open Source License |1.0 | +|----------------------------------------------+-------------------------| +|MIT License (As listed in file |- | +|MIT-License.txt) | | +|----------------------------------------------+-------------------------| +|Mozilla Public License (MPL) |1.0/1.1 | +|----------------------------------------------+-------------------------| +|Open Software License |2.0 | +|----------------------------------------------+-------------------------| +|OpenSSL license (with original SSLeay license)|"2003" ("1998") | +|----------------------------------------------+-------------------------| +|PHP License |3.0/3.01 | +|----------------------------------------------+-------------------------| +|Python license (CNRI Python License) |- | +|----------------------------------------------+-------------------------| +|Python Software Foundation License |2.1.1 | +|----------------------------------------------+-------------------------| +|Sleepycat License |"1999" | +|----------------------------------------------+-------------------------| +|University of Illinois/NCSA Open Source |- | +|License | | +|----------------------------------------------+-------------------------| +|W3C License |"2001" | +|----------------------------------------------+-------------------------| +|X11 License |"2001" | +|----------------------------------------------+-------------------------| +|Zlib/libpng License |- | +|----------------------------------------------+-------------------------| +|Zope Public License |2.0 | ++------------------------------------------------------------------------+ + +¹) When an Independent Work is licensed under a "Compatible License" +pursuant to the EUPL, the Compatible License rather than the EUPL is the +applicable license for purposes of these FOSS License Exception Terms and +Conditions. + From 759fa19690bb1bc76a0f0387b1847d975c07acff Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 1 Jun 2014 11:23:20 +0200 Subject: [PATCH 42/52] don't install ndb related .ini files, remove mysql_fix_privilege_tables.1 and mysqlman.1 --- debian/mariadb-client-5.5.files | 1 - man/CMakeLists.txt | 4 +- man/mysql_fix_privilege_tables.1 | 175 ------------------------------- man/mysqlman.1 | 15 --- support-files/CMakeLists.txt | 3 +- 5 files changed, 3 insertions(+), 195 deletions(-) delete mode 100644 man/mysql_fix_privilege_tables.1 delete mode 100644 man/mysqlman.1 diff --git a/debian/mariadb-client-5.5.files b/debian/mariadb-client-5.5.files index f15a47157a2..5bd737f5267 100644 --- a/debian/mariadb-client-5.5.files +++ b/debian/mariadb-client-5.5.files @@ -22,7 +22,6 @@ usr/share/man/man1/mysqldumpslow.1 usr/share/man/man1/mysql_find_rows.1 usr/share/man/man1/mysql_fix_extensions.1 usr/share/man/man1/mysqlimport.1 -usr/share/man/man1/mysqlman.1 usr/share/man/man1/mysqlreport.1 usr/share/man/man1/mysqlshow.1 usr/share/man/man1/mysqlslap.1 diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt index a20aa7b91b5..f2842959c3f 100644 --- a/man/CMakeLists.txt +++ b/man/CMakeLists.txt @@ -16,11 +16,11 @@ SET(MAN1_SERVER innochecksum.1 my_print_defaults.1 myisam_ftdump.1 myisamchk.1 myisamlog.1 myisampack.1 mysql.server.1 mysql_convert_table_format.1 mysql_fix_extensions.1 - mysql_fix_privilege_tables.1 mysql_install_db.1 + mysql_install_db.1 mysql_secure_installation.1 mysql_setpermission.1 mysql_tzinfo_to_sql.1 mysql_upgrade.1 mysql_zap.1 mysqld_multi.1 mysqld_safe.1 mysqldumpslow.1 mysqlhotcopy.1 - mysqlman.1 mysqltest.1 perror.1 replace.1 resolve_stack_dump.1 + mysqltest.1 perror.1 replace.1 resolve_stack_dump.1 resolveip.1 mysqlbug.1) SET(MAN8_SERVER mysqld.8) SET(MAN1_CLIENT msql2mysql.1 mysql.1 mysql_find_rows.1 mysql_waitpid.1 diff --git a/man/mysql_fix_privilege_tables.1 b/man/mysql_fix_privilege_tables.1 deleted file mode 100644 index 99b126047fb..00000000000 --- a/man/mysql_fix_privilege_tables.1 +++ /dev/null @@ -1,175 +0,0 @@ -'\" t -.\" Title: \fBmysql_fix_privilege_tables\fR -.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] -.\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/06/2010 -.\" Manual: MySQL Database System -.\" Source: MySQL 5.1 -.\" Language: English -.\" -.TH "\FBMYSQL_FIX_PRIVILE" "1" "04/06/2010" "MySQL 5\&.1" "MySQL Database System" -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.\" mysql_fix_privilege_tables -.\" upgrading: grant tables -.\" grant tables: upgrading -.SH "NAME" -mysql_fix_privilege_tables \- upgrade MySQL system tables -.SH "SYNOPSIS" -.HP \w'\fBmysql_fix_privilege_tables\ \-\-password=\fR\fB\fIroot_password\fR\fR\ 'u -\fBmysql_fix_privilege_tables \-\-password=\fR\fB\fIroot_password\fR\fR -.SH "DESCRIPTION" -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.PP -In MySQL 5\&.1\&.7, -\fBmysql_fix_privilege_tables\fR -was superseded by -\fBmysql_upgrade\fR, which should be used instead\&. See -\fBmysql_upgrade\fR(1)\&. -.sp .5v -.RE -.PP -Some releases of MySQL introduce changes to the structure of the system tables in the -mysql -database to add new privileges or support new features\&. When you update to a new version of MySQL, you should update your system tables as well to make sure that their structure is up to date\&. Otherwise, there might be capabilities that you cannot take advantage of\&. -.PP -\fBmysql_fix_privilege_tables\fR -is an older script that previously was used to uprade the system tables in the -mysql -database after a MySQL upgrade\&. -.PP -Before running -\fBmysql_fix_privilege_tables\fR, make a backup of your -mysql -database\&. -.PP -On Unix or Unix\-like systems, update the system tables by running the -\fBmysql_fix_privilege_tables\fR -script: -.sp -.if n \{\ -.RS 4 -.\} -.nf -shell> \fBmysql_fix_privilege_tables\fR -.fi -.if n \{\ -.RE -.\} -.PP -You must run this script while the server is running\&. It attempts to connect to the server running on the local host as -root\&. If your -root -account requires a password, indicate the password on the command line like this: -.sp -.if n \{\ -.RS 4 -.\} -.nf -shell> \fBmysql_fix_privilege_tables \-\-password=\fR\fB\fIroot_password\fR\fR -.fi -.if n \{\ -.RE -.\} -.PP -The -\fBmysql_fix_privilege_tables\fR -script performs any actions necessary to convert your system tables to the current format\&. You might see some -Duplicate column name -warnings as it runs; you can ignore them\&. -.PP -After running the script, stop the server and restart it so that any changes made to the system tables take effect\&. -.PP -On Windows systems, MySQL distributions include a -mysql_fix_privilege_tables\&.sql -SQL script that you can run using the -\fBmysql\fR -client\&. For example, if your MySQL installation is located at -C:\eProgram Files\eMySQL\eMySQL Server 5\&.1, the commands look like this: -.sp -.if n \{\ -.RS 4 -.\} -.nf -C:\e> \fBcd "C:\eProgram Files\eMySQL\eMySQL Server 5\&.1"\fR -C:\e> \fBbin\emysql \-u root \-p mysql\fR -mysql> \fBSOURCE share/mysql_fix_privilege_tables\&.sql\fR -.fi -.if n \{\ -.RE -.\} -.sp -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.PP -Prior to version 5\&.1\&.17, the -mysql_fix_privilege_tables\&.sql -script is found in the -scripts -directory\&. -.sp .5v -.RE -.PP -The -\fBmysql\fR -command will prompt you for the -root -password; enter it when prompted\&. -.PP -If your installation is located in some other directory, adjust the path names appropriately\&. -.PP -As with the Unix procedure, you might see some -Duplicate column name -warnings as -\fBmysql\fR -processes the statements in the -mysql_fix_privilege_tables\&.sql -script; you can ignore them\&. -.PP -After running the script, stop the server and restart it\&. -.SH "COPYRIGHT" -.br -.PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc. -.PP -This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. -.PP -This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -.PP -You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/. -.sp -.SH "SEE ALSO" -For more information, please refer to the MySQL Reference Manual, -which may already be installed locally and which is also available -online at http://dev.mysql.com/doc/. -.SH AUTHOR -Sun Microsystems, Inc. (http://www.mysql.com/). diff --git a/man/mysqlman.1 b/man/mysqlman.1 deleted file mode 100644 index 2170942ebd9..00000000000 --- a/man/mysqlman.1 +++ /dev/null @@ -1,15 +0,0 @@ -.TH mysqlman 1 "20 July 2004" "MySQL" "MySQL database" -.SH NAME -mysqlman \- default man page for mysql -.SH "DESCRIPTION" -Certain executables distributed with the MySQL database management system do -not have specific man pages. -.SH "SEE ALSO" -In most cases, you can run the executable from the command line with a "--help" -argument to display a brief summary of the executable's arguments and function. -For more information about MySQL, please refer to the MySQL reference manual, -which may already be installed locally and which is also available online at -http://dev.mysql.com/doc/mysql/en -.SH BUGS -Please refer to http://bugs.mysql.com/ to report bugs. -.\" end of man page diff --git a/support-files/CMakeLists.txt b/support-files/CMakeLists.txt index ed29fa96a78..98e1560f5fb 100644 --- a/support-files/CMakeLists.txt +++ b/support-files/CMakeLists.txt @@ -50,8 +50,7 @@ ENDFOREACH() IF(UNIX) SET(prefix ${CMAKE_INSTALL_PREFIX}) - FOREACH(script mysqld_multi.server mysql-log-rotate binary-configure - config.medium.ini config.small.ini config.huge.ini ndb-config-2-node.ini) + FOREACH(script mysqld_multi.server mysql-log-rotate binary-configure) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${script}.sh ${CMAKE_CURRENT_BINARY_DIR}/${script} @ONLY ) From 0fbe91b45bd2181e4c39b7550081b468ba179457 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 2 Jun 2014 15:36:06 +0300 Subject: [PATCH 43/52] MDEV-6251: SIGSEGV in query optimizer (in set_check_materialized with MERGE view) mysql_derived_merge() made correctly working with views. --- mysql-test/r/view.result | 220 ++++++++++++++++++++++++++++++++++++- mysql-test/t/view.test | 229 ++++++++++++++++++++++++++++++++++++++- sql/sql_derived.cc | 17 ++- sql/table.cc | 5 + sql/table.h | 2 +- 5 files changed, 462 insertions(+), 11 deletions(-) diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 5d90ce08e50..6c9ca76b489 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -1,5 +1,5 @@ -drop table if exists t1,t2,t3,t4,t9,`t1a``b`,v1,v2,v3,v4,v5,v6; -drop view if exists t1,t2,`t1a``b`,v1,v2,v3,v4,v5,v6; +drop table if exists t1,t2,t3,t4,t5,t6,t9,`t1a``b`,v1,v2,v3,v4,v5,v6; +drop view if exists t1,t2,t3,t4,t5,t6,t9,`t1a``b`,v1,v2,v3,v4,v5,v6; drop database if exists mysqltest; use test; SET @save_optimizer_switch=@@optimizer_switch; @@ -3983,6 +3983,114 @@ a 20 DROP VIEW v1,v2,v3; DROP TABLE t1,t2; +# +# MDEV-6251: SIGSEGV in query optimizer (in set_check_materialized +# with MERGE view) +# +CREATE TABLE t1 (a1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t2 (b1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t3 (c1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t4 (d1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t5 (e1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t6 (f1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE OR REPLACE view v1 AS +SELECT 1 +FROM t1 a_alias_1 +LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 +LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 +LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 +LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +; +SELECT 1 +FROM (( SELECT 1 +FROM t1 a_alias_1 +LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 +LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 +LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 +LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t1) +LEFT OUTER JOIN (( SELECT 1 +FROM t1 a_alias_1 +LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 +LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 +LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 +LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t2) ON 1=1 +LEFT OUTER JOIN (( SELECT 1 +FROM t1 a_alias_1 +LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 +LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 +LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 +LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t3) ON 1=1 +LEFT OUTER JOIN (( SELECT 1 +FROM t1 a_alias_1 +LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 +LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 +LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 +LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t4) ON 1=1 +LEFT OUTER JOIN (( SELECT 1 +FROM t1 a_alias_1 +LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 +LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 +LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 +LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t5) ON 1=1 +LEFT OUTER JOIN (( SELECT 1 +FROM t1 a_alias_1 +LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 +LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 +LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 +LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t6) ON 1=1 +LEFT OUTER JOIN (( SELECT 1 +FROM t1 a_alias_1 +LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 +LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 +LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 +LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t7) ON 1=1 +LEFT OUTER JOIN (( SELECT 1 +FROM t1 a_alias_1 +LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 +LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 +LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 +LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t8) ON 1=1 +; +1 +SELECT 1 +FROM (v1 t1) +LEFT OUTER JOIN (v1 t2) ON 1=1 +LEFT OUTER JOIN (v1 t3) ON 1=1 +LEFT OUTER JOIN (v1 t4) ON 1=1 +LEFT OUTER JOIN (v1 t5) ON 1=1 +LEFT OUTER JOIN (v1 t6) ON 1=1 +LEFT OUTER JOIN (v1 t7) ON 1=1 +LEFT OUTER JOIN (v1 t8) ON 1=1 +; +1 +drop view v1; +drop table t1,t2,t3,t4,t5,t6; # ----------------------------------------------------------------- # -- End of 5.2 tests. # ----------------------------------------------------------------- @@ -4824,6 +4932,114 @@ execute stmt1; deallocate prepare stmt1; drop view v1,v2; drop table t1,t2; +# +# MDEV-6251: SIGSEGV in query optimizer (in set_check_materialized +# with MERGE view) +# +CREATE TABLE t1 (a1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t2 (b1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t3 (c1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t4 (d1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t5 (e1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t6 (f1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE OR REPLACE view v1 AS +SELECT 1 +FROM t1 a_alias_1 +LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 +LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 +LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 +LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +; +SELECT 1 +FROM (( SELECT 1 +FROM t1 a_alias_1 +LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 +LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 +LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 +LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t1) +LEFT OUTER JOIN (( SELECT 1 +FROM t1 a_alias_1 +LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 +LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 +LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 +LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t2) ON 1=1 +LEFT OUTER JOIN (( SELECT 1 +FROM t1 a_alias_1 +LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 +LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 +LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 +LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t3) ON 1=1 +LEFT OUTER JOIN (( SELECT 1 +FROM t1 a_alias_1 +LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 +LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 +LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 +LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t4) ON 1=1 +LEFT OUTER JOIN (( SELECT 1 +FROM t1 a_alias_1 +LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 +LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 +LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 +LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t5) ON 1=1 +LEFT OUTER JOIN (( SELECT 1 +FROM t1 a_alias_1 +LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 +LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 +LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 +LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t6) ON 1=1 +LEFT OUTER JOIN (( SELECT 1 +FROM t1 a_alias_1 +LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 +LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 +LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 +LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t7) ON 1=1 +LEFT OUTER JOIN (( SELECT 1 +FROM t1 a_alias_1 +LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 +LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 +LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 +LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 +LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t8) ON 1=1 +; +1 +SELECT 1 +FROM (v1 t1) +LEFT OUTER JOIN (v1 t2) ON 1=1 +LEFT OUTER JOIN (v1 t3) ON 1=1 +LEFT OUTER JOIN (v1 t4) ON 1=1 +LEFT OUTER JOIN (v1 t5) ON 1=1 +LEFT OUTER JOIN (v1 t6) ON 1=1 +LEFT OUTER JOIN (v1 t7) ON 1=1 +LEFT OUTER JOIN (v1 t8) ON 1=1 +; +1 +drop view v1; +drop table t1,t2,t3,t4,t5,t6; # ----------------------------------------------------------------- # -- End of 5.3 tests. # ----------------------------------------------------------------- diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index b91e2f4bd24..1c72bac4d0c 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -1,6 +1,6 @@ --disable_warnings -drop table if exists t1,t2,t3,t4,t9,`t1a``b`,v1,v2,v3,v4,v5,v6; -drop view if exists t1,t2,`t1a``b`,v1,v2,v3,v4,v5,v6; +drop table if exists t1,t2,t3,t4,t5,t6,t9,`t1a``b`,v1,v2,v3,v4,v5,v6; +drop view if exists t1,t2,t3,t4,t5,t6,t9,`t1a``b`,v1,v2,v3,v4,v5,v6; drop database if exists mysqltest; --enable_warnings use test; @@ -4030,6 +4030,118 @@ select * from t2; DROP VIEW v1,v2,v3; DROP TABLE t1,t2; +--echo # +--echo # MDEV-6251: SIGSEGV in query optimizer (in set_check_materialized +--echo # with MERGE view) +--echo # + +CREATE TABLE t1 (a1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t2 (b1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t3 (c1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t4 (d1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t5 (e1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t6 (f1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY); + +CREATE OR REPLACE view v1 AS + SELECT 1 + FROM t1 a_alias_1 + LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 + LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 + LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 + LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +; + +SELECT 1 +FROM (( SELECT 1 + FROM t1 a_alias_1 + LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 + LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 + LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 + LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t1) +LEFT OUTER JOIN (( SELECT 1 + FROM t1 a_alias_1 + LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 + LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 + LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 + LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t2) ON 1=1 +LEFT OUTER JOIN (( SELECT 1 + FROM t1 a_alias_1 + LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 + LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 + LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 + LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t3) ON 1=1 +LEFT OUTER JOIN (( SELECT 1 + FROM t1 a_alias_1 + LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 + LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 + LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 + LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t4) ON 1=1 +LEFT OUTER JOIN (( SELECT 1 + FROM t1 a_alias_1 + LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 + LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 + LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 + LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t5) ON 1=1 +LEFT OUTER JOIN (( SELECT 1 + FROM t1 a_alias_1 + LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 + LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 + LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 + LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t6) ON 1=1 +LEFT OUTER JOIN (( SELECT 1 + FROM t1 a_alias_1 + LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 + LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 + LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 + LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t7) ON 1=1 +LEFT OUTER JOIN (( SELECT 1 + FROM t1 a_alias_1 + LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 + LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 + LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 + LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t8) ON 1=1 +; + +SELECT 1 +FROM (v1 t1) +LEFT OUTER JOIN (v1 t2) ON 1=1 +LEFT OUTER JOIN (v1 t3) ON 1=1 +LEFT OUTER JOIN (v1 t4) ON 1=1 +LEFT OUTER JOIN (v1 t5) ON 1=1 +LEFT OUTER JOIN (v1 t6) ON 1=1 +LEFT OUTER JOIN (v1 t7) ON 1=1 +LEFT OUTER JOIN (v1 t8) ON 1=1 +; + +drop view v1; +drop table t1,t2,t3,t4,t5,t6; + --echo # ----------------------------------------------------------------- --echo # -- End of 5.2 tests. --echo # ----------------------------------------------------------------- @@ -4758,6 +4870,119 @@ execute stmt1; deallocate prepare stmt1; drop view v1,v2; drop table t1,t2; + +--echo # +--echo # MDEV-6251: SIGSEGV in query optimizer (in set_check_materialized +--echo # with MERGE view) +--echo # + +CREATE TABLE t1 (a1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t2 (b1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t3 (c1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t4 (d1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t5 (e1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t6 (f1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY); + +CREATE OR REPLACE view v1 AS + SELECT 1 + FROM t1 a_alias_1 + LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 + LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 + LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 + LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +; + +SELECT 1 +FROM (( SELECT 1 + FROM t1 a_alias_1 + LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 + LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 + LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 + LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t1) +LEFT OUTER JOIN (( SELECT 1 + FROM t1 a_alias_1 + LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 + LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 + LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 + LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t2) ON 1=1 +LEFT OUTER JOIN (( SELECT 1 + FROM t1 a_alias_1 + LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 + LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 + LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 + LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t3) ON 1=1 +LEFT OUTER JOIN (( SELECT 1 + FROM t1 a_alias_1 + LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 + LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 + LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 + LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t4) ON 1=1 +LEFT OUTER JOIN (( SELECT 1 + FROM t1 a_alias_1 + LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 + LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 + LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 + LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t5) ON 1=1 +LEFT OUTER JOIN (( SELECT 1 + FROM t1 a_alias_1 + LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 + LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 + LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 + LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t6) ON 1=1 +LEFT OUTER JOIN (( SELECT 1 + FROM t1 a_alias_1 + LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 + LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 + LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 + LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t7) ON 1=1 +LEFT OUTER JOIN (( SELECT 1 + FROM t1 a_alias_1 + LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1 + LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1 + LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1 + LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1 + LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1 +) t8) ON 1=1 +; + +SELECT 1 +FROM (v1 t1) +LEFT OUTER JOIN (v1 t2) ON 1=1 +LEFT OUTER JOIN (v1 t3) ON 1=1 +LEFT OUTER JOIN (v1 t4) ON 1=1 +LEFT OUTER JOIN (v1 t5) ON 1=1 +LEFT OUTER JOIN (v1 t6) ON 1=1 +LEFT OUTER JOIN (v1 t7) ON 1=1 +LEFT OUTER JOIN (v1 t8) ON 1=1 +; + +drop view v1; +drop table t1,t2,t3,t4,t5,t6; + --echo # ----------------------------------------------------------------- --echo # -- End of 5.3 tests. --echo # ----------------------------------------------------------------- diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index 5bc6c64c0b4..8e3d182c7b1 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -391,17 +391,13 @@ bool mysql_derived_merge(THD *thd, LEX *lex, TABLE_LIST *derived) if (parent_lex->get_free_table_map(&map, &tablenr)) { /* There is no enough table bits, fall back to materialization. */ - derived->change_refs_to_fields(); - derived->set_materialized_derived(); - goto exit_merge; + goto unconditional_materialization; } if (dt_select->leaf_tables.elements + tablenr > MAX_TABLES) { /* There is no enough table bits, fall back to materialization. */ - derived->change_refs_to_fields(); - derived->set_materialized_derived(); - goto exit_merge; + goto unconditional_materialization; } if (dt_select->options & OPTION_SCHEMA_TABLE) @@ -472,6 +468,15 @@ exit_merge: if (arena) thd->restore_active_arena(arena, &backup); DBUG_RETURN(res); + +unconditional_materialization: + derived->change_refs_to_fields(); + derived->set_materialized_derived(); + if (!derived->table || !derived->table->created) + res= mysql_derived_create(thd, lex, derived); + if (!res) + res= mysql_derived_fill(thd, lex, derived); + goto exit_merge; } diff --git a/sql/table.cc b/sql/table.cc index 419621634b3..2ebd9624e8f 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -4441,6 +4441,10 @@ void TABLE_LIST::set_check_merged() void TABLE_LIST::set_check_materialized() { + DBUG_ENTER("TABLE_LIST::set_check_materialized"); + SELECT_LEX_UNIT *derived= this->derived; + if (view) + derived= &view->unit; DBUG_ASSERT(derived); if (!derived->first_select()->exclude_from_table_unique_test) derived->set_unique_exclude(); @@ -4453,6 +4457,7 @@ void TABLE_LIST::set_check_materialized() derived->first_select()->first_inner_unit()->first_select()-> exclude_from_table_unique_test); } + DBUG_VOID_RETURN; } TABLE *TABLE_LIST::get_real_join_table() diff --git a/sql/table.h b/sql/table.h index 95925cb202e..8875ee26afb 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1804,7 +1804,7 @@ struct TABLE_LIST void set_materialized_derived() { DBUG_ENTER("set_materialized_derived"); - derived_type= ((derived_type & DTYPE_MASK) | + derived_type= ((derived_type & (derived ? DTYPE_MASK : DTYPE_VIEW)) | DTYPE_TABLE | DTYPE_MATERIALIZE); set_check_materialized(); DBUG_VOID_RETURN; From d60b4df1ef923d337ccff1be3c358d54ae72707e Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 2 Jun 2014 23:25:54 +0200 Subject: [PATCH 44/52] percona-server-5.5.37-35.0.tar.gz --- buf/buf0buf.c | 4 +++- fil/fil0fil.c | 22 ++++++++++++++------ handler/ha_innodb.cc | 22 +++++++++++++++++--- handler/ha_innodb.h | 1 + handler/handler0alter.cc | 4 ++-- include/univ.i | 2 +- row/row0ins.c | 6 +++++- row/row0upd.c | 43 +++++++++------------------------------- srv/srv0start.c | 6 +++++- 9 files changed, 61 insertions(+), 49 deletions(-) diff --git a/buf/buf0buf.c b/buf/buf0buf.c index c0909715972..7f5ce7c5462 100644 --- a/buf/buf0buf.c +++ b/buf/buf0buf.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Portions of this file contain modifications contributed and copyrighted by @@ -2519,7 +2519,9 @@ loop: rw_lock_s_unlock(&buf_pool->page_hash_latch); } +#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG loop2: +#endif if (block && buf_pool_watch_is_sentinel(buf_pool, &block->page)) { mutex_exit(block_mutex); block = NULL; diff --git a/fil/fil0fil.c b/fil/fil0fil.c index 2ab74b1595d..67ad5ef7855 100644 --- a/fil/fil0fil.c +++ b/fil/fil0fil.c @@ -4953,14 +4953,24 @@ fil_extend_space_to_desired_size( #ifdef HAVE_POSIX_FALLOCATE if (srv_use_posix_fallocate) { - offset_high = (size_after_extend - file_start_page_no) - * page_size / (4ULL * 1024 * 1024 * 1024); - offset_low = (size_after_extend - file_start_page_no) - * page_size % (4ULL * 1024 * 1024 * 1024); + + ib_int64_t start_offset + = file_start_page_no * page_size; + ib_int64_t end_offset + = (size_after_extend - file_start_page_no) * page_size; mutex_exit(&fil_system->mutex); - success = os_file_set_size(node->name, node->handle, - offset_low, offset_high); + success = (posix_fallocate(node->handle, start_offset, + end_offset) == 0); + if (!success) + { + fprintf(stderr, + "InnoDB: Error: preallocating file space for " + "file \'%s\' failed. Current size %lld, " + "len %lld, desired size %lld\n", node->name, + start_offset, end_offset, + start_offset + end_offset); + } mutex_enter(&fil_system->mutex); if (success) { node->size += (size_after_extend - start_page_no); diff --git a/handler/ha_innodb.cc b/handler/ha_innodb.cc index 148b872f337..396a33cdf13 100644 --- a/handler/ha_innodb.cc +++ b/handler/ha_innodb.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2000, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2000, 2014, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, 2009 Google Inc. Copyright (c) 2009, Percona Inc. @@ -2936,7 +2936,8 @@ skip_relay: internal_innobase_data_file_path); if (ret == FALSE) { sql_print_error( - "InnoDB: syntax error in innodb_data_file_path"); + "InnoDB: syntax error in innodb_data_file_path" + " or size specified is less than 1 megabyte"); mem_free_and_error: srv_free_paths_and_sizes(); my_free(internal_innobase_data_file_path); @@ -11329,6 +11330,21 @@ ha_innobase::get_auto_increment( current = *first_value > col_max_value ? autoinc : *first_value; + /* If the increment step of the auto increment column + decreases then it is not affecting the immediate + next value in the series. */ + if (prebuilt->autoinc_increment > increment) { + + current = autoinc - prebuilt->autoinc_increment; + + current = innobase_next_autoinc( + current, 1, increment, 1, col_max_value); + + dict_table_autoinc_initialize(prebuilt->table, current); + + *first_value = current; + } + /* Compute the last value in the interval */ next_value = innobase_next_autoinc( current, *nb_reserved_values, increment, offset, @@ -13070,7 +13086,7 @@ static MYSQL_SYSVAR_ULONG(thread_concurrency, srv_thread_concurrency, static MYSQL_SYSVAR_ULONG(thread_sleep_delay, srv_thread_sleep_delay, PLUGIN_VAR_RQCMDARG, "Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a sleep", - NULL, NULL, 10000L, 0L, ~0UL, 0); + NULL, NULL, 10000L, 0L, 1000000L, 0); static MYSQL_SYSVAR_STR(data_file_path, innobase_data_file_path, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, diff --git a/handler/ha_innodb.h b/handler/ha_innodb.h index 640abda20c3..773a0bbc035 100644 --- a/handler/ha_innodb.h +++ b/handler/ha_innodb.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2000, 2010, MySQL AB & Innobase Oy. 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 the Free Software diff --git a/handler/handler0alter.cc b/handler/handler0alter.cc index 7014479df70..b4d63fc23b7 100644 --- a/handler/handler0alter.cc +++ b/handler/handler0alter.cc @@ -110,16 +110,16 @@ innobase_col_to_mysql( /* These column types should never be shipped to MySQL. */ ut_ad(0); - case DATA_FIXBINARY: case DATA_FLOAT: case DATA_DOUBLE: case DATA_DECIMAL: /* Above are the valid column types for MySQL data. */ ut_ad(flen == len); /* fall through */ + case DATA_FIXBINARY: case DATA_CHAR: /* We may have flen > len when there is a shorter - prefix on a CHAR column. */ + prefix on the CHAR and BINARY column. */ ut_ad(flen >= len); #else /* UNIV_DEBUG */ default: diff --git a/include/univ.i b/include/univ.i index 318be0430d7..43eec268805 100644 --- a/include/univ.i +++ b/include/univ.i @@ -64,7 +64,7 @@ component, i.e. we show M.N.P as M.N */ (INNODB_VERSION_MAJOR << 8 | INNODB_VERSION_MINOR) #ifndef PERCONA_INNODB_VERSION -#define PERCONA_INNODB_VERSION 34.0 +#define PERCONA_INNODB_VERSION 35.0 #endif #define INNODB_VERSION_STR MYSQL_SERVER_VERSION "-" IB_TO_STR(PERCONA_INNODB_VERSION) diff --git a/row/row0ins.c b/row/row0ins.c index 0d9db2f6d1f..af2692b2f2e 100644 --- a/row/row0ins.c +++ b/row/row0ins.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved. 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 @@ -2290,6 +2290,10 @@ row_ins_index_entry( { ulint err; + DBUG_EXECUTE_IF("row_ins_index_entry_timeout", { + DBUG_SET("-d,row_ins_index_entry_timeout"); + return(DB_LOCK_WAIT);}); + if (foreign && UT_LIST_GET_FIRST(index->table->foreign_list)) { err = row_ins_check_foreign_constraints(index->table, index, entry, thr); diff --git a/row/row0upd.c b/row/row0upd.c index 3560ec88e2e..370a46dc3c4 100644 --- a/row/row0upd.c +++ b/row/row0upd.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved. 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 @@ -1789,9 +1789,7 @@ row_upd_clust_rec_by_insert_inherit_func( data += len - BTR_EXTERN_FIELD_REF_SIZE; /* The pointer must not be zero. */ ut_a(memcmp(data, field_ref_zero, BTR_EXTERN_FIELD_REF_SIZE)); - /* The BLOB must be owned. */ - ut_a(!(data[BTR_EXTERN_LEN] & BTR_EXTERN_OWNER_FLAG)); - + data[BTR_EXTERN_LEN] &= ~BTR_EXTERN_OWNER_FLAG; data[BTR_EXTERN_LEN] |= BTR_EXTERN_INHERITED_FLAG; /* The BTR_EXTERN_INHERITED_FLAG only matters in rollback. Purge will always free the extern fields of @@ -1896,7 +1894,13 @@ err_exit: rec, offsets, entry, node->update); if (change_ownership) { - btr_pcur_store_position(pcur, mtr); + /* The blobs are disowned here, expecting the + insert down below to inherit them. But if the + insert fails, then this disown will be undone + when the operation is rolled back. */ + btr_cur_disown_inherited_fields( + btr_cur_get_page_zip(btr_cur), + rec, index, offsets, node->update, mtr); } } @@ -1922,35 +1926,6 @@ err_exit: ? UPD_NODE_INSERT_BLOB : UPD_NODE_INSERT_CLUSTERED; - if (err == DB_SUCCESS && change_ownership) { - /* Mark the non-updated fields disowned by the old record. */ - - /* NOTE: this transaction has an x-lock on the record - and therefore other transactions cannot modify the - record when we have no latch on the page. In addition, - we assume that other query threads of the same - transaction do not modify the record in the meantime. - Therefore we can assert that the restoration of the - cursor succeeds. */ - - mtr_start(mtr); - - if (!btr_pcur_restore_position(BTR_MODIFY_LEAF, pcur, mtr)) { - ut_error; - } - - rec = btr_cur_get_rec(btr_cur); - offsets = rec_get_offsets(rec, index, offsets, - ULINT_UNDEFINED, &heap); - ut_ad(page_rec_is_user_rec(rec)); - - btr_cur_disown_inherited_fields( - btr_cur_get_page_zip(btr_cur), - rec, index, offsets, node->update, mtr); - - mtr_commit(mtr); - } - mem_heap_free(heap); return(err); diff --git a/srv/srv0start.c b/srv/srv0start.c index 46094759092..5c40e0b703e 100644 --- a/srv/srv0start.c +++ b/srv/srv0start.c @@ -150,7 +150,7 @@ UNIV_INTERN mysql_pfs_key_t srv_log_tracking_thread_key; #endif /* UNIV_PFS_THREAD */ /*********************************************************************//** -Convert a numeric string that optionally ends in G or M, to a number +Convert a numeric string that optionally ends in G or M or K, to a number containing megabytes. @return next character in string */ static @@ -174,6 +174,10 @@ srv_parse_megabytes( case 'M': case 'm': str++; break; + case 'K': case 'k': + size /= 1024; + str++; + break; default: size /= 1024 * 1024; break; From 57d15d62f15e8b17eddf0a5e6c4beee8e78c07b1 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 3 Jun 2014 10:52:36 +0200 Subject: [PATCH 45/52] Add a test case for MySQL's: Bug #18167356: EXPLAIN W/ EXISTS(SELECT* UNION SELECT*) WHERE ONE OF SELECT* IS DISTINCT FAILS. the bugfix itself was not merged - MariaDB doesn't have this bug. --- mysql-test/r/union.result | 13 +++++++++++-- mysql-test/t/union.test | 12 ++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index a3ad63c035a..6d99cad30f0 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -1876,8 +1876,8 @@ SELECT(SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev; dev 1 # -# LP bug#1010729: Unexpected syntax error from UNION -# (bug #54382) with single-table join nest +# lp:1010729: Unexpected syntax error from UNION +# (bug #54382) with single-table join nest # CREATE TABLE t1 (a int); CREATE TABLE t2 (b int); @@ -1892,3 +1892,12 @@ UNION SELECT t1.pk FROM t1 LEFT JOIN (t2) ON (t1.pk = t2.fk); pk DROP TABLE t1,t2; +create table t1 (a int); +insert t1 values (1),(2),(3),(1); +explain select 1 from dual where exists (select max(a) from t1 group by a union select a+2 from t1); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort +3 UNION t1 ALL NULL NULL NULL NULL 4 +NULL UNION RESULT ALL NULL NULL NULL NULL NULL +drop table t1; diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index a53427f7fc6..877509a9fc0 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -1274,8 +1274,8 @@ SELECT(SELECT 1 AS a LIMIT 1) AS dev; SELECT(SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev; --echo # ---echo # LP bug#1010729: Unexpected syntax error from UNION ---echo # (bug #54382) with single-table join nest +--echo # lp:1010729: Unexpected syntax error from UNION +--echo # (bug #54382) with single-table join nest --echo # CREATE TABLE t1 (a int); CREATE TABLE t2 (b int); @@ -1292,3 +1292,11 @@ SELECT t1.pk FROM t1 LEFT JOIN (t2) ON (t1.pk = t2.fk); DROP TABLE t1,t2; +# +# Bug #18167356: EXPLAIN W/ EXISTS(SELECT* UNION SELECT*) +# WHERE ONE OF SELECT* IS DISTINCT FAILS. +# +create table t1 (a int); +insert t1 values (1),(2),(3),(1); +explain select 1 from dual where exists (select max(a) from t1 group by a union select a+2 from t1); +drop table t1; From 77ec219d58fb7819ec7ce7ea5a441716c850b37b Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 3 Jun 2014 10:57:57 +0200 Subject: [PATCH 46/52] cmake: mark AIO_LIBRARY, EVENT_LIBRARY, GROFF, NROFF as advanced; use -ggdb3 if supported --- CMakeLists.txt | 5 +++++ cmake/os/WindowsCache.cmake | 3 ++- dbug/CMakeLists.txt | 2 ++ storage/xtradb/CMakeLists.txt | 1 + tests/CMakeLists.txt | 1 + 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 54a93ed3791..b03cdf438a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,6 +61,7 @@ IF(UNIX AND NOT APPLE) # Compiling with PIC speeds up embedded build, on PIC sensitive systems # Predefine it to OFF in release builds, because of the performance penalty SET(WITH_PIC ${WITH_PIC_DEFAULT} CACHE BOOL "Compile with PIC.") + MARK_AS_ADVANCED(WITH_PIC) ENDIF() # Optionally set project name, e.g. @@ -263,6 +264,10 @@ IF (ENABLE_GCOV AND NOT WIN32 AND NOT APPLE) SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage -lgcov") ENDIF() +MY_CHECK_C_COMPILER_FLAG(-ggdb3 HAVE_GGDB3) +SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb3") +SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb3") + OPTION(ENABLED_LOCAL_INFILE "If we should should enable LOAD DATA LOCAL by default" ${IF_WIN}) MARK_AS_ADVANCED(ENABLED_LOCAL_INFILE) diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake index 2a6fb5ae31f..1453cc55053 100644 --- a/cmake/os/WindowsCache.cmake +++ b/cmake/os/WindowsCache.cmake @@ -370,4 +370,5 @@ SET(HAVE_SYS_UTSNAME_H CACHE INTERNAL "") SET(HAVE_PTHREAD_ATTR_GETGUARDSIZE CACHE INTERNAL "") SET(HAVE_UCONTEXT_H CACHE INTERNAL "") SET(HAVE_SOCKPEERCRED CACHE INTERNAL "") -ENDIF() +SET(HAVE_GGDB3 CACHE INTERNAL "") +ENDIF(MSVC) diff --git a/dbug/CMakeLists.txt b/dbug/CMakeLists.txt index fddf234a4f1..3d0b0801132 100644 --- a/dbug/CMakeLists.txt +++ b/dbug/CMakeLists.txt @@ -30,6 +30,8 @@ TARGET_LINK_LIBRARIES(factorial dbug) IF(NOT WIN32 AND NOT CMAKE_GENERATOR MATCHES Xcode) FIND_PROGRAM(GROFF groff) FIND_PROGRAM(NROFF nroff) + MARK_AS_ADVANCED(GROFF) + MARK_AS_ADVANCED(NROFF) SET(OUTPUT_INC output1.r output2.r output3.r output4.r output5.r) SET(SOURCE_INC factorial.r main.r example1.r example2.r example3.r) ADD_CUSTOM_COMMAND(OUTPUT ${OUTPUT_INC} diff --git a/storage/xtradb/CMakeLists.txt b/storage/xtradb/CMakeLists.txt index f128833f1e7..5cbdddfa778 100644 --- a/storage/xtradb/CMakeLists.txt +++ b/storage/xtradb/CMakeLists.txt @@ -27,6 +27,7 @@ IF(UNIX) SET(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) ENDIF() FIND_LIBRARY(AIO_LIBRARY aio) + MARK_AS_ADVANCED(AIO_LIBRARY) IF(AIO_LIBRARY) CHECK_LIBRARY_EXISTS(${AIO_LIBRARY} io_queue_init "" HAVE_LIBAIO) IF(HAVE_LIBAIO AND HAVE_LIBAIO_H) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0acad6bf30b..dc775020954 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -31,6 +31,7 @@ INSTALL(TARGETS mysql_client_test DESTINATION ${INSTALL_BINDIR} COMPONENT Test) CHECK_INCLUDE_FILE(event.h HAVE_EVENT_H) FIND_LIBRARY(EVENT_LIBRARY event) +MARK_AS_ADVANCED(EVENT_LIBRARY) IF(HAVE_EVENT_H AND EVENT_LIBRARY) ADD_EXECUTABLE(async_queries async_queries.c) TARGET_LINK_LIBRARIES(async_queries mysqlclient ${EVENT_LIBRARY}) From 267391065401440bd578e2cc1126df12f2300251 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 3 Jun 2014 10:58:03 +0200 Subject: [PATCH 47/52] mark tokudb in 5.5 as MariaDB_PLUGIN_MATURITY_GAMMA, not MariaDB_PLUGIN_MATURITY_ALPHA. --- storage/tokudb/hatoku_hton.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/storage/tokudb/hatoku_hton.cc b/storage/tokudb/hatoku_hton.cc index 78c7ee89bb8..2cb33e38547 100644 --- a/storage/tokudb/hatoku_hton.cc +++ b/storage/tokudb/hatoku_hton.cc @@ -2420,7 +2420,7 @@ maria_declare_plugin(tokudb) toku_global_status_variables_export, /* status variables */ tokudb_system_variables, /* system variables */ TOKUDB_PLUGIN_VERSION_STR, /* string version */ - MariaDB_PLUGIN_MATURITY_ALPHA /* maturity */ + MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */ }, { MYSQL_INFORMATION_SCHEMA_PLUGIN, @@ -2435,7 +2435,7 @@ maria_declare_plugin(tokudb) NULL, /* status variables */ NULL, /* system variables */ TOKUDB_PLUGIN_VERSION_STR, /* string version */ - MariaDB_PLUGIN_MATURITY_ALPHA /* maturity */ + MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */ }, { MYSQL_INFORMATION_SCHEMA_PLUGIN, @@ -2450,7 +2450,7 @@ maria_declare_plugin(tokudb) NULL, /* status variables */ NULL, /* system variables */ TOKUDB_PLUGIN_VERSION_STR, /* string version */ - MariaDB_PLUGIN_MATURITY_ALPHA /* maturity */ + MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */ }, { MYSQL_INFORMATION_SCHEMA_PLUGIN, @@ -2465,7 +2465,7 @@ maria_declare_plugin(tokudb) NULL, /* status variables */ NULL, /* system variables */ TOKUDB_PLUGIN_VERSION_STR, /* string version */ - MariaDB_PLUGIN_MATURITY_ALPHA /* maturity */ + MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */ }, { MYSQL_INFORMATION_SCHEMA_PLUGIN, @@ -2480,7 +2480,7 @@ maria_declare_plugin(tokudb) NULL, /* status variables */ NULL, /* system variables */ TOKUDB_PLUGIN_VERSION_STR, /* string version */ - MariaDB_PLUGIN_MATURITY_ALPHA /* maturity */ + MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */ }, { MYSQL_INFORMATION_SCHEMA_PLUGIN, @@ -2495,7 +2495,7 @@ maria_declare_plugin(tokudb) NULL, /* status variables */ NULL, /* system variables */ TOKUDB_PLUGIN_VERSION_STR, /* string version */ - MariaDB_PLUGIN_MATURITY_ALPHA /* maturity */ + MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */ }, { MYSQL_INFORMATION_SCHEMA_PLUGIN, @@ -2510,7 +2510,7 @@ maria_declare_plugin(tokudb) NULL, /* status variables */ NULL, /* system variables */ TOKUDB_PLUGIN_VERSION_STR, /* string version */ - MariaDB_PLUGIN_MATURITY_ALPHA /* maturity */ + MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */ } maria_declare_plugin_end; From 55bfabf9715c15df16adb4a3e8880deb4943df2b Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 4 Jun 2014 10:10:19 +0300 Subject: [PATCH 48/52] MDEV-6163: Error while executing an update query that has the same table in a sub-query We have to run the derived table prepare before the unique table check to mark the derived table (in this case the unique table check can turn that table to materialized one). --- mysql-test/r/derived.result | 14 ++++++++++++++ mysql-test/t/derived.test | 19 +++++++++++++++++++ sql/sql_update.cc | 7 +++++++ 3 files changed, 40 insertions(+) diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index 3a3b69f1fc7..d0f42c3d3ec 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -539,6 +539,7 @@ n d1 d2 result 2085 2012-01-01 00:00:00 2013-01-01 00:00:00 0 2084 2012-02-01 00:00:00 2013-01-01 00:00:00 0 drop table t1; +set @save_derived_optimizer_switch_bug=@@optimizer_switch; SET optimizer_switch = 'derived_merge=on,derived_with_keys=on,in_to_exists=on'; CREATE TABLE t1 (a INT) ENGINE=MyISAM; INSERT INTO t1 VALUES (8); @@ -553,4 +554,17 @@ id select_type table type possible_keys key key_len ref rows Extra Warnings: Note 1249 Select 4 was reduced during optimization DROP TABLE t1, t2; +set optimizer_switch=@save_derived_optimizer_switch_bug; +# +# MDEV-6163: Error while executing an update query that has the +# same table in a sub-query +# +set @save_derived_optimizer_switch_bug=@@optimizer_switch; +SET optimizer_switch = 'derived_merge=on'; +create table t1 (balance float, accountId varchar(64), primary key (accountId)); +insert into t1 (accountId,balance) values +('dealer-1',199354.0),('dealer-2',0),('dealer-3',0),('dealer-5',0),('FINANCE',-200000),('OPERATOR',0); +update t1 set balance=(select sum(balance) from (SELECT balance FROM t1 where accountId like 'dealer%') AS copied) where accountId = 'OPERATOR'; +set optimizer_switch=@save_derived_optimizer_switch_bug; +drop table t1; set optimizer_switch=@save_derived_optimizer_switch; diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index 4b1d7604b9d..61ae3695a1f 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -465,6 +465,7 @@ drop table t1; # # MDEV-5012 Server crashes in Item_ref::real_item on EXPLAIN with select subqueries or views, constant table, derived_merge+derived_with_keys # +set @save_derived_optimizer_switch_bug=@@optimizer_switch; SET optimizer_switch = 'derived_merge=on,derived_with_keys=on,in_to_exists=on'; CREATE TABLE t1 (a INT) ENGINE=MyISAM; INSERT INTO t1 VALUES (8); @@ -473,5 +474,23 @@ INSERT INTO t2 VALUES (1),(7); EXPLAIN SELECT * FROM (SELECT * FROM t1) AS table1, (SELECT DISTINCT * FROM t2) AS table2 WHERE b = a AND a <> ANY (SELECT 9); DROP TABLE t1, t2; +set optimizer_switch=@save_derived_optimizer_switch_bug; + +--echo # +--echo # MDEV-6163: Error while executing an update query that has the +--echo # same table in a sub-query +--echo # + +set @save_derived_optimizer_switch_bug=@@optimizer_switch; +SET optimizer_switch = 'derived_merge=on'; +create table t1 (balance float, accountId varchar(64), primary key (accountId)); + +insert into t1 (accountId,balance) values +('dealer-1',199354.0),('dealer-2',0),('dealer-3',0),('dealer-5',0),('FINANCE',-200000),('OPERATOR',0); + +update t1 set balance=(select sum(balance) from (SELECT balance FROM t1 where accountId like 'dealer%') AS copied) where accountId = 'OPERATOR'; +set optimizer_switch=@save_derived_optimizer_switch_bug; +drop table t1; + set optimizer_switch=@save_derived_optimizer_switch; diff --git a/sql/sql_update.cc b/sql/sql_update.cc index e785b1106cf..300769ef099 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -1017,6 +1017,13 @@ bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list, thd->lex->allow_sum_func= 0; + /* + We do not call DT_MERGE_FOR_INSERT because it has no sense for simple + (not multi-) update + */ + if (mysql_handle_derived(thd->lex, DT_PREPARE)) + DBUG_RETURN(TRUE); + if (setup_tables_and_check_access(thd, &select_lex->context, &select_lex->top_join_list, table_list, From 661daf16f11ffa879ffb005008b6e73f6744e0ad Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 4 Jun 2014 20:32:57 +0400 Subject: [PATCH 49/52] MDEV-4858 Wrong results for a huge unsigned value inserted into a TIME column MDEV-6099 Bad results for DATE_ADD(.., INTERVAL 2000000000000000000.0 SECOND) MDEV-6097 Inconsistent results for CAST(int,decimal,double AS DATETIME) MDEV-6100 No warning on CAST(9000000 AS TIME) --- include/my_global.h | 1 + include/my_time.h | 9 ++++++++- mysql-test/r/cast.result | 16 +++++++-------- mysql-test/r/dyncol.result | 31 +++++++++++++++++++---------- mysql-test/r/func_time.result | 12 +++++++++-- mysql-test/r/type_datetime.result | 9 +++++++++ mysql-test/r/type_time.result | 28 ++++++++++++++++++++++++++ mysql-test/r/type_time_hires.result | 14 ++++++------- mysql-test/t/dyncol.test | 7 +++++++ mysql-test/t/func_time.test | 5 +++++ mysql-test/t/type_datetime.test | 8 ++++++++ mysql-test/t/type_time.test | 17 ++++++++++++++++ sql-common/my_time.c | 12 +++++++---- sql/field.cc | 27 +++++++++++++++++++------ sql/item.cc | 4 +++- sql/item_func.cc | 4 +++- sql/item_strfunc.cc | 6 ++++-- sql/item_timefunc.cc | 12 +++++++++++ sql/mysql_priv.h | 11 ++++++---- sql/time.cc | 12 ++++++----- 20 files changed, 194 insertions(+), 51 deletions(-) diff --git a/include/my_global.h b/include/my_global.h index 41ab8bc518d..b924c47e86e 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -630,6 +630,7 @@ typedef unsigned short ushort; #define sgn(a) (((a) < 0) ? -1 : ((a) > 0) ? 1 : 0) #define swap_variables(t, a, b) { t dummy; dummy= a; a= b; b= dummy; } #define test(a) ((a) ? 1 : 0) +#define MY_TEST(a) ((a) ? 1 : 0) #define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0) #define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0) #define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1)) diff --git a/include/my_time.h b/include/my_time.h index 4d8ea0c2eda..f3fd1f1b638 100644 --- a/include/my_time.h +++ b/include/my_time.h @@ -82,6 +82,13 @@ typedef long my_time_t; #define MYSQL_TIME_WARN_TRUNCATED 1 #define MYSQL_TIME_WARN_OUT_OF_RANGE 2 +#define MYSQL_TIME_NOTE_TRUNCATED 16 + +#define MYSQL_TIME_WARN_WARNINGS (MYSQL_TIME_WARN_TRUNCATED|MYSQL_TIME_WARN_OUT_OF_RANGE) +#define MYSQL_TIME_WARN_NOTES (MYSQL_TIME_NOTE_TRUNCATED) + +#define MYSQL_TIME_WARN_HAVE_WARNINGS(x) MY_TEST((x) & MYSQL_TIME_WARN_WARNINGS) +#define MYSQL_TIME_WARN_HAVE_NOTES(x) MY_TEST((x) & MYSQL_TIME_WARN_NOTES) /* Limits for the TIME data type */ #define TIME_MAX_HOUR 838 @@ -115,7 +122,7 @@ longlong double_to_datetime(double nr, MYSQL_TIME *ltime, uint flags, int *cut) ltime, flags, cut); } -int number_to_time(my_bool neg, longlong nr, ulong sec_part, +int number_to_time(my_bool neg, ulonglong nr, ulong sec_part, MYSQL_TIME *ltime, int *was_cut); ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *); ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *); diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result index 94715e28518..e79f514c9c3 100644 --- a/mysql-test/r/cast.result +++ b/mysql-test/r/cast.result @@ -77,7 +77,7 @@ cast(cast(20010203101112.121314 as double) as datetime) 2001-02-03 10:11:12 select cast(cast(010203101112.12 as double) as datetime); cast(cast(010203101112.12 as double) as datetime) -0001-02-03 10:11:12 +2001-02-03 10:11:12 select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime); cast(cast(20010203101112.121314 as decimal(32,6)) as datetime) 2001-02-03 10:11:12 @@ -86,10 +86,10 @@ cast(20010203101112.121314 as datetime) 2001-02-03 10:11:12 select cast(110203101112.121314 as datetime); cast(110203101112.121314 as datetime) -0011-02-03 10:11:12 +2011-02-03 10:11:12 select cast(cast(010203101112.12 as double) as datetime); cast(cast(010203101112.12 as double) as datetime) -0001-02-03 10:11:12 +2001-02-03 10:11:12 select cast("2011-02-03 10:11:12.123456" as datetime); cast("2011-02-03 10:11:12.123456" as datetime) 2011-02-03 10:11:12 @@ -110,7 +110,7 @@ cast(cast(20010203101112.5 as double) as datetime(1)) 2001-02-03 10:11:12.5 select cast(cast(010203101112.12 as double) as datetime(2)); cast(cast(010203101112.12 as double) as datetime(2)) -0001-02-03 10:11:12.12 +2001-02-03 10:11:12.12 select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime(6)); cast(cast(20010203101112.121314 as decimal(32,6)) as datetime(6)) 2001-02-03 10:11:12.121314 @@ -119,10 +119,10 @@ cast(20010203101112.121314 as datetime(6)) 2001-02-03 10:11:12.121314 select cast(110203101112.121314 as datetime(6)); cast(110203101112.121314 as datetime(6)) -0011-02-03 10:11:12.121314 +2011-02-03 10:11:12.121314 select cast(cast(010203101112.12 as double) as datetime(6)); cast(cast(010203101112.12 as double) as datetime(6)) -0001-02-03 10:11:12.120000 +2001-02-03 10:11:12.120000 select cast("2011-02-03 10:11:12.123456" as time); cast("2011-02-03 10:11:12.123456" as time) 10:11:12 @@ -265,7 +265,7 @@ Warnings: Warning 1264 Out of range value for column 'cast(-1000 as double(5,2))' at row 1 select cast(010203101112.121314 as datetime); cast(010203101112.121314 as datetime) -0001-02-03 10:11:12 +2001-02-03 10:11:12 select cast(120010203101112.121314 as datetime); cast(120010203101112.121314 as datetime) NULL @@ -326,7 +326,7 @@ cast(cast(120010203101112.121314 as double) as datetime) NULL select cast(cast(1.1 as double) as datetime); cast(cast(1.1 as double) as datetime) -0000-00-00 00:00:01 +NULL select cast(cast(-1.1 as double) as datetime); cast(cast(-1.1 as double) as datetime) NULL diff --git a/mysql-test/r/dyncol.result b/mysql-test/r/dyncol.result index 1b06bd06162..28ae1957564 100644 --- a/mysql-test/r/dyncol.result +++ b/mysql-test/r/dyncol.result @@ -1001,29 +1001,29 @@ Warnings: Warning 1292 Truncated incorrect time value: '1223.5aa' select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as time); column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as time) -NULL +838:59:59 Warnings: -Warning 1292 Incorrect datetime value: '1.84467440737096e+19' +Warning 1292 Truncated incorrect time value: '1.84467440737096e+19' select column_get(column_create(1, 9223372036854775807 AS int), 1 as time); column_get(column_create(1, 9223372036854775807 AS int), 1 as time) -NULL +838:59:59 Warnings: -Warning 1292 Incorrect datetime value: '9223372036854775807' +Warning 1292 Truncated incorrect time value: '9223372036854775807' select column_get(column_create(1, -9223372036854775808 AS int), 1 as time); column_get(column_create(1, -9223372036854775808 AS int), 1 as time) -NULL +-838:59:59 Warnings: -Warning 1292 Incorrect datetime value: '-9223372036854775808' +Warning 1292 Truncated incorrect time value: '-9223372036854775808' select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as time); column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as time) -NULL +838:59:59 Warnings: -Warning 1292 Incorrect datetime value: '99999999999999999999999999999' +Warning 1292 Truncated incorrect time value: '99999999999999999999999999999' select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as time); column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as time) -NULL +838:59:59 Warnings: -Warning 1292 Incorrect datetime value: '1e+29' +Warning 1292 Truncated incorrect time value: '1e+29' select column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as time); column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as time) NULL @@ -1425,5 +1425,16 @@ Warning 1265 Data truncated for column 'dyncol' at row 1 SELECT COLUMN_ADD( dyncol, 7, '22:22:22', 8, REPEAT('x',270) AS CHAR ) FROM t1; DROP table t1; # +# MDEV-4858 Wrong results for a huge unsigned value inserted into a TIME column +# +SELECT +column_get(column_create(1, -999999999999999 AS int), 1 AS TIME) AS t1, +column_get(column_create(1, -9223372036854775808 AS int), 1 AS TIME) AS t2; +t1 t2 +-838:59:59 -838:59:59 +Warnings: +Warning 1292 Truncated incorrect time value: '-999999999999999' +Warning 1292 Truncated incorrect time value: '-9223372036854775808' +# # end of 5.3 tests # diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index ac336418823..c52f512aa70 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1101,9 +1101,9 @@ NULL select isnull(week(now() + 0)), isnull(week(now() + 0.2)), week(20061108), week(20061108.01), week(20061108085411.000002); isnull(week(now() + 0)) isnull(week(now() + 0.2)) week(20061108) week(20061108.01) week(20061108085411.000002) -0 0 45 NULL 45 +0 0 45 45 45 Warnings: -Warning 1292 Incorrect datetime value: '20061108.01' +Warning 1292 Truncated incorrect datetime value: '20061108.01' End of 4.1 tests explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1, timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2; @@ -2381,3 +2381,11 @@ SELECT 1 FROM t1 GROUP BY MONTHNAME(0) WITH ROLLUP; 1 1 DROP TABLE t1; +# +# MDEV-6099 Bad results for DATE_ADD(.., INTERVAL 2000000000000000000.0 SECOND) +# +SELECT DATE_ADD('2001-01-01 10:20:30',INTERVAL 250000000000.0 SECOND) AS c1, DATE_ADD('2001-01-01 10:20:30',INTERVAL 2000000000000000000.0 SECOND) AS c2; +c1 c2 +9923-03-10 22:47:10.0 NULL +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: '2000000000000000000.0' diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index d20506288ad..33d94069980 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -724,4 +724,13 @@ call test5041(); dt 0000-01-02 08:20:30 drop procedure test5041; +# +# MDEV-6097 Inconsistent results for CAST(int,decimal,double AS DATETIME) +# +SELECT +CAST(010203101112 AS DATETIME(1)) AS c1, +CAST(010203101112.2 AS DATETIME(1)) AS c2, +CAST(010203101112.2+0e0 AS DATETIME(1)) AS c3; +c1 c2 c3 +2001-02-03 10:11:12.0 2001-02-03 10:11:12.2 2001-02-03 10:11:12.1 End of 5.3 tests diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result index 26e42d3b3b2..56b35e04502 100644 --- a/mysql-test/r/type_time.result +++ b/mysql-test/r/type_time.result @@ -298,5 +298,33 @@ Field Type Null Key Default Extra MAX(t1)+1 decimal(22,1) YES NULL DROP TABLE t2,t1; # +# MDEV-4858 Wrong results for a huge unsigned value inserted into a TIME column +# +SET sql_mode=traditional; +CREATE TABLE t1 (a TIME(6)); +INSERT INTO t1 VALUES (CAST(0xFFFFFFFF00000000 AS UNSIGNED)); +ERROR 22007: Incorrect time value: '18446744069414584320' for column 'a' at row 1 +SET sql_mode=DEFAULT; +INSERT INTO t1 VALUES (CAST(0xFFFFFFFF00000000 AS UNSIGNED)); +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +SELECT * FROM t1; +a +838:59:59.999999 +DROP TABLE t1; +SELECT TIME'00:00:00'> CAST(0xFFFFFFFF00000000 AS UNSIGNED); +TIME'00:00:00'> CAST(0xFFFFFFFF00000000 AS UNSIGNED) +0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '00:00:00' +# +# MDEV-6100 No warning on CAST(9000000 AS TIME) +# +SELECT CAST(9000000 AS TIME); +CAST(9000000 AS TIME) +838:59:59 +Warnings: +Warning 1292 Truncated incorrect time value: '9000000' +# # End of 5.3 tests # diff --git a/mysql-test/r/type_time_hires.result b/mysql-test/r/type_time_hires.result index bf54434a04c..7fbb5079d5a 100644 --- a/mysql-test/r/type_time_hires.result +++ b/mysql-test/r/type_time_hires.result @@ -16,46 +16,46 @@ Warnings: Warning 1265 Data truncated for column 'a' at row 1 insert t1 values (99991231235959e1); Warnings: -Warning 1265 Data truncated for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 1 select * from t1; a -00:00:00.000 00:20:03.123 01:02:03.456 03:04:05.789 15:47:11.123 +838:59:59.999 select truncate(a, 6) from t1; truncate(a, 6) -0.000000 2003.123000 10203.456000 30405.789062 154711.123000 +8385959.999000 select a DIV 1 from t1; a DIV 1 -0 2003 10203 30405 154711 +8385959 select group_concat(distinct a) from t1; group_concat(distinct a) -00:00:00.000,00:20:03.123,01:02:03.456,03:04:05.789,15:47:11.123 +00:20:03.123,01:02:03.456,03:04:05.789,15:47:11.123,838:59:59.999 alter table t1 engine=innodb; select * from t1 order by a; a -00:00:00.000 00:20:03.123 01:02:03.456 03:04:05.789 15:47:11.123 +838:59:59.999 select * from t1 order by a+0; a -00:00:00.000 00:20:03.123 01:02:03.456 03:04:05.789 15:47:11.123 +838:59:59.999 drop table t1; create table t1 (a time(4)) engine=innodb; insert t1 values ('2010-12-11 01:02:03.456789'); diff --git a/mysql-test/t/dyncol.test b/mysql-test/t/dyncol.test index 914bf9151b3..de4e150130a 100644 --- a/mysql-test/t/dyncol.test +++ b/mysql-test/t/dyncol.test @@ -622,6 +622,13 @@ INSERT INTO t1 SET dyncol = COLUMN_CREATE( 7, REPEAT('k',487), 209, REPEAT('x',4 SELECT COLUMN_ADD( dyncol, 7, '22:22:22', 8, REPEAT('x',270) AS CHAR ) FROM t1; DROP table t1; +--echo # +--echo # MDEV-4858 Wrong results for a huge unsigned value inserted into a TIME column +--echo # +SELECT + column_get(column_create(1, -999999999999999 AS int), 1 AS TIME) AS t1, + column_get(column_create(1, -9223372036854775808 AS int), 1 AS TIME) AS t2; + --echo # --echo # end of 5.3 tests --echo # diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 4205a70ee56..52dbf3471ac 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -1437,3 +1437,8 @@ CREATE TABLE t1 (i INT); INSERT INTO t1 VALUES (1),(2); SELECT 1 FROM t1 GROUP BY MONTHNAME(0) WITH ROLLUP; DROP TABLE t1; + +--echo # +--echo # MDEV-6099 Bad results for DATE_ADD(.., INTERVAL 2000000000000000000.0 SECOND) +--echo # +SELECT DATE_ADD('2001-01-01 10:20:30',INTERVAL 250000000000.0 SECOND) AS c1, DATE_ADD('2001-01-01 10:20:30',INTERVAL 2000000000000000000.0 SECOND) AS c2; diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index 2fdc33ab079..d249039293c 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -519,6 +519,14 @@ DELIMITER ;| call test5041(); drop procedure test5041; +--echo # +--echo # MDEV-6097 Inconsistent results for CAST(int,decimal,double AS DATETIME) +--echo # +SELECT + CAST(010203101112 AS DATETIME(1)) AS c1, + CAST(010203101112.2 AS DATETIME(1)) AS c2, + CAST(010203101112.2+0e0 AS DATETIME(1)) AS c3; + --echo End of 5.3 tests diff --git a/mysql-test/t/type_time.test b/mysql-test/t/type_time.test index 724e25625af..07fae572a7d 100644 --- a/mysql-test/t/type_time.test +++ b/mysql-test/t/type_time.test @@ -201,6 +201,23 @@ SELECT * FROM t2; SHOW COLUMNS FROM t2; DROP TABLE t2,t1; +--echo # +--echo # MDEV-4858 Wrong results for a huge unsigned value inserted into a TIME column +--echo # +SET sql_mode=traditional; +CREATE TABLE t1 (a TIME(6)); +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO t1 VALUES (CAST(0xFFFFFFFF00000000 AS UNSIGNED)); +SET sql_mode=DEFAULT; +INSERT INTO t1 VALUES (CAST(0xFFFFFFFF00000000 AS UNSIGNED)); +SELECT * FROM t1; +DROP TABLE t1; +SELECT TIME'00:00:00'> CAST(0xFFFFFFFF00000000 AS UNSIGNED); + +--echo # +--echo # MDEV-6100 No warning on CAST(9000000 AS TIME) +--echo # +SELECT CAST(9000000 AS TIME); --echo # --echo # End of 5.3 tests diff --git a/sql-common/my_time.c b/sql-common/my_time.c index 1f058f89bb7..17d031168c6 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -1226,7 +1226,7 @@ longlong number_to_datetime(longlong nr, ulong sec_part, MYSQL_TIME *time_res, *was_cut= 0; time_res->time_type=MYSQL_TIMESTAMP_DATE; - if (nr == 0 || nr >= 10000101000000LL || sec_part) + if (nr == 0 || nr >= 10000101000000LL) { time_res->time_type=MYSQL_TIMESTAMP_DATETIME; goto ok; @@ -1284,7 +1284,11 @@ longlong number_to_datetime(longlong nr, ulong sec_part, MYSQL_TIME *time_res, time_res->minute <= 59 && time_res->second <= 59 && sec_part <= TIME_MAX_SECOND_PART && !check_date(time_res, nr || sec_part, flags, was_cut)) + { + if (time_res->time_type == MYSQL_TIMESTAMP_DATE && sec_part != 0) + *was_cut= MYSQL_TIME_NOTE_TRUNCATED; return nr; + } /* Don't want to have was_cut get set if NO_ZERO_DATE was violated. */ if (nr || !(flags & TIME_NO_ZERO_DATE)) @@ -1318,10 +1322,10 @@ longlong number_to_datetime(longlong nr, ulong sec_part, MYSQL_TIME *time_res, 0 time value is valid, but was possibly truncated -1 time value is invalid */ -int number_to_time(my_bool neg, longlong nr, ulong sec_part, +int number_to_time(my_bool neg, ulonglong nr, ulong sec_part, MYSQL_TIME *ltime, int *was_cut) { - if (nr > 9999999 && neg == 0) + if (nr > 9999999 && nr < 99991231235959ULL && neg == 0) { if (number_to_datetime(nr, sec_part, ltime, TIME_INVALID_DATES, was_cut) < 0) @@ -1329,7 +1333,7 @@ int number_to_time(my_bool neg, longlong nr, ulong sec_part, ltime->year= ltime->month= ltime->day= 0; ltime->time_type= MYSQL_TIMESTAMP_TIME; - *was_cut= MYSQL_TIME_WARN_TRUNCATED; + *was_cut= MYSQL_TIME_NOTE_TRUNCATED; return 0; } diff --git a/sql/field.cc b/sql/field.cc index 78d39a79194..4452f881fb7 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -4664,7 +4664,7 @@ int Field_timestamp::store(longlong nr, bool unsigned_val) { MYSQL_TIME l_time; int error; - Lazy_string_num str(nr); + Lazy_string_num str(nr, unsigned_val); THD *thd= table->in_use; /* We don't want to store invalid or fuzzy datetime values in TIMESTAMP */ @@ -5067,6 +5067,17 @@ int Field_temporal::store_TIME_with_warning(MYSQL_TIME *ltime, ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED; +#if MARIADB_VERSION_ID < 1000000 + /* + Check if the YYYYMMDD part was truncated. + Translate a note into a warning. + In MariaDB-10.0 we have a better warnings/notes handling, + so this code is not needed. + */ + if (was_cut & MYSQL_TIME_NOTE_TRUNCATED) + was_cut|= MYSQL_TIME_WARN_TRUNCATED; +#endif + if (was_cut == 0 && have_smth_to_conv == 0 && temporal_type() != MYSQL_TIMESTAMP_TIME) // special case: zero date @@ -5157,7 +5168,7 @@ int Field_temporal::store(longlong nr, bool unsigned_val) MYSQL_TIME ltime; longlong tmp; THD *thd= table->in_use; - Lazy_string_num str(nr); + Lazy_string_num str(nr, unsigned_val); tmp= number_to_datetime(nr, 0, <ime, (thd->variables.sql_mode & (MODE_NO_ZERO_IN_DATE | @@ -5255,7 +5266,7 @@ int Field_time::store(double nr) bool neg= nr < 0; if (neg) nr= -nr; - int have_smth_to_conv= !number_to_time(neg, (longlong)nr, + int have_smth_to_conv= !number_to_time(neg, (ulonglong) nr, (ulong)((nr - floor(nr)) * TIME_SECOND_PART_FACTOR), <ime, &was_cut); @@ -5266,9 +5277,12 @@ int Field_time::store(double nr) int Field_time::store(longlong nr, bool unsigned_val) { MYSQL_TIME ltime; - Lazy_string_num str(nr); + Lazy_string_num str(nr, unsigned_val); int was_cut; - int have_smth_to_conv= !number_to_time(nr < 0, nr < 0 ? -nr : nr, + if (nr < 0 && unsigned_val) + nr= 99991231235959LL + 1; + int have_smth_to_conv= !number_to_time(nr < 0, + (ulonglong) (nr < 0 ? -nr : nr), 0, <ime, &was_cut); return store_TIME_with_warning(<ime, &str, was_cut, have_smth_to_conv); @@ -5633,7 +5647,8 @@ bool Field_year::get_date(MYSQL_TIME *ltime,uint fuzzydate) int tmp= (int) ptr[0]; if (tmp || field_length != 4) tmp+= 1900; - return int_to_datetime_with_warn(tmp * 10000, ltime, fuzzydate, field_name); + return int_to_datetime_with_warn(false, tmp * 10000, + ltime, fuzzydate, field_name); } diff --git a/sql/item.cc b/sql/item.cc index a45a7500f1c..3a1913bd4a1 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1228,6 +1228,7 @@ bool Item::get_date(MYSQL_TIME *ltime,uint fuzzydate) case INT_RESULT: { longlong value= val_int(); + bool neg= !unsigned_flag && value < 0; if (field_type() == MYSQL_TYPE_YEAR) { if (max_length == 2) @@ -1239,7 +1240,8 @@ bool Item::get_date(MYSQL_TIME *ltime,uint fuzzydate) } value*= 10000; /* make it YYYYMMHH */ } - if (null_value || int_to_datetime_with_warn(value, ltime, fuzzydate, + if (null_value || int_to_datetime_with_warn(neg, neg ? -value : value, + ltime, fuzzydate, field_name_or_null())) goto err; break; diff --git a/sql/item_func.cc b/sql/item_func.cc index a4f713a16b0..fc69fa711c2 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1088,7 +1088,9 @@ bool Item_func_hybrid_result_type::get_date(MYSQL_TIME *ltime, uint fuzzydate) case INT_RESULT: { longlong value= int_op(); - if (null_value || int_to_datetime_with_warn(value, ltime, fuzzydate, + bool neg= !unsigned_flag && value < 0; + if (null_value || int_to_datetime_with_warn(neg, neg ? -value : value, + ltime, fuzzydate, field_name_or_null())) goto err; break; diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 4044ee3cd19..4a58ad339e2 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -4149,8 +4149,10 @@ bool Item_dyncol_get::get_date(MYSQL_TIME *ltime, uint fuzzy_date) case DYN_COL_UINT: if (signed_value || val.x.ulong_value <= LONGLONG_MAX) { - if (int_to_datetime_with_warn(val.x.ulong_value, ltime, fuzzy_date, - 0 /* TODO */)) + bool neg= val.x.ulong_value > LONGLONG_MAX; + if (int_to_datetime_with_warn(neg, neg ? -val.x.ulong_value : + val.x.ulong_value, + ltime, fuzzy_date, 0 /* TODO */)) goto null; return 0; } diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index fbc7bc36842..bb93fc08faa 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1206,6 +1206,18 @@ bool get_interval_value(Item *args,interval_type int_type, if (!(val= args->val_decimal(&decimal_value))) return true; interval->neg= my_decimal2seconds(val, &second, &second_part); + if (second == LONGLONG_MAX) + { + char buff[DECIMAL_MAX_STR_LENGTH]; + int length= sizeof(buff); + decimal2string(val, buff, &length, 0, 0, 0); + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_TRUNCATED_WRONG_VALUE, + ER(ER_TRUNCATED_WRONG_VALUE), "DECIMAL", + buff); + return true; + } + interval->second= second; interval->second_part= second_part; return false; diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 2f04f02064c..0a64f654863 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -876,10 +876,13 @@ public: class Lazy_string_num : public Lazy_string { - longlong num; + longlong m_value; + bool m_unsigned; public: - Lazy_string_num(longlong num_arg) : Lazy_string(), num(num_arg) {} - void copy_to(String *dst) const { dst->set(num, &my_charset_bin); } + Lazy_string_num(longlong num_arg, bool unsigned_flag= false) : + Lazy_string(), m_value(num_arg), m_unsigned(unsigned_flag) {} + void copy_to(String *dst) const + { dst->set_int(m_value, m_unsigned, &my_charset_bin); } }; class Lazy_string_decimal: public Lazy_string @@ -2540,7 +2543,7 @@ bool double_to_datetime_with_warn(double value, MYSQL_TIME *ltime, ulong fuzzydate, const char *field_name); bool decimal_to_datetime_with_warn(const my_decimal *value, MYSQL_TIME *ltime, ulong fuzzydate, const char *field_name); -bool int_to_datetime_with_warn(longlong value, MYSQL_TIME *ltime, +bool int_to_datetime_with_warn(bool neg, ulonglong value, MYSQL_TIME *ltime, ulong fuzzydate, const char *field_name); static inline void make_truncated_value_warning(THD *thd, diff --git a/sql/time.cc b/sql/time.cc index b91ddad6cd4..ab36db40bfe 100644 --- a/sql/time.cc +++ b/sql/time.cc @@ -291,20 +291,23 @@ static bool number_to_time_with_warn(bool neg, ulonglong nr, ulong sec_part, int was_cut; longlong res; enum_field_types f_type; + bool have_warnings; if (fuzzydate & TIME_TIME_ONLY) { fuzzydate= TIME_TIME_ONLY; // clear other flags f_type= MYSQL_TYPE_TIME; res= number_to_time(neg, nr, sec_part, ltime, &was_cut); + have_warnings= MYSQL_TIME_WARN_HAVE_WARNINGS(was_cut); } else { f_type= MYSQL_TYPE_DATETIME; res= neg ? -1 : number_to_datetime(nr, sec_part, ltime, fuzzydate, &was_cut); + have_warnings= was_cut && (fuzzydate & TIME_NO_ZERO_IN_DATE); } - if (res < 0 || (was_cut && (fuzzydate & TIME_NO_ZERO_IN_DATE))) + if (res < 0 || have_warnings) { make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, str, @@ -347,12 +350,11 @@ bool decimal_to_datetime_with_warn(const my_decimal *value, MYSQL_TIME *ltime, } -bool int_to_datetime_with_warn(longlong value, MYSQL_TIME *ltime, +bool int_to_datetime_with_warn(bool neg, ulonglong value, MYSQL_TIME *ltime, ulong fuzzydate, const char *field_name) { - const Lazy_string_num str(value); - bool neg= value < 0; - return number_to_time_with_warn(neg, neg ? -value : value, 0, ltime, + const Lazy_string_num str(neg ? -value : value, !neg); + return number_to_time_with_warn(neg, value, 0, ltime, fuzzydate, &str, field_name); } From 30b007a1ab5dd950fe451d78c29805f09cc0b98f Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Thu, 5 Jun 2014 09:01:05 +0400 Subject: [PATCH 50/52] Fixing a valgrind warning introduced in the previous changeset: "have_warnings" was set to an uninialized value when converting a negative number to datetime. --- sql/time.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sql/time.cc b/sql/time.cc index ab36db40bfe..2cb3befe5a2 100644 --- a/sql/time.cc +++ b/sql/time.cc @@ -303,8 +303,15 @@ static bool number_to_time_with_warn(bool neg, ulonglong nr, ulong sec_part, else { f_type= MYSQL_TYPE_DATETIME; - res= neg ? -1 : number_to_datetime(nr, sec_part, ltime, fuzzydate, &was_cut); - have_warnings= was_cut && (fuzzydate & TIME_NO_ZERO_IN_DATE); + if (neg) + { + res= -1; + } + else + { + res= number_to_datetime(nr, sec_part, ltime, fuzzydate, &was_cut); + have_warnings= was_cut && (fuzzydate & TIME_NO_ZERO_IN_DATE); + } } if (res < 0 || have_warnings) From c7e5a1f70d15cba2424f66e5a55d4d7fef445fab Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Thu, 5 Jun 2014 19:18:35 +0400 Subject: [PATCH 51/52] MDEV-6105: Emoji unicode character string search query makes mariadb performance down - When range optimizer cannot the lookup value into [VAR]CHAR(n) column, it should produce: = "Impossible range" for equality = "no range" for non-equalities. --- mysql-test/r/range.result | 54 +++++++++++++++++++++++++++++++++++++++ mysql-test/t/range.test | 38 +++++++++++++++++++++++++++ sql/opt_range.cc | 11 ++++++++ 3 files changed, 103 insertions(+) diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index d41bfaa2c67..21acfee897e 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -2046,3 +2046,57 @@ f1 f2 f3 f4 10 0 0 0 DROP TABLE t1; DROP VIEW v3; +# +# MDEV-6105: Emoji unicode character string search query makes mariadb performance down +# +SET NAMES utf8; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1( +id int AUTO_INCREMENT, +fd varchar(20), +primary key(id), +index ix_fd(fd) +)engine=innodb default charset=UTF8; +INSERT INTO t1(id, fd) VALUES (null, ''),(null, 'matt'),(null, 'pitt'),(null, 'lee'),(null, 'kim'); +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +# The following should show "Impossible WHERE" : +explain +SELECT * FROM t1 WHERE fd='😁'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1 +SELECT * FROM t1 WHERE fd='😁'; +id fd +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1 +# The following must not use range access: +explain select count(*) from t1 where fd <'😁'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ix_fd ix_fd 63 NULL 41410 Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1 +select count(*) from t1 where fd <'😁'; +count(*) +40960 +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1 +select count(*) from t1 ignore index (ix_fd) where fd <'😁'; +count(*) +40960 +drop table t1; +set names default; diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index dc9ca0012fe..5791509a739 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -1638,3 +1638,41 @@ UPDATE v3 SET f3=0, f4=4 WHERE f2=68 ORDER BY f1; SELECT * FROM v3; DROP TABLE t1; DROP VIEW v3; + +--echo # +--echo # MDEV-6105: Emoji unicode character string search query makes mariadb performance down +--echo # +SET NAMES utf8; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1( +id int AUTO_INCREMENT, +fd varchar(20), +primary key(id), +index ix_fd(fd) +)engine=innodb default charset=UTF8; +INSERT INTO t1(id, fd) VALUES (null, ''),(null, 'matt'),(null, 'pitt'),(null, 'lee'),(null, 'kim'); +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +--echo # The following should show "Impossible WHERE" : +explain +SELECT * FROM t1 WHERE fd='😁'; +SELECT * FROM t1 WHERE fd='😁'; + +--echo # The following must not use range access: +explain select count(*) from t1 where fd <'😁'; +select count(*) from t1 where fd <'😁'; +select count(*) from t1 ignore index (ix_fd) where fd <'😁'; + +drop table t1; +set names default; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 66bd287d86a..5db080394eb 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -7775,6 +7775,17 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field, if (field->cmp_type() == STRING_RESULT && value->cmp_type() != STRING_RESULT) goto end; err= value->save_in_field_no_warnings(field, 1); + if (err == 2 && field->cmp_type() == STRING_RESULT) + { + if (type == Item_func::EQ_FUNC) + { + tree= new (alloc) SEL_ARG(field, 0, 0); + tree->type= SEL_ARG::IMPOSSIBLE; + } + else + tree= NULL; /* Cannot infer anything */ + goto end; + } if (err > 0) { if (field->cmp_type() != value->result_type()) From 6d75570e99fbf070cdbeefdfbcfc94d1c7b3ad1f Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 5 Jun 2014 19:25:51 +0200 Subject: [PATCH 52/52] fix range.test --- mysql-test/r/range.result | 2 +- mysql-test/r/range_mrr_icp.result | 54 +++++++++++++++++++++++++++++++ mysql-test/t/range.test | 1 + 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index 21acfee897e..3942f517e7c 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -2087,7 +2087,7 @@ Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1 # The following must not use range access: explain select count(*) from t1 where fd <'😁'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ix_fd ix_fd 63 NULL 41410 Using where; Using index +1 SIMPLE t1 index ix_fd ix_fd 63 NULL # Using where; Using index Warnings: Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1 select count(*) from t1 where fd <'😁'; diff --git a/mysql-test/r/range_mrr_icp.result b/mysql-test/r/range_mrr_icp.result index a5c14d99975..11a1687e5bf 100644 --- a/mysql-test/r/range_mrr_icp.result +++ b/mysql-test/r/range_mrr_icp.result @@ -2048,4 +2048,58 @@ f1 f2 f3 f4 10 0 0 0 DROP TABLE t1; DROP VIEW v3; +# +# MDEV-6105: Emoji unicode character string search query makes mariadb performance down +# +SET NAMES utf8; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1( +id int AUTO_INCREMENT, +fd varchar(20), +primary key(id), +index ix_fd(fd) +)engine=innodb default charset=UTF8; +INSERT INTO t1(id, fd) VALUES (null, ''),(null, 'matt'),(null, 'pitt'),(null, 'lee'),(null, 'kim'); +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +INSERT INTO t1 (fd) SELECT fd FROM t1; +# The following should show "Impossible WHERE" : +explain +SELECT * FROM t1 WHERE fd='😁'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1 +SELECT * FROM t1 WHERE fd='😁'; +id fd +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1 +# The following must not use range access: +explain select count(*) from t1 where fd <'😁'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ix_fd ix_fd 63 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1 +select count(*) from t1 where fd <'😁'; +count(*) +40960 +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1 +select count(*) from t1 ignore index (ix_fd) where fd <'😁'; +count(*) +40960 +drop table t1; +set names default; set optimizer_switch=@mrr_icp_extra_tmp; diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 5791509a739..0b8e1a9b3f3 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -1670,6 +1670,7 @@ SELECT * FROM t1 WHERE fd='😁'; SELECT * FROM t1 WHERE fd='😁'; --echo # The following must not use range access: +--replace_column 9 # explain select count(*) from t1 where fd <'😁'; select count(*) from t1 where fd <'😁'; select count(*) from t1 ignore index (ix_fd) where fd <'😁';