From ff6f4d7db11c1b8960376de3035b9e498fac5d34 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 3 Apr 2017 15:18:46 +0000 Subject: [PATCH 01/38] Windows : Fix compiling with VS2013 We do not use it now, but there is still no reason to break compilation for other users. --- storage/xtradb/btr/btr0cur.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/storage/xtradb/btr/btr0cur.cc b/storage/xtradb/btr/btr0cur.cc index 1705de7ce3657..dcb197a761fcf 100644 --- a/storage/xtradb/btr/btr0cur.cc +++ b/storage/xtradb/btr/btr0cur.cc @@ -3863,7 +3863,7 @@ static const unsigned rows_in_range_max_retries = 4; /** We pretend that a range has that many records if the tree keeps changing for rows_in_range_max_retries retries while we try to estimate the records in a given range. */ -static const int64_t rows_in_range_arbitrary_ret_val = 10; +static const ib_int64_t rows_in_range_arbitrary_ret_val = 10; /** Estimates the number of rows in a given index range. @param[in] index index @@ -3881,7 +3881,7 @@ rows_in_range_arbitrary_ret_val as a result (if nth_attempt >= rows_in_range_max_retries and the tree is modified between the two dives). */ static -int64_t +ib_int64_t btr_estimate_n_rows_in_range_low( dict_index_t* index, const dtuple_t* tuple1, @@ -4017,7 +4017,7 @@ btr_estimate_n_rows_in_range_low( return(rows_in_range_arbitrary_ret_val); } - const int64_t ret = + const ib_int64_t ret = btr_estimate_n_rows_in_range_low( index, tuple1, mode1, tuple2, mode2, trx, @@ -4083,7 +4083,7 @@ btr_estimate_n_rows_in_range_low( @param[in] mode2 search mode for range end @param[in] trx trx @return estimated number of rows */ -int64_t +ib_int64_t btr_estimate_n_rows_in_range( dict_index_t* index, const dtuple_t* tuple1, @@ -4092,7 +4092,7 @@ btr_estimate_n_rows_in_range( ulint mode2, trx_t* trx) { - const int64_t ret = btr_estimate_n_rows_in_range_low( + const ib_int64_t ret = btr_estimate_n_rows_in_range_low( index, tuple1, mode1, tuple2, mode2, trx, 1 /* first attempt */); From f2dc04abea172e4c5d701a749902c88f4a626c2c Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 3 Apr 2017 18:48:48 +0000 Subject: [PATCH 02/38] Compiling, Windows . Avoid unnecessary rebuilds with MSVC. To export symbols from the mysqld.exe, use lib.exe with /DEF, rather than pre-link step when building mysqld.exe. This helps to avoid relinking all plugins, if mysqld.exe was recompiled but the list of its exports has not changed. Also removed unnecessary DEPENDS in some ADD_CUSTOM_COMMAND (gen_lex_token, gen_lex_hash etc). They confuse VS generator which tends to recreate headers and do unnecessary recompilations. --- cmake/plugin.cmake | 11 +++++- sql/CMakeLists.txt | 83 +++++++++++++++++++++++++++++++----------- win/create_def_file.js | 46 ++++++++++++++++++++--- 3 files changed, 111 insertions(+), 29 deletions(-) diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index e1d2af2add645..ba7bac837b1c5 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -179,8 +179,15 @@ MACRO(MYSQL_ADD_PLUGIN) # executable to the linker command line (it would result into link error). # Thus we skip TARGET_LINK_LIBRARIES on Linux, as it would only generate # an additional dependency. - IF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux") - TARGET_LINK_LIBRARIES (${target} mysqld ${ARG_LINK_LIBRARIES}) + IF(MSVC) + ADD_DEPENDENCIES(${target} gen_mysqld_lib) + TARGET_LINK_LIBRARIES(${target} mysqld_import_lib) + ELSEIF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux") + TARGET_LINK_LIBRARIES (${target} mysqld) + ENDIF() + + IF(ARG_LINK_LIBRARIES) + TARGET_LINK_LIBRARIES (${target} ${ARG_LINK_LIBRARIES}) ENDIF() ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDENCIES}) diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 652664fa43818..5cdf597301fad 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -46,7 +46,6 @@ ENDIF() ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h COMMAND gen_lex_token > lex_token.h - DEPENDS gen_lex_token ) ADD_DEFINITIONS(-DMYSQL_SERVER -DHAVE_EVENT_SCHEDULER) @@ -150,6 +149,63 @@ ELSE() SET(MYSQLD_SOURCE main.cc ${DTRACE_PROBES_ALL}) ENDIF() + +IF(MSVC AND NOT WITHOUT_DYNAMIC_PLUGINS) + + # mysqld.exe must to export symbols from some specific libs. + # These symbols are used by dynamic plugins, that "link" to mysqld. + # + # To do that, we + # + # 1. Generate mysqld_lib.def text file with all symbols from static + # libraries mysys, dbug, strings, sql. + # 2. Then we call + # lib.exe /DEF:mysqld_lib.def ... + # to create import library mysqld_lib.lib and export library mysqld_lib.exp + # 3. mysqld.exe links with mysqld_lib.exp (exporting symbols) + # 4. plugins link with mysqld_lib.lib (importing symbols) + # + # We do not not regenerate .def, .lib and .exp + # without necessity.E.g source modifications, that do not + # change list of exported symbols, will not result in a relink for plugins. + + SET(MYSQLD_DEF ${CMAKE_CURRENT_BINARY_DIR}/mysqld_lib.def) + SET(MYSQLD_EXP ${CMAKE_CURRENT_BINARY_DIR}/mysqld_lib.exp) + SET(MYSQLD_LIB ${CMAKE_CURRENT_BINARY_DIR}/mysqld_lib.lib) + SET(MYSQLD_CORELIBS sql mysys mysys_ssl dbug strings) + FOREACH (CORELIB ${MYSQLD_CORELIBS}) + GET_TARGET_PROPERTY(LOC ${CORELIB} LOCATION) + FILE(TO_NATIVE_PATH ${LOC} LOC) + SET (LIB_LOCATIONS ${LIB_LOCATIONS} ${LOC}) + ENDFOREACH (CORELIB) + + SET(_PLATFORM x86) + IF(CMAKE_SIZEOF_VOID_P EQUAL 8) + SET(_PLATFORM x64) + ENDIF() + + ADD_CUSTOM_COMMAND( + OUTPUT ${MYSQLD_DEF} + COMMAND cscript ARGS //nologo ${PROJECT_SOURCE_DIR}/win/create_def_file.js + ${_PLATFORM} /forLib ${LIB_LOCATIONS} > mysqld_lib.def.tmp + COMMAND ${CMAKE_COMMAND} -E copy_if_different mysqld_lib.def.tmp mysqld_lib.def + COMMAND ${CMAKE_COMMAND} -E remove mysqld_lib.def.tmp + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${MYSQLD_CORELIBS} + ) + + ADD_CUSTOM_COMMAND( + OUTPUT ${MYSQLD_LIB} + COMMAND lib + ARGS /NAME:mysqld.exe "/DEF:${MYSQLD_DEF}" "/MACHINE:${_PLATFORM}" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${MYSQLD_DEF} + ) + ADD_CUSTOM_TARGET(gen_mysqld_lib DEPENDS ${MYSQLD_LIB}) + ADD_LIBRARY(mysqld_import_lib UNKNOWN IMPORTED GLOBAL) + SET_TARGET_PROPERTIES(mysqld_import_lib PROPERTIES IMPORTED_LOCATION ${MYSQLD_LIB}) +ENDIF() + MYSQL_ADD_EXECUTABLE(mysqld ${MYSQLD_SOURCE} DESTINATION ${INSTALL_SBINDIR} COMPONENT Server) IF(APPLE) @@ -170,25 +226,9 @@ IF(NOT WITHOUT_DYNAMIC_PLUGINS) SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_FLAGS "${mysqld_link_flags} -Wl,--export-all-symbols") ENDIF() IF(MSVC) - # Set module definition file. Also use non-incremental linker, - # incremental appears to crash from time to time,if used with /DEF option - SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_FLAGS "${mysqld_link_flags} /DEF:mysqld.def /INCREMENTAL:NO") - - FOREACH (CORELIB sql mysys mysys_ssl dbug strings) - GET_TARGET_PROPERTY(LOC ${CORELIB} LOCATION) - FILE(TO_NATIVE_PATH ${LOC} LOC) - SET (LIB_LOCATIONS ${LIB_LOCATIONS} ${LOC}) - ENDFOREACH (CORELIB ${MYSQLD_CORE_LIBS}) - SET(_PLATFORM x86) - IF(CMAKE_SIZEOF_VOID_P EQUAL 8) - SET(_PLATFORM x64) - ENDIF() - ADD_CUSTOM_COMMAND(TARGET mysqld PRE_LINK - COMMAND echo ${_PLATFORM} && cscript ARGS //nologo ${PROJECT_SOURCE_DIR}/win/create_def_file.js - ${_PLATFORM} ${LIB_LOCATIONS} > mysqld.def - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - ADD_DEPENDENCIES(sql GenError) - ENDIF(MSVC) + SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_FLAGS "${mysqld_link_flags} \"${MYSQLD_EXP}\"") + ADD_DEPENDENCIES(mysqld gen_mysqld_lib) + ENDIF() ENDIF(NOT WITHOUT_DYNAMIC_PLUGINS) SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE) @@ -254,7 +294,6 @@ ENDIF() ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h COMMAND gen_lex_hash > lex_hash.h - DEPENDS gen_lex_hash ) MYSQL_ADD_EXECUTABLE(mysql_tzinfo_to_sql tztime.cc COMPONENT Server) @@ -379,7 +418,7 @@ IF(WIN32) ${CMAKE_CURRENT_BINARY_DIR}/my_bootstrap.sql mysql_bootstrap_sql.c WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS comp_sql ${my_bootstrap_sql} + DEPENDS ${my_bootstrap_sql} ) MYSQL_ADD_EXECUTABLE(mysql_install_db diff --git a/win/create_def_file.js b/win/create_def_file.js index 5fb28ef0bee8f..25bbbb4eb3d50 100644 --- a/win/create_def_file.js +++ b/win/create_def_file.js @@ -54,6 +54,22 @@ var is64 = args.Item(0).toLowerCase() == "x64"; var shell = new ActiveXObject("WScript.Shell"); var fso = new ActiveXObject("Scripting.FileSystemObject"); +/* + If .def file is used with together with lib.exe + the name mangling for stdcall is slightly different. + + Undescore prefix for stdcall function name must be removed for + lib.exe but not link.exe (see ScrubSymbol()) + + This difference is not documented anywhere and could + be a bug in compiler tools. + + We use a parameter /forLib, if the resulting .def file is used + with lib.exe . +*/ +var forLib = false; + + OutputSymbols(CollectSymbols()); @@ -62,8 +78,8 @@ function OutputSymbols(symbols) { var out = WScript.StdOut; out.WriteLine("EXPORTS"); - for (var sym in symbols) - out.WriteLine(sym); + for (var i= 0; i < symbols.length; i++) + out.WriteLine(symbols[i]); } function echo(message) @@ -72,9 +88,10 @@ function echo(message) } // Extract global symbol names and type from objects +// Returns string array with symbol names function CollectSymbols() { - var uniqueSymbols = new Array(); + var uniqueSymbols = new Object(); try { @@ -146,7 +163,19 @@ function CollectSymbols() uniqueSymbols[symbol] = 1; } fso.DeleteFile(rspfilename); - return uniqueSymbols; + // Sort symbols names + var keys=[]; + var sorted = {}; + for (key in uniqueSymbols) + { + if (uniqueSymbols.hasOwnProperty(key)) + { + keys.push(key); + } + } + keys.sort(); + + return keys; } // performs necessary cleanup on the symbol name @@ -156,6 +185,9 @@ function ScrubSymbol(symbol) if (symbol.charAt(0) != "_") return symbol; + if (forLib) + return symbol.substring(1, symbol.length); + var atSign = symbol.indexOf("@"); if (atSign != -1) { @@ -189,7 +221,11 @@ function CreateResponseFile(filename) var index = 1; for (; index < args.length; index++) { - addToResponseFile(args.Item(index),responseFile); + var param = args.Item(index); + if (param == "/forLib") + forLib = true; + else + addToResponseFile(args.Item(index),responseFile); } responseFile.Close(); } From 9a218f4fb871c1169dd6015a3be9d965929dbd1f Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Tue, 4 Apr 2017 15:47:21 +1000 Subject: [PATCH 03/38] fil_crypt_rotate_page - space_id should be compared to TRX_SYS_SPACE not space Fixes compile error that highlights problem: /source/storage/innobase/fil/fil0crypt.cc: In function 'void fil_crypt_rotate_page(const key_state_t*, rotate_thread_t*)': /source/storage/innobase/fil/fil0crypt.cc:1770:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] if (space == TRX_SYS_SPACE && offset == TRX_SYS_PAGE_NO) { Signed-off-by: Daniel Black --- storage/innobase/fil/fil0crypt.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index 7bef91f47ff87..9c5f782da32fa 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -1951,7 +1951,7 @@ fil_crypt_rotate_page( return; } - if (space == TRX_SYS_SPACE && offset == TRX_SYS_PAGE_NO) { + if (space_id == TRX_SYS_SPACE && offset == TRX_SYS_PAGE_NO) { /* don't encrypt this as it contains address to dblwr buffer */ return; } From a7bb9e8fdbdd5a3a01910117ef54c0fe09374de2 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 5 Apr 2017 16:29:08 +1000 Subject: [PATCH 04/38] xtradb: fil_crypt_rotate_page, space_id should be compared to TRX_SYS_SPACE not space like 9a218f4fb871c1169dd6015a3be9d965929dbd1f fil_crypt_rotate_page - space_id should be compared to TRX_SYS_SPACE not space Signed-off-by: Daniel Black --- storage/xtradb/fil/fil0crypt.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/xtradb/fil/fil0crypt.cc b/storage/xtradb/fil/fil0crypt.cc index 7bef91f47ff87..9c5f782da32fa 100644 --- a/storage/xtradb/fil/fil0crypt.cc +++ b/storage/xtradb/fil/fil0crypt.cc @@ -1951,7 +1951,7 @@ fil_crypt_rotate_page( return; } - if (space == TRX_SYS_SPACE && offset == TRX_SYS_PAGE_NO) { + if (space_id == TRX_SYS_SPACE && offset == TRX_SYS_PAGE_NO) { /* don't encrypt this as it contains address to dblwr buffer */ return; } From cd494f4cefb36faa9e4fa343050a30201d4bdebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Wed, 5 Apr 2017 08:54:20 +0300 Subject: [PATCH 05/38] fix warning "ignoring return value" of fwrite. Merge pull request https://github.com/MariaDB/server/pull/343 contributed by Eric Herman. --- sql/wsrep_binlog.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sql/wsrep_binlog.cc b/sql/wsrep_binlog.cc index d3f59cee5f2d6..b6aee3a74abd9 100644 --- a/sql/wsrep_binlog.cc +++ b/sql/wsrep_binlog.cc @@ -329,9 +329,13 @@ void wsrep_dump_rbr_buf(THD *thd, const void* rbr_buf, size_t buf_len) } FILE *of= fopen(filename, "wb"); + if (of) { - fwrite (rbr_buf, buf_len, 1, of); + if (fwrite(rbr_buf, buf_len, 1, of) == 0) + WSREP_ERROR("Failed to write buffer of length %llu to '%s'", + (unsigned long long)buf_len, filename); + fclose(of); } else From 8e36216a06603942613f8157b9b790e98f90d608 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 5 Apr 2017 14:46:35 +0300 Subject: [PATCH 06/38] =?UTF-8?q?Import=20two=20ALTER=20TABLE=E2=80=A6ALGO?= =?UTF-8?q?RITHM=3DINPLACE=20tests=20from=20MySQL=205.6.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also, revert part of MDEV-7685 that added an InnoDB abort when ALTER TABLE…ALGORITHM=INPLACE is reporting that it ran out of file space. --- .../suite/innodb/r/innodb-alter-debug.result | 56 +++++++++++++ .../innodb/r/innodb-alter-nullable.result | 53 +++++++++++++ .../suite/innodb/t/innodb-alter-debug.test | 79 +++++++++++++++++++ .../suite/innodb/t/innodb-alter-nullable.test | 76 ++++++++++++++++++ storage/innobase/handler/handler0alter.cc | 1 - storage/xtradb/handler/handler0alter.cc | 1 - 6 files changed, 264 insertions(+), 2 deletions(-) create mode 100644 mysql-test/suite/innodb/r/innodb-alter-debug.result create mode 100644 mysql-test/suite/innodb/r/innodb-alter-nullable.result create mode 100644 mysql-test/suite/innodb/t/innodb-alter-debug.test create mode 100644 mysql-test/suite/innodb/t/innodb-alter-nullable.test diff --git a/mysql-test/suite/innodb/r/innodb-alter-debug.result b/mysql-test/suite/innodb/r/innodb-alter-debug.result new file mode 100644 index 0000000000000..78976030ac8fc --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-alter-debug.result @@ -0,0 +1,56 @@ +SET NAMES utf8; +CREATE TABLE ① ( +c1 INT PRIMARY KEY, c2 INT DEFAULT 1, ct TEXT, INDEX(c2)) +ENGINE = InnoDB; +CREATE TABLE t1ć (c1 INT PRIMARY KEY, c2 INT, INDEX(c2), +CONSTRAINT t1c2 FOREIGN KEY (c2) REFERENCES ①(c2)) +ENGINE=InnoDB; +INSERT INTO ① SET c1 = 1; +SET @saved_debug_dbug = @@SESSION.debug_dbug; +SET DEBUG_DBUG = '+d,ib_drop_foreign_error'; +ALTER TABLE t1ć DROP FOREIGN KEY t1c2, RENAME TO ②; +ERROR HY000: The table 't1ć' is full +SET DEBUG_DBUG = @saved_debug_dbug; +SET DEBUG_DBUG = '+d,ib_rename_column_error'; +ALTER TABLE ① CHANGE c2 š INT; +ERROR HY000: The table '①' is full +SET DEBUG_DBUG = @saved_debug_dbug; +SHOW CREATE TABLE t1ć; +Table Create Table +t1ć CREATE TABLE `t1ć` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2` (`c2`), + CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `①` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1ć, ①; +# +# Bug #21364096 THE BOGUS DUPLICATE KEY ERROR IN ONLINE DDL +# WITH INCORRECT KEY NAME +create table t1 (id int auto_increment primary key, a int, unique key uk(a)) +engine = innodb; +insert into t1 select 1, 1; +insert into t1 select 2, 2; +SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL s1 WAIT_FOR s2'; +alter table t1 add b int, ALGORITHM=inplace; +/* connection con1 */ +SET DEBUG_SYNC = 'now WAIT_FOR s1'; +insert into t1 select NULL, 1; +ERROR 23000: Duplicate entry '1' for key 'uk' +SET DEBUG_SYNC = 'now SIGNAL s2'; +/* connection default */ +/* reap */ alter table t1 add b int, ALGORITHM=inplace; +ERROR 23000: Duplicate entry '1' for key 'uk' +SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL s1 WAIT_FOR s2'; +alter table t1 add b int, ALGORITHM=inplace;; +/* connection con1 */ +set DEBUG_SYNC = 'now WAIT_FOR s1'; +update t1 set a=1 where id=2; +ERROR 23000: Duplicate entry '1' for key 'uk' +SET DEBUG_SYNC = 'now SIGNAL s2'; +/* connection default */ +/* reap */ alter table t1 add b int, ALGORITHM=inplace; +ERROR 23000: Duplicate entry '1' for key 'uk' +SET DEBUG_SYNC = 'RESET'; +drop table t1; diff --git a/mysql-test/suite/innodb/r/innodb-alter-nullable.result b/mysql-test/suite/innodb/r/innodb-alter-nullable.result new file mode 100644 index 0000000000000..e9711b2ac31bd --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-alter-nullable.result @@ -0,0 +1,53 @@ +CREATE TABLE t (c1 INT PRIMARY KEY, c2 INT NOT NULL, c3 INT) ENGINE=InnoDB; +INSERT INTO t VALUES (1,2,3),(4,5,6),(7,8,9); +ALTER TABLE t CHANGE c1 c1 INT NULL FIRST, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +set @old_sql_mode = @@sql_mode; +set @@sql_mode = 'STRICT_TRANS_TABLES'; +ALTER TABLE t MODIFY c3 INT NOT NULL, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +set @@sql_mode = @old_sql_mode; +ALTER TABLE t CHANGE c2 c2 INT, CHANGE c2 c2 INT NOT NULL; +ERROR 42S22: Unknown column 'c2' in 't' +ALTER TABLE t MODIFY c2 INT, MODIFY c2 INT NOT NULL; +ERROR 42S22: Unknown column 'c2' in 't' +ALTER TABLE t MODIFY c2 INT UNSIGNED, MODIFY c2 INT; +ERROR 42S22: Unknown column 'c2' in 't' +ALTER TABLE t MODIFY c2 CHAR(1) NOT NULL, MODIFY c2 INT NOT NULL; +ERROR 42S22: Unknown column 'c2' in 't' +ALTER TABLE t CHANGE c2 c2 INT NOT NULL; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t MODIFY c2 INT NOT NULL; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SET SQL_MODE='STRICT_ALL_TABLES'; +UPDATE t SET c2=NULL; +ERROR 23000: Column 'c2' cannot be null +SELECT * FROM t; +c1 c2 c3 +1 2 3 +4 5 6 +7 8 9 +ALTER TABLE t MODIFY c2 INT, ALGORITHM=INPLACE; +BEGIN; +UPDATE t SET c2=NULL; +SELECT * FROM t; +c1 c2 c3 +1 NULL 3 +4 NULL 6 +7 NULL 9 +ROLLBACK; +SELECT * FROM t; +c1 c2 c3 +1 2 3 +4 5 6 +7 8 9 +ALTER TABLE t MODIFY c2 INT NULL, ALGORITHM=INPLACE; +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES +WHERE NAME='test/t'; +TABLE_ID NAME FLAG N_COLS SPACE FILE_FORMAT ROW_FORMAT ZIP_PAGE_SIZE +# test/t 1 6 # Antelope Compact 0 +DROP TABLE t; diff --git a/mysql-test/suite/innodb/t/innodb-alter-debug.test b/mysql-test/suite/innodb/t/innodb-alter-debug.test new file mode 100644 index 0000000000000..70017ffba3543 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb-alter-debug.test @@ -0,0 +1,79 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +--source include/count_sessions.inc + +SET NAMES utf8; + +CREATE TABLE ① ( + c1 INT PRIMARY KEY, c2 INT DEFAULT 1, ct TEXT, INDEX(c2)) +ENGINE = InnoDB; + +CREATE TABLE t1ć (c1 INT PRIMARY KEY, c2 INT, INDEX(c2), + CONSTRAINT t1c2 FOREIGN KEY (c2) REFERENCES ①(c2)) +ENGINE=InnoDB; + +INSERT INTO ① SET c1 = 1; + +SET @saved_debug_dbug = @@SESSION.debug_dbug; +SET DEBUG_DBUG = '+d,ib_drop_foreign_error'; +--error ER_RECORD_FILE_FULL +ALTER TABLE t1ć DROP FOREIGN KEY t1c2, RENAME TO ②; +SET DEBUG_DBUG = @saved_debug_dbug; + +SET DEBUG_DBUG = '+d,ib_rename_column_error'; +--error ER_RECORD_FILE_FULL +ALTER TABLE ① CHANGE c2 š INT; +SET DEBUG_DBUG = @saved_debug_dbug; + +SHOW CREATE TABLE t1ć; + +DROP TABLE t1ć, ①; + +--echo # +--echo # Bug #21364096 THE BOGUS DUPLICATE KEY ERROR IN ONLINE DDL +--echo # WITH INCORRECT KEY NAME + +create table t1 (id int auto_increment primary key, a int, unique key uk(a)) +engine = innodb; +insert into t1 select 1, 1; +insert into t1 select 2, 2; +SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL s1 WAIT_FOR s2'; +--send alter table t1 add b int, ALGORITHM=inplace + +--echo /* connection con1 */ +connect (con1,localhost,root,,); +SET DEBUG_SYNC = 'now WAIT_FOR s1'; +--error ER_DUP_ENTRY +insert into t1 select NULL, 1; +SET DEBUG_SYNC = 'now SIGNAL s2'; + +--echo /* connection default */ +connection default; +--echo /* reap */ alter table t1 add b int, ALGORITHM=inplace; +--error ER_DUP_ENTRY +--reap + +SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL s1 WAIT_FOR s2'; +--send alter table t1 add b int, ALGORITHM=inplace; + +--echo /* connection con1 */ +connection con1; +set DEBUG_SYNC = 'now WAIT_FOR s1'; +--error ER_DUP_ENTRY +update t1 set a=1 where id=2; +SET DEBUG_SYNC = 'now SIGNAL s2'; +disconnect con1; + +--echo /* connection default */ +connection default; +--echo /* reap */ alter table t1 add b int, ALGORITHM=inplace; +--error ER_DUP_ENTRY +--reap +SET DEBUG_SYNC = 'RESET'; + +drop table t1; + +# Wait till all disconnects are completed +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb/t/innodb-alter-nullable.test b/mysql-test/suite/innodb/t/innodb-alter-nullable.test new file mode 100644 index 0000000000000..3f1e82b3183d6 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb-alter-nullable.test @@ -0,0 +1,76 @@ +--source include/have_innodb.inc + +# Save the initial number of concurrent sessions. +--source include/count_sessions.inc + +CREATE TABLE t (c1 INT PRIMARY KEY, c2 INT NOT NULL, c3 INT) ENGINE=InnoDB; +INSERT INTO t VALUES (1,2,3),(4,5,6),(7,8,9); + +--enable_info +# This one will be a no-op. +# MySQL should perhaps issue an error, because it refuses to modify +# the PRIMARY KEY column c1 from NOT NULL to NULL. +ALTER TABLE t CHANGE c1 c1 INT NULL FIRST, ALGORITHM=INPLACE; + +# NULL -> NOT NULL only allowed INPLACE if strict sql_mode is on. +--disable_info +set @old_sql_mode = @@sql_mode; +set @@sql_mode = 'STRICT_TRANS_TABLES'; +--enable_info +ALTER TABLE t MODIFY c3 INT NOT NULL, ALGORITHM=INPLACE; +--disable_info +set @@sql_mode = @old_sql_mode; +--enable_info + +# Request some conflicting changes for a single column. +--error ER_BAD_FIELD_ERROR +ALTER TABLE t CHANGE c2 c2 INT, CHANGE c2 c2 INT NOT NULL; +--error ER_BAD_FIELD_ERROR +ALTER TABLE t MODIFY c2 INT, MODIFY c2 INT NOT NULL; +--error ER_BAD_FIELD_ERROR +ALTER TABLE t MODIFY c2 INT UNSIGNED, MODIFY c2 INT; +--error ER_BAD_FIELD_ERROR +ALTER TABLE t MODIFY c2 CHAR(1) NOT NULL, MODIFY c2 INT NOT NULL; + +# No-ops. +ALTER TABLE t CHANGE c2 c2 INT NOT NULL; +ALTER TABLE t MODIFY c2 INT NOT NULL; +--disable_info + +connect (con1,localhost,root,,); +connection con1; + +SET SQL_MODE='STRICT_ALL_TABLES'; + +--error ER_BAD_NULL_ERROR +UPDATE t SET c2=NULL; + +SELECT * FROM t; + +connection default; + +# This should change the column to NULL. +ALTER TABLE t MODIFY c2 INT, ALGORITHM=INPLACE; + +connection con1; +BEGIN; +UPDATE t SET c2=NULL; +SELECT * FROM t; +ROLLBACK; +SELECT * FROM t; + +disconnect con1; +connection default; + +# This should be no-op. +ALTER TABLE t MODIFY c2 INT NULL, ALGORITHM=INPLACE; + +--replace_column 1 # 5 # +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES +WHERE NAME='test/t'; + +DROP TABLE t; + +# Check that all connections opened by test cases in this file are really +# gone so execution of other tests won't be affected by their presence. +--source include/wait_until_count_sessions.inc diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index cc00b841579d5..dc084dc1b9514 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -129,7 +129,6 @@ my_error_innodb( break; case DB_OUT_OF_FILE_SPACE: my_error(ER_RECORD_FILE_FULL, MYF(0), table); - ut_error; break; case DB_TEMP_FILE_WRITE_FAILURE: my_error(ER_GET_ERRMSG, MYF(0), diff --git a/storage/xtradb/handler/handler0alter.cc b/storage/xtradb/handler/handler0alter.cc index cfae2725b056e..3d20c9abccfa5 100644 --- a/storage/xtradb/handler/handler0alter.cc +++ b/storage/xtradb/handler/handler0alter.cc @@ -130,7 +130,6 @@ my_error_innodb( break; case DB_OUT_OF_FILE_SPACE: my_error(ER_RECORD_FILE_FULL, MYF(0), table); - ut_error; break; case DB_TEMP_FILE_WRITE_FAILURE: my_error(ER_GET_ERRMSG, MYF(0), From 35e582c917f7bee878ff45ff05cb440080112804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 5 Apr 2017 16:00:35 +0300 Subject: [PATCH 07/38] Adjust tests for the removal of kill_and_restart_mysqld.inc. --- mysql-test/suite/innodb/r/innodb-32k-crash.result | 1 - mysql-test/suite/innodb/r/innodb-64k-crash.result | 1 - mysql-test/suite/innodb/t/innodb-32k-crash.test | 4 +++- mysql-test/suite/innodb/t/innodb-64k-crash.test | 4 +++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb-32k-crash.result b/mysql-test/suite/innodb/r/innodb-32k-crash.result index d0bc25968c69f..83b8054831ac4 100644 --- a/mysql-test/suite/innodb/r/innodb-32k-crash.result +++ b/mysql-test/suite/innodb/r/innodb-32k-crash.result @@ -119,7 +119,6 @@ BEGIN; INSERT INTO t1 SELECT * from t2; BEGIN; UPDATE t1 SET a=@e,b=@e,c=@e,d=@e,e=@e; -# Kill and restart UPDATE t1 SET a=@f,b=@f,c=@f,d=@f,e=@f,f=@f,g=@f,h=@f,i=@f,j=@f, k=@f,l=@f,m=@f,n=@f,o=@f,p=@f,q=@f,r=@f,s=@f,t=@f,u=@f, v=@f,w=@f,x=@b,y=@f,z=@f, diff --git a/mysql-test/suite/innodb/r/innodb-64k-crash.result b/mysql-test/suite/innodb/r/innodb-64k-crash.result index bfeec58bda92a..138ad5345edd6 100644 --- a/mysql-test/suite/innodb/r/innodb-64k-crash.result +++ b/mysql-test/suite/innodb/r/innodb-64k-crash.result @@ -271,7 +271,6 @@ vb=@c,wb=@c,xb=@c,yb=@c,zb=@c, ac=@c,bc=@c,cc=@c,dc=@c,ec=@c,fc=@c,gc=@c,hc=@c,ic=@c,jc=@c, kc=@c,lc=@c,mc=@c,nc=@c,oc=@c,pc=@c,qc=@c,rc=@c,sc=@c,tc=@c,uc=@c, vc=@c,wc=@c,xc=@c,yc=@c,zc=@c; -# Kill and restart UPDATE t1 SET a=@e,b=@e,c=@e,d=@e,e=@e,f=@e,g=@e,h=@e,i=@e,j=@e, k=@e,l=@e,m=@e,n=@e,o=@e,p=@e,q=@e,r=@e,s=@e,t=@e,u=@e, v=@e,w=@e,x=@e,y=@e,z=@e, diff --git a/mysql-test/suite/innodb/t/innodb-32k-crash.test b/mysql-test/suite/innodb/t/innodb-32k-crash.test index c77e44ce9d6a2..b510c115dab65 100644 --- a/mysql-test/suite/innodb/t/innodb-32k-crash.test +++ b/mysql-test/suite/innodb/t/innodb-32k-crash.test @@ -144,7 +144,9 @@ INSERT INTO t1 SELECT * from t2; BEGIN; UPDATE t1 SET a=@e,b=@e,c=@e,d=@e,e=@e; ---source include/kill_and_restart_mysqld.inc +--let $shutdown_timeout=0 +--source include/restart_mysqld.inc +--let $shutdown_timeout= UPDATE t1 SET a=@f,b=@f,c=@f,d=@f,e=@f,f=@f,g=@f,h=@f,i=@f,j=@f, k=@f,l=@f,m=@f,n=@f,o=@f,p=@f,q=@f,r=@f,s=@f,t=@f,u=@f, diff --git a/mysql-test/suite/innodb/t/innodb-64k-crash.test b/mysql-test/suite/innodb/t/innodb-64k-crash.test index 78f14d539a531..8139b7ce4e4fb 100644 --- a/mysql-test/suite/innodb/t/innodb-64k-crash.test +++ b/mysql-test/suite/innodb/t/innodb-64k-crash.test @@ -300,7 +300,9 @@ UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c, kc=@c,lc=@c,mc=@c,nc=@c,oc=@c,pc=@c,qc=@c,rc=@c,sc=@c,tc=@c,uc=@c, vc=@c,wc=@c,xc=@c,yc=@c,zc=@c; ---source include/kill_and_restart_mysqld.inc +--let $shutdown_timeout=0 +--source include/restart_mysqld.inc +--let $shutdown_timeout= UPDATE t1 SET a=@e,b=@e,c=@e,d=@e,e=@e,f=@e,g=@e,h=@e,i=@e,j=@e, k=@e,l=@e,m=@e,n=@e,o=@e,p=@e,q=@e,r=@e,s=@e,t=@e,u=@e, From 8423294acf32d966027ef99a38938bb4acc001d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 5 Apr 2017 16:24:44 +0300 Subject: [PATCH 08/38] Make InnoDB doublewrite buffer creation more robust. buf_dblwr_create(): Remove a bogus check for the buffer pool size. Theoretically, there is no problem if the doublewrite buffer is larger than the buffer pool. It could only cause trouble on crash recovery, and on recovery the doublewrite buffer is read to a buffer that is allocated outside of the buffer pool. Moreover, this check was only performed when the database was initialized for the first time. On a normal startup, buf_dblwr_init() would not enforce any rule on the innodb_buffer_pool_size. Furthermore, in case of an error, commit the mini-transaction in order to avoid an assertion failure on shutdown. Yes, this will leave the doublewrite buffer in a corrupted stage, but the doublewrite buffer should only be initialized when the data files are being initialized from the scratch in the first place. --- storage/innobase/buf/buf0dblwr.cc | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index c0cf26b869c68..fcf6d55f660c1 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -206,19 +206,6 @@ buf_dblwr_create(void) ib::info() << "Doublewrite buffer not found: creating new"; - ulint min_doublewrite_size = - ( ( 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE - + FSP_EXTENT_SIZE / 2 - + 100) - * UNIV_PAGE_SIZE); - if (buf_pool_get_curr_size() < min_doublewrite_size) { - ib::error() << "Cannot create doublewrite buffer: you must" - " increase your buffer pool size. Cannot continue" - " operation."; - - return(false); - } - block2 = fseg_create(TRX_SYS_SPACE, TRX_SYS_PAGE_NO, TRX_SYS_DOUBLEWRITE + TRX_SYS_DOUBLEWRITE_FSEG, &mtr); @@ -233,9 +220,9 @@ buf_dblwr_create(void) " increase your tablespace size." " Cannot continue operation."; - /* We exit without committing the mtr to prevent - its modifications to the database getting to disk */ - + /* The mini-transaction did not write anything yet; + we merely failed to allocate a page. */ + mtr.commit(); return(false); } @@ -250,7 +237,12 @@ buf_dblwr_create(void) ib::error() << "Cannot create doublewrite buffer: " " you must increase your tablespace size." " Cannot continue operation."; - + /* This may essentially corrupt the doublewrite + buffer. However, usually the doublewrite buffer + is created at database initialization, and it + should not matter (just remove all newly created + InnoDB files and restart). */ + mtr.commit(); return(false); } From d528fd72f281541e95cec803e9db63d620cccf5e Mon Sep 17 00:00:00 2001 From: Daniel Bartholomew Date: Wed, 5 Apr 2017 14:43:24 -0400 Subject: [PATCH 09/38] bump the VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index e90777ce978ad..ed825f4c577dd 100644 --- a/VERSION +++ b/VERSION @@ -1,3 +1,3 @@ MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MINOR=2 -MYSQL_VERSION_PATCH=5 +MYSQL_VERSION_PATCH=6 From 57a699b0a0f3300404948775356d31fb478e80c6 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Fri, 17 Jun 2016 16:51:11 +0200 Subject: [PATCH 10/38] MDEV-8642: WHERE Clause not applied on View - Empty result set returned An attempt to mark reference as dependent lead to transfering this property to original view field and through it to other references of this field which can't be dependent. --- mysql-test/r/view.result | 37 +++++++++++++++++++++++++++++++++++++ mysql-test/t/view.test | 38 ++++++++++++++++++++++++++++++++++++++ sql/item.cc | 13 ------------- 3 files changed, 75 insertions(+), 13 deletions(-) diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 3c6eb235a575d..d6da2a03b4689 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -5907,6 +5907,43 @@ a 2 DROP VIEW v1; DROP TABLE t1; +# +# MDEV-8642: WHERE Clause not applied on View - Empty result set returned +# +CREATE TABLE `t1` ( +`id` int(20) NOT NULL AUTO_INCREMENT, +`use_case` int(11) DEFAULT NULL, +`current_deadline` date DEFAULT NULL, +`ts_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, +PRIMARY KEY (`id`), +UNIQUE KEY `id_UNIQUE` (`id`) +) ENGINE=MyISAM AUTO_INCREMENT=13976 DEFAULT CHARSET=latin1; +INSERT INTO `t1` VALUES (1,10,'2015-12-18','2015-08-18 08:38:16'); +INSERT INTO `t1` VALUES (2,20,'2015-10-18','2015-08-18 08:43:30'); +CREATE VIEW v1 AS SELECT +use_case as use_case_id, +( +SELECT +deadline_sub.current_deadline +FROM +t1 deadline_sub +WHERE +deadline_sub.use_case = use_case_id +AND ts_create = (SELECT +MIN(ts_create) +FROM +t1 startdate_sub +WHERE +startdate_sub.use_case = use_case_id +) +) AS InitialDeadline +FROM +t1; +SELECT * FROM v1 where use_case_id = 10; +use_case_id InitialDeadline +10 2015-12-18 +drop view v1; +drop table t1; # ----------------------------------------------------------------- # -- End of 10.0 tests. # ----------------------------------------------------------------- diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 630c247e85b37..89a8e0c9ffc5c 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -5775,6 +5775,44 @@ DROP VIEW v1; DROP TABLE t1; +--echo # +--echo # MDEV-8642: WHERE Clause not applied on View - Empty result set returned +--echo # + +CREATE TABLE `t1` ( + `id` int(20) NOT NULL AUTO_INCREMENT, + `use_case` int(11) DEFAULT NULL, + `current_deadline` date DEFAULT NULL, + `ts_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `id_UNIQUE` (`id`) +) ENGINE=MyISAM AUTO_INCREMENT=13976 DEFAULT CHARSET=latin1; +INSERT INTO `t1` VALUES (1,10,'2015-12-18','2015-08-18 08:38:16'); +INSERT INTO `t1` VALUES (2,20,'2015-10-18','2015-08-18 08:43:30'); +CREATE VIEW v1 AS SELECT + use_case as use_case_id, + ( + SELECT + deadline_sub.current_deadline + FROM + t1 deadline_sub + WHERE + deadline_sub.use_case = use_case_id + AND ts_create = (SELECT + MIN(ts_create) + FROM + t1 startdate_sub + WHERE + startdate_sub.use_case = use_case_id + ) + ) AS InitialDeadline +FROM + t1; + +SELECT * FROM v1 where use_case_id = 10; + +drop view v1; +drop table t1; --echo # ----------------------------------------------------------------- --echo # -- End of 10.0 tests. diff --git a/sql/item.cc b/sql/item.cc index 86f1795a4dac7..dbec742e4a2af 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -7141,19 +7141,6 @@ bool Item_ref::fix_fields(THD *thd, Item **reference) last_checked_context->select_lex->nest_level); } } - else if (ref_type() != VIEW_REF) - { - /* - It could be that we're referring to something that's in ancestor selects. - We must make an appropriate mark_as_dependent() call for each such - outside reference. - */ - Dependency_marker dep_marker; - dep_marker.current_select= current_sel; - dep_marker.thd= thd; - (*ref)->walk(&Item::enumerate_field_refs_processor, FALSE, - (uchar*)&dep_marker); - } DBUG_ASSERT(*ref); /* From 25d69ea0124941cca54dbf0c2ebb2aa20ab2d6a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 4 Apr 2017 10:13:53 +0300 Subject: [PATCH 11/38] MDEV-12198 innodb_defragment=1 crashes server on OPTIMIZE TABLE when FULLTEXT index exists ha_innobase::defragment_table(): Skip corrupted indexes and FULLTEXT INDEX. In InnoDB, FULLTEXT INDEX is implemented with auxiliary tables. We will not defragment them on OPTIMIZE TABLE. --- .../suite/innodb/r/innodb_defragment.result | 1 - .../innodb/r/innodb_defragment_small.result | 24 ++++++++++++++++ .../innodb/t/innodb_defragment-master.opt | 2 -- .../suite/innodb/t/innodb_defragment.opt | 1 + .../suite/innodb/t/innodb_defragment.test | 19 ++----------- .../innodb/t/innodb_defragment_small.test | 28 +++++++++++++++++++ storage/innobase/handler/ha_innodb.cc | 11 ++++++++ storage/xtradb/handler/ha_innodb.cc | 11 ++++++++ 8 files changed, 77 insertions(+), 20 deletions(-) create mode 100644 mysql-test/suite/innodb/r/innodb_defragment_small.result delete mode 100644 mysql-test/suite/innodb/t/innodb_defragment-master.opt create mode 100644 mysql-test/suite/innodb/t/innodb_defragment_small.test diff --git a/mysql-test/suite/innodb/r/innodb_defragment.result b/mysql-test/suite/innodb/r/innodb_defragment.result index 5f3fd523946d8..5d53fde35494f 100644 --- a/mysql-test/suite/innodb/r/innodb_defragment.result +++ b/mysql-test/suite/innodb/r/innodb_defragment.result @@ -1,4 +1,3 @@ -DROP TABLE if exists t1; set global innodb_defragment_stats_accuracy = 80; CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256), KEY SECOND(a, b)) ENGINE=INNODB; optimize table t1; diff --git a/mysql-test/suite/innodb/r/innodb_defragment_small.result b/mysql-test/suite/innodb/r/innodb_defragment_small.result new file mode 100644 index 0000000000000..3f594f79e7028 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_defragment_small.result @@ -0,0 +1,24 @@ +SET @innodb_defragment_orig=@@GLOBAL.innodb_defragment; +SET GLOBAL innodb_defragment = 1; +CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256), KEY(a, b)) ENGINE=INNODB; +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +INSERT INTO t1 VALUES (100000, REPEAT('A', 256)); +INSERT INTO t1 VALUES (200000, REPEAT('A', 256)); +INSERT INTO t1 VALUES (300000, REPEAT('A', 256)); +INSERT INTO t1 VALUES (400000, REPEAT('A', 256)); +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +DROP TABLE t1; +# +# MDEV-12198 innodb_defragment=1 crashes server on +# OPTIMIZE TABLE when FULLTEXT index exists +# +CREATE TABLE t1 (c TEXT, FULLTEXT KEY (c)) ENGINE=InnoDB; +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +DROP TABLE t1; +SET GLOBAL innodb_defragment = @innodb_defragment_orig; diff --git a/mysql-test/suite/innodb/t/innodb_defragment-master.opt b/mysql-test/suite/innodb/t/innodb_defragment-master.opt deleted file mode 100644 index 6fc7f343b2405..0000000000000 --- a/mysql-test/suite/innodb/t/innodb_defragment-master.opt +++ /dev/null @@ -1,2 +0,0 @@ ---innodb_file_per_table ---innodb-defragment=1 \ No newline at end of file diff --git a/mysql-test/suite/innodb/t/innodb_defragment.opt b/mysql-test/suite/innodb/t/innodb_defragment.opt index 6426bac41a07c..aea3d480c244b 100644 --- a/mysql-test/suite/innodb/t/innodb_defragment.opt +++ b/mysql-test/suite/innodb/t/innodb_defragment.opt @@ -1,4 +1,5 @@ --loose-innodb-buffer-pool-stats --loose-innodb-buffer-page --loose-innodb-buffer-page-lru +--innodb-file-per-table --innodb-defragment=1 \ No newline at end of file diff --git a/mysql-test/suite/innodb/t/innodb_defragment.test b/mysql-test/suite/innodb/t/innodb_defragment.test index 22b72a4aa6b76..d9f5f56316ef2 100644 --- a/mysql-test/suite/innodb/t/innodb_defragment.test +++ b/mysql-test/suite/innodb/t/innodb_defragment.test @@ -1,17 +1,7 @@ --source include/have_innodb.inc --source include/big_test.inc ---source include/not_valgrind.inc --source include/not_embedded.inc ---disable_warnings -DROP TABLE if exists t1; ---enable_warnings - ---disable_query_log -let $innodb_defragment_n_pages_orig=`select @@innodb_defragment_n_pages`; -let $innodb_defragment_stats_accuracy_orig=`select @@innodb_defragment_stats_accuracy`; ---enable_query_log - set global innodb_defragment_stats_accuracy = 80; # Create table. @@ -47,12 +37,14 @@ delimiter ;// # Populate table. let $i = $data_size; --disable_query_log +BEGIN; while ($i) { eval INSERT INTO t1 VALUES ($data_size + 1 - $i, REPEAT('A', 256)); dec $i; } +COMMIT; --enable_query_log select count(stat_value) from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); @@ -161,10 +153,3 @@ select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like DROP PROCEDURE defragment; DROP TABLE t1; - -# reset system ---disable_query_log -EVAL SET GLOBAL innodb_defragment_n_pages = $innodb_defragment_n_pages_orig; -EVAL SET GLOBAL innodb_defragment_stats_accuracy = $innodb_defragment_stats_accuracy_orig; ---enable_query_log - diff --git a/mysql-test/suite/innodb/t/innodb_defragment_small.test b/mysql-test/suite/innodb/t/innodb_defragment_small.test new file mode 100644 index 0000000000000..454333d698608 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_defragment_small.test @@ -0,0 +1,28 @@ +--source include/have_innodb.inc + +SET @innodb_defragment_orig=@@GLOBAL.innodb_defragment; +SET GLOBAL innodb_defragment = 1; + +# Small tests copied from innodb.innodb_defragment +CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256), KEY(a, b)) ENGINE=INNODB; +OPTIMIZE TABLE t1; + +INSERT INTO t1 VALUES (100000, REPEAT('A', 256)); +INSERT INTO t1 VALUES (200000, REPEAT('A', 256)); +INSERT INTO t1 VALUES (300000, REPEAT('A', 256)); +INSERT INTO t1 VALUES (400000, REPEAT('A', 256)); + +OPTIMIZE TABLE t1; +DROP TABLE t1; + +--echo # +--echo # MDEV-12198 innodb_defragment=1 crashes server on +--echo # OPTIMIZE TABLE when FULLTEXT index exists +--echo # + +CREATE TABLE t1 (c TEXT, FULLTEXT KEY (c)) ENGINE=InnoDB; + +OPTIMIZE TABLE t1; +DROP TABLE t1; + +SET GLOBAL innodb_defragment = @innodb_defragment_orig; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index e447af9bdad76..f198a18656c87 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -12599,6 +12599,17 @@ ha_innobase::defragment_table( for (index = dict_table_get_first_index(table); index; index = dict_table_get_next_index(index)) { + if (dict_index_is_corrupted(index)) { + continue; + } + + if (index->page == FIL_NULL) { + /* Do not defragment auxiliary tables related + to FULLTEXT INDEX. */ + ut_ad(index->type & DICT_FTS); + continue; + } + if (one_index && strcasecmp(index_name, index->name) != 0) { continue; } diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 3130dc980d29e..d2cd1951bd7f5 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -13272,6 +13272,17 @@ ha_innobase::defragment_table( for (index = dict_table_get_first_index(table); index; index = dict_table_get_next_index(index)) { + if (dict_index_is_corrupted(index)) { + continue; + } + + if (index->page == FIL_NULL) { + /* Do not defragment auxiliary tables related + to FULLTEXT INDEX. */ + ut_ad(index->type & DICT_FTS); + continue; + } + if (one_index && strcasecmp(index_name, index->name) != 0) { continue; } From b666732182b34d30c5ada8da37835ec388cc077a Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 6 Apr 2017 09:50:27 +0000 Subject: [PATCH 12/38] Do not link client plugins to mysqld they might not be able to load after this. --- cmake/plugin.cmake | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index 53969f3a13cae..8615d6ed4b28e 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -201,11 +201,13 @@ MACRO(MYSQL_ADD_PLUGIN) # executable to the linker command line (it would result into link error). # Thus we skip TARGET_LINK_LIBRARIES on Linux, as it would only generate # an additional dependency. - IF(MSVC) - ADD_DEPENDENCIES(${target} gen_mysqld_lib) - TARGET_LINK_LIBRARIES(${target} mysqld_import_lib) - ELSEIF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux") - TARGET_LINK_LIBRARIES (${target} mysqld) + IF(NOT ARG_CLIENT) + IF(MSVC) + ADD_DEPENDENCIES(${target} gen_mysqld_lib) + TARGET_LINK_LIBRARIES(${target} mysqld_import_lib) + ELSEIF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux") + TARGET_LINK_LIBRARIES (${target} mysqld) + ENDIF() ENDIF() IF(ARG_LINK_LIBRARIES) From eb04ee5c9d2416aa45acd1353dff19f569e96317 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 17 Mar 2017 12:50:21 +1100 Subject: [PATCH 13/38] Travis: llvm, additional packages and container Additionally use clang as a compiler, versions 3.8, 3.9 and 4.0 Additionally use gcc/g++-7 Add additional packages used by build now that they are whitelisted. - libsnappy-dev - innodb compression - liblzma-dev - innodb compression - libzmq-dev - used my Mgoonga - libdistro-info-perl - used by autobake-debian Change to a container build as they tend to have more ram Signed-off-by: Daniel Black --- .travis.compiler.sh | 12 ++++++++++++ .travis.yml | 35 +++++++++++++++++++++++------------ 2 files changed, 35 insertions(+), 12 deletions(-) create mode 100755 .travis.compiler.sh diff --git a/.travis.compiler.sh b/.travis.compiler.sh new file mode 100755 index 0000000000000..155b3af2424f4 --- /dev/null +++ b/.travis.compiler.sh @@ -0,0 +1,12 @@ +#!/bin/sh +if [[ "${TRAVIS_OS_NAME}" == 'linux' && "${CXX}" == 'clang++' ]]; then + case ${GCC_VERSION} in + 4.8) MYSQL_BUILD_CXX=clang++-3.8;; + 5) MYSQL_BUILD_CXX=clang++-3.9;; + 6) MYSQL_BUILD_CXX=clang++-4.0;; + esac + export MYSQL_BUILD_CXX MYSQL_BUILD_CC=${MYSQL_BUILD_CXX/++/} +elif [[ "${TRAVIS_OS_NAME}" == 'linux' && "${CXX}" == 'g++' ]]; then + export MYSQL_BUILD_CXX=g++-${GCC_VERSION}; + export MYSQL_BUILD_CC=gcc-${GCC_VERSION} +fi diff --git a/.travis.yml b/.travis.yml index c2fa7283e9a1e..89c702cc34052 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,15 @@ # vim ft=yaml # travis-ci.org definition -# non-container builds don't have enough RAM to reliably compile -sudo: required +sudo: false dist: trusty language: cpp +os: + - linux compiler: - gcc + - clang cache: - apt - ccache @@ -17,21 +19,25 @@ env: - GCC_VERSION=4.8 - GCC_VERSION=5 - GCC_VERSION=6 + addons: apt: sources: - ubuntu-toolchain-r-test -# below requires https://github.com/travis-ci/apt-source-whitelist/pull/309 -# - llvm-toolchain-trusty-3.8 -# - llvm-toolchain-trusty-3.9 -# llvm urls awaiting fix -# https://github.com/travis-ci/apt-source-whitelist/pull/288 -# https://github.com/travis-ci/apt-source-whitelist/pull/309 + - llvm-toolchain-trusty + - llvm-toolchain-trusty-3.9 + - llvm-toolchain-trusty-4.0 packages: # make sure these match debian/control contents - gcc-5 - g++-5 - gcc-6 - g++-6 + - clang-3.8 + - llvm-3.8-dev + - clang-3.9 + - llvm-3.9-dev + - clang-4.0 + - llvm-4.0-dev - bison - chrpath - cmake @@ -57,18 +63,23 @@ addons: - zlib1g-dev - libcrack2-dev - libjemalloc-dev + - libsnappy-dev + - liblzma-dev + - libzmq-dev + - libdistro-info-perl - devscripts # implicit for any build on Ubuntu -# libsnappy-dev # https://github.com/travis-ci/apt-package-whitelist/issues/3880 -# liblzma-dev # https://github.com/travis-ci/apt-package-whitelist/issues/3879 -# libzmq-dev # https://github.com/travis-ci/apt-package-whitelist/issues/3881 # libsystemd-daemon-dev # https://github.com/travis-ci/apt-package-whitelist/issues/3882 script: - - export MYSQL_BUILD_CC=/usr/bin/gcc-${GCC_VERSION} MYSQL_BUILD_CXX=/usr/bin/g++-${GCC_VERSION} + - source .travis.compiler.sh - ${MYSQL_BUILD_CC} --version ; ${MYSQL_BUILD_CXX} --version - cd "${TRAVIS_BUILD_DIR}" +# https://github.com/travis-ci/travis-ci/issues/7062 - /run/shm isn't writable or executable +# in trusty containers + - export MTR_MEM=/tmp - env DEB_BUILD_OPTIONS="parallel=3" debian/autobake-deb.sh; + - ccache --show-stats notifications: irc: From cfd9a75c23e9f3a5963af4b3ce7bd3f1f85d3a61 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Sun, 2 Apr 2017 12:30:13 +1000 Subject: [PATCH 14/38] travis: disable main.mysqlhotcopy_myisam in container builds --- .travis.compiler.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.compiler.sh b/.travis.compiler.sh index 155b3af2424f4..a6108545803ae 100755 --- a/.travis.compiler.sh +++ b/.travis.compiler.sh @@ -10,3 +10,6 @@ elif [[ "${TRAVIS_OS_NAME}" == 'linux' && "${CXX}" == 'g++' ]]; then export MYSQL_BUILD_CXX=g++-${GCC_VERSION}; export MYSQL_BUILD_CC=gcc-${GCC_VERSION} fi +# main.mysqlhotcopy_myisam consitently failed in travis containers +# https://travis-ci.org/grooverdan/mariadb-server/builds/217661580 +echo 'main.mysqlhotcopy_myisam : unstable in containers' | tee -a debian/unstable-tests.amd64 From 837fa86cf0291b5c918c812241f8f850cd603a99 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 17 Mar 2017 13:09:00 +1100 Subject: [PATCH 15/38] Travis: add ccache for clang Signed-off-by: Daniel Black --- .travis.compiler.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.compiler.sh b/.travis.compiler.sh index a6108545803ae..8ff13e834b54a 100755 --- a/.travis.compiler.sh +++ b/.travis.compiler.sh @@ -5,7 +5,7 @@ if [[ "${TRAVIS_OS_NAME}" == 'linux' && "${CXX}" == 'clang++' ]]; then 5) MYSQL_BUILD_CXX=clang++-3.9;; 6) MYSQL_BUILD_CXX=clang++-4.0;; esac - export MYSQL_BUILD_CXX MYSQL_BUILD_CC=${MYSQL_BUILD_CXX/++/} + export MYSQL_BUILD_CXX MYSQL_BUILD_CC=${MYSQL_BUILD_CXX/++/} MYSQL_COMPILER_LAUNCHER=ccache elif [[ "${TRAVIS_OS_NAME}" == 'linux' && "${CXX}" == 'g++' ]]; then export MYSQL_BUILD_CXX=g++-${GCC_VERSION}; export MYSQL_BUILD_CC=gcc-${GCC_VERSION} From e130ee552affbb2d3e0c9b25d5c82361fc8a161f Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 17 Mar 2017 13:33:21 +1100 Subject: [PATCH 16/38] Travis: remove Mroonga for clang Mroonga generated far too many warnings (and hence output) for Travis's sensibilities on output log file size. So we just remove the storage engine. Signed-off-by: Daniel Black --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 89c702cc34052..530fb6ca247b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -72,6 +72,10 @@ addons: # libsystemd-daemon-dev # https://github.com/travis-ci/apt-package-whitelist/issues/3882 script: +# mroonga just generates too many warnings with clang and travis stops the job + - if [[ "${TRAVIS_OS_NAME}" == 'linux' && "${CXX}" == 'clang++' ]]; then + rm -rf "${TRAVIS_BUILD_DIR}"/storage/mroonga; + fi - source .travis.compiler.sh - ${MYSQL_BUILD_CC} --version ; ${MYSQL_BUILD_CXX} --version - cd "${TRAVIS_BUILD_DIR}" From fce645745bdf297ca55c43e3f1569d7f3dfc6189 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 17 Mar 2017 14:41:53 +1100 Subject: [PATCH 17/38] Travis: remove tokudb when building with clang --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 530fb6ca247b3..135c6cf75c60f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -73,8 +73,9 @@ addons: script: # mroonga just generates too many warnings with clang and travis stops the job +# tokudb has fatal warnings - if [[ "${TRAVIS_OS_NAME}" == 'linux' && "${CXX}" == 'clang++' ]]; then - rm -rf "${TRAVIS_BUILD_DIR}"/storage/mroonga; + rm -rf "${TRAVIS_BUILD_DIR}"/storage/{mroonga,tokudb}; fi - source .travis.compiler.sh - ${MYSQL_BUILD_CC} --version ; ${MYSQL_BUILD_CXX} --version From 46e2442f6fcb383d70851be2cc2986b04e13709e Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 17 Mar 2017 16:37:53 +1100 Subject: [PATCH 18/38] MDEV-6262: travis coverity support --- .travis.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.travis.yml b/.travis.yml index 135c6cf75c60f..6a1fbb4bdeefb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,39 @@ env: - GCC_VERSION=5 - GCC_VERSION=6 +#matrix: +# include: +# - env: +# - GCC_VERSION=6 +# addon: +# coverity_scan: +# # ref: https://scan.coverity.com/travis_ci +# # GitHub project metadata +# project: +# - name: MariaDB/server +# - description: MariaDB Server +# +# # Where email notification of build analysis results will be sent +# notification_email: security@mariadb.org +# +# # Commands to prepare for build_command +# build_command_prepend: +# - source .travis.compiler.sh +# - ${MYSQL_BUILD_CC} --version ; ${MYSQL_BUILD_CXX} --version +# - cmake . {MYSQL_BUILD_CXX:+-DCMAKE_CXX_COMPILER=$${MYSQL_BUILD_CXX} \ +# {MYSQL_BUILD_CC:+-DCMAKE_C_COMPILER=$${MYSQL_BUILD_CC} \ +# -DCMAKE_BUILD_TYPE=Debug \ +# -DWITH_SSL=system -DWITH_ZLIB=system \ +# -DWITHOUT_TOKUDB_STORAGE_ENGINE=ON -DWITHOUT_MROONGA_STORAGE_ENGINE=ON +# +# # The command that will be added as an argument to "cov-build" to compile your project for analysis, +# build_command: make -j 4 +# +# # Pattern to match selecting branches that will run analysis. +# # Take care in resource usage, and consider the build frequency allowances per +# # https://scan.coverity.com/faq#frequency - 7 per week is the current limit. +# branch_pattern: .*coverity.* +# addons: apt: sources: From 3bfb0b3bbd019e722add5ea3777bfdb3b8e2e9f8 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Sun, 2 Apr 2017 20:20:32 +1000 Subject: [PATCH 19/38] Travis: Add OSX to tests (but allow failure) --- .travis.yml | 48 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6a1fbb4bdeefb..ee43ff2cf63a8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,15 +4,21 @@ sudo: false dist: trusty +git: + depth: 2 + language: cpp os: - linux compiler: - gcc - clang + cache: - - apt - - ccache + apt: true + ccache: true + directories: + - /usr/local env: matrix: @@ -20,8 +26,30 @@ env: - GCC_VERSION=5 - GCC_VERSION=6 -#matrix: -# include: +matrix: + allowed_failures: + - os: osx + include: + - os: osx + before_install: + - brew update + - brew install homebrew/boneyard/judy gnutls lz4 lzo xz snappy ccache + # Below fixed by: https://github.com/MariaDB/server/pull/347 + - sed -i -e 's:/usr/bin/::g' cmake/libutils.cmake + script: + - ccache --version + - cmake . + -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl + -DCMAKE_C_COMPILER_LAUNCHER=/usr/local/bin/ccache + -DCMAKE_CXX_COMPILER_LAUNCHER=/usr/local/bin/ccache + -DCMAKE_BUILD_TYPE=Debug + -DWITH_SSL=system -DWITH_ZLIB=system + -DWITHOUT_TOKUDB_STORAGE_ENGINE=ON -DWITHOUT_MROONGA_STORAGE_ENGINE=ON + - make -j 4 + - cd mysql-test + - ./mtr --force --parallel=4 --skip-rpl --suite=main,innodb --skip-test-list=unstable-tests + - ccache --show-stats + # - env: # - GCC_VERSION=6 # addon: @@ -39,12 +67,12 @@ env: # build_command_prepend: # - source .travis.compiler.sh # - ${MYSQL_BUILD_CC} --version ; ${MYSQL_BUILD_CXX} --version -# - cmake . {MYSQL_BUILD_CXX:+-DCMAKE_CXX_COMPILER=$${MYSQL_BUILD_CXX} \ -# {MYSQL_BUILD_CC:+-DCMAKE_C_COMPILER=$${MYSQL_BUILD_CC} \ -# -DCMAKE_BUILD_TYPE=Debug \ -# -DWITH_SSL=system -DWITH_ZLIB=system \ +# - cmake . {MYSQL_BUILD_CXX:+-DCMAKE_CXX_COMPILER=$${MYSQL_BUILD_CXX} +# {MYSQL_BUILD_CC:+-DCMAKE_C_COMPILER=$${MYSQL_BUILD_CC} +# -DCMAKE_BUILD_TYPE=Debug +# -DWITH_SSL=system -DWITH_ZLIB=system # -DWITHOUT_TOKUDB_STORAGE_ENGINE=ON -DWITHOUT_MROONGA_STORAGE_ENGINE=ON -# +# # # The command that will be added as an argument to "cov-build" to compile your project for analysis, # build_command: make -j 4 # @@ -52,7 +80,7 @@ env: # # Take care in resource usage, and consider the build frequency allowances per # # https://scan.coverity.com/faq#frequency - 7 per week is the current limit. # branch_pattern: .*coverity.* -# + addons: apt: sources: From 08359bc570dc4a078c025e5650d303954df244ac Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Sun, 2 Apr 2017 20:39:01 +1000 Subject: [PATCH 20/38] travis: OSX - 2 minute test case timeout --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ee43ff2cf63a8..31141a3dec2ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,7 +47,10 @@ matrix: -DWITHOUT_TOKUDB_STORAGE_ENGINE=ON -DWITHOUT_MROONGA_STORAGE_ENGINE=ON - make -j 4 - cd mysql-test - - ./mtr --force --parallel=4 --skip-rpl --suite=main,innodb --skip-test-list=unstable-tests + - ./mtr --force --parallel=4 --testcase-timeout=2 + --suite=main,innodb + --skip-rpl + --skip-test-list=unstable-tests - ccache --show-stats # - env: From 1759e91986e4370eede029e0fc39168a6fffd57b Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Sun, 2 Apr 2017 21:46:10 +1000 Subject: [PATCH 21/38] travis: osx - specify allowed_failures accurately --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index 31141a3dec2ab..e1cb47420b7f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,6 +29,13 @@ env: matrix: allowed_failures: - os: osx + env: + - GCC_VERSION=4.8 + - GCC_VERSION=5 + - GCC_VERSION=6 + compiler: + - gcc + - clang include: - os: osx before_install: From 428a922cd0284b5fbdf97f74118209a6a9b4fb4c Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Thu, 6 Apr 2017 12:08:14 -0700 Subject: [PATCH 22/38] Fixed the bug mdev-12440. When a CTE referring to another CTE from the same with clause was used twice then the server could not find the second CTE and reported a bogus error message. This happened because for any unit that was created as a clone of a CTE specification the pointer to the WITH clause that owned this CTE was not set. --- mysql-test/r/cte_nonrecursive.result | 23 +++++++++++++++++++++++ mysql-test/t/cte_nonrecursive.test | 24 ++++++++++++++++++++++++ sql/sql_cte.cc | 1 + 3 files changed, 48 insertions(+) diff --git a/mysql-test/r/cte_nonrecursive.result b/mysql-test/r/cte_nonrecursive.result index 54184f8aba111..207df07f08368 100644 --- a/mysql-test/r/cte_nonrecursive.result +++ b/mysql-test/r/cte_nonrecursive.result @@ -961,3 +961,26 @@ show create view v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with alias1 as (select 1 AS `one`), alias2 as (select 2 AS `two`)select `alias1`.`one` AS `one`,`alias2`.`two` AS `two` from (`alias1` join `alias2`) latin1 latin1_swedish_ci drop view v1; +# +# MDEV-12440: the same CTE table is used in twice +# +create table t1 (a int, b varchar(32)); +insert into t1 values +(4,'aaaa' ), (7,'bb'), (1,'ccc'), (4,'dd'); +# cte2 is used in the main query and in the spec for ct3 +with +cte1 as (select * from t1 where b >= 'c'), +cte2 as (select * from cte1 where a < 7), +cte3 as (select * from cte2 where a > 1) +select * from cte2, cte3 where cte2.a = cte3.a; +a b a b +4 dd 4 dd +# cte2 is used twice in the spec for ct3 +with +cte1 as (select * from t1 where b >= 'b'), +cte2 as (select * from cte1 where b > 'c'), +cte3 as (select * from cte2 where a > 1 union select * from cte2 where a > 1) +select * from cte3; +a b +4 dd +drop table t1; diff --git a/mysql-test/t/cte_nonrecursive.test b/mysql-test/t/cte_nonrecursive.test index 700111d5507ed..bcdc06afbadb7 100644 --- a/mysql-test/t/cte_nonrecursive.test +++ b/mysql-test/t/cte_nonrecursive.test @@ -642,3 +642,27 @@ select * from v1; show create view v1; drop view v1; + +--echo # +--echo # MDEV-12440: the same CTE table is used in twice +--echo # + +create table t1 (a int, b varchar(32)); +insert into t1 values + (4,'aaaa' ), (7,'bb'), (1,'ccc'), (4,'dd'); + +--echo # cte2 is used in the main query and in the spec for ct3 +with +cte1 as (select * from t1 where b >= 'c'), +cte2 as (select * from cte1 where a < 7), +cte3 as (select * from cte2 where a > 1) +select * from cte2, cte3 where cte2.a = cte3.a; + +--echo # cte2 is used twice in the spec for ct3 +with +cte1 as (select * from t1 where b >= 'b'), +cte2 as (select * from cte1 where b > 'c'), +cte3 as (select * from cte2 where a > 1 union select * from cte2 where a > 1) +select * from cte3; + +drop table t1; \ No newline at end of file diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc index 1dded86c82400..d76ee13a010ac 100644 --- a/sql/sql_cte.cc +++ b/sql/sql_cte.cc @@ -780,6 +780,7 @@ st_select_lex_unit *With_element::clone_parsed_spec(THD *thd, with_table->next_global= spec_tables; } res= &lex->unit; + res->set_with_clause(owner); lex->unit.include_down(with_table->select_lex); lex->unit.set_slave(with_select); From b64910ce27a4df33e3ad2e3f40764e8b3271a9aa Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 6 Apr 2017 18:29:33 -0400 Subject: [PATCH 23/38] MDEV-12452 MDEV-12453 : Fix building rocksdb and aws_key_management on macOS use CMAKE_CXX_STANDARD to set C++11 flags with CMake 3.1+ (apples flags are somehow different from standard clang) port htonbe16/32/64 macros for rocksdb use reinterpret_cast to cast macOS's pthread_t (pointer type) to size_t , for rocksdb --- plugin/aws_key_management/CMakeLists.txt | 8 ++++++-- storage/rocksdb/CMakeLists.txt | 4 +++- storage/rocksdb/build_rocksdb.cmake | 4 ---- storage/rocksdb/rdb_buff.h | 10 ++++++++++ storage/rocksdb/ut0counter.h | 2 +- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/plugin/aws_key_management/CMakeLists.txt b/plugin/aws_key_management/CMakeLists.txt index 66b8074406f40..59fdd1684f213 100644 --- a/plugin/aws_key_management/CMakeLists.txt +++ b/plugin/aws_key_management/CMakeLists.txt @@ -50,7 +50,6 @@ ENDIF() FIND_LIBRARY(AWS_CPP_SDK_CORE NAMES aws-cpp-sdk-core PATH_SUFFIXES "${SDK_INSTALL_BINARY_PREFIX}") FIND_LIBRARY(AWS_CPP_SDK_KMS NAMES aws-cpp-sdk-kms PATH_SUFFIXES "${SDK_INSTALL_BINARY_PREFIX}") -SET(CMAKE_REQUIRED_FLAGS ${CXX11_FLAGS}) FIND_PATH(AWS_CPP_SDK_INCLUDE_DIR NAMES aws/kms/KMSClient.h) IF(AWS_CPP_SDK_CORE AND AWS_CPP_SDK_KMS AND AWS_CPP_SDK_INCLUDE_DIR) @@ -121,6 +120,7 @@ ELSE() -DBUILD_ONLY=kms -DBUILD_SHARED_LIBS=OFF -DFORCE_SHARED_CRT=OFF + -DENABLE_TESTING=OFF "-DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG} ${PIC_FLAG}" "-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${PIC_FLAG}" "-DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE} ${PIC_FLAG}" @@ -140,7 +140,11 @@ ELSE() ENDIF() ADD_DEFINITIONS(${SSL_DEFINES}) # Need to know whether openssl should be initialized -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_FLAGS}") +IF(CMAKE_VERSION GREATER "3.0") + SET(CMAKE_CXX_STANDARD 11) +ELSE() + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_FLAGS}") +ENDIF() IF(WIN32) SET(AWS_CPP_SDK_DEPENDENCIES bcrypt winhttp wininet userenv version) ELSE() diff --git a/storage/rocksdb/CMakeLists.txt b/storage/rocksdb/CMakeLists.txt index 308bd26592e49..3223e084709ab 100644 --- a/storage/rocksdb/CMakeLists.txt +++ b/storage/rocksdb/CMakeLists.txt @@ -54,7 +54,9 @@ ELSE() SKIP_ROCKSDB_PLUGIN("Compiler not supported") ENDIF() -IF(CXX11_FLAGS) +IF(CMAKE_VERSION GREATER 3.0) + SET(CMAKE_CXX_STANDARD 11) +ELSEIF(CXX11_FLAGS) ADD_DEFINITIONS(${CXX11_FLAGS}) ENDIF() diff --git a/storage/rocksdb/build_rocksdb.cmake b/storage/rocksdb/build_rocksdb.cmake index 4b830bbdf32ec..b4871662f9dd0 100644 --- a/storage/rocksdb/build_rocksdb.cmake +++ b/storage/rocksdb/build_rocksdb.cmake @@ -29,10 +29,6 @@ else() endif() endif() -include (CheckTypeSize) -check_type_size(size_t SIZEOF_SIZE_T) -set_property(SOURCE ha_rocksdb.cc APPEND PROPERTY COMPILE_DEFINITIONS - SIZEOF_SIZE_T=${SIZEOF_SIZE_T} SIZEOF_UINT64_T=8) # Optional compression libraries. diff --git a/storage/rocksdb/rdb_buff.h b/storage/rocksdb/rdb_buff.h index c2d039b46c57b..4b5850137f652 100644 --- a/storage/rocksdb/rdb_buff.h +++ b/storage/rocksdb/rdb_buff.h @@ -30,6 +30,16 @@ #define be16toh _byteswap_ushort #endif +#if __APPLE__ +#include +#define htobe64(x) OSSwapHostToBigInt64(x) +#define be64toh(x) OSSwapBigToHostInt64(x) +#define htobe32(x) OSSwapHostToBigInt32(x) +#define be32toh(x) OSSwapBigToHostInt32(x) +#define htobe16(x) OSSwapHostToBigInt16(x) +#define be16toh(x) OSSwapBigToHostInt16(x) +#endif + namespace myrocks { /* diff --git a/storage/rocksdb/ut0counter.h b/storage/rocksdb/ut0counter.h index af2e023af27eb..97c92dc675bff 100644 --- a/storage/rocksdb/ut0counter.h +++ b/storage/rocksdb/ut0counter.h @@ -78,7 +78,7 @@ struct thread_id_indexer_t : public generic_indexer_t { thread id is represented as a pointer, it may not work as effectively. */ size_t get_rnd_index() const { - return get_curr_thread_id(); + return reinterpret_cast(get_curr_thread_id()); } }; From 73c57e2be7f1905b605d1f1d843ef6313cb08d2c Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 6 Apr 2017 23:11:57 +0000 Subject: [PATCH 24/38] Fix building aws_key_management on Linux in MYSQL_ADD_PLUGIN, do not add TARGET_LINK_LIBRARIES twice for the LINK_LIBRARIES parameter It is usually harmless to add libraries twice. However, aws_key_management uses -Wl,-whole-archive to workaround linker issues on Linux If libraries are added twice with whole-archive, linking will fail complaining about duplicate symbols --- cmake/plugin.cmake | 3 --- 1 file changed, 3 deletions(-) diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index bca488e66c95e..354ee53c7bbf6 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -210,9 +210,6 @@ MACRO(MYSQL_ADD_PLUGIN) ENDIF() ENDIF() - IF(ARG_LINK_LIBRARIES) - TARGET_LINK_LIBRARIES (${target} ${ARG_LINK_LIBRARIES}) - ENDIF() ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDENCIES}) SET_TARGET_PROPERTIES(${target} PROPERTIES From 30cbbfbf774b4795ac70d7ca333f37f402a9184d Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 7 Apr 2017 06:09:25 +0000 Subject: [PATCH 25/38] MDEV-12452 postfix - use C style cast, not reinterpret_cast to fix build on Win64 --- storage/rocksdb/ut0counter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/rocksdb/ut0counter.h b/storage/rocksdb/ut0counter.h index 97c92dc675bff..cfa474e7a99b1 100644 --- a/storage/rocksdb/ut0counter.h +++ b/storage/rocksdb/ut0counter.h @@ -78,7 +78,7 @@ struct thread_id_indexer_t : public generic_indexer_t { thread id is represented as a pointer, it may not work as effectively. */ size_t get_rnd_index() const { - return reinterpret_cast(get_curr_thread_id()); + return (size_t)get_curr_thread_id(); } }; From 82196f0131a26c0f72e7452ff172eb2f93067efd Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 3 Apr 2017 17:18:37 +0200 Subject: [PATCH 26/38] MDEV-11995 ALTER TABLE proceeds despite reporting ER_TOO_LONG_KEY error automatic shortening of a too-long non-unique key should be not a warning, but a note. It's a normal optimization, doesn't affect correctness, and should never be converted to an error, no matter how strict sql_mode is. --- mysql-test/r/ctype_utf8mb4.result | 2 +- mysql-test/r/ctype_utf8mb4_innodb.result | 2 +- mysql-test/r/ctype_utf8mb4_myisam.result | 2 +- mysql-test/r/type_blob.result | 2 +- mysql-test/suite/innodb/r/alter_table.result | 13 +++++++ mysql-test/suite/innodb/r/innodb.result | 4 +-- mysql-test/suite/innodb/t/alter_table.test | 10 ++++++ .../innodb_zip/r/index_large_prefix.result | 34 +++++++++---------- .../r/innodb_index_large_prefix.result | 34 +++++++++---------- sql/sql_table.cc | 2 +- 10 files changed, 64 insertions(+), 41 deletions(-) create mode 100644 mysql-test/suite/innodb/r/alter_table.result create mode 100644 mysql-test/suite/innodb/t/alter_table.test diff --git a/mysql-test/r/ctype_utf8mb4.result b/mysql-test/r/ctype_utf8mb4.result index cb2f93dec3028..d74cfd4dd3f16 100644 --- a/mysql-test/r/ctype_utf8mb4.result +++ b/mysql-test/r/ctype_utf8mb4.result @@ -2387,7 +2387,7 @@ PRIMARY KEY (clipid), KEY tape(Tape(255)) ) CHARACTER SET=utf8mb4; Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes ALTER TABLE t1 ADD mos TINYINT DEFAULT 0 AFTER clipid; SHOW CREATE TABLE t1; Table Create Table diff --git a/mysql-test/r/ctype_utf8mb4_innodb.result b/mysql-test/r/ctype_utf8mb4_innodb.result index 28ed7ed313d17..11d8915426941 100644 --- a/mysql-test/r/ctype_utf8mb4_innodb.result +++ b/mysql-test/r/ctype_utf8mb4_innodb.result @@ -2347,7 +2347,7 @@ PRIMARY KEY (clipid), KEY tape(Tape(255)) ) CHARACTER SET=utf8mb4 ENGINE InnoDB; Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes ALTER TABLE t1 ADD mos TINYINT DEFAULT 0 AFTER clipid; SHOW CREATE TABLE t1; Table Create Table diff --git a/mysql-test/r/ctype_utf8mb4_myisam.result b/mysql-test/r/ctype_utf8mb4_myisam.result index 2c798102e5032..ef7bda0a79b3d 100644 --- a/mysql-test/r/ctype_utf8mb4_myisam.result +++ b/mysql-test/r/ctype_utf8mb4_myisam.result @@ -2347,7 +2347,7 @@ PRIMARY KEY (clipid), KEY tape(Tape(255)) ) CHARACTER SET=utf8mb4 ENGINE MyISAM; Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes ALTER TABLE t1 ADD mos TINYINT DEFAULT 0 AFTER clipid; SHOW CREATE TABLE t1; Table Create Table diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result index b2fe974acdb45..569ba65df3fe8 100644 --- a/mysql-test/r/type_blob.result +++ b/mysql-test/r/type_blob.result @@ -373,7 +373,7 @@ create table t1 (a text, unique (a(2100))); ERROR 42000: Specified key was too long; max key length is 1000 bytes create table t1 (a text, key (a(2100))); Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes show create table t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/suite/innodb/r/alter_table.result b/mysql-test/suite/innodb/r/alter_table.result new file mode 100644 index 0000000000000..304bc865f7583 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_table.result @@ -0,0 +1,13 @@ +set @@sql_mode=strict_trans_tables; +create table t1(a text not null) row_format=dynamic engine=innodb; +create index idx1 on t1(a(3073)); +Warnings: +Note 1071 Specified key was too long; max key length is 3072 bytes +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + KEY `idx1` (`a`(3072)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +drop table t1; +set @@sql_mode=default; diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result index 1b62854efefcf..2ce733042811f 100644 --- a/mysql-test/suite/innodb/r/innodb.result +++ b/mysql-test/suite/innodb/r/innodb.result @@ -2543,11 +2543,11 @@ Warning 1071 Specified key was too long; max key length is 767 bytes create table t3 (col1 text, index(col1(768))) character set = latin1 engine = innodb; Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes create table t4 (col1 blob, index(col1(768))) character set = latin1 engine = innodb; Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes SET GLOBAL innodb_large_prefix=default; Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html diff --git a/mysql-test/suite/innodb/t/alter_table.test b/mysql-test/suite/innodb/t/alter_table.test new file mode 100644 index 0000000000000..13fb574972af8 --- /dev/null +++ b/mysql-test/suite/innodb/t/alter_table.test @@ -0,0 +1,10 @@ +--source include/have_innodb.inc +# +# MDEV-11995 ALTER TABLE proceeds despite reporting ER_TOO_LONG_KEY error +# +set @@sql_mode=strict_trans_tables; +create table t1(a text not null) row_format=dynamic engine=innodb; +create index idx1 on t1(a(3073)); +show create table t1; +drop table t1; +set @@sql_mode=default; diff --git a/mysql-test/suite/innodb_zip/r/index_large_prefix.result b/mysql-test/suite/innodb_zip/r/index_large_prefix.result index 4e57b27dec870..df177e8ea2a0f 100644 --- a/mysql-test/suite/innodb_zip/r/index_large_prefix.result +++ b/mysql-test/suite/innodb_zip/r/index_large_prefix.result @@ -101,7 +101,7 @@ create index idx1 on worklog5743_1(a2(4000)); Got one of the listed errors show warnings; Level Code Message -Error 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs set global innodb_large_prefix=1; Warnings: @@ -110,7 +110,7 @@ create index idx2 on worklog5743_1(a2(4000)); Got one of the listed errors show warnings; Level Code Message -Error 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs create index idx3 on worklog5743_1(a2(436)); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs @@ -134,10 +134,10 @@ Warning 131 Using innodb_large_prefix is deprecated and the parameter may be rem SET sql_mode= ''; create index idx1 on worklog5743_2(a2(4000)); Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes set global innodb_large_prefix=1; Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html @@ -145,7 +145,7 @@ create index idx2 on worklog5743_2(a2(4000)); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs create index idx3 on worklog5743_2(a2(948)); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs @@ -168,10 +168,10 @@ Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html create index idx1 on worklog5743_4(a2(4000)); Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes set global innodb_large_prefix=1; Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html @@ -179,7 +179,7 @@ create index idx2 on worklog5743_4(a2(4000)); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs create index idx3 on worklog5743_4(a2(1972)); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs @@ -202,19 +202,19 @@ Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html create index idx1 on worklog5743_8(a2(1000)); Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes set global innodb_large_prefix=1; Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html create index idx2 on worklog5743_8(a2(3073)); Warnings: -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes create index idx3 on worklog5743_8(a2(3072)); Warnings: Note 1831 Duplicate index `idx3`. This is deprecated and will be disallowed in a future release @@ -242,19 +242,19 @@ Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html create index idx1 on worklog5743_16(a2(1000)); Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes set global innodb_large_prefix=1; Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html create index idx2 on worklog5743_16(a2(3073)); Warnings: -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes create index idx3 on worklog5743_16(a2(3072)); Warnings: Note 1831 Duplicate index `idx3`. This is deprecated and will be disallowed in a future release @@ -508,7 +508,7 @@ create table worklog5743(a TEXT not null) ROW_FORMAT=DYNAMIC; SET sql_mode=''; create index idx1 on worklog5743(a(3073)); Warnings: -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes create index idx2 on worklog5743(a(3072)); Warnings: Note 1831 Duplicate index `idx2`. This is deprecated and will be disallowed in a future release diff --git a/mysql-test/suite/innodb_zip/r/innodb_index_large_prefix.result b/mysql-test/suite/innodb_zip/r/innodb_index_large_prefix.result index 20deee57d4695..5be18b840658a 100644 --- a/mysql-test/suite/innodb_zip/r/innodb_index_large_prefix.result +++ b/mysql-test/suite/innodb_zip/r/innodb_index_large_prefix.result @@ -106,7 +106,7 @@ create index idx1 on worklog5743_1(a2(4000)); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs set global innodb_large_prefix=1; Warnings: @@ -115,7 +115,7 @@ create index idx2 on worklog5743_1(a2(4000)); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs create index idx3 on worklog5743_1(a2(436)); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs @@ -138,10 +138,10 @@ Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html create index idx1 on worklog5743_2(a2(4000)); Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes set global innodb_large_prefix=1; Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html @@ -149,7 +149,7 @@ create index idx2 on worklog5743_2(a2(4000)); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs create index idx3 on worklog5743_2(a2(948)); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs @@ -172,10 +172,10 @@ Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html create index idx1 on worklog5743_4(a2(4000)); Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes set global innodb_large_prefix=1; Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html @@ -183,7 +183,7 @@ create index idx2 on worklog5743_4(a2(4000)); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs create index idx3 on worklog5743_4(a2(1972)); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs @@ -206,19 +206,19 @@ Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html create index idx1 on worklog5743_8(a2(1000)); Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes set global innodb_large_prefix=1; Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html create index idx2 on worklog5743_8(a2(3073)); Warnings: -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes create index idx3 on worklog5743_8(a2(3072)); Warnings: Note 1831 Duplicate index `idx3`. This is deprecated and will be disallowed in a future release @@ -246,19 +246,19 @@ Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html create index idx1 on worklog5743_16(a2(1000)); Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes set global innodb_large_prefix=1; Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html create index idx2 on worklog5743_16(a2(3073)); Warnings: -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes create index idx3 on worklog5743_16(a2(3072)); Warnings: Note 1831 Duplicate index `idx3`. This is deprecated and will be disallowed in a future release @@ -510,7 +510,7 @@ create table worklog5743(a TEXT not null) ROW_FORMAT=DYNAMIC; set statement sql_mode = '' for create index idx1 on worklog5743(a(3073)); Warnings: -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes create index idx2 on worklog5743(a(3072)); Warnings: Note 1831 Duplicate index `idx2`. This is deprecated and will be disallowed in a future release diff --git a/sql/sql_table.cc b/sql/sql_table.cc index baab8e320a0fa..f5f2ffb0b6389 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3949,7 +3949,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, if (key->type == Key::MULTIPLE) { /* not a critical problem */ - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, ER_TOO_LONG_KEY, ER_THD(thd, ER_TOO_LONG_KEY), key_part_length); From 30ed99cb8259b0bd3eb4c7c98d88d565eb8712bb Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 3 Apr 2017 21:08:23 +0200 Subject: [PATCH 27/38] ASAN errors in many rpl tests Annotate_rows_log_event should always restore thd->query_string if it was backed up. Even if the backed up value is NULL. --- sql/log_event.cc | 7 ++++--- sql/log_event.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sql/log_event.cc b/sql/log_event.cc index 3aea3eaf2f1e0..156f5bac7b781 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -11322,7 +11322,7 @@ Annotate_rows_log_event::Annotate_rows_log_event(THD *thd, bool direct) : Log_event(thd, 0, using_trans), m_save_thd_query_txt(0), - m_save_thd_query_len(0) + m_save_thd_query_len(0), m_saved_thd_query(false) { m_query_txt= thd->query(); m_query_len= thd->query_length(); @@ -11336,7 +11336,7 @@ Annotate_rows_log_event::Annotate_rows_log_event(const char *buf, const Format_description_log_event *desc) : Log_event(buf, desc), m_save_thd_query_txt(0), - m_save_thd_query_len(0) + m_save_thd_query_len(0), m_saved_thd_query(false) { m_query_len= event_len - desc->common_header_len; m_query_txt= (char*) buf + desc->common_header_len; @@ -11345,7 +11345,7 @@ Annotate_rows_log_event::Annotate_rows_log_event(const char *buf, Annotate_rows_log_event::~Annotate_rows_log_event() { #ifndef MYSQL_CLIENT - if (m_save_thd_query_txt) + if (m_saved_thd_query) thd->set_query(m_save_thd_query_txt, m_save_thd_query_len); #endif } @@ -11431,6 +11431,7 @@ int Annotate_rows_log_event::do_apply_event(rpl_group_info *rgi) { m_save_thd_query_txt= thd->query(); m_save_thd_query_len= thd->query_length(); + m_saved_thd_query= true; thd->set_query(m_query_txt, m_query_len); return 0; } diff --git a/sql/log_event.h b/sql/log_event.h index 5689d36aea8fb..6c6dce7e18e48 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -3885,6 +3885,7 @@ class Annotate_rows_log_event: public Log_event uint m_query_len; char *m_save_thd_query_txt; uint m_save_thd_query_len; + bool m_saved_thd_query; }; /** From 06ee58a7ddb9d2c2b758042c89727e6cc1605383 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 3 Apr 2017 23:58:36 +0200 Subject: [PATCH 28/38] ASAN error in rpl.mysql-wsrep#110-2 Annotate_rows_log_event again. When a new annotate event comes, the server applies it first (which backs up thd->query_string), then frees the old annotate event, if any. Normally there isn't. But with sub-statements (e.g. triggers) new annotate event comes before the first one is freed, so the second event backs up thd->query_string that was set by the first annotate event. Then the first event is freed, together with its query string. And then the second event restores thd->query_string to this freed memory. Fix: free old annotate event before applying the new one. --- sql/log_event.cc | 1 + sql/rpl_rli.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/log_event.cc b/sql/log_event.cc index 156f5bac7b781..0ba44c5d35be6 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -11429,6 +11429,7 @@ void Annotate_rows_log_event::print(FILE *file, PRINT_EVENT_INFO *pinfo) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) int Annotate_rows_log_event::do_apply_event(rpl_group_info *rgi) { + rgi->free_annotate_event(); m_save_thd_query_txt= thd->query(); m_save_thd_query_len= thd->query_length(); m_saved_thd_query= true; diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h index 93e7b869be033..448fc231b2b16 100644 --- a/sql/rpl_rli.h +++ b/sql/rpl_rli.h @@ -835,7 +835,7 @@ struct rpl_group_info */ inline void set_annotate_event(Annotate_rows_log_event *event) { - free_annotate_event(); + DBUG_ASSERT(m_annotate_event == NULL); m_annotate_event= event; this->thd->variables.binlog_annotate_row_events= 1; } From cd79be82d1d2c17d9f43f993b13412a2172032c4 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 6 Apr 2017 14:47:55 +0200 Subject: [PATCH 29/38] cleanup: unused method LOGGER::flush_logs --- sql/log.cc | 17 ----------------- sql/log.h | 1 - 2 files changed, 18 deletions(-) diff --git a/sql/log.cc b/sql/log.cc index 64c7698e2a2a5..a6ece712099e1 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1197,23 +1197,6 @@ void LOGGER::init_log_tables() } -bool LOGGER::flush_logs(THD *thd) -{ - /* - Now we lock logger, as nobody should be able to use logging routines while - log tables are closed - */ - logger.lock_exclusive(); - - /* reopen log files */ - file_log_handler->flush(); - - /* end of log flush */ - logger.unlock(); - return 0; -} - - /** Close and reopen the slow log (with locks). diff --git a/sql/log.h b/sql/log.h index f1a025edfb9f5..4471f0be26df6 100644 --- a/sql/log.h +++ b/sql/log.h @@ -1016,7 +1016,6 @@ class LOGGER */ void init_base(); void init_log_tables(); - bool flush_logs(THD *thd); bool flush_slow_log(); bool flush_general_log(); /* Perform basic logger cleanup. this will leave e.g. error log open. */ From 84d9d286cff93e2f637ac1591e991bbc5b03285a Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 5 Apr 2017 13:17:43 +0200 Subject: [PATCH 30/38] use log-error in mtr, don't let mysqld to write to stderr because on Windows it cannot properly append to the file, doesn't use CreateFile(..., FILE_APPEND_DATA, ...) this fixes main.shutdown failures on Windows --- mysql-test/lib/My/ConfigFactory.pm | 4 ++-- mysql-test/mysql-test-run.pl | 12 +++++------ .../suite/sys_vars/r/log_error_basic.result | 21 ------------------- .../suite/sys_vars/r/log_error_func.result | 4 ++-- .../r/sysvars_server_notembedded.result | 4 ++-- .../suite/sys_vars/t/log_error_basic.test | 18 ---------------- .../suite/sys_vars/t/log_error_func.cnf | 5 ----- .../suite/sys_vars/t/log_error_func.test | 5 ++++- .../suite/sys_vars/t/log_error_func2.cnf | 5 ----- .../suite/sys_vars/t/log_error_func2.opt | 1 + .../suite/sys_vars/t/log_error_func3.opt | 1 + mysql-test/t/plugin_loaderr.test | 2 +- 12 files changed, 19 insertions(+), 63 deletions(-) delete mode 100644 mysql-test/suite/sys_vars/r/log_error_basic.result delete mode 100644 mysql-test/suite/sys_vars/t/log_error_basic.test delete mode 100644 mysql-test/suite/sys_vars/t/log_error_func.cnf delete mode 100644 mysql-test/suite/sys_vars/t/log_error_func2.cnf create mode 100644 mysql-test/suite/sys_vars/t/log_error_func2.opt create mode 100644 mysql-test/suite/sys_vars/t/log_error_func3.opt diff --git a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm index 8b997e8b096ed..12c0095e80e44 100644 --- a/mysql-test/lib/My/ConfigFactory.pm +++ b/mysql-test/lib/My/ConfigFactory.pm @@ -246,7 +246,7 @@ my @mysqld_rules= { '#host' => \&fix_host }, { 'port' => \&fix_port }, { 'socket' => \&fix_socket }, - { '#log-error' => \&fix_log_error }, + { 'log-error' => \&fix_log_error }, { 'general-log' => 1 }, { 'plugin-dir' => sub { $::plugindir } }, { 'general-log-file' => \&fix_log }, @@ -394,7 +394,7 @@ sub post_check_embedded_group { my %no_copy = map { $_ => 1 } ( - '#log-error', # Embedded server writes stderr to mysqltest's log file + 'log-error', # Embedded server writes stderr to mysqltest's log file 'slave-net-timeout', # Embedded server are not build with replication 'shared-memory-base-name', # No shared memory for embedded ); diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 296a646d9bade..2c6db5ba42ba0 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -2757,7 +2757,7 @@ ($) # Already started # Write start of testcase to log file - mark_log($mysqld->value('#log-error'), $tinfo); + mark_log($mysqld->value('log-error'), $tinfo); return; } @@ -2814,7 +2814,7 @@ ($) mkpath($tmpdir) unless -d $tmpdir; # Write start of testcase to log file - mark_log($mysqld->value('#log-error'), $tinfo); + mark_log($mysqld->value('log-error'), $tinfo); # Run -master.sh if ($mysqld->option('#!run-master-sh') and @@ -4259,7 +4259,7 @@ ($$) foreach my $mysqld (all_servers()) { if ($mysqld->{proc} eq $proc) { - my @srv_lines= extract_server_log($mysqld->if_exist('#log-error'), $name); + my @srv_lines= extract_server_log($mysqld->if_exist('log-error'), $name); $srv_log= "\nServer log from this test:\n" . "----------SERVER LOG START-----------\n". join ("", @srv_lines) . "----------SERVER LOG END-------------\n"; @@ -4466,7 +4466,7 @@ ($$) my $name= "warnings-".$mysqld->name(); - my $log_error= $mysqld->value('#log-error'); + my $log_error= $mysqld->value('log-error'); # To be communicated to the test $ENV{MTR_LOG_ERROR}= $log_error; extract_warning_lines($log_error, 0); @@ -4624,7 +4624,7 @@ sub check_warnings_post_shutdown { foreach my $mysqld ( mysqlds()) { my ($testlist, $match_lines)= - extract_warning_lines($mysqld->value('#log-error'), 1); + extract_warning_lines($mysqld->value('log-error'), 1); $testname_hash->{$_}= 1 for @$testlist; $report.= join('', @$match_lines); } @@ -5073,7 +5073,7 @@ ($$) # Remove the old pidfile if any unlink($mysqld->value('pid-file')); - my $output= $mysqld->value('#log-error'); + my $output= $mysqld->value('log-error'); if ( $opt_valgrind and $opt_debug ) { diff --git a/mysql-test/suite/sys_vars/r/log_error_basic.result b/mysql-test/suite/sys_vars/r/log_error_basic.result deleted file mode 100644 index c18d43762bf46..0000000000000 --- a/mysql-test/suite/sys_vars/r/log_error_basic.result +++ /dev/null @@ -1,21 +0,0 @@ -select @@global.log_error; -@@global.log_error - -select @@session.log_error; -ERROR HY000: Variable 'log_error' is a GLOBAL variable -show global variables like 'log_error'; -Variable_name Value -log_error -show session variables like 'log_error'; -Variable_name Value -log_error -select * from information_schema.global_variables where variable_name='log_error'; -VARIABLE_NAME VARIABLE_VALUE -LOG_ERROR -select * from information_schema.session_variables where variable_name='log_error'; -VARIABLE_NAME VARIABLE_VALUE -LOG_ERROR -set global log_error=1; -ERROR HY000: Variable 'log_error' is a read only variable -set session log_error=1; -ERROR HY000: Variable 'log_error' is a read only variable diff --git a/mysql-test/suite/sys_vars/r/log_error_func.result b/mysql-test/suite/sys_vars/r/log_error_func.result index c787c5ceb4f8c..39127951789d8 100644 --- a/mysql-test/suite/sys_vars/r/log_error_func.result +++ b/mysql-test/suite/sys_vars/r/log_error_func.result @@ -1,6 +1,6 @@ select (@err_log:=variable_value)*0 from information_schema.global_variables where variable_name="log_error"; (@err_log:=variable_value)*0 0 -select instr(@err_log, "some_random_name5435413.err")>0; -instr(@err_log, "some_random_name5435413.err")>0 +select instr(@err_log, "mysqld.1.err")>0; +instr(@err_log, "mysqld.1.err")>0 1 diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index 052d30563b283..11d6594ee808b 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -1817,8 +1817,8 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME LOG_ERROR SESSION_VALUE NULL -GLOBAL_VALUE -GLOBAL_VALUE_ORIGIN COMPILE-TIME +GLOBAL_VALUE PATH +GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL VARIABLE_TYPE VARCHAR diff --git a/mysql-test/suite/sys_vars/t/log_error_basic.test b/mysql-test/suite/sys_vars/t/log_error_basic.test deleted file mode 100644 index 67bd33cb31b67..0000000000000 --- a/mysql-test/suite/sys_vars/t/log_error_basic.test +++ /dev/null @@ -1,18 +0,0 @@ -# -# only global -# -select @@global.log_error; ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -select @@session.log_error; -show global variables like 'log_error'; -show session variables like 'log_error'; -select * from information_schema.global_variables where variable_name='log_error'; -select * from information_schema.session_variables where variable_name='log_error'; - -# -# show that it's read-only -# ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -set global log_error=1; ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -set session log_error=1; diff --git a/mysql-test/suite/sys_vars/t/log_error_func.cnf b/mysql-test/suite/sys_vars/t/log_error_func.cnf deleted file mode 100644 index 7a030b5518d50..0000000000000 --- a/mysql-test/suite/sys_vars/t/log_error_func.cnf +++ /dev/null @@ -1,5 +0,0 @@ -# Use default setting for mysqld processes -!include include/default_mysqld.cnf - -[mysqld.1] -log-error=some_random_name5435413 diff --git a/mysql-test/suite/sys_vars/t/log_error_func.test b/mysql-test/suite/sys_vars/t/log_error_func.test index 1cd45a54ff776..926398a7d059d 100644 --- a/mysql-test/suite/sys_vars/t/log_error_func.test +++ b/mysql-test/suite/sys_vars/t/log_error_func.test @@ -1,10 +1,13 @@ +# embedded .cnf doesn't have log-error option +source include/not_embedded.inc; + # Test for BUG#51215 "log-error partially works with version 5.5" # when --log-error is used without argument # check displayed value. We can check only the base name, the rest # depends on paths, symbolic links, --vardir, etc... select (@err_log:=variable_value)*0 from information_schema.global_variables where variable_name="log_error"; -select instr(@err_log, "some_random_name5435413.err")>0; +select instr(@err_log, "mysqld.1.err")>0; # Check file's existence. The displayed value may be relative or not. let $err_log=`select @err_log`; diff --git a/mysql-test/suite/sys_vars/t/log_error_func2.cnf b/mysql-test/suite/sys_vars/t/log_error_func2.cnf deleted file mode 100644 index ff7e8f7a1015f..0000000000000 --- a/mysql-test/suite/sys_vars/t/log_error_func2.cnf +++ /dev/null @@ -1,5 +0,0 @@ -# Use default setting for mysqld processes -!include include/default_mysqld.cnf - -[mysqld.1] -log-error diff --git a/mysql-test/suite/sys_vars/t/log_error_func2.opt b/mysql-test/suite/sys_vars/t/log_error_func2.opt new file mode 100644 index 0000000000000..4658d62af608e --- /dev/null +++ b/mysql-test/suite/sys_vars/t/log_error_func2.opt @@ -0,0 +1 @@ +--log-error diff --git a/mysql-test/suite/sys_vars/t/log_error_func3.opt b/mysql-test/suite/sys_vars/t/log_error_func3.opt new file mode 100644 index 0000000000000..a236474f94789 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/log_error_func3.opt @@ -0,0 +1 @@ +--disable-log-error diff --git a/mysql-test/t/plugin_loaderr.test b/mysql-test/t/plugin_loaderr.test index 7b98a94afd438..85621ad047da9 100644 --- a/mysql-test/t/plugin_loaderr.test +++ b/mysql-test/t/plugin_loaderr.test @@ -18,7 +18,7 @@ FROM INFORMATION_SCHEMA.PLUGINS WHERE plugin_name = 'innodb'; --source include/wait_until_disconnected.inc --error 1 ---exec $MYSQLD_CMD --innodb=force --innodb-page-size=6000 +--exec $MYSQLD_CMD --innodb=force --innodb-page-size=6000 --disable-log-error --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --enable_reconnect From 85da56bf2dc983b346089f463f2cce1552b0d3bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 7 Apr 2017 13:33:59 +0300 Subject: [PATCH 31/38] Remove the unused variable trx_t::support_xa. Also, merge some test changes from MySQL 5.7.10, for deprecating innodb_support_xa. --- .../sys_vars/r/innodb_support_xa_func.result | 2 ++ .../sys_vars/t/innodb_support_xa_basic.test | 36 +++++++++---------- .../sys_vars/t/innodb_support_xa_func.test | 16 +++++---- storage/innobase/include/trx0trx.h | 1 - storage/innobase/trx/trx0trx.cc | 2 -- 5 files changed, 30 insertions(+), 27 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/innodb_support_xa_func.result b/mysql-test/suite/sys_vars/r/innodb_support_xa_func.result index d86cf8960166c..376cc7dd0760d 100644 --- a/mysql-test/suite/sys_vars/r/innodb_support_xa_func.result +++ b/mysql-test/suite/sys_vars/r/innodb_support_xa_func.result @@ -85,4 +85,6 @@ xa rollback 'testb',0x2030405060,11; SELECT * from t1; a 30 +disconnect con1; +connection default; DROP table t1; diff --git a/mysql-test/suite/sys_vars/t/innodb_support_xa_basic.test b/mysql-test/suite/sys_vars/t/innodb_support_xa_basic.test index 6668d48609023..30f3b0ef46bac 100644 --- a/mysql-test/suite/sys_vars/t/innodb_support_xa_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_support_xa_basic.test @@ -26,14 +26,14 @@ --source include/have_innodb.inc --source include/load_sysvars.inc -######################################################################## +######################################################################## # START OF innodb_support_xa TESTS # -######################################################################## +######################################################################## -################################################################################ +################################################################################ # Saving initial value of innodb_support_xa in a temporary variable # -################################################################################ +################################################################################ SET @session_start_value = @@session.innodb_support_xa; @@ -46,9 +46,9 @@ SELECT @global_start_value; --echo '#--------------------FN_DYNVARS_046_01------------------------#' -######################################################################## +######################################################################## # Display the DEFAULT value of innodb_support_xa # -######################################################################## +######################################################################## SET @@session.innodb_support_xa = 0; SET @@session.innodb_support_xa = DEFAULT; @@ -83,9 +83,9 @@ SELECT @@global.innodb_support_xa; --echo '#--------------------FN_DYNVARS_046_03------------------------#' -########################################################################## +########################################################################## # change the value of innodb_support_xa to a valid value # -########################################################################## +########################################################################## # for session SET @@session.innodb_support_xa = 0; SELECT @@session.innodb_support_xa; @@ -150,9 +150,9 @@ SET @@global.innodb_support_xa = --echo '#-------------------FN_DYNVARS_046_05----------------------------#' -########################################################################### +########################################################################### # Test if changing global variable effects session and vice versa # -########################################################################### +########################################################################### SET @@global.innodb_support_xa = 0; SET @@session.innodb_support_xa = 1; @@ -162,7 +162,7 @@ SET @@global.innodb_support_xa = 0; SELECT @@session.innodb_support_xa AS res_is_1; --echo '#----------------------FN_DYNVARS_046_06------------------------#' -######################################################################### +######################################################################### # Check if the value in GLOBAL Table matches value in variable # ######################################################################### @@ -179,7 +179,7 @@ SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES --echo '#----------------------FN_DYNVARS_046_07------------------------#' -######################################################################### +######################################################################### # Check if the value in SESSION Table matches value in variable # ######################################################################### @@ -196,9 +196,9 @@ SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES --echo '#---------------------FN_DYNVARS_046_08-------------------------#' -################################################################### +################################################################### # Check if ON and OFF values can be used on variable # -################################################################### +################################################################### SET @@session.innodb_support_xa = OFF; SELECT @@session.innodb_support_xa; @@ -211,9 +211,9 @@ SET @@global.innodb_support_xa = ON; SELECT @@global.innodb_support_xa; --echo '#---------------------FN_DYNVARS_046_09----------------------#' -################################################################### +################################################################### # Check if TRUE and FALSE values can be used on variable # -################################################################### +################################################################### SET @@session.innodb_support_xa = TRUE; SELECT @@session.innodb_support_xa; @@ -225,7 +225,7 @@ SELECT @@global.innodb_support_xa; SET @@global.innodb_support_xa = FALSE; SELECT @@global.innodb_support_xa; -############################## +############################## # Restore initial value # ############################## @@ -237,4 +237,4 @@ SELECT @@global.innodb_support_xa; ############################################################### # END OF innodb_support_xa TESTS # -############################################################### +############################################################### diff --git a/mysql-test/suite/sys_vars/t/innodb_support_xa_func.test b/mysql-test/suite/sys_vars/t/innodb_support_xa_func.test index 693a21b2732f6..a6875ec780d33 100644 --- a/mysql-test/suite/sys_vars/t/innodb_support_xa_func.test +++ b/mysql-test/suite/sys_vars/t/innodb_support_xa_func.test @@ -20,9 +20,10 @@ ############################################################################### --source include/have_innodb.inc +--source include/count_sessions.inc --echo '#--------------------FN_DYNVARS_046_01-------------------------#' #################################################################### -# Check if setting innodb_support_xa is changed in new connection # +# Check if setting innodb_support_xa is changed in new connection # #################################################################### SET @@global.innodb_support_xa = OFF; @@ -35,7 +36,7 @@ disconnect con1; --echo '#--------------------FN_DYNVARS_046_01-------------------------#' ########################################################### -# Begin the functionality Testing of innodb_support_xa # +# Begin the functionality Testing of innodb_support_xa # ########################################################### connection default; @@ -101,8 +102,8 @@ xa start 'testa','testb', 123; # gtrid [ , bqual [ , formatID ] ] xa start 0x7465737462, 0x2030405060, 0xb; INSERT t1 values (40); -xa end 'testb',' 0@P`',11; -xa prepare 'testb',0x2030405060,11; +xa end 'testb',' 0@P`',11; +xa prepare 'testb',0x2030405060,11; --Error ER_XAER_RMFAIL START TRANSACTION; @@ -112,18 +113,21 @@ xa recover; #disconnect con1; CONNECTION default; -xa prepare 'testa','testb'; +xa prepare 'testa','testb'; xa recover; --Error ER_XAER_NOTA xa commit 'testb',0x2030405060,11; xa commit 'testa','testb'; CONNECTION con1; -xa rollback 'testb',0x2030405060,11; +xa rollback 'testb',0x2030405060,11; SELECT * from t1; +disconnect con1; +connection default; DROP table t1; +--source include/wait_until_count_sessions.inc ######################################################## # End of functionality Testing for innodb_support_xa # diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index d0a67a7ed284b..b08148578dc7a 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -1043,7 +1043,6 @@ struct trx_t { for secondary indexes when we decide if we can use the insert buffer for them, we set this FALSE */ - bool support_xa; /*!< normally we do the XA two-phase */ bool flush_log_later;/* In 2PC, we hold the prepare_commit mutex across both phases. In that case, we diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index db09f7894a71e..36324c43970d6 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -145,8 +145,6 @@ trx_init( trx->check_unique_secondary = true; - trx->support_xa = true; - trx->lock.n_rec_locks = 0; trx->dict_operation = TRX_DICT_OP_NONE; From a33653eedb42a99568d9e7b4c3f4576e73ba3726 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 7 Apr 2017 15:09:28 +0000 Subject: [PATCH 32/38] MDEV-12473 - fix rocksdb linking error link rocksdb with librt, for clock_gettime() --- storage/rocksdb/build_rocksdb.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/rocksdb/build_rocksdb.cmake b/storage/rocksdb/build_rocksdb.cmake index b4871662f9dd0..8b7e64a8e0870 100644 --- a/storage/rocksdb/build_rocksdb.cmake +++ b/storage/rocksdb/build_rocksdb.cmake @@ -132,7 +132,7 @@ find_package(Threads REQUIRED) if(WIN32) set(SYSTEM_LIBS ${SYSTEM_LIBS} Shlwapi.lib Rpcrt4.lib) else() - set(SYSTEM_LIBS ${CMAKE_THREAD_LIBS_INIT}) + set(SYSTEM_LIBS ${CMAKE_THREAD_LIBS_INIT} ${LIBRT}) endif() set(ROCKSDB_LIBS rocksdblib}) From 27f6b11a97c8c95cb6d4e282e101c484c8acf281 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Tue, 4 Apr 2017 11:00:25 +0200 Subject: [PATCH 33/38] MDEV-12379: Server crashes in TABLE_LIST::is_with_table on SHOW CREATE VIEW In case of error on opening VIEW (absent table for example) it is still possible to print its definition but some variable is not set (table_list->derived->derived) so it is better do not try to test it when there is safer alternative (table_list itself). --- mysql-test/r/view.result | 13 +++++++++++++ mysql-test/t/view.test | 12 ++++++++++++ sql/sql_select.cc | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 4119c11c67b88..bd0ebb54ee76d 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -6466,5 +6466,18 @@ ERROR HY000: Can not modify more than one base table through a join view 'test.v drop view v; drop table t1,t2,t3; # +# MDEV-12379: Server crashes in TABLE_LIST::is_with_table on +# SHOW CREATE VIEW +# +CREATE TABLE t (i INT); +CREATE VIEW v AS SELECT * FROM ( SELECT * FROM t ) sq; +DROP TABLE IF EXISTS t; +SHOW CREATE VIEW v; +View Create View character_set_client collation_connection +v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `sq`.`i` AS `i` from (select `test`.`t`.`i` AS `i` from `test`.`t`) `sq` latin1 latin1_swedish_ci +Warnings: +Warning 1356 View 'test.v' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +DROP VIEW v; +# # End of 10.2 tests # diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index cb658b5146fa7..bab640e1371f9 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -6186,6 +6186,18 @@ REPLACE INTO v (f1,f2) VALUES (1,1); drop view v; drop table t1,t2,t3; + +--echo # +--echo # MDEV-12379: Server crashes in TABLE_LIST::is_with_table on +--echo # SHOW CREATE VIEW +--echo # + +CREATE TABLE t (i INT); +CREATE VIEW v AS SELECT * FROM ( SELECT * FROM t ) sq; +DROP TABLE IF EXISTS t; +SHOW CREATE VIEW v; +DROP VIEW v; + --echo # --echo # End of 10.2 tests --echo # diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 6e355ef58f5c7..ecbac041dc45c 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -25077,7 +25077,7 @@ void TABLE_LIST::print(THD *thd, table_map eliminated_tables, String *str, } else if (derived) { - if (!derived->derived->is_with_table()) + if (!is_with_table()) { // A derived table str->append('('); From d9484a2f60c488c63e6f9e6cacc06066cf0118be Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Tue, 4 Apr 2017 14:47:58 +0200 Subject: [PATCH 34/38] MDEV-12395: DROP PARTITION does not work as expected when table has DEFAULT LIST partition Data loss in case of partituon removing is documented => do not try to prevent it --- mysql-test/r/partition_default.result | 48 ++++++++++++++++++++++----- mysql-test/t/partition_default.test | 32 ++++++++++++++---- sql/sql_partition.cc | 3 +- 3 files changed, 67 insertions(+), 16 deletions(-) diff --git a/mysql-test/r/partition_default.result b/mysql-test/r/partition_default.result index 2833d92de323c..bb0a5d4061bd9 100644 --- a/mysql-test/r/partition_default.result +++ b/mysql-test/r/partition_default.result @@ -921,9 +921,6 @@ explain partitions select * from t1 where a=10 and b=10; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 alter table t1 drop partition p2; -ERROR HY000: Table has no partition for value 2 -delete from t1 where a=2; -alter table t1 drop partition p2; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -1069,9 +1066,6 @@ explain partitions select * from t1 where a=10 and b=10; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 alter table t1 drop partition p2; -ERROR HY000: Table has no partition for value from column_list -delete from t1 where a=2; -alter table t1 drop partition p2; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -1125,10 +1119,10 @@ alter table t1 add partition (partition p0 VALUES IN (2,3)); select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1'; partition_name table_rows -p0 2 +p0 0 p1 1 p2 1 -pd 0 +pd 2 drop table t1; create table t1 (a int, b int) PARTITION BY LIST COLUMNS(a,b) @@ -1233,3 +1227,41 @@ select * from t1 where i is null; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 drop table t1; +# +# MDEV-12395: DROP PARTITION does not work as expected when +# table has DEFAULT LIST partition +# +CREATE TABLE t1 (i INT) +PARTITION BY LIST (i) +(PARTITION p VALUES IN (1,2,3,4), +PARTITION pdef DEFAULT); +INSERT INTO t1 VALUES (1),(10); +ALTER TABLE t1 DROP PARTITION p; +SELECT * FROM t1; +i +10 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + PARTITION BY LIST (i) +(PARTITION pdef DEFAULT ENGINE = MyISAM) +DROP TABLE t1; +CREATE TABLE t1 (i INT) +PARTITION BY LIST (i) +(PARTITION p VALUES IN (1,2,3,4), +PARTITION pdef DEFAULT); +INSERT INTO t1 VALUES (1),(10); +ALTER TABLE t1 DROP PARTITION pdef; +SELECT * FROM t1; +i +1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + PARTITION BY LIST (i) +(PARTITION p VALUES IN (1,2,3,4) ENGINE = MyISAM) +DROP TABLE t1; diff --git a/mysql-test/t/partition_default.test b/mysql-test/t/partition_default.test index 1110b311c2999..b0424f567e436 100644 --- a/mysql-test/t/partition_default.test +++ b/mysql-test/t/partition_default.test @@ -326,9 +326,6 @@ select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table explain partitions select * from t1 where a=2 and b=5; explain partitions select * from t1 where a=10 and b=10; ---error ER_NO_PARTITION_FOR_GIVEN_VALUE -alter table t1 drop partition p2; -delete from t1 where a=2; alter table t1 drop partition p2; show create table t1; select * from t1; @@ -395,9 +392,6 @@ select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table explain partitions select * from t1 where a=2 and b=5; explain partitions select * from t1 where a=10 and b=10; ---error ER_NO_PARTITION_FOR_GIVEN_VALUE -alter table t1 drop partition p2; -delete from t1 where a=2; alter table t1 drop partition p2; show create table t1; select * from t1; @@ -520,3 +514,29 @@ explain partitions select * from t1 where i is null; drop table t1; + + +--echo # +--echo # MDEV-12395: DROP PARTITION does not work as expected when +--echo # table has DEFAULT LIST partition +--echo # + +CREATE TABLE t1 (i INT) + PARTITION BY LIST (i) + (PARTITION p VALUES IN (1,2,3,4), + PARTITION pdef DEFAULT); +INSERT INTO t1 VALUES (1),(10); +ALTER TABLE t1 DROP PARTITION p; +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1 (i INT) + PARTITION BY LIST (i) + (PARTITION p VALUES IN (1,2,3,4), + PARTITION pdef DEFAULT); +INSERT INTO t1 VALUES (1),(10); +ALTER TABLE t1 DROP PARTITION pdef; +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 4e71e792a0888..0a146aeb12beb 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -4842,8 +4842,7 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info, my_error(ER_PARTITION_FUNCTION_FAILURE, MYF(0)); goto err; } - if ((flags & (HA_FAST_CHANGE_PARTITION | HA_PARTITION_ONE_PHASE)) != 0 && - !tab_part_info->has_default_partititon()) + if ((flags & (HA_FAST_CHANGE_PARTITION | HA_PARTITION_ONE_PHASE)) != 0) { /* "Fast" change of partitioning is supported in this case. From 8c9cd26c06ac3ccf667af17249478b6afae6f3aa Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 7 Apr 2017 17:00:35 +0000 Subject: [PATCH 35/38] Rocksdb - disable tests that fail regularly on buildbot (MDEV-12474) --- storage/rocksdb/mysql-test/rocksdb/t/disabled.def | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/storage/rocksdb/mysql-test/rocksdb/t/disabled.def b/storage/rocksdb/mysql-test/rocksdb/t/disabled.def index 8d3fc09027398..cff53e6370e46 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/disabled.def +++ b/storage/rocksdb/mysql-test/rocksdb/t/disabled.def @@ -57,3 +57,9 @@ unique_sec : Intermittent failures in BB allow_no_pk_concurrent_insert: stress test rocksdb_deadlock_stress_rc: stress test rocksdb_deadlock_stress_rr: stress test + +# MDEV-12474 Regularly failing tests on Buildbot +autoinc_vars_thread : MDEV-12474 Regularly fails on buildbot +validate_datadic : MDEV-12474 Regularly fails on buildbot +unique_check : MDEV-12474 Regularly fails on buildbot +bloomfilter : MDEV-12474 Regularly fails on buildbot From c7319cf3d51c923a7eeb8bcdd623c36d8b2fe3c8 Mon Sep 17 00:00:00 2001 From: =Ian Gilfillan Date: Mon, 3 Apr 2017 14:11:27 +0200 Subject: [PATCH 36/38] 10.2 man pages --- man/comp_err.1 | 2 +- man/galera_new_cluster.1 | 2 +- man/galera_recovery.1 | 2 +- man/innochecksum.1 | 2 +- man/make_win_bin_dist.1 | 2 +- man/mariadb-service-convert.1 | 2 +- man/msql2mysql.1 | 2 +- man/my_print_defaults.1 | 2 +- man/myisam_ftdump.1 | 2 +- man/myisamchk.1 | 2 +- man/myisamlog.1 | 2 +- man/myisampack.1 | 2 +- man/mysql-stress-test.pl.1 | 2 +- man/mysql-test-run.pl.1 | 2 +- man/mysql.1 | 2 +- man/mysql.server.1 | 2 +- man/mysql_client_test.1 | 2 +- man/mysql_config.1 | 2 +- man/mysql_convert_table_format.1 | 2 +- man/mysql_find_rows.1 | 2 +- man/mysql_fix_extensions.1 | 2 +- man/mysql_install_db.1 | 2 +- man/mysql_plugin.1 | 2 +- man/mysql_secure_installation.1 | 2 +- man/mysql_setpermission.1 | 2 +- man/mysql_tzinfo_to_sql.1 | 2 +- man/mysql_upgrade.1 | 2 +- man/mysql_waitpid.1 | 2 +- man/mysqlaccess.1 | 2 +- man/mysqladmin.1 | 2 +- man/mysqlbinlog.1 | 2 +- man/mysqlcheck.1 | 2 +- man/mysqld.8 | 2 +- man/mysqld_multi.1 | 2 +- man/mysqld_safe.1 | 2 +- man/mysqld_safe_helper.1 | 2 +- man/mysqldump.1 | 18 +++++++++++++++++- man/mysqldumpslow.1 | 2 +- man/mysqlhotcopy.1 | 2 +- man/mysqlimport.1 | 2 +- man/mysqlshow.1 | 2 +- man/mysqlslap.1 | 2 +- man/mysqltest.1 | 2 +- man/perror.1 | 2 +- man/replace.1 | 2 +- man/resolve_stack_dump.1 | 2 +- man/resolveip.1 | 2 +- man/tokuftdump.1 | 2 +- man/wsrep_sst_common.1 | 2 +- man/wsrep_sst_mysqldump.1 | 2 +- man/wsrep_sst_rsync.1 | 2 +- man/wsrep_sst_xtrabackup-v2.1 | 2 +- man/wsrep_sst_xtrabackup.1 | 2 +- 53 files changed, 69 insertions(+), 53 deletions(-) diff --git a/man/comp_err.1 b/man/comp_err.1 index c566e2d11e0e0..4ff91aac2e68d 100644 --- a/man/comp_err.1 +++ b/man/comp_err.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBCOMP_ERR\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBCOMP_ERR\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/galera_new_cluster.1 b/man/galera_new_cluster.1 index c351a5e0c5f12..72c46edc54a7a 100644 --- a/man/galera_new_cluster.1 +++ b/man/galera_new_cluster.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBGALERA_NEW_CLUSTER\FR" "1" "26 January 2017" "MariaDB 10\&.1" "MariaDB Database System" +.TH "\FBGALERA_NEW_CLUSTER\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/galera_recovery.1 b/man/galera_recovery.1 index 12cb450da4619..6856d0a1c7d83 100644 --- a/man/galera_recovery.1 +++ b/man/galera_recovery.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBGALERA_RECOVERY\FR" "1" "26 January 2017" "MariaDB 10\&.1" "MariaDB Database System" +.TH "\FBGALERA_RECOVERY\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/innochecksum.1 b/man/innochecksum.1 index 72614ad1617fb..70eb9875ac7ad 100644 --- a/man/innochecksum.1 +++ b/man/innochecksum.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBINNOCHECKSUM\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBINNOCHECKSUM\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/make_win_bin_dist.1 b/man/make_win_bin_dist.1 index 32043390059bf..7f041ce26b38c 100644 --- a/man/make_win_bin_dist.1 +++ b/man/make_win_bin_dist.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMAKE_WIN_BIN_DIST" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMAKE_WIN_BIN_DIST" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mariadb-service-convert.1 b/man/mariadb-service-convert.1 index 6301087208b13..35c9b001599c0 100644 --- a/man/mariadb-service-convert.1 +++ b/man/mariadb-service-convert.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADB-SERVICE-CONVERT\FR" "1" "26 January 2017" "MariaDB 10\&.1" "MariaDB Database System" +.TH "\FBMARIADB-SERVICE-CONVERT\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/msql2mysql.1 b/man/msql2mysql.1 index dfe5ebf4d89ed..87cedc5e80b99 100644 --- a/man/msql2mysql.1 +++ b/man/msql2mysql.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMSQL2MYSQL\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMSQL2MYSQL\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/my_print_defaults.1 b/man/my_print_defaults.1 index 857566133e3d4..87e82f91023ef 100644 --- a/man/my_print_defaults.1 +++ b/man/my_print_defaults.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMY_PRINT_DEFAULTS" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMY_PRINT_DEFAULTS" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/myisam_ftdump.1 b/man/myisam_ftdump.1 index eb383605084d5..889031c7e34df 100644 --- a/man/myisam_ftdump.1 +++ b/man/myisam_ftdump.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYISAM_FTDUMP\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYISAM_FTDUMP\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/myisamchk.1 b/man/myisamchk.1 index e13df13488264..557ab1d6b3363 100644 --- a/man/myisamchk.1 +++ b/man/myisamchk.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYISAMCHK\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYISAMCHK\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/myisamlog.1 b/man/myisamlog.1 index 25e4b5d8640cf..bd318bedd9199 100644 --- a/man/myisamlog.1 +++ b/man/myisamlog.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYISAMLOG\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYISAMLOG\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/myisampack.1 b/man/myisampack.1 index e3f301df15648..8baeb26285b56 100644 --- a/man/myisampack.1 +++ b/man/myisampack.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYISAMPACK\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYISAMPACK\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysql-stress-test.pl.1 b/man/mysql-stress-test.pl.1 index 0e47538efbed4..ccd1a187fd1fb 100644 --- a/man/mysql-stress-test.pl.1 +++ b/man/mysql-stress-test.pl.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL\-STRESS\-TE" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQL\-STRESS\-TE" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysql-test-run.pl.1 b/man/mysql-test-run.pl.1 index 784e62a3c663e..b99815778ee75 100644 --- a/man/mysql-test-run.pl.1 +++ b/man/mysql-test-run.pl.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL\-TEST\-RUN\" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQL\-TEST\-RUN\" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysql.1 b/man/mysql.1 index e4c0727d1ae5a..624e69a0d54d5 100644 --- a/man/mysql.1 +++ b/man/mysql.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQL\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysql.server.1 b/man/mysql.server.1 index 252d8002ca2ff..ed6fb51782059 100644 --- a/man/mysql.server.1 +++ b/man/mysql.server.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL\&.SERVER\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQL\&.SERVER\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysql_client_test.1 b/man/mysql_client_test.1 index 21da6397b2bed..a1652d7b2dcd9 100644 --- a/man/mysql_client_test.1 +++ b/man/mysql_client_test.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_CLIENT_TEST" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQL_CLIENT_TEST" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysql_config.1 b/man/mysql_config.1 index 91b04b65f7552..f321ae937b6c7 100644 --- a/man/mysql_config.1 +++ b/man/mysql_config.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_CONFIG\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQL_CONFIG\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysql_convert_table_format.1 b/man/mysql_convert_table_format.1 index 0d46fa4415130..3956609d547d9 100644 --- a/man/mysql_convert_table_format.1 +++ b/man/mysql_convert_table_format.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_CONVERT_TAB" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQL_CONVERT_TAB" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysql_find_rows.1 b/man/mysql_find_rows.1 index 0c38b91f5235b..9e3aca171918f 100644 --- a/man/mysql_find_rows.1 +++ b/man/mysql_find_rows.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_FIND_ROWS\F" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQL_FIND_ROWS\F" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysql_fix_extensions.1 b/man/mysql_fix_extensions.1 index 04d96fd9058f0..6bb7f6375958f 100644 --- a/man/mysql_fix_extensions.1 +++ b/man/mysql_fix_extensions.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_FIX_EXTENSI" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQL_FIX_EXTENSI" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysql_install_db.1 b/man/mysql_install_db.1 index 716fb56956d88..ea54477f5160c 100644 --- a/man/mysql_install_db.1 +++ b/man/mysql_install_db.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_INSTALL_DB\" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQL_INSTALL_DB\" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysql_plugin.1 b/man/mysql_plugin.1 index 0326a7ddb0978..33530235afbad 100644 --- a/man/mysql_plugin.1 +++ b/man/mysql_plugin.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_PLUGIN\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQL_PLUGIN\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/man/mysql_secure_installation.1 b/man/mysql_secure_installation.1 index 71e9d67dee461..5c1fd70f956ec 100644 --- a/man/mysql_secure_installation.1 +++ b/man/mysql_secure_installation.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_SECURE_INST" "1" "3 January 2017" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQL_SECURE_INST" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysql_setpermission.1 b/man/mysql_setpermission.1 index 0ca22ca27dddc..5a3c6f1b811c1 100644 --- a/man/mysql_setpermission.1 +++ b/man/mysql_setpermission.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_SETPERMISSI" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQL_SETPERMISSI" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysql_tzinfo_to_sql.1 b/man/mysql_tzinfo_to_sql.1 index ece013dd40f79..2063523ddc094 100644 --- a/man/mysql_tzinfo_to_sql.1 +++ b/man/mysql_tzinfo_to_sql.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_TZINFO_TO_S" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQL_TZINFO_TO_S" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysql_upgrade.1 b/man/mysql_upgrade.1 index 62e3939324038..876e224aa8308 100644 --- a/man/mysql_upgrade.1 +++ b/man/mysql_upgrade.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_UPGRADE\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQL_UPGRADE\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysql_waitpid.1 b/man/mysql_waitpid.1 index ae645be872f02..91acfec604deb 100644 --- a/man/mysql_waitpid.1 +++ b/man/mysql_waitpid.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_WAITPID\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQL_WAITPID\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysqlaccess.1 b/man/mysqlaccess.1 index 02b5169b50d0f..2d48214104321 100644 --- a/man/mysqlaccess.1 +++ b/man/mysqlaccess.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLACCESS\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQLACCESS\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysqladmin.1 b/man/mysqladmin.1 index 786b288f1013a..85ab1e0e7dcd7 100644 --- a/man/mysqladmin.1 +++ b/man/mysqladmin.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLADMIN\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQLADMIN\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysqlbinlog.1 b/man/mysqlbinlog.1 index 34cf246ff1b8e..9a00c64292a4c 100644 --- a/man/mysqlbinlog.1 +++ b/man/mysqlbinlog.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLBINLOG\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQLBINLOG\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysqlcheck.1 b/man/mysqlcheck.1 index abc8d64c2af24..d0a512711a4c9 100644 --- a/man/mysqlcheck.1 +++ b/man/mysqlcheck.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLCHECK\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQLCHECK\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysqld.8 b/man/mysqld.8 index b77b551bd48ac..04e631e72d006 100644 --- a/man/mysqld.8 +++ b/man/mysqld.8 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLD\FR" "8" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQLD\FR" "8" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysqld_multi.1 b/man/mysqld_multi.1 index 6a52116fffe89..b82dd2182392f 100644 --- a/man/mysqld_multi.1 +++ b/man/mysqld_multi.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLD_MULTI\FR" "1" "7 December 2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQLD_MULTI\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysqld_safe.1 b/man/mysqld_safe.1 index eb31d05d4ef4a..7b9387f0a5f34 100644 --- a/man/mysqld_safe.1 +++ b/man/mysqld_safe.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLD_SAFE\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQLD_SAFE\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysqld_safe_helper.1 b/man/mysqld_safe_helper.1 index 63770a49d28b9..93b4fc35c53ec 100644 --- a/man/mysqld_safe_helper.1 +++ b/man/mysqld_safe_helper.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLD_SAFE_HELPER\FR" "1" "26 January 2017" "MariaDB 10\&.1" "MariaDB Database System" +.TH "\FBMYSQLD_SAFE_HELPER\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysqldump.1 b/man/mysqldump.1 index ebd3b1fc896e7..7e7e455e02039 100644 --- a/man/mysqldump.1 +++ b/man/mysqldump.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLDUMP\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQLDUMP\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -858,6 +858,22 @@ instead\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqldump: flashback option +.\" flashback option: mysqldump +\fB\-\-flashback\fR, +\fB\-B\fR +.sp +Support flashback mode\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqldump: flush-logs option .\" flush-logs option: mysqldump \fB\-\-flush\-logs\fR, diff --git a/man/mysqldumpslow.1 b/man/mysqldumpslow.1 index 47dffef7edd78..78a85264627ad 100644 --- a/man/mysqldumpslow.1 +++ b/man/mysqldumpslow.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLDUMPSLOW\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQLDUMPSLOW\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysqlhotcopy.1 b/man/mysqlhotcopy.1 index bb6f83ac8102c..480b2d43a613f 100644 --- a/man/mysqlhotcopy.1 +++ b/man/mysqlhotcopy.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLHOTCOPY\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQLHOTCOPY\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysqlimport.1 b/man/mysqlimport.1 index 4c4ed342d7a53..3478865c83fa0 100644 --- a/man/mysqlimport.1 +++ b/man/mysqlimport.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLIMPORT\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQLIMPORT\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysqlshow.1 b/man/mysqlshow.1 index 1790978144a4e..d387f9dfdb52a 100644 --- a/man/mysqlshow.1 +++ b/man/mysqlshow.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLSHOW\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQLSHOW\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysqlslap.1 b/man/mysqlslap.1 index e3246e811bf18..07ec3a4a04234 100644 --- a/man/mysqlslap.1 +++ b/man/mysqlslap.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLSLAP\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQLSLAP\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysqltest.1 b/man/mysqltest.1 index 772702e4091a5..4dce3d54db3d4 100644 --- a/man/mysqltest.1 +++ b/man/mysqltest.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLTEST\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBMYSQLTEST\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/perror.1 b/man/perror.1 index 3a680c96201ec..6a929828201a9 100644 --- a/man/perror.1 +++ b/man/perror.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBPERROR\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBPERROR\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/replace.1 b/man/replace.1 index 5c63027535e91..e17ecedbcb81d 100644 --- a/man/replace.1 +++ b/man/replace.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBREPLACE\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBREPLACE\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/resolve_stack_dump.1 b/man/resolve_stack_dump.1 index 693c84e8da021..d2f6e53d864c2 100644 --- a/man/resolve_stack_dump.1 +++ b/man/resolve_stack_dump.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBRESOLVE_STACK_DUM" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBRESOLVE_STACK_DUM" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/resolveip.1 b/man/resolveip.1 index 2f1c4a1a290e2..2a0155b1721d4 100644 --- a/man/resolveip.1 +++ b/man/resolveip.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBRESOLVEIP\FR" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System" +.TH "\FBRESOLVEIP\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/tokuftdump.1 b/man/tokuftdump.1 index d0a11a840a551..d88a1f076764c 100644 --- a/man/tokuftdump.1 +++ b/man/tokuftdump.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBTOKUFTDUMP\FR" "1" "9 March 2017" "MariaDB 10\&.1" "MariaDB Database System" +.TH "\FBTOKUFTDUMP\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_common.1 b/man/wsrep_sst_common.1 index 05242e66c0000..6a73e69cbe6eb 100644 --- a/man/wsrep_sst_common.1 +++ b/man/wsrep_sst_common.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBWSREP_SST_COMMON\FR" "1" "26 January 2017" "MariaDB 10\&.1" "MariaDB Database System" +.TH "\FBWSREP_SST_COMMON\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_mysqldump.1 b/man/wsrep_sst_mysqldump.1 index 17ad5b2cdf18b..da70ace00ac2e 100644 --- a/man/wsrep_sst_mysqldump.1 +++ b/man/wsrep_sst_mysqldump.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBWSREP_SST_MYSQLDUMP\FR" "1" "26 January 2017" "MariaDB 10\&.1" "MariaDB Database System" +.TH "\FBWSREP_SST_MYSQLDUMP\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_rsync.1 b/man/wsrep_sst_rsync.1 index 95a80b20821c8..aa0a492d7c323 100644 --- a/man/wsrep_sst_rsync.1 +++ b/man/wsrep_sst_rsync.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBWSREP_SST_RSYNC\FR" "1" "26 January 2017" "MariaDB 10\&.1" "MariaDB Database System" +.TH "\FBWSREP_SST_RSYNC\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_xtrabackup-v2.1 b/man/wsrep_sst_xtrabackup-v2.1 index d61ce803b939d..10352be2c1b36 100644 --- a/man/wsrep_sst_xtrabackup-v2.1 +++ b/man/wsrep_sst_xtrabackup-v2.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBWSREP_SST_XTRABACKUP-V2\FR" "1" "26 January 2017" "MariaDB 10\&.1" "MariaDB Database System" +.TH "\FBWSREP_SST_XTRABACKUP-V2\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_xtrabackup.1 b/man/wsrep_sst_xtrabackup.1 index 9644a29c4ca72..ddbd8c7f6ec67 100644 --- a/man/wsrep_sst_xtrabackup.1 +++ b/man/wsrep_sst_xtrabackup.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBWSREP_SST_XTRABACKUP\FR" "1" "24 January 2017" "MariaDB 10\&.1" "MariaDB Database System" +.TH "\FBWSREP_SST_XTRABACKUP\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- From eecce3d7c8a6374342ed7d0cd8844420d8957682 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Mon, 10 Apr 2017 19:11:01 +1000 Subject: [PATCH 37/38] Travis: Test more suites, latest OSX Remove clang-3.8 which doesn't have a repository on apt.llvm.org any more. For OSX, xcode8.3 is explicitly specified. /usr/local/Cellar is used as a cache repository to save brew install time on OSX (and /usr/local was too big). Debian autobake.sh is moved to a matrix include. Other branches of the matrix build test other test suites. An Ubuntu galera is downloaded and used in the test suite. TYPE=RelWithDebInfo used with the test to provide backtraces with line numbers when crashes occur. Build of PLUGIN_AWS_KEY_MANAGEMENT enabled in build. Code supporting TYPE=Debug and -DWITH_ASAN=ON included by not enabled due to large numbers of errors. Running more tests in parallel (6) as container based builds seem to support them. The test case timeout has been set to 2 minutes as large stalls will put test cases over 50 minute interval. ccache enabled where possible. Linux clang builds don't use them as the minimum CMake version isn't there. --- .travis.compiler.sh | 53 +++++++++++++++++++------ .travis.yml | 96 +++++++++++++++++++++++---------------------- 2 files changed, 91 insertions(+), 58 deletions(-) diff --git a/.travis.compiler.sh b/.travis.compiler.sh index 8ff13e834b54a..35e79e177ef3d 100755 --- a/.travis.compiler.sh +++ b/.travis.compiler.sh @@ -1,15 +1,46 @@ #!/bin/sh -if [[ "${TRAVIS_OS_NAME}" == 'linux' && "${CXX}" == 'clang++' ]]; then - case ${GCC_VERSION} in - 4.8) MYSQL_BUILD_CXX=clang++-3.8;; - 5) MYSQL_BUILD_CXX=clang++-3.9;; - 6) MYSQL_BUILD_CXX=clang++-4.0;; - esac - export MYSQL_BUILD_CXX MYSQL_BUILD_CC=${MYSQL_BUILD_CXX/++/} MYSQL_COMPILER_LAUNCHER=ccache -elif [[ "${TRAVIS_OS_NAME}" == 'linux' && "${CXX}" == 'g++' ]]; then - export MYSQL_BUILD_CXX=g++-${GCC_VERSION}; - export MYSQL_BUILD_CC=gcc-${GCC_VERSION} +set -v -x +if [[ "${TRAVIS_OS_NAME}" == 'linux' ]]; then + if [[ "${CXX}" == 'clang++' ]]; then + CMAKE_OPT="-DWITHOUT_TOKUDB_STORAGE_ENGINE=ON -DWITHOUT_MROONGA_STORAGE_ENGINE=ON" + #CMAKE_OPT="${CMAKE_OPT} -DWITH_ASAN=ON" + if which ccache ; then + CMAKE_OPT="${CMAKE_OPT} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache" + fi + case ${GCC_VERSION} in + 5) CXX=clang++-3.9 ;; + 6) CXX=clang++-4.0 ;; + esac + export CXX CC=${CXX/++/} + elif [[ "${CXX}" == 'g++' ]]; then + CMAKE_OPT="" + export CXX=g++-${GCC_VERSION} + export CC=gcc-${GCC_VERSION} + fi + if [[ ${GCC_VERSION} == 6 ]]; then + wget http://mirrors.kernel.org/ubuntu/pool/universe/p/percona-xtradb-cluster-galera-2.x/percona-xtradb-cluster-galera-2.x_165-0ubuntu1_amd64.deb ; + ar vx percona-xtradb-cluster-galera-2.x_165-0ubuntu1_amd64.deb + tar -xJvf data.tar.xz + export WSREP_PROVIDER=$PWD/usr/lib/libgalera_smm.so + MYSQL_TEST_SUITES="${MYSQL_TEST_SUITES},wsrep" + #elif [[ ${GCC_VERSION} != 5 ]]; then + #CMAKE_OPT="${CMAKE_OPT} -DWITH_ASAN=ON" + fi +else + # osx_image based tests + CMAKE_OPT="-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl" + #CMAKE_OPT="${CMAKE_OPT} -DWITH_ASAN=ON" + if which ccache ; then + CMAKE_OPT="${CMAKE_OPT} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache" + fi + CMAKE_OPT="${CMAKE_OPT} -DWITHOUT_MROONGA_STORAGE_ENGINE=ON" + if [[ "${TYPE}" == "Debug" ]]; then + CMAKE_OPT="${CMAKE_OPT} -DWITHOUT_TOKUDB_STORAGE_ENGINE=ON" + fi fi + # main.mysqlhotcopy_myisam consitently failed in travis containers # https://travis-ci.org/grooverdan/mariadb-server/builds/217661580 -echo 'main.mysqlhotcopy_myisam : unstable in containers' | tee -a debian/unstable-tests.amd64 +echo 'main.mysqlhotcopy_myisam : unstable in containers' >> ${TRAVIS_BUILD_DIR}/mysql-test/unstable-tests +echo 'archive.mysqlhotcopy_archive : unstable in containers' >> ${TRAVIS_BUILD_DIR}/mysql-test/unstable-tests +set +v +x diff --git a/.travis.yml b/.travis.yml index e1cb47420b7f2..f33de07628962 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,8 @@ git: language: cpp os: - linux + - osx +osx_image: xcode8.3 compiler: - gcc - clang @@ -18,48 +20,37 @@ cache: apt: true ccache: true directories: - - /usr/local + - /usr/local/Cellar env: matrix: - - GCC_VERSION=4.8 - - GCC_VERSION=5 - - GCC_VERSION=6 +# - GCC_VERSION=4.8 TYPE=Debug MYSQL_TEST_SUITES=rpl +# - GCC_VERSION=5 TYPE=Debug MYSQL_TEST_SUITES=main,archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts +# - GCC_VERSION=6 TYPE=Debug MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption,rocksdb +# - GCC_VERSION=6 TYPE=Debug MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,percona,perfschema,plugins,multi_source,roles + - GCC_VERSION=4.8 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rpl + - GCC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main,archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts + - GCC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption,rocksdb + - GCC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,percona,perfschema,plugins,multi_source,roles matrix: - allowed_failures: + exclude: - os: osx - env: - - GCC_VERSION=4.8 - - GCC_VERSION=5 - - GCC_VERSION=6 - compiler: - - gcc - - clang + compiler: gcc include: - - os: osx - before_install: - - brew update - - brew install homebrew/boneyard/judy gnutls lz4 lzo xz snappy ccache - # Below fixed by: https://github.com/MariaDB/server/pull/347 - - sed -i -e 's:/usr/bin/::g' cmake/libutils.cmake + - os: linux + compiler: gcc script: - - ccache --version - - cmake . - -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl - -DCMAKE_C_COMPILER_LAUNCHER=/usr/local/bin/ccache - -DCMAKE_CXX_COMPILER_LAUNCHER=/usr/local/bin/ccache - -DCMAKE_BUILD_TYPE=Debug - -DWITH_SSL=system -DWITH_ZLIB=system - -DWITHOUT_TOKUDB_STORAGE_ENGINE=ON -DWITHOUT_MROONGA_STORAGE_ENGINE=ON - - make -j 4 - - cd mysql-test - - ./mtr --force --parallel=4 --testcase-timeout=2 - --suite=main,innodb - --skip-rpl - --skip-test-list=unstable-tests + - ${CC} --version ; ${CXX} --version + # Just for disabling hotcopy tests for now + - source .travis.compiler.sh + # https://github.com/travis-ci/travis-ci/issues/7062 - /run/shm isn't writable or executable + # in trusty containers + - export MTR_MEM=/tmp + - env DEB_BUILD_OPTIONS="parallel=6" debian/autobake-deb.sh; - ccache --show-stats +# Matrix include for coverity # - env: # - GCC_VERSION=6 # addon: @@ -77,8 +68,7 @@ matrix: # build_command_prepend: # - source .travis.compiler.sh # - ${MYSQL_BUILD_CC} --version ; ${MYSQL_BUILD_CXX} --version -# - cmake . {MYSQL_BUILD_CXX:+-DCMAKE_CXX_COMPILER=$${MYSQL_BUILD_CXX} -# {MYSQL_BUILD_CC:+-DCMAKE_C_COMPILER=$${MYSQL_BUILD_CC} +# - cmake . # -DCMAKE_BUILD_TYPE=Debug # -DWITH_SSL=system -DWITH_ZLIB=system # -DWITHOUT_TOKUDB_STORAGE_ENGINE=ON -DWITHOUT_MROONGA_STORAGE_ENGINE=ON @@ -103,12 +93,11 @@ addons: - g++-5 - gcc-6 - g++-6 - - clang-3.8 - - llvm-3.8-dev - clang-3.9 - llvm-3.9-dev - clang-4.0 - llvm-4.0-dev + - libasan0 - bison - chrpath - cmake @@ -118,6 +107,7 @@ addons: - gdb - libaio-dev - libboost-dev + - libcurl3-dev - libjudy-dev - libncurses5-dev - libpam0g-dev @@ -142,19 +132,31 @@ addons: # libsystemd-daemon-dev # https://github.com/travis-ci/apt-package-whitelist/issues/3882 +before_install: + - if [[ "${TRAVIS_OS_NAME}" == 'osx' ]]; then + brew update; + brew install gnutls lz4 lzo xz snappy ccache jemalloc curl ossp-uuid pcre; + brew link ccache; + fi + script: -# mroonga just generates too many warnings with clang and travis stops the job -# tokudb has fatal warnings - - if [[ "${TRAVIS_OS_NAME}" == 'linux' && "${CXX}" == 'clang++' ]]; then - rm -rf "${TRAVIS_BUILD_DIR}"/storage/{mroonga,tokudb}; - fi + - ccache --version +# Clang: +# mroonga just generates too many warnings with clang and travis stops the job +# tokudb has fatal warnings - source .travis.compiler.sh - - ${MYSQL_BUILD_CC} --version ; ${MYSQL_BUILD_CXX} --version - - cd "${TRAVIS_BUILD_DIR}" -# https://github.com/travis-ci/travis-ci/issues/7062 - /run/shm isn't writable or executable -# in trusty containers - - export MTR_MEM=/tmp - - env DEB_BUILD_OPTIONS="parallel=3" debian/autobake-deb.sh; + - cmake . + -DCMAKE_BUILD_TYPE=${TYPE} + ${CMAKE_OPT} + -DWITH_SSL=system -DWITH_ZLIB=system -DPLUGIN_AWS_KEY_MANAGEMENT=DYNAMIC -DAWS_SDK_EXTERNAL_PROJECT=ON + - make -j 6 + - cd mysql-test +# With ASAN --thread-stack=400K to account for overhead +# Test timeout needs to be 10(minutes) or less due to travis out timeout + - ./mtr --force --max-test-fail=20 --parallel=6 --testcase-timeout=2 + --suite=${MYSQL_TEST_SUITES} + --skip-test-list=unstable-tests + --skip-test=binlog.binlog_unsafe - ccache --show-stats notifications: From 45730fb11e08571bbe4023cd7a7e8d1168ceb008 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Thu, 13 Apr 2017 06:50:00 +0400 Subject: [PATCH 38/38] MDEV-12238 Add Type_handler::Item_func_{plus|minus|mul|div|mod}_fix_length_and_dec() --- mysql-test/r/gis-debug.result | 53 ++++++ mysql-test/r/gis.result | 65 +++++++ mysql-test/t/gis-debug.test | 65 +++++++ mysql-test/t/gis.test | 75 ++++++++ sql/item_func.cc | 189 ++++++++++---------- sql/item_func.h | 62 ++++++- sql/sql_type.cc | 313 ++++++++++++++++++++++++++++++++++ sql/sql_type.h | 92 ++++++++-- 8 files changed, 811 insertions(+), 103 deletions(-) diff --git a/mysql-test/r/gis-debug.result b/mysql-test/r/gis-debug.result index 0f63509bb993a..889ee5c9513c3 100644 --- a/mysql-test/r/gis-debug.result +++ b/mysql-test/r/gis-debug.result @@ -352,3 +352,56 @@ Note 1105 DBUG: types_compatible=yes bisect=yes DROP TABLE t1; SET SESSION debug_dbug="-d,Predicant_to_list_comparator"; SET SESSION debug_dbug="-d,Item_func_in"; +# +# MDEV-12238 Add Type_handler::Item_func_{plus|minus|mul|div|mod}_fix_length_and_dec() +# +SET debug_dbug='+d,num_op'; +CREATE TABLE t1 AS SELECT +POINT(0,0)+POINT(0,0), +POINT(0,0)-POINT(0,0), +POINT(0,0)*POINT(0,0), +POINT(0,0)/POINT(0,0), +POINT(0,0) MOD POINT(0,0) LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `POINT(0,0)+POINT(0,0)` geometry DEFAULT NULL, + `POINT(0,0)-POINT(0,0)` geometry DEFAULT NULL, + `POINT(0,0)*POINT(0,0)` geometry DEFAULT NULL, + `POINT(0,0)/POINT(0,0)` geometry DEFAULT NULL, + `POINT(0,0) MOD POINT(0,0)` geometry DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 AS SELECT +POINT(0,0)+'0', +POINT(0,0)-'0', +POINT(0,0)*'0', +POINT(0,0)/'0', +POINT(0,0) MOD '0' LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `POINT(0,0)+'0'` longtext DEFAULT NULL, + `POINT(0,0)-'0'` longtext DEFAULT NULL, + `POINT(0,0)*'0'` longtext DEFAULT NULL, + `POINT(0,0)/'0'` longtext DEFAULT NULL, + `POINT(0,0) MOD '0'` longtext DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 AS SELECT +'0'+POINT(0,0), +'0'*POINT(0,0) LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `'0'+POINT(0,0)` longtext DEFAULT NULL, + `'0'*POINT(0,0)` longtext DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 AS SELECT '0'-POINT(0,0) LIMIT 0; +ERROR HY000: Illegal parameter data types varchar and geometry for operation '-' +CREATE TABLE t1 AS SELECT '0'/POINT(0,0) LIMIT 0; +ERROR HY000: Illegal parameter data types varchar and geometry for operation '/' +CREATE TABLE t1 AS SELECT '0' MOD POINT(0,0) LIMIT 0; +ERROR HY000: Illegal parameter data types varchar and geometry for operation '%' +SET debug_dbug='-d,num_op'; diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index ea1736d7aa347..e713233180603 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -3837,5 +3837,70 @@ SELECT LENGTH(CAST(COALESCE(a) AS BINARY)) FROM t1; LENGTH(CAST(COALESCE(a) AS BINARY)) DROP TABLE t1; # +# MDEV-12238 Add Type_handler::Item_func_{plus|minus|mul|div|mod}_fix_length_and_dec() +# +CREATE TABLE t1 (a GEOMETRY); +SELECT POINT(1,1) + 1; +ERROR HY000: Illegal parameter data types geometry and bigint for operation '+' +SELECT POINT(1,1) - 1; +ERROR HY000: Illegal parameter data types geometry and bigint for operation '-' +SELECT POINT(1,1) * 1; +ERROR HY000: Illegal parameter data types geometry and bigint for operation '*' +SELECT POINT(1,1) / 1; +ERROR HY000: Illegal parameter data types geometry and bigint for operation '/' +SELECT POINT(1,1) MOD 1; +ERROR HY000: Illegal parameter data types geometry and bigint for operation '%' +SELECT 1 + POINT(1,1); +ERROR HY000: Illegal parameter data types bigint and geometry for operation '+' +SELECT 1 - POINT(1,1); +ERROR HY000: Illegal parameter data types bigint and geometry for operation '-' +SELECT 1 * POINT(1,1); +ERROR HY000: Illegal parameter data types bigint and geometry for operation '*' +SELECT 1 / POINT(1,1); +ERROR HY000: Illegal parameter data types bigint and geometry for operation '/' +SELECT 1 MOD POINT(1,1); +ERROR HY000: Illegal parameter data types bigint and geometry for operation '%' +SELECT a + 1 FROM t1; +ERROR HY000: Illegal parameter data types geometry and bigint for operation '+' +SELECT a - 1 FROM t1; +ERROR HY000: Illegal parameter data types geometry and bigint for operation '-' +SELECT a * 1 FROM t1; +ERROR HY000: Illegal parameter data types geometry and bigint for operation '*' +SELECT a / 1 FROM t1; +ERROR HY000: Illegal parameter data types geometry and bigint for operation '/' +SELECT a MOD 1 FROM t1; +ERROR HY000: Illegal parameter data types geometry and bigint for operation '%' +SELECT 1 + a FROM t1; +ERROR HY000: Illegal parameter data types bigint and geometry for operation '+' +SELECT 1 - a FROM t1; +ERROR HY000: Illegal parameter data types bigint and geometry for operation '-' +SELECT 1 * a FROM t1; +ERROR HY000: Illegal parameter data types bigint and geometry for operation '*' +SELECT 1 / a FROM t1; +ERROR HY000: Illegal parameter data types bigint and geometry for operation '/' +SELECT 1 MOD a FROM t1; +ERROR HY000: Illegal parameter data types bigint and geometry for operation '%' +SELECT COALESCE(a) + 1 FROM t1; +ERROR HY000: Illegal parameter data types geometry and bigint for operation '+' +SELECT COALESCE(a) - 1 FROM t1; +ERROR HY000: Illegal parameter data types geometry and bigint for operation '-' +SELECT COALESCE(a) * 1 FROM t1; +ERROR HY000: Illegal parameter data types geometry and bigint for operation '*' +SELECT COALESCE(a) / 1 FROM t1; +ERROR HY000: Illegal parameter data types geometry and bigint for operation '/' +SELECT COALESCE(a) MOD 1 FROM t1; +ERROR HY000: Illegal parameter data types geometry and bigint for operation '%' +SELECT 1 + COALESCE(a) FROM t1; +ERROR HY000: Illegal parameter data types bigint and geometry for operation '+' +SELECT 1 - COALESCE(a) FROM t1; +ERROR HY000: Illegal parameter data types bigint and geometry for operation '-' +SELECT 1 * COALESCE(a) FROM t1; +ERROR HY000: Illegal parameter data types bigint and geometry for operation '*' +SELECT 1 / COALESCE(a) FROM t1; +ERROR HY000: Illegal parameter data types bigint and geometry for operation '/' +SELECT 1 MOD COALESCE(a) FROM t1; +ERROR HY000: Illegal parameter data types bigint and geometry for operation '%' +DROP TABLE t1; +# # End of 10.3 tests # diff --git a/mysql-test/t/gis-debug.test b/mysql-test/t/gis-debug.test index a34dd6223122b..588bc70637004 100644 --- a/mysql-test/t/gis-debug.test +++ b/mysql-test/t/gis-debug.test @@ -46,3 +46,68 @@ DROP TABLE t1; SET SESSION debug_dbug="-d,Predicant_to_list_comparator"; SET SESSION debug_dbug="-d,Item_func_in"; + + +--echo # +--echo # MDEV-12238 Add Type_handler::Item_func_{plus|minus|mul|div|mod}_fix_length_and_dec() +--echo # + +# This tests is to check that operators '+' and '*' are commutative, +# while operators '/', '-' and 'MOD' are not commutative. +# +# It forces substitution of type_aggregator_for_{plus|minus|mul|div|mod} to +# type_aggregator_for_result / type_aggregator_non_commutative_test, +# which have pairs: +# (GEOMETRY,GEOMETRY)->GEOMETRY +# (GEOMETRY,VARCHAR)->GEOMETRY +# Note, they don't not have a pair: +# (VARCHAR,GEOMETRY)->GEOMETRY +# +# Commutative operators should work for all these argument type combinations: +# (GEOMETRY,GEOMETRY), (GEOMETRY,VARCHAR), (VARCHAR,GEOMETRY). +# Non-commutative operators should work for: +# (GEOMETRY,GEOMETRY), (GEOMETRY,VARCHAR), +# but should fail for (VARCHAR,GEOMETRY). +# +# Note, LIMIT 0 is needed to avoid calling str_op(), which does DBUG_ASSERT(0). + +SET debug_dbug='+d,num_op'; + +# (GEOMETRY,GEOMETRY) gives GEOMETRY for all operators +CREATE TABLE t1 AS SELECT + POINT(0,0)+POINT(0,0), + POINT(0,0)-POINT(0,0), + POINT(0,0)*POINT(0,0), + POINT(0,0)/POINT(0,0), + POINT(0,0) MOD POINT(0,0) LIMIT 0; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +# (GEOMETRY,VARCHAR) gives GEOMETRY for all operators +CREATE TABLE t1 AS SELECT + POINT(0,0)+'0', + POINT(0,0)-'0', + POINT(0,0)*'0', + POINT(0,0)/'0', + POINT(0,0) MOD '0' LIMIT 0; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +# (VARCHAR,GEOMETRY) gives GEOMETRY for commutative operators +CREATE TABLE t1 AS SELECT + '0'+POINT(0,0), + '0'*POINT(0,0) LIMIT 0; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +# (VARCHAR,GEOMETRY) gives an error for non-commutative operators +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +CREATE TABLE t1 AS SELECT '0'-POINT(0,0) LIMIT 0; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +CREATE TABLE t1 AS SELECT '0'/POINT(0,0) LIMIT 0; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +CREATE TABLE t1 AS SELECT '0' MOD POINT(0,0) LIMIT 0; + +SET debug_dbug='-d,num_op'; diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index ee074c8721535..a19de83f0466b 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -2016,6 +2016,81 @@ SELECT LENGTH(CAST(COALESCE(a) AS BINARY)) FROM t1; DROP TABLE t1; +--echo # +--echo # MDEV-12238 Add Type_handler::Item_func_{plus|minus|mul|div|mod}_fix_length_and_dec() +--echo # + +CREATE TABLE t1 (a GEOMETRY); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT POINT(1,1) + 1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT POINT(1,1) - 1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT POINT(1,1) * 1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT POINT(1,1) / 1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT POINT(1,1) MOD 1; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 + POINT(1,1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 - POINT(1,1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 * POINT(1,1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 / POINT(1,1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 MOD POINT(1,1); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT a + 1 FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT a - 1 FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT a * 1 FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT a / 1 FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT a MOD 1 FROM t1; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 + a FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 - a FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 * a FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 / a FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 MOD a FROM t1; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT COALESCE(a) + 1 FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT COALESCE(a) - 1 FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT COALESCE(a) * 1 FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT COALESCE(a) / 1 FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT COALESCE(a) MOD 1 FROM t1; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 + COALESCE(a) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 - COALESCE(a) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 * COALESCE(a) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 / COALESCE(a) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 MOD COALESCE(a) FROM t1; + +DROP TABLE t1; + + --echo # --echo # End of 10.3 tests --echo # diff --git a/sql/item_func.cc b/sql/item_func.cc index 8b52ed3c613ab..03d0b1068a27f 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -729,47 +729,31 @@ bool Item_func_connection_id::fix_fields(THD *thd, Item **ref) } -/** - Check arguments here to determine result's type for a numeric - function of two arguments. -*/ - -void Item_num_op::fix_length_and_dec(void) +bool Item_num_op::fix_type_handler(const Type_aggregator *aggregator) { - DBUG_ENTER("Item_num_op::fix_length_and_dec"); - DBUG_PRINT("info", ("name %s", func_name())); DBUG_ASSERT(arg_count == 2); - Item_result r0= args[0]->cast_to_int_type_handler()->cmp_type(); - Item_result r1= args[1]->cast_to_int_type_handler()->cmp_type(); + const Type_handler *h0= args[0]->cast_to_int_type_handler(); + const Type_handler *h1= args[1]->cast_to_int_type_handler(); + if (!aggregate_for_num_op(aggregator, h0, h1)) + return false; + my_error(ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION, MYF(0), + h0->name().ptr(), h1->name().ptr(), func_name()); + return true; +} - if (r0 == REAL_RESULT || r1 == REAL_RESULT || - r0 == STRING_RESULT || r1 ==STRING_RESULT) - { - count_real_length(args, arg_count); - max_length= float_length(decimals); - set_handler_by_result_type(REAL_RESULT); - } - else if (r0 == DECIMAL_RESULT || r1 == DECIMAL_RESULT || - r0 == TIME_RESULT || r1 == TIME_RESULT) - { - set_handler_by_result_type(DECIMAL_RESULT); - result_precision(); - fix_decimals(); - if ((r0 == TIME_RESULT || r1 == TIME_RESULT) && decimals == 0) - set_handler_by_result_type(INT_RESULT); - } - else + +void Item_func_plus::fix_length_and_dec(void) +{ + DBUG_ENTER("Item_func_plus::fix_length_and_dec"); + DBUG_PRINT("info", ("name %s", func_name())); + const Type_aggregator *aggregator= &type_handler_data->m_type_aggregator_for_plus; + DBUG_EXECUTE_IF("num_op", aggregator= &type_handler_data->m_type_aggregator_for_result;); + DBUG_ASSERT(aggregator->is_commutative()); + if (!fix_type_handler(aggregator)) { - DBUG_ASSERT(r0 == INT_RESULT && r1 == INT_RESULT); - set_handler_by_result_type(INT_RESULT); - result_precision(); - decimals= 0; + Item_func_plus::type_handler()->Item_func_plus_fix_length_and_dec(this); + DBUG_PRINT("info", ("Type: %s", type_handler()->name().ptr())); } - DBUG_PRINT("info", ("Type: %s", - (result_type() == REAL_RESULT ? "REAL_RESULT" : - result_type() == DECIMAL_RESULT ? "DECIMAL_RESULT" : - result_type() == INT_RESULT ? "INT_RESULT" : - "--ILLEGAL!!!--"))); DBUG_VOID_RETURN; } @@ -1299,11 +1283,6 @@ void Item_func_additive_op::result_precision() DBUG_ASSERT(arg1_int >= 0); DBUG_ASSERT(arg2_int >= 0); - /* Integer operations keep unsigned_flag if one of arguments is unsigned */ - if (result_type() == INT_RESULT) - unsigned_flag= args[0]->unsigned_flag | args[1]->unsigned_flag; - else - unsigned_flag= args[0]->unsigned_flag & args[1]->unsigned_flag; max_length= my_decimal_precision_to_length_no_truncation(precision, decimals, unsigned_flag); } @@ -1313,16 +1292,30 @@ void Item_func_additive_op::result_precision() The following function is here to allow the user to force subtraction of UNSIGNED BIGINT to return negative values. */ - -void Item_func_minus::fix_length_and_dec() +void Item_func_minus::fix_unsigned_flag() { - Item_num_op::fix_length_and_dec(); if (unsigned_flag && (current_thd->variables.sql_mode & MODE_NO_UNSIGNED_SUBTRACTION)) unsigned_flag=0; } +void Item_func_minus::fix_length_and_dec() +{ + DBUG_ENTER("Item_func_minus::fix_length_and_dec"); + DBUG_PRINT("info", ("name %s", func_name())); + const Type_aggregator *aggregator= &type_handler_data->m_type_aggregator_for_minus; + DBUG_EXECUTE_IF("num_op", aggregator= &type_handler_data->m_type_aggregator_non_commutative_test;); + DBUG_ASSERT(!aggregator->is_commutative()); + if (!fix_type_handler(aggregator)) + { + Item_func_minus::type_handler()->Item_func_minus_fix_length_and_dec(this); + DBUG_PRINT("info", ("Type: %s", type_handler()->name().ptr())); + } + DBUG_VOID_RETURN; +} + + double Item_func_minus::real_op() { double value= args[0]->val_real() - args[1]->val_real(); @@ -1530,13 +1523,8 @@ my_decimal *Item_func_mul::decimal_op(my_decimal *decimal_value) void Item_func_mul::result_precision() { - /* Integer operations keep unsigned_flag if one of arguments is unsigned */ - if (result_type() == INT_RESULT) - unsigned_flag= args[0]->unsigned_flag | args[1]->unsigned_flag; - else - unsigned_flag= args[0]->unsigned_flag & args[1]->unsigned_flag; decimals= MY_MIN(args[0]->decimal_scale() + args[1]->decimal_scale(), - DECIMAL_MAX_SCALE); + DECIMAL_MAX_SCALE); uint est_prec = args[0]->decimal_precision() + args[1]->decimal_precision(); uint precision= MY_MIN(est_prec, DECIMAL_MAX_PRECISION); max_length= my_decimal_precision_to_length_no_truncation(precision, decimals, @@ -1544,6 +1532,22 @@ void Item_func_mul::result_precision() } +void Item_func_mul::fix_length_and_dec(void) +{ + DBUG_ENTER("Item_func_mul::fix_length_and_dec"); + DBUG_PRINT("info", ("name %s", func_name())); + const Type_aggregator *aggregator= &type_handler_data->m_type_aggregator_for_mul; + DBUG_EXECUTE_IF("num_op", aggregator= &type_handler_data->m_type_aggregator_for_result;); + DBUG_ASSERT(aggregator->is_commutative()); + if (!fix_type_handler(aggregator)) + { + Item_func_mul::type_handler()->Item_func_mul_fix_length_and_dec(this); + DBUG_PRINT("info", ("Type: %s", type_handler()->name().ptr())); + } + DBUG_VOID_RETURN; +} + + double Item_func_div::real_op() { DBUG_ASSERT(fixed == 1); @@ -1605,53 +1609,51 @@ void Item_func_div::result_precision() uint precision=MY_MIN(args[0]->decimal_precision() + args[1]->divisor_precision_increment() + prec_increment, DECIMAL_MAX_PRECISION); - - /* Integer operations keep unsigned_flag if one of arguments is unsigned */ - if (result_type() == INT_RESULT) - unsigned_flag= args[0]->unsigned_flag | args[1]->unsigned_flag; - else - unsigned_flag= args[0]->unsigned_flag & args[1]->unsigned_flag; decimals= MY_MIN(args[0]->decimal_scale() + prec_increment, DECIMAL_MAX_SCALE); max_length= my_decimal_precision_to_length_no_truncation(precision, decimals, unsigned_flag); } -void Item_func_div::fix_length_and_dec() +void Item_func_div::fix_length_and_dec_double(void) +{ + Item_num_op::fix_length_and_dec_double(); + decimals= MY_MAX(args[0]->decimals, args[1]->decimals) + prec_increment; + set_if_smaller(decimals, NOT_FIXED_DEC); + uint tmp= float_length(decimals); + if (decimals == NOT_FIXED_DEC) + max_length= tmp; + else + { + max_length=args[0]->max_length - args[0]->decimals + decimals; + set_if_smaller(max_length, tmp); + } +} + + +void Item_func_div::fix_length_and_dec_int(void) +{ + set_handler(&type_handler_newdecimal); + DBUG_PRINT("info", ("Type changed: %s", type_handler()->name().ptr())); + Item_num_op::fix_length_and_dec_decimal(); +} + + +void Item_func_div::fix_length_and_dec(void) { DBUG_ENTER("Item_func_div::fix_length_and_dec"); + DBUG_PRINT("info", ("name %s", func_name())); prec_increment= current_thd->variables.div_precincrement; - Item_num_op::fix_length_and_dec(); - switch (Item_func_div::result_type()) { - case REAL_RESULT: + maybe_null= 1; // devision by zero + + const Type_aggregator *aggregator= &type_handler_data->m_type_aggregator_for_div; + DBUG_EXECUTE_IF("num_op", aggregator= &type_handler_data->m_type_aggregator_non_commutative_test;); + DBUG_ASSERT(!aggregator->is_commutative()); + if (!fix_type_handler(aggregator)) { - decimals=MY_MAX(args[0]->decimals,args[1]->decimals)+prec_increment; - set_if_smaller(decimals, NOT_FIXED_DEC); - uint tmp=float_length(decimals); - if (decimals == NOT_FIXED_DEC) - max_length= tmp; - else - { - max_length=args[0]->max_length - args[0]->decimals + decimals; - set_if_smaller(max_length,tmp); - } - break; - } - case INT_RESULT: - set_handler_by_result_type(DECIMAL_RESULT); - DBUG_PRINT("info", ("Type changed: DECIMAL_RESULT")); - result_precision(); - break; - case DECIMAL_RESULT: - result_precision(); - fix_decimals(); - break; - case STRING_RESULT: - case ROW_RESULT: - case TIME_RESULT: - DBUG_ASSERT(0); + Item_func_div::type_handler()->Item_func_div_fix_length_and_dec(this); + DBUG_PRINT("info", ("Type: %s", type_handler()->name().ptr())); } - maybe_null= 1; // devision by zero DBUG_VOID_RETURN; } @@ -1823,9 +1825,18 @@ void Item_func_mod::result_precision() void Item_func_mod::fix_length_and_dec() { - Item_num_op::fix_length_and_dec(); - maybe_null= 1; - unsigned_flag= args[0]->unsigned_flag; + DBUG_ENTER("Item_func_mod::fix_length_and_dec"); + DBUG_PRINT("info", ("name %s", func_name())); + maybe_null= true; // division by zero + const Type_aggregator *aggregator= &type_handler_data->m_type_aggregator_for_mod; + DBUG_EXECUTE_IF("num_op", aggregator= &type_handler_data->m_type_aggregator_non_commutative_test;); + DBUG_ASSERT(!aggregator->is_commutative()); + if (!fix_type_handler(aggregator)) + { + Item_func_mod::type_handler()->Item_func_mod_fix_length_and_dec(this); + DBUG_PRINT("info", ("Type: %s", type_handler()->name().ptr())); + } + DBUG_VOID_RETURN; } diff --git a/sql/item_func.h b/sql/item_func.h index 0b398adb9371c..7f9321f017d21 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -695,7 +695,31 @@ class Item_num_op :public Item_func_numhybrid { print_op(str, query_type); } - void fix_length_and_dec(); + bool fix_type_handler(const Type_aggregator *aggregator); + void fix_length_and_dec_double() + { + count_real_length(args, arg_count); + max_length= float_length(decimals); + } + void fix_length_and_dec_decimal() + { + unsigned_flag= args[0]->unsigned_flag & args[1]->unsigned_flag; + result_precision(); + fix_decimals(); + } + void fix_length_and_dec_int() + { + unsigned_flag= args[0]->unsigned_flag | args[1]->unsigned_flag; + result_precision(); + decimals= 0; + } + void fix_length_and_dec_temporal() + { + set_handler(&type_handler_newdecimal); + fix_length_and_dec_decimal(); + if (decimals == 0) + set_handler(&type_handler_longlong); + } bool need_parentheses_in_default() { return true; } }; @@ -949,6 +973,7 @@ class Item_func_plus :public Item_func_additive_op Item_func_additive_op(thd, a, b) {} const char *func_name() const { return "+"; } enum precedence precedence() const { return ADD_PRECEDENCE; } + void fix_length_and_dec(); longlong int_op(); double real_op(); my_decimal *decimal_op(my_decimal *); @@ -967,6 +992,22 @@ class Item_func_minus :public Item_func_additive_op double real_op(); my_decimal *decimal_op(my_decimal *); void fix_length_and_dec(); + void fix_unsigned_flag(); + void fix_length_and_dec_double() + { + Item_func_additive_op::fix_length_and_dec_double(); + fix_unsigned_flag(); + } + void fix_length_and_dec_decimal() + { + Item_func_additive_op::fix_length_and_dec_decimal(); + fix_unsigned_flag(); + } + void fix_length_and_dec_int() + { + Item_func_additive_op::fix_length_and_dec_int(); + fix_unsigned_flag(); + } Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); } }; @@ -983,6 +1024,7 @@ class Item_func_mul :public Item_num_op double real_op(); my_decimal *decimal_op(my_decimal *); void result_precision(); + void fix_length_and_dec(); bool check_partition_func_processor(void *int_arg) {return FALSE;} bool check_vcol_func_processor(void *arg) { return FALSE;} Item *get_copy(THD *thd, MEM_ROOT *mem_root) @@ -1001,6 +1043,8 @@ class Item_func_div :public Item_num_op const char *func_name() const { return "/"; } enum precedence precedence() const { return MUL_PRECEDENCE; } void fix_length_and_dec(); + void fix_length_and_dec_double(); + void fix_length_and_dec_int(); void result_precision(); Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); } @@ -1040,6 +1084,22 @@ class Item_func_mod :public Item_num_op enum precedence precedence() const { return MUL_PRECEDENCE; } void result_precision(); void fix_length_and_dec(); + void fix_length_and_dec_double() + { + Item_num_op::fix_length_and_dec_double(); + unsigned_flag= args[0]->unsigned_flag; + } + void fix_length_and_dec_decimal() + { + Item_num_op::fix_length_and_dec_decimal(); + unsigned_flag= args[0]->unsigned_flag; + } + void fix_length_and_dec_int() + { + max_length= MY_MAX(args[0]->max_length, args[1]->max_length); + decimals= 0; + unsigned_flag= args[0]->unsigned_flag; + } bool check_partition_func_processor(void *int_arg) {return FALSE;} bool check_vcol_func_processor(void *arg) { return FALSE;} Item *get_copy(THD *thd, MEM_ROOT *mem_root) diff --git a/sql/sql_type.cc b/sql/sql_type.cc index 055a89697872e..337111f6e535e 100644 --- a/sql/sql_type.cc +++ b/sql/sql_type.cc @@ -60,6 +60,17 @@ Type_handler_geometry type_handler_geometry; bool Type_handler_data::init() { #ifdef HAVE_SPATIAL + +#ifndef DBUG_OFF + if (m_type_aggregator_non_commutative_test.add(&type_handler_geometry, + &type_handler_geometry, + &type_handler_geometry) || + m_type_aggregator_non_commutative_test.add(&type_handler_geometry, + &type_handler_varchar, + &type_handler_long_blob)) + return true; +#endif + return m_type_aggregator_for_result.add(&type_handler_geometry, &type_handler_null, @@ -466,6 +477,63 @@ Type_handler_hybrid_field_type::aggregate_for_comparison(const Type_handler *h) } +const Type_handler * +Type_handler::aggregate_for_num_op_traditional(const Type_handler *h0, + const Type_handler *h1) +{ + Item_result r0= h0->cmp_type(); + Item_result r1= h1->cmp_type(); + + if (r0 == REAL_RESULT || r1 == REAL_RESULT || + r0 == STRING_RESULT || r1 ==STRING_RESULT) + return &type_handler_double; + + if (r0 == TIME_RESULT || r1 == TIME_RESULT) + return &type_handler_datetime; + + if (r0 == DECIMAL_RESULT || r1 == DECIMAL_RESULT) + return &type_handler_newdecimal; + + DBUG_ASSERT(r0 == INT_RESULT && r1 == INT_RESULT); + return &type_handler_longlong; +} + + +const Type_aggregator::Pair* +Type_aggregator::find_pair(const Type_handler *handler1, + const Type_handler *handler2) const +{ + for (uint i= 0; i < m_array.elements(); i++) + { + const Pair& el= m_array.at(i); + if (el.eq(handler1, handler2) || + (m_is_commutative && el.eq(handler2, handler1))) + return ⪙ + } + return NULL; +} + + +bool +Type_handler_hybrid_field_type::aggregate_for_num_op(const Type_aggregator *agg, + const Type_handler *h0, + const Type_handler *h1) +{ + const Type_handler *hres; + if (h0->is_traditional_type() && h1->is_traditional_type()) + { + set_handler(Type_handler::aggregate_for_num_op_traditional(h0, h1)); + return false; + } + if ((hres= agg->find_handler(h0, h1))) + { + set_handler(hres); + return false; + } + return true; +} + + /***************************************************************************/ const Type_handler * @@ -2709,3 +2777,248 @@ bool Type_handler_geometry:: #endif /* HAVE_SPATIAL */ /***************************************************************************/ + +bool Type_handler_row:: + Item_func_plus_fix_length_and_dec(Item_func_plus *item) const +{ + DBUG_ASSERT(0); + return true; +} + + +bool Type_handler_int_result:: + Item_func_plus_fix_length_and_dec(Item_func_plus *item) const +{ + item->fix_length_and_dec_int(); + return false; +} + + +bool Type_handler_real_result:: + Item_func_plus_fix_length_and_dec(Item_func_plus *item) const +{ + item->fix_length_and_dec_double(); + return false; +} + + +bool Type_handler_decimal_result:: + Item_func_plus_fix_length_and_dec(Item_func_plus *item) const +{ + item->fix_length_and_dec_decimal(); + return false; +} + + +bool Type_handler_temporal_result:: + Item_func_plus_fix_length_and_dec(Item_func_plus *item) const +{ + item->fix_length_and_dec_temporal(); + return false; +} + + +bool Type_handler_string_result:: + Item_func_plus_fix_length_and_dec(Item_func_plus *item) const +{ + item->fix_length_and_dec_double(); + return false; +} + +/***************************************************************************/ + +bool Type_handler_row:: + Item_func_minus_fix_length_and_dec(Item_func_minus *item) const +{ + DBUG_ASSERT(0); + return true; +} + + +bool Type_handler_int_result:: + Item_func_minus_fix_length_and_dec(Item_func_minus *item) const +{ + item->fix_length_and_dec_int(); + return false; +} + + +bool Type_handler_real_result:: + Item_func_minus_fix_length_and_dec(Item_func_minus *item) const +{ + item->fix_length_and_dec_double(); + return false; +} + + +bool Type_handler_decimal_result:: + Item_func_minus_fix_length_and_dec(Item_func_minus *item) const +{ + item->fix_length_and_dec_decimal(); + return false; +} + + +bool Type_handler_temporal_result:: + Item_func_minus_fix_length_and_dec(Item_func_minus *item) const +{ + item->fix_length_and_dec_temporal(); + return false; +} + + +bool Type_handler_string_result:: + Item_func_minus_fix_length_and_dec(Item_func_minus *item) const +{ + item->fix_length_and_dec_double(); + return false; +} + +/***************************************************************************/ + +bool Type_handler_row:: + Item_func_mul_fix_length_and_dec(Item_func_mul *item) const +{ + DBUG_ASSERT(0); + return true; +} + + +bool Type_handler_int_result:: + Item_func_mul_fix_length_and_dec(Item_func_mul *item) const +{ + item->fix_length_and_dec_int(); + return false; +} + + +bool Type_handler_real_result:: + Item_func_mul_fix_length_and_dec(Item_func_mul *item) const +{ + item->fix_length_and_dec_double(); + return false; +} + + +bool Type_handler_decimal_result:: + Item_func_mul_fix_length_and_dec(Item_func_mul *item) const +{ + item->fix_length_and_dec_decimal(); + return false; +} + + +bool Type_handler_temporal_result:: + Item_func_mul_fix_length_and_dec(Item_func_mul *item) const +{ + item->fix_length_and_dec_temporal(); + return false; +} + + +bool Type_handler_string_result:: + Item_func_mul_fix_length_and_dec(Item_func_mul *item) const +{ + item->fix_length_and_dec_double(); + return false; +} + +/***************************************************************************/ + +bool Type_handler_row:: + Item_func_div_fix_length_and_dec(Item_func_div *item) const +{ + DBUG_ASSERT(0); + return true; +} + + +bool Type_handler_int_result:: + Item_func_div_fix_length_and_dec(Item_func_div *item) const +{ + item->fix_length_and_dec_int(); + return false; +} + + +bool Type_handler_real_result:: + Item_func_div_fix_length_and_dec(Item_func_div *item) const +{ + item->fix_length_and_dec_double(); + return false; +} + + +bool Type_handler_decimal_result:: + Item_func_div_fix_length_and_dec(Item_func_div *item) const +{ + item->fix_length_and_dec_decimal(); + return false; +} + + +bool Type_handler_temporal_result:: + Item_func_div_fix_length_and_dec(Item_func_div *item) const +{ + item->fix_length_and_dec_temporal(); + return false; +} + + +bool Type_handler_string_result:: + Item_func_div_fix_length_and_dec(Item_func_div *item) const +{ + item->fix_length_and_dec_double(); + return false; +} + +/***************************************************************************/ + +bool Type_handler_row:: + Item_func_mod_fix_length_and_dec(Item_func_mod *item) const +{ + DBUG_ASSERT(0); + return true; +} + + +bool Type_handler_int_result:: + Item_func_mod_fix_length_and_dec(Item_func_mod *item) const +{ + item->fix_length_and_dec_int(); + return false; +} + + +bool Type_handler_real_result:: + Item_func_mod_fix_length_and_dec(Item_func_mod *item) const +{ + item->fix_length_and_dec_double(); + return false; +} + + +bool Type_handler_decimal_result:: + Item_func_mod_fix_length_and_dec(Item_func_mod *item) const +{ + item->fix_length_and_dec_decimal(); + return false; +} + + +bool Type_handler_temporal_result:: + Item_func_mod_fix_length_and_dec(Item_func_mod *item) const +{ + item->fix_length_and_dec_temporal(); + return false; +} + + +bool Type_handler_string_result:: + Item_func_mod_fix_length_and_dec(Item_func_mod *item) const +{ + item->fix_length_and_dec_double(); + return false; +} + +/***************************************************************************/ diff --git a/sql/sql_type.h b/sql/sql_type.h index 053132626a3b4..891c785fef20e 100644 --- a/sql/sql_type.h +++ b/sql/sql_type.h @@ -51,6 +51,11 @@ class Item_char_typecast; class Item_time_typecast; class Item_date_typecast; class Item_datetime_typecast; +class Item_func_plus; +class Item_func_minus; +class Item_func_mul; +class Item_func_div; +class Item_func_mod; class cmp_item; class in_vector; class Type_std_attributes; @@ -303,6 +308,9 @@ class Type_handler static const Type_handler *aggregate_for_result_traditional(const Type_handler *h1, const Type_handler *h2); + static const + Type_handler *aggregate_for_num_op_traditional(const Type_handler *h1, + const Type_handler *h2); virtual const Name name() const= 0; virtual enum_field_types field_type() const= 0; @@ -497,6 +505,17 @@ class Type_handler Item_date_typecast_fix_length_and_dec(Item_date_typecast *item) const; virtual bool Item_datetime_typecast_fix_length_and_dec(Item_datetime_typecast *item) const; + + virtual bool + Item_func_plus_fix_length_and_dec(Item_func_plus *func) const= 0; + virtual bool + Item_func_minus_fix_length_and_dec(Item_func_minus *func) const= 0; + virtual bool + Item_func_mul_fix_length_and_dec(Item_func_mul *func) const= 0; + virtual bool + Item_func_div_fix_length_and_dec(Item_func_div *func) const= 0; + virtual bool + Item_func_mod_fix_length_and_dec(Item_func_mod *func) const= 0; }; @@ -708,6 +727,12 @@ class Type_handler_row: public Type_handler DBUG_ASSERT(0); return true; } + + bool Item_func_plus_fix_length_and_dec(Item_func_plus *) const; + bool Item_func_minus_fix_length_and_dec(Item_func_minus *) const; + bool Item_func_mul_fix_length_and_dec(Item_func_mul *) const; + bool Item_func_div_fix_length_and_dec(Item_func_div *) const; + bool Item_func_mod_fix_length_and_dec(Item_func_mod *) const; }; @@ -784,6 +809,11 @@ class Type_handler_real_result: public Type_handler_numeric bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const; bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const; bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const; + bool Item_func_plus_fix_length_and_dec(Item_func_plus *) const; + bool Item_func_minus_fix_length_and_dec(Item_func_minus *) const; + bool Item_func_mul_fix_length_and_dec(Item_func_mul *) const; + bool Item_func_div_fix_length_and_dec(Item_func_div *) const; + bool Item_func_mod_fix_length_and_dec(Item_func_mod *) const; }; @@ -833,6 +863,11 @@ class Type_handler_decimal_result: public Type_handler_numeric bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const; bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const; bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const; + bool Item_func_plus_fix_length_and_dec(Item_func_plus *) const; + bool Item_func_minus_fix_length_and_dec(Item_func_minus *) const; + bool Item_func_mul_fix_length_and_dec(Item_func_mul *) const; + bool Item_func_div_fix_length_and_dec(Item_func_div *) const; + bool Item_func_mod_fix_length_and_dec(Item_func_mod *) const; }; @@ -881,6 +916,11 @@ class Type_handler_int_result: public Type_handler_numeric bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const; bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const; bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const; + bool Item_func_plus_fix_length_and_dec(Item_func_plus *) const; + bool Item_func_minus_fix_length_and_dec(Item_func_minus *) const; + bool Item_func_mul_fix_length_and_dec(Item_func_mul *) const; + bool Item_func_div_fix_length_and_dec(Item_func_div *) const; + bool Item_func_mod_fix_length_and_dec(Item_func_mod *) const; }; @@ -933,6 +973,11 @@ class Type_handler_temporal_result: public Type_handler bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const; bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const; bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const; + bool Item_func_plus_fix_length_and_dec(Item_func_plus *) const; + bool Item_func_minus_fix_length_and_dec(Item_func_minus *) const; + bool Item_func_mul_fix_length_and_dec(Item_func_mul *) const; + bool Item_func_div_fix_length_and_dec(Item_func_div *) const; + bool Item_func_mod_fix_length_and_dec(Item_func_mod *) const; }; @@ -999,6 +1044,11 @@ class Type_handler_string_result: public Type_handler bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const; bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const; bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const; + bool Item_func_plus_fix_length_and_dec(Item_func_plus *) const; + bool Item_func_minus_fix_length_and_dec(Item_func_minus *) const; + bool Item_func_mul_fix_length_and_dec(Item_func_mul *) const; + bool Item_func_div_fix_length_and_dec(Item_func_div *) const; + bool Item_func_mod_fix_length_and_dec(Item_func_mod *) const; }; @@ -1528,6 +1578,8 @@ class Type_handler_hybrid_field_type bool aggregate_for_result(const Type_handler *other); bool aggregate_for_result(const char *funcname, Item **item, uint nitems, bool treat_bit_as_number); + bool aggregate_for_num_op(const class Type_aggregator *aggregator, + const Type_handler *h0, const Type_handler *h1); }; @@ -1547,6 +1599,7 @@ extern Type_handler_set type_handler_set; class Type_aggregator { + bool m_is_commutative; class Pair { public: @@ -1566,18 +1619,10 @@ class Type_aggregator }; Dynamic_array m_array; const Pair* find_pair(const Type_handler *handler1, - const Type_handler *handler2) const - { - for (uint i= 0; i < m_array.elements(); i++) - { - const Pair& el= m_array.at(i); - if (el.eq(handler1, handler2) || el.eq(handler2, handler1)) - return ⪙ - } - return NULL; - } + const Type_handler *handler2) const; public: - Type_aggregator() + Type_aggregator(bool is_commutative= false) + :m_is_commutative(is_commutative) { } bool add(const Type_handler *handler1, const Type_handler *handler2, @@ -1591,14 +1636,35 @@ class Type_aggregator const Pair* el= find_pair(handler1, handler2); return el ? el->m_result : NULL; } + bool is_commutative() const { return m_is_commutative; } +}; + + +class Type_aggregator_commutative: public Type_aggregator +{ +public: + Type_aggregator_commutative() + :Type_aggregator(true) + { } }; class Type_handler_data { public: - Type_aggregator m_type_aggregator_for_result; - Type_aggregator m_type_aggregator_for_comparison; + Type_aggregator_commutative m_type_aggregator_for_result; + Type_aggregator_commutative m_type_aggregator_for_comparison; + + Type_aggregator_commutative m_type_aggregator_for_plus; + Type_aggregator_commutative m_type_aggregator_for_mul; + + Type_aggregator m_type_aggregator_for_minus; + Type_aggregator m_type_aggregator_for_div; + Type_aggregator m_type_aggregator_for_mod; +#ifndef DBUG_OFF + // This is used for mtr purposes in debug builds + Type_aggregator m_type_aggregator_non_commutative_test; +#endif bool init(); };