From e3859a81448b481ad33518455d20fb76acbde84d Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 27 Aug 2013 09:08:49 +0200 Subject: [PATCH 01/80] Raise version number after cloning 5.5.34 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 26414adb678..3a42bb0f600 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ MYSQL_VERSION_MAJOR=5 MYSQL_VERSION_MINOR=5 -MYSQL_VERSION_PATCH=34 +MYSQL_VERSION_PATCH=35 MYSQL_VERSION_EXTRA= From 277697b81f5a3856a0fc7c7282810590cf0e5346 Mon Sep 17 00:00:00 2001 From: Neeraj Bisht Date: Wed, 28 Aug 2013 14:54:53 +0530 Subject: [PATCH 02/80] Bug#16346241 - SERVER CRASH IN ITEM_PARAM::QUERY_VAL_STR Problem:- Second execution of prepared statement for query with parameter in limit clause, causes an assert when using connectors (e.g., Connector C). Analysis:- In prepared statement, LIMIT parameters can be specified using '?' markers. Value for the parameter can be supplied while executing the prepared statement. Passing string, float or double values for LIMIT clause works well from command-line client. That's because, while setting the LIMIT parameter value from a user-variable, the value is converted to integer value. However, when prepared statement is executed from other interfaces as J connectors, or C applications etc, the value for the parameters are sent to the server with execute command. Each item in command has value and the data TYPE. So, while setting parameter values from this log, value is set to all the parameters with the same data type as passed. Here, we have the logic to convert the value to change the state and item_type if it is part of LIMIT parameter and its item_type is not INT. But when we reset this parameter we save the item_type but change state. So on second execution we have old item_type but our state has been changed, which make us to use string type variable in Item_param::query_str_val(). This cause an assert. Fix: Instead of checking the item_type of the parameter, check for the state of the parameter. As state value are reset everytime we execute the statement. --- sql/sql_prepare.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 74279c5539d..48d23cd5d21 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -877,7 +877,7 @@ static bool insert_params_with_log(Prepared_statement *stmt, uchar *null_array, if (param->state == Item_param::NO_VALUE) DBUG_RETURN(1); - if (param->limit_clause_param && param->item_type != Item::INT_ITEM) + if (param->limit_clause_param && param->state != Item_param::INT_VALUE) { param->set_int(param->val_int(), MY_INT64_NUM_DECIMAL_DIGITS); param->item_type= Item::INT_ITEM; From 881e61db72e568ef0b55bc36d710c650abccfa85 Mon Sep 17 00:00:00 2001 From: Raghav Kapoor Date: Wed, 28 Aug 2013 15:17:46 +0530 Subject: [PATCH 03/80] BUG#17294150-POTENTIAL CRASH DUE TO BUFFER OVERRUN IN SSL ERROR HANDLING CODE BACKGROUND: There can be a potential crash due to buffer overrun in SSL error handling code due to missing comma in ssl_error_string[] array in viosslfactories.c. ANALYSIS: Found by code Inspection. FIX: Added the missing comma in SSL error handling code in ssl_error_string[] array in viosslfactories.c. --- vio/viosslfactories.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c index 5d31d1dde56..9f689bf7c86 100644 --- a/vio/viosslfactories.c +++ b/vio/viosslfactories.c @@ -80,7 +80,7 @@ ssl_error_string[] = "No error", "Unable to get certificate", "Unable to get private key", - "Private key does not match the certificate public key" + "Private key does not match the certificate public key", "SSL_CTX_set_default_verify_paths failed", "Failed to set ciphers to use", "SSL_CTX_new failed" From 095b6645b0eba758ab258ca9587da7e0edd34f16 Mon Sep 17 00:00:00 2001 From: Balasubramanian Kandasamy Date: Thu, 29 Aug 2013 14:42:55 +0200 Subject: [PATCH 04/80] Fix for Bug#17377159, ignore mysqld_safe.pid file created by mysqld_safe script --- support-files/mysql.spec.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 2d8aa78464b..bcd66b96c2b 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -643,7 +643,7 @@ then fi if [ -z "$PID_FILE_PATT" ] then - PID_FILE_PATT="$mysql_datadir/*.pid" + PID_FILE_PATT=`ls $mysql_datadir/*.pid 2>/dev/null | grep -v "mysqld_safe.pid"` fi # Check if we can safely upgrade. An upgrade is only safe if it's from one @@ -1194,6 +1194,9 @@ fi # merging BK trees) ############################################################################## %changelog +* Thu Aug 29 2013 Balasubramanian Kandasamy +- Added logic to ignore mysqld_safe.pid file created by mysqld_safe script + * Tue Sep 11 2012 Joerg Bruehe - Disable "maintainer mode" in debug builds, there is a cast ulonglong -> int From 9e49de009c2ce2523c3c50effb049fc98825e71c Mon Sep 17 00:00:00 2001 From: Balasubramanian Kandasamy Date: Fri, 30 Aug 2013 17:14:46 +0200 Subject: [PATCH 05/80] Fix to ignore mysqld_safe.pid --- support-files/mysql.spec.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index bcd66b96c2b..ea6eddd7279 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -643,7 +643,7 @@ then fi if [ -z "$PID_FILE_PATT" ] then - PID_FILE_PATT=`ls $mysql_datadir/*.pid 2>/dev/null | grep -v "mysqld_safe.pid"` + PID_FILE_PATT="$mysql_datadir/*.pid" fi # Check if we can safely upgrade. An upgrade is only safe if it's from one @@ -716,7 +716,7 @@ fi # We assume that if there is exactly one ".pid" file, # it contains the valid PID of a running MySQL server. -NR_PID_FILES=`ls $PID_FILE_PATT 2>/dev/null | wc -l` +NR_PID_FILES=`ls $PID_FILE_PATT 2>/dev/null | grep -v "mysqld_safe.pid" | wc -l` case $NR_PID_FILES in 0 ) SERVER_TO_START='' ;; # No "*.pid" file == no running server 1 ) SERVER_TO_START='true' ;; From 28959a5661d14de784ab8b369613511727200811 Mon Sep 17 00:00:00 2001 From: Igor Solodovnikov Date: Fri, 30 Aug 2013 20:05:37 +0300 Subject: [PATCH 06/80] Bug #17297012 MEMORY LEAK IN MYSQL_OPTIONS WHILE CALLING WITH OPTION MYSQL_SET_CLIENT_IP Memory Leak in mysql_options() was caused by missing call to my_free() in MYSQL_SET_CLIENT_IP branch. Fixed by adding my_free() to cleanup mysql->options.client_ip value before assigning new value. --- sql-common/client.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql-common/client.c b/sql-common/client.c index 51911d913c7..7ee0eabe0ef 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -3167,6 +3167,7 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg) mysql->options.methods_to_use= option; break; case MYSQL_SET_CLIENT_IP: + my_free(mysql->options.client_ip,MYF(MY_ALLOW_ZERO_PTR)); mysql->options.client_ip= my_strdup(arg, MYF(MY_WME)); break; case MYSQL_SECURE_AUTH: From ee15c1fd5fcbbed3293d564c29e672de02b55b65 Mon Sep 17 00:00:00 2001 From: Igor Solodovnikov Date: Fri, 30 Aug 2013 20:22:09 +0300 Subject: [PATCH 07/80] Bug #17297012 MEMORY LEAK IN MYSQL_OPTIONS WHILE CALLING WITH OPTION MYSQL_SET_CLIENT_IP Memory Leak in mysql_options() was caused by missing call to my_free() in MYSQL_SET_CLIENT_IP branch. Fixed by adding my_free() to cleanup mysql->options.client_ip value before assigning new value. --- sql-common/client.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sql-common/client.c b/sql-common/client.c index 1e98eadda28..16a61d7f53d 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -4151,6 +4151,7 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg) mysql->options.methods_to_use= option; break; case MYSQL_SET_CLIENT_IP: + my_free(mysql->options.client_ip); mysql->options.client_ip= my_strdup(arg, MYF(MY_WME)); break; case MYSQL_SECURE_AUTH: From 8054e052a5eb56fde7fcc89564ca22117058af3d Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 1 Sep 2013 18:51:52 +0530 Subject: [PATCH 08/80] From a752639714e15f3843b0570c0f2ff95c3cf3df0e Mon Sep 17 00:00:00 2001 From: Arun Kuruvila Date: Mon, 2 Sep 2013 14:53:45 +0530 Subject: [PATCH 09/80] Bug #17168602 MYSQL_PLUGIN REMOVES NON-DIRECTORY TYPE FILES SPECIFIED WITH THE BASEDIR OPTION Description: The mysql_plugin client attempts to remove any filename specified to the --basedir option. The problem is that if the filename does not end with a slash, it will attempt to unlink it, which succeeds for files, but not for directories. Analysis: When we are starting mysql_plugin with basedir option and if we are giving path of a file as basedir, it deletes that file. It was because it uses a function my_delete which unlinks the file path given. Fix: As a fix we replace that line using another function my_free, which will only free the pointer which is having that file path. --- client/mysql_plugin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/mysql_plugin.c b/client/mysql_plugin.c index 72bab3ad528..7fbfeb9e9a6 100644 --- a/client/mysql_plugin.c +++ b/client/mysql_plugin.c @@ -856,7 +856,7 @@ static int process_options(int argc, char *argv[], char *operation) strncat(buff, FN_DIRSEP, sizeof(buff) - strlen(buff) - 1); #endif buff[sizeof(buff) - 1]= 0; - my_delete(opt_basedir, MYF(0)); + my_free(opt_basedir); opt_basedir= my_strdup(buff, MYF(MY_FAE)); } } From 0daae54fb541e806b521e8b6db9d14d83af48136 Mon Sep 17 00:00:00 2001 From: Hery Ramilison Date: Tue, 3 Sep 2013 18:37:46 +0200 Subject: [PATCH 10/80] Fixing sles11 build that /usr/lib/mysql/plugin is not owned by a package --- support-files/mysql.spec.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index ea6eddd7279..9560eeea53a 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -1025,6 +1025,7 @@ fi %attr(755, root, root) %{_sbindir}/mysqld-debug %attr(755, root, root) %{_sbindir}/mysqlmanager %attr(755, root, root) %{_sbindir}/rcmysql +%attr(755, root, root) %{_libdir}/mysql/plugin %if %{INNODB_BUILD} %if %{WITH_INNODB_PLUGIN} %attr(755, root, root) %{_libdir}/mysql/plugin/ha_innodb_plugin.so* From e203951cb1e42404ed62abbfe7eb6e4cce53218c Mon Sep 17 00:00:00 2001 From: Neeraj Bisht Date: Wed, 4 Sep 2013 10:45:55 +0530 Subject: [PATCH 11/80] Bug#17222452 - SELECT COUNT(DISTINCT A,B) INCORRECTLY COUNTS ROWS CONTAINING NULL Problem:- In MySQL, We can obtain the number of distinct expression combinations that do not contain NULL by giving a list of expressions in COUNT(DISTINCT). However rows with NULL values are incorrectly included in the count when loose index scan is used. Analysis:- In case of loose index scan, we check whether the field is null or not and increase the count in Item_sum_count::add(). But there we are checking for the first field in COUNT(DISTINCT), not for every field. This is causing an incorrect result. Solution:- Check all field in Item_sum_count::add(), whether there values are null or not. Then only increment the count. ****** Bug#17222452 - SELECT COUNT(DISTINCT A,B) INCORRECTLY COUNTS ROWS CONTAINING NULL Problem:- In MySQL, We can obtain the number of distinct expression combinations that do not contain NULL by giving a list of expressions in COUNT(DISTINCT). However rows with NULL values are incorrectly included in the count when loose index scan is used. Analysis:- In case of loose index scan, we check whether the field is null or not and increase the count in Item_sum_count::add(). But there we are checking for the first field in COUNT(DISTINCT), not for every field. This is causing an incorrect result. Solution:- Check all field in Item_sum_count::add(), whether there values are null or not. Then only increment the count. --- sql/item_sum.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sql/item_sum.cc b/sql/item_sum.cc index e194907fa06..3fbbc1b811a 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1496,8 +1496,12 @@ void Item_sum_count::clear() bool Item_sum_count::add() { - if (!args[0]->maybe_null || !args[0]->is_null()) - count++; + for (uint i=0; imaybe_null && args[i]->is_null()) + return 0; + } + count++; return 0; } From 14976fbe8a5d9e88cba6474808b8b59790e84c3e Mon Sep 17 00:00:00 2001 From: Nisha Gopalakrishnan Date: Thu, 5 Sep 2013 13:40:27 +0530 Subject: [PATCH 12/80] BUG#16032946 - PLEASE GIVE A MESSAGE FOR "THREAD_CONCURRENCY DOESN'T DO WHAT YOU EXPECT" Fix info: -------- Backport of the deprecation bug fix (WL#5265) for global variable 'THREAD_CONCURRENCY' from mysql-5.6 to mysql-5.5 Note: With this backport, certain additional deprecation warnings would be reported under error conditions while setting the global/session variables. --- sql/set_var.cc | 2 +- sql/set_var.h | 3 ++- sql/sys_vars.cc | 10 +++++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/sql/set_var.cc b/sql/set_var.cc index 75387b974f1..82ea8298a66 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -217,7 +217,6 @@ uchar *sys_var::global_value_ptr(THD *thd, LEX_STRING *base) bool sys_var::check(THD *thd, set_var *var) { - do_deprecated_warning(thd); if ((var->value && do_check(thd, var)) || (on_check && on_check(this, thd, var))) { @@ -593,6 +592,7 @@ err: int set_var::check(THD *thd) { + var->do_deprecated_warning(thd); if (var->is_readonly()) { my_error(ER_INCORRECT_GLOBAL_LOCAL_VAR, MYF(0), var->name.str, "read only"); diff --git a/sql/set_var.h b/sql/set_var.h index 01e3be11621..60164ba0363 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -143,6 +143,7 @@ public: return (option.id != -1) && (m_parse_flag & parse_flags) && insert_dynamic(array, (uchar*)&option); } + void do_deprecated_warning(THD *thd); private: virtual bool do_check(THD *thd, set_var *var) = 0; @@ -156,7 +157,7 @@ private: virtual void global_save_default(THD *thd, set_var *var) = 0; virtual bool session_update(THD *thd, set_var *var) = 0; virtual bool global_update(THD *thd, set_var *var) = 0; - void do_deprecated_warning(THD *thd); + protected: /** A pointer to a value of the variable for SHOW. diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 1d0f9691629..63f478be5f0 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1797,9 +1797,13 @@ static Sys_var_charptr Sys_socket( static Sys_var_ulong Sys_thread_concurrency( "thread_concurrency", "Permits the application to give the threads system a hint for " - "the desired number of threads that should be run at the same time", + "the desired number of threads that should be run at the same time." + "This variable has no effect, and is deprecated. " + "It will be removed in a future release.", READ_ONLY GLOBAL_VAR(concurrency), CMD_LINE(REQUIRED_ARG), - VALID_RANGE(1, 512), DEFAULT(DEFAULT_CONCURRENCY), BLOCK_SIZE(1)); + VALID_RANGE(1, 512), DEFAULT(DEFAULT_CONCURRENCY), BLOCK_SIZE(1), + NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0), + DEPRECATED("")); static Sys_var_ulong Sys_thread_stack( "thread_stack", "The stack size for each thread", From b0915e6abdd607fc666025ca57aef615b4816864 Mon Sep 17 00:00:00 2001 From: Venkata Sidagam Date: Thu, 5 Sep 2013 14:18:43 +0530 Subject: [PATCH 13/80] Bug #17168602 MYSQL_PLUGIN REMOVES NON-DIRECTORY TYPE FILES SPECIFIED WITH THE BASEDIR OPTION Reverting the patch. Because asked for second review. --- client/mysql_plugin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/mysql_plugin.c b/client/mysql_plugin.c index 7fbfeb9e9a6..72bab3ad528 100644 --- a/client/mysql_plugin.c +++ b/client/mysql_plugin.c @@ -856,7 +856,7 @@ static int process_options(int argc, char *argv[], char *operation) strncat(buff, FN_DIRSEP, sizeof(buff) - strlen(buff) - 1); #endif buff[sizeof(buff) - 1]= 0; - my_free(opt_basedir); + my_delete(opt_basedir, MYF(0)); opt_basedir= my_strdup(buff, MYF(MY_FAE)); } } From 7b5e90b4dd7e5be7552f75fbc7e2c89b2fd63260 Mon Sep 17 00:00:00 2001 From: Raghav Kapoor Date: Fri, 6 Sep 2013 12:38:11 +0530 Subject: [PATCH 14/80] Post push fix of openssl_1.test failure --- mysql-test/r/openssl_1.result | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result index b6efab9c055..2a3eeacab3b 100644 --- a/mysql-test/r/openssl_1.result +++ b/mysql-test/r/openssl_1.result @@ -83,7 +83,7 @@ Ssl_cipher AES128-SHA SHOW STATUS LIKE 'Ssl_cipher'; Variable_name Value Ssl_cipher AES128-SHA -mysqltest: Could not open connection 'default': 2026 SSL connection error: SSL_CTX_new failed +mysqltest: Could not open connection 'default': 2026 SSL connection error: Failed to set ciphers to use CREATE TABLE t1(a int); INSERT INTO t1 VALUES (1), (2); From 28278b141009a44957986bba8f553040dffb1373 Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Mon, 9 Sep 2013 12:43:08 +0200 Subject: [PATCH 15/80] Bug#16870783 RECENT REGRESSION: CRASH WITH GROUP_CONCAT AND INVALID SEPARATOR Add missing initialization in lex_start() --- sql/sql_lex.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index bc313ed0486..9113f31c76c 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -411,6 +411,7 @@ void lex_start(THD *thd) lex->select_lex.ftfunc_list= &lex->select_lex.ftfunc_list_alloc; lex->select_lex.group_list.empty(); lex->select_lex.order_list.empty(); + lex->select_lex.gorder_list.empty(); lex->duplicates= DUP_ERROR; lex->ignore= 0; lex->spname= NULL; From 27c6c4e8ac690b3619b7ee2f8582b015e42ce346 Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Mon, 9 Sep 2013 14:20:50 +0200 Subject: [PATCH 16/80] Bug#17296644 CONV(X, INT_MIN, INT_MIN) SEGFAULTS THE SERVER Do not call abs(INT_MIN) as the result is undefined. --- configure.cmake | 4 ++++ sql/item_strfunc.cc | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/configure.cmake b/configure.cmake index 3474f12f1e1..c3ac3a8222f 100644 --- a/configure.cmake +++ b/configure.cmake @@ -147,6 +147,10 @@ IF(UNIX) SET(CMAKE_REQUIRED_LIBRARIES ${LIBM} ${LIBNSL} ${LIBBIND} ${LIBCRYPT} ${LIBSOCKET} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT} ${LIBRT}) + # Need explicit pthread for gcc -fsanitize=address + IF(CMAKE_USE_PTHREADS_INIT AND CMAKE_C_FLAGS MATCHES "-fsanitize=") + SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} pthread) + ENDIF() LIST(LENGTH CMAKE_REQUIRED_LIBRARIES required_libs_length) IF(${required_libs_length} GREATER 0) diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index f654d260564..363ca02fd7a 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -2928,7 +2928,9 @@ String *Item_func_conv::val_str(String *str) int to_base= (int) args[2]->val_int(); int err; + // Note that abs(INT_MIN) is undefined. if (args[0]->null_value || args[1]->null_value || args[2]->null_value || + from_base == INT_MIN || to_base == INT_MIN || abs(to_base) > 36 || abs(to_base) < 2 || abs(from_base) > 36 || abs(from_base) < 2 || !(res->length())) { From 044a7d7c2f2c13f1649d02b69de93c85edd3fdf2 Mon Sep 17 00:00:00 2001 From: Venkata Sidagam Date: Mon, 9 Sep 2013 20:32:50 +0530 Subject: [PATCH 17/80] Bug #16776528 RACE CONDITION CAN CAUSE MYSQLD TO REMOVE SOCKET FILE ERRANTLY Reverting the patch. Because this change is not to me made for GA versions. --- scripts/mysqld_safe.sh | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index f3759cbbf6b..48c98f2fde3 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -343,32 +343,6 @@ fi parse_arguments `$print_defaults $defaults --loose-verbose mysqld_safe safe_mysqld` parse_arguments PICK-ARGS-FROM-ARGV "$@" -# A pid file is created for the mysqld_safe process. This file protects the -# server instance resources during race conditions. -safe_pid="$DATADIR/mysqld_safe.pid" -if test -f $safe_pid -then - PID=`cat "$safe_pid"` - if @CHECK_PID@ - then - if @FIND_PROC@ - then - log_error "A mysqld_safe process already exists" - exit 1 - fi - fi - rm -f "$safe_pid" - if test -f "$safe_pid" - then - log_error "Fatal error: Can't remove the mysqld_safe pid file" - exit 1 - fi -fi - -# Insert pid proerply into the pid file. -ps -e | grep [m]ysqld_safe | awk '{print $1}' | sed -n 1p > $safe_pid -# End of mysqld_safe pid(safe_pid) check. - # Determine what logging facility to use # Ensure that 'logger' exists, if it's requested @@ -378,7 +352,6 @@ then if [ $? -ne 0 ] then log_error "--syslog requested, but no 'logger' program found. Please ensure that 'logger' is in your PATH, or do not specify the --syslog option to mysqld_safe." - rm -f "$safe_pid" # Clean Up of mysqld_safe.pid file. exit 1 fi fi @@ -483,7 +456,6 @@ does not exist or is not executable. Please cd to the mysql installation directory and restart this script from there as follows: ./bin/mysqld_safe& See http://dev.mysql.com/doc/mysql/en/mysqld-safe.html for more information" - rm -f "$safe_pid" # Clean Up of mysqld_safe.pid file. exit 1 fi @@ -577,7 +549,6 @@ then if @FIND_PROC@ then # The pid contains a mysqld process log_error "A mysqld process already exists" - rm -f "$safe_pid" # Clean Up of mysqld_safe.pid file. exit 1 fi fi @@ -588,7 +559,6 @@ then $pid_file Please remove it manually and start $0 again; mysqld daemon not started" - rm -f "$safe_pid" # Clean Up of mysqld_safe.pid file. exit 1 fi fi @@ -674,5 +644,3 @@ done log_notice "mysqld from pid file $pid_file ended" -rm -f "$safe_pid" # Some Extra Safety. File is deleted - # once the mysqld process ends. From 199a98ee28a01c6f378cf4a9d6940376862c4f6f Mon Sep 17 00:00:00 2001 From: Hery Ramilison Date: Mon, 9 Sep 2013 18:58:08 +0200 Subject: [PATCH 18/80] Committing patch from venkata.sidagam@oracle.com for Bug#16776528 --- scripts/mysqld_safe.sh | 32 -------------------------------- support-files/mysql.spec.sh | 2 +- 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index f3759cbbf6b..48c98f2fde3 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -343,32 +343,6 @@ fi parse_arguments `$print_defaults $defaults --loose-verbose mysqld_safe safe_mysqld` parse_arguments PICK-ARGS-FROM-ARGV "$@" -# A pid file is created for the mysqld_safe process. This file protects the -# server instance resources during race conditions. -safe_pid="$DATADIR/mysqld_safe.pid" -if test -f $safe_pid -then - PID=`cat "$safe_pid"` - if @CHECK_PID@ - then - if @FIND_PROC@ - then - log_error "A mysqld_safe process already exists" - exit 1 - fi - fi - rm -f "$safe_pid" - if test -f "$safe_pid" - then - log_error "Fatal error: Can't remove the mysqld_safe pid file" - exit 1 - fi -fi - -# Insert pid proerply into the pid file. -ps -e | grep [m]ysqld_safe | awk '{print $1}' | sed -n 1p > $safe_pid -# End of mysqld_safe pid(safe_pid) check. - # Determine what logging facility to use # Ensure that 'logger' exists, if it's requested @@ -378,7 +352,6 @@ then if [ $? -ne 0 ] then log_error "--syslog requested, but no 'logger' program found. Please ensure that 'logger' is in your PATH, or do not specify the --syslog option to mysqld_safe." - rm -f "$safe_pid" # Clean Up of mysqld_safe.pid file. exit 1 fi fi @@ -483,7 +456,6 @@ does not exist or is not executable. Please cd to the mysql installation directory and restart this script from there as follows: ./bin/mysqld_safe& See http://dev.mysql.com/doc/mysql/en/mysqld-safe.html for more information" - rm -f "$safe_pid" # Clean Up of mysqld_safe.pid file. exit 1 fi @@ -577,7 +549,6 @@ then if @FIND_PROC@ then # The pid contains a mysqld process log_error "A mysqld process already exists" - rm -f "$safe_pid" # Clean Up of mysqld_safe.pid file. exit 1 fi fi @@ -588,7 +559,6 @@ then $pid_file Please remove it manually and start $0 again; mysqld daemon not started" - rm -f "$safe_pid" # Clean Up of mysqld_safe.pid file. exit 1 fi fi @@ -674,5 +644,3 @@ done log_notice "mysqld from pid file $pid_file ended" -rm -f "$safe_pid" # Some Extra Safety. File is deleted - # once the mysqld process ends. diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 9560eeea53a..93a74ac8445 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -1025,9 +1025,9 @@ fi %attr(755, root, root) %{_sbindir}/mysqld-debug %attr(755, root, root) %{_sbindir}/mysqlmanager %attr(755, root, root) %{_sbindir}/rcmysql -%attr(755, root, root) %{_libdir}/mysql/plugin %if %{INNODB_BUILD} %if %{WITH_INNODB_PLUGIN} +%attr(755, root, root) %{_libdir}/mysql/plugin/ %attr(755, root, root) %{_libdir}/mysql/plugin/ha_innodb_plugin.so* %endif %endif From 07ffbdc2c93346479a5cc8257ed492efac77cd70 Mon Sep 17 00:00:00 2001 From: Balasubramanian Kandasamy Date: Mon, 9 Sep 2013 20:07:12 +0200 Subject: [PATCH 19/80] Reverted the changes to spec file to ignore mysqld_safe.pid file, updated the logic to get the correct count of PID files --- support-files/mysql.spec.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 93a74ac8445..8fbf9f08b9e 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -716,7 +716,7 @@ fi # We assume that if there is exactly one ".pid" file, # it contains the valid PID of a running MySQL server. -NR_PID_FILES=`ls $PID_FILE_PATT 2>/dev/null | grep -v "mysqld_safe.pid" | wc -l` +NR_PID_FILES=`ls -1 $PID_FILE_PATT 2>/dev/null | wc -l` case $NR_PID_FILES in 0 ) SERVER_TO_START='' ;; # No "*.pid" file == no running server 1 ) SERVER_TO_START='true' ;; @@ -1195,8 +1195,8 @@ fi # merging BK trees) ############################################################################## %changelog -* Thu Aug 29 2013 Balasubramanian Kandasamy -- Added logic to ignore mysqld_safe.pid file created by mysqld_safe script +* Mon Sep 09 2013 Balasubramanian Kandasamy +- Updated logic to get the correct count of PID files * Tue Sep 11 2012 Joerg Bruehe From 514b8261b5404c0b4fecbd66fc6fa99ca1bd8c47 Mon Sep 17 00:00:00 2001 From: Libing Song Date: Tue, 10 Sep 2013 09:35:49 +0800 Subject: [PATCH 20/80] Bug#17402313 DUMP THREAD SENDS SOME EVENTS MORE THAN ONCE Dump thread may encounter an error when reading events from the active binlog file. However the errors may be temporary, so dump thread will try to read the event again. But dump thread seeked to an wrong position, it caused some events was sent twice. To fix the bug, prev_pos is defined out the while loop and is set the correct position after reading every event correctly. This patch also make binlog_can_be_corrupted more accurate, only the binlogs not closed normally are marked binlog_can_be_corrupted. Finally, two warnings are added when dump threads encounter the temporary errors. --- sql/log_event.cc | 11 +++++++++++ sql/sql_repl.cc | 51 ++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 54 insertions(+), 8 deletions(-) diff --git a/sql/log_event.cc b/sql/log_event.cc index 16388fbbef7..d7e912cfe1a 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1027,6 +1027,17 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet, if (log_file_name_arg) *is_binlog_active= mysql_bin_log.is_active(log_file_name_arg); + DBUG_EXECUTE_IF("dump_fake_io_error", + { + if (log_lock) + { + pthread_mutex_unlock(log_lock); + + DBUG_SET("-d,dump_fake_io_error"); + DBUG_RETURN(LOG_READ_IO); + } + }); + if (my_b_read(file, (uchar*) buf, sizeof(buf))) { /* diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 06c25c324c7..4da7c5851ba 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -360,6 +360,9 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, int left_events = max_binlog_dump_events; #endif int old_max_allowed_packet= thd->variables.max_allowed_packet; + bool is_active_binlog= false; + my_off_t prev_pos= pos; + DBUG_ENTER("mysql_binlog_send"); DBUG_PRINT("enter",("log_ident: '%s' pos: %ld", log_ident, (long) pos)); @@ -483,7 +486,8 @@ impossible position"; Try to find a Format_description_log_event at the beginning of the binlog */ - if (!(error = Log_event::read_log_event(&log, packet, log_lock))) + if (!(error = Log_event::read_log_event(&log, packet, log_lock, + log_file_name, &is_active_binlog))) { /* The packet has offsets equal to the normal offsets in a binlog @@ -494,8 +498,14 @@ impossible position"; (*packet)[EVENT_TYPE_OFFSET+1])); if ((*packet)[EVENT_TYPE_OFFSET+1] == FORMAT_DESCRIPTION_EVENT) { - binlog_can_be_corrupted= test((*packet)[FLAGS_OFFSET+1] & - LOG_EVENT_BINLOG_IN_USE_F); + /* + If a binlog is not active, but LOG_EVENT_BINLOG_IN_USE_F + flag is 1. That means it is not closed in normal way + (E.g server crash) and may include corrupted events. + */ + binlog_can_be_corrupted= (!is_active_binlog) && + test((*packet)[FLAGS_OFFSET+1] & LOG_EVENT_BINLOG_IN_USE_F); + (*packet)[FLAGS_OFFSET+1] &= ~LOG_EVENT_BINLOG_IN_USE_F; /* mark that this event with "log_pos=0", so the slave @@ -547,12 +557,11 @@ impossible position"; while (!net->error && net->vio != 0 && !thd->killed) { - my_off_t prev_pos= pos; - bool is_active_binlog= false; while (!(error= Log_event::read_log_event(&log, packet, log_lock, log_file_name, &is_active_binlog))) { + DBUG_ASSERT(prev_pos < my_b_tell(&log)); prev_pos= my_b_tell(&log); #ifndef DBUG_OFF if (max_binlog_dump_events && !left_events--) @@ -580,8 +589,9 @@ impossible position"; if ((*packet)[EVENT_TYPE_OFFSET+1] == FORMAT_DESCRIPTION_EVENT) { - binlog_can_be_corrupted= test((*packet)[FLAGS_OFFSET+1] & - LOG_EVENT_BINLOG_IN_USE_F); + binlog_can_be_corrupted= (!is_active_binlog) && + test((*packet)[FLAGS_OFFSET+1] & LOG_EVENT_BINLOG_IN_USE_F); + (*packet)[FLAGS_OFFSET+1] &= ~LOG_EVENT_BINLOG_IN_USE_F; } else if ((*packet)[EVENT_TYPE_OFFSET+1] == STOP_EVENT) @@ -620,9 +630,31 @@ impossible position"; here we were reading binlog that was not closed properly (as a result of a crash ?). treat any corruption as EOF */ - if (binlog_can_be_corrupted && + if ((binlog_can_be_corrupted || is_active_binlog) && error != LOG_READ_MEM && error != LOG_READ_EOF) { + test_for_non_eof_log_read_errors(error, &errmsg); + + if (is_active_binlog) + { + sql_print_warning("Failed to read an event from active binlog(%s,%lu). " + "error: %s. Dump thread will try to read it again.", + log_file_name, (ulong)prev_pos, errmsg); + } + else + { + sql_print_warning("Failed to read an event from inactive binlog" + "(%s, %lu). error: %s. Dump thread found the binlog " + "was not rotated correctly. It will jump to next " + "binlog directly.", + log_file_name, (ulong) prev_pos, errmsg); + } + errmsg= NULL; + + /* + If binlog is active, it will try to read the event again. Otherwise, + skip the corrupted events and switch to next binlog. + */ my_b_seek(&log, prev_pos); error=LOG_READ_EOF; } @@ -695,6 +727,8 @@ impossible position"; /* we read successfully, so we'll need to send it to the slave */ pthread_mutex_unlock(log_lock); read_packet = 1; + DBUG_ASSERT(prev_pos < my_b_tell(&log)); + prev_pos= my_b_tell(&log); break; case LOG_READ_EOF: @@ -757,6 +791,7 @@ impossible position"; thd_proc_info(thd, "Finished reading one binlog; switching to next binlog"); switch (mysql_bin_log.find_next_log(&linfo, 1)) { case 0: + prev_pos= BIN_LOG_HEADER_SIZE; break; case LOG_INFO_EOF: if (mysql_bin_log.is_active(log_file_name)) From 1ba0dac57444ef0422d9ff13bd584c525959b840 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 10 Sep 2013 07:25:01 +0200 Subject: [PATCH 21/80] MTR: fix broken logic for ignoring missing ctest in Pushbuild --- mysql-test/mysql-test-run.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 19f82303221..54dcd982a4c 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -5998,7 +5998,7 @@ sub run_ctest() { # Special override: also ignore in Pushbuild, some platforms may not have it # Now, run ctest and collect output my $ctest_out= `ctest $ctest_vs 2>&1`; - if ($? == $no_ctest && $opt_ctest == -1 && ! defined $ENV{PB2WORKDIR}) { + if ($? == $no_ctest && ($opt_ctest == -1 || defined $ENV{PB2WORKDIR})) { chdir($olddir); return; } From aff9f26290277baa97ce3ce74829d8c1cf870e45 Mon Sep 17 00:00:00 2001 From: Libing Song Date: Tue, 10 Sep 2013 16:12:25 +0800 Subject: [PATCH 22/80] Bug#17402313 DUMP THREAD SENDS SOME EVENTS MORE THAN ONCE Postfix, suppress the new warning generated by the bug's fix. --- mysql-test/suite/rpl/r/rpl_log_pos.result | 1 + mysql-test/suite/rpl/t/rpl_log_pos.test | 1 + 2 files changed, 2 insertions(+) diff --git a/mysql-test/suite/rpl/r/rpl_log_pos.result b/mysql-test/suite/rpl/r/rpl_log_pos.result index b2224dcd725..b3f68157211 100644 --- a/mysql-test/suite/rpl/r/rpl_log_pos.result +++ b/mysql-test/suite/rpl/r/rpl_log_pos.result @@ -1,6 +1,7 @@ include/master-slave.inc [connection master] call mtr.add_suppression ("Slave I/O: Got fatal error 1236 from master when reading data from binary"); +CALL mtr.add_suppression("Failed to read an event from active binlog.*"); show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 # diff --git a/mysql-test/suite/rpl/t/rpl_log_pos.test b/mysql-test/suite/rpl/t/rpl_log_pos.test index 484ffa52a44..87be576c285 100644 --- a/mysql-test/suite/rpl/t/rpl_log_pos.test +++ b/mysql-test/suite/rpl/t/rpl_log_pos.test @@ -12,6 +12,7 @@ source include/master-slave.inc; call mtr.add_suppression ("Slave I/O: Got fatal error 1236 from master when reading data from binary"); +CALL mtr.add_suppression("Failed to read an event from active binlog.*"); source include/show_master_status.inc; sync_slave_with_master; source include/stop_slave.inc; From b9ec18374165acc1081c810104d0371c444fe49d Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Tue, 10 Sep 2013 11:20:29 +0200 Subject: [PATCH 23/80] Bug#16482467 ORDER BY IGNORED IN SOME SITUATIONS FOR UPDATE QUERY For queries like update t1 set ... where order by ... limit ... we need to handle the fact that unique keys allow NULL values, and hence can return more than one row. sql/opt_range.cc: When the unique key has multiple key parts, check each key_part for nullability, rather than the first key part. (s/key->part ==/key_tree->part ==/) Also: revert the if() test, for better readability. --- sql/opt_range.cc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 386faed3aa2..c7a7d2531af 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -8071,15 +8071,16 @@ get_quick_keys(PARAM *param,QUICK_RANGE_SELECT *quick,KEY_PART *key, { KEY *table_key=quick->head->key_info+quick->index; flag=EQ_RANGE; - if ((table_key->flags & HA_NOSAME) && key->part == table_key->key_parts-1) + if ((table_key->flags & HA_NOSAME) && + key_tree->part == table_key->key_parts-1) { - if (!(table_key->flags & HA_NULL_PART_KEY) || - !null_part_in_key(key, - param->min_key, - (uint) (tmp_min_key - param->min_key))) - flag|= UNIQUE_RANGE; - else - flag|= NULL_RANGE; + if ((table_key->flags & HA_NULL_PART_KEY) && + null_part_in_key(key, + param->min_key, + (uint) (tmp_min_key - param->min_key))) + flag|= NULL_RANGE; + else + flag|= UNIQUE_RANGE; } } } @@ -8109,7 +8110,7 @@ get_quick_keys(PARAM *param,QUICK_RANGE_SELECT *quick,KEY_PART *key, } /* - Return 1 if there is only one range and this uses the whole primary key + Return 1 if there is only one range and this uses the whole unique key */ bool QUICK_RANGE_SELECT::unique_key_range() From 42501173084f8a085a5cab38cb7d19ada8a96739 Mon Sep 17 00:00:00 2001 From: mithun Date: Tue, 10 Sep 2013 15:32:27 +0530 Subject: [PATCH 24/80] Bug #16978278 : BUFFER OVERFLOW WHEN PRINTING A LARGE 64-BIT INTEGER WITH MY_B_VPRINTF() Issue : In LP 64 machine max long value can be 20 digit decimal value. But in my_b_vprintf() the intermediate buffer storage used is 17 bytes length. This will lead to buffer overflow. Solution : Increased the buffer storage from 17 to 32 bytes. code is backported from 5.6 mysys/mf_iocache2.c: In function my_b_vprintf increased the size of local buff from 17 to 32 bytes. --- mysys/mf_iocache2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysys/mf_iocache2.c b/mysys/mf_iocache2.c index eaa70782f16..f65ca97bd16 100644 --- a/mysys/mf_iocache2.c +++ b/mysys/mf_iocache2.c @@ -415,7 +415,7 @@ process_flags: { register int iarg; size_t length2; - char buff[17]; + char buff[32]; iarg = va_arg(args, int); if (*fmt == 'd') @@ -450,7 +450,7 @@ process_flags: { register long iarg; size_t length2; - char buff[17]; + char buff[32]; iarg = va_arg(args, long); if (*++fmt == 'd') From 59402fe0a76bae115c622cc241995180c4bdf4c9 Mon Sep 17 00:00:00 2001 From: Satya Bodapati Date: Wed, 11 Sep 2013 16:57:02 +0530 Subject: [PATCH 25/80] Bug#16752251 - INNODB DOESN'T REDO-LOG INSERT BUFFER MERGE OPERATION IF IT IS DONE IN-PLACE With change buffer enabled, InnoDB doesn't write a transaction log record when it merges a record from the insert buffer to an secondary index page if the insertion is performed as an update-in-place. Fixed by logging the 'update-in-place' operation on secondary index pages. Approved by Marko. rb#2429 --- .../include/have_innodb_change_buffering.inc | 6 ++ mysql-test/include/search_pattern_in_file.inc | 66 +++++++++++++++++++ storage/innobase/btr/btr0cur.c | 30 ++++++--- storage/innobase/ibuf/ibuf0ibuf.c | 18 +++++ storage/innobase/include/btr0cur.h | 13 ++++ storage/innodb_plugin/btr/btr0cur.c | 30 ++++++--- storage/innodb_plugin/ibuf/ibuf0ibuf.c | 18 +++++ storage/innodb_plugin/include/btr0cur.h | 17 ++++- 8 files changed, 181 insertions(+), 17 deletions(-) create mode 100644 mysql-test/include/have_innodb_change_buffering.inc create mode 100644 mysql-test/include/search_pattern_in_file.inc diff --git a/mysql-test/include/have_innodb_change_buffering.inc b/mysql-test/include/have_innodb_change_buffering.inc new file mode 100644 index 00000000000..aadad84c6a1 --- /dev/null +++ b/mysql-test/include/have_innodb_change_buffering.inc @@ -0,0 +1,6 @@ +if (!`SHOW VARIABLES LIKE 'innodb_change_buffering_debug'`) +{ + # innodb_change_buffering_debug is enabled by UNIV_DEBUG or + # UNIV_IBUF_DEBUG + --skip Test requires binary with UNIV_DEBUG enabled +} diff --git a/mysql-test/include/search_pattern_in_file.inc b/mysql-test/include/search_pattern_in_file.inc new file mode 100644 index 00000000000..c047b5bc499 --- /dev/null +++ b/mysql-test/include/search_pattern_in_file.inc @@ -0,0 +1,66 @@ +# Purpose: +# Simple search with Perl for a pattern in some file. +# +# The advantages compared to thinkable auxiliary constructs using the +# mysqltest language and SQL are: +# 1. We do not need a running MySQL server. +# 2. SQL causes "noise" during debugging and increases the size of logs. +# Perl code does not disturb at all. +# +# The environment variables SEARCH_FILE and SEARCH_PATTERN must be set +# before sourcing this routine. +# +# In case of +# - SEARCH_FILE and/or SEARCH_PATTERN is not set +# - SEARCH_FILE cannot be opened +# - SEARCH_FILE does not contain SEARCH_PATTERN +# the test will abort immediate. +# MTR will report something like +# .... +# worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 13000..13009 +# main.1st [ pass ] 3 +# innodb.innodb_page_size [ fail ] +# Test ended at 2011-11-11 18:15:58 +# +# CURRENT_TEST: innodb.innodb_page_size +# # ERROR: The file '' does not contain the expected pattern +# mysqltest: In included file "./include/search_pattern_in_file.inc": +# included from ./include/search_pattern_in_file.inc at line 36: +# At line 25: command "perl" failed with error 255. my_errno=175 +# +# The result from queries just before the failure was: +# ... +# - saving '' to '' +# main.1st [ pass ] 2 +# +# Typical use case (check invalid server startup options): +# let $error_log= $MYSQLTEST_VARDIR/log/my_restart.err; +# --error 0,1 +# --remove_file $error_log +# let SEARCH_FILE= $error_log; +# # Stop the server +# let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; +# --exec echo "wait" > $restart_file +# --shutdown_server 10 +# --source include/wait_until_disconnected.inc +# +# --error 1 +# --exec $MYSQLD_CMD > $error_log 2>&1 +# # The server restart aborts +# let SEARCH_PATTERN= \[ERROR\] Aborting; +# --source include/search_pattern_in_file.inc +# +# Created: 2011-11-11 mleich +# + +perl; + use strict; + my $search_file= $ENV{'SEARCH_FILE'} or die "SEARCH_FILE not set"; + my $search_pattern= $ENV{'SEARCH_PATTERN'} or die "SEARCH_PATTERN not set"; + open(FILE, "$search_file") or die("Unable to open '$search_file': $!\n"); + read(FILE, my $file_content, 50000, 0); + close(FILE); + if ( not $file_content =~ m{$search_pattern} ) { + die("# ERROR: The file '$search_file' does not contain the expected pattern $search_pattern\n->$file_content<-\n"); + } +EOF diff --git a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c index 8dc0a92408b..4ad4bacdc0f 100644 --- a/storage/innobase/btr/btr0cur.c +++ b/storage/innobase/btr/btr0cur.c @@ -31,6 +31,7 @@ Created 10/16/1994 Heikki Tuuri #include "btr0sea.h" #include "row0upd.h" #include "trx0rec.h" +#include "trx0undo.h" #include "trx0roll.h" /* trx_roll_crash_recv_trx */ #include "que0que.h" #include "row0row.h" @@ -1363,18 +1364,31 @@ btr_cur_update_in_place_log( return; } - /* The code below assumes index is a clustered index: change index to - the clustered index if we are updating a secondary index record (or we - could as well skip writing the sys col values to the log in this case - because they are not needed for a secondary index record update) */ - - index = dict_table_get_first_index(index->table); + /* For secondary indexes, we could skip writing the dummy system fields + to the redo log but we have to change redo log parsing of + MLOG_REC_UPDATE_IN_PLACE/MLOG_COMP_REC_UPDATE_IN_PLACE or we have to add + new redo log record. For now, just write dummy sys fields to the redo + log if we are updating a secondary index record. + */ mach_write_to_1(log_ptr, flags); log_ptr++; - log_ptr = row_upd_write_sys_vals_to_log(index, trx, roll_ptr, log_ptr, - mtr); + if (index->type & DICT_CLUSTERED) { + log_ptr = row_upd_write_sys_vals_to_log( + index, trx, roll_ptr, log_ptr, mtr); + } else { + /* Dummy system fields for a secondary index */ + /* TRX_ID Position */ + log_ptr += mach_write_compressed(log_ptr, 0); + /* ROLL_PTR */ + trx_write_roll_ptr(log_ptr, ut_dulint_zero); + log_ptr += DATA_ROLL_PTR_LEN; + /* TRX_ID */ + log_ptr += mach_dulint_write_compressed(log_ptr, + ut_dulint_zero); + } + mach_write_to_2(log_ptr, page_offset(rec)); log_ptr += 2; diff --git a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c index 2ba3d785194..ae6c5f6636f 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.c +++ b/storage/innobase/ibuf/ibuf0ibuf.c @@ -3024,6 +3024,24 @@ updated_in_place: /* This is the easy case. Do something similar to btr_cur_update_in_place(). */ row_upd_rec_in_place(rec, offsets, update); + + /* Log the update in place operation. During recovery + MLOG_COMP_REC_UPDATE_IN_PLACE/MLOG_REC_UPDATE_IN_PLACE + expects trx_id, roll_ptr for secondary indexes. So we + just write dummy trx_id(0), roll_ptr(0) */ + btr_cur_update_in_place_log(BTR_KEEP_SYS_FLAG, rec, + index, update, + NULL, + ut_dulint_zero, mtr); + DBUG_EXECUTE_IF( + "crash_after_log_ibuf_upd_inplace", + log_buffer_flush_to_disk(); + fprintf(stderr, + "InnoDB: Wrote log record for ibuf " + "update in place operation\n"); + DBUG_SUICIDE(); + ); + goto updated_in_place; } diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h index c2b81d0ae91..bab405fa91e 100644 --- a/storage/innobase/include/btr0cur.h +++ b/storage/innobase/include/btr0cur.h @@ -558,6 +558,19 @@ btr_push_update_extern_fields( const ulint* offsets,/* in: array returned by rec_get_offsets() */ upd_t* update);/* in: update vector or NULL */ +/*************************************************************** +Writes a redo log record of updating a record in-place. */ +UNIV_INLINE +void +btr_cur_update_in_place_log( +/*========================*/ + ulint flags, /* in: flags */ + rec_t* rec, /* in: record */ + dict_index_t* index, /* in: index where cursor positioned */ + upd_t* update, /* in: update vector */ + trx_t* trx, /* in: transaction */ + dulint roll_ptr, /* in: roll ptr */ + mtr_t* mtr); /* in: mtr */ /*######################################################################*/ diff --git a/storage/innodb_plugin/btr/btr0cur.c b/storage/innodb_plugin/btr/btr0cur.c index 2b98b416793..f653929193a 100644 --- a/storage/innodb_plugin/btr/btr0cur.c +++ b/storage/innodb_plugin/btr/btr0cur.c @@ -58,6 +58,7 @@ Created 10/16/1994 Heikki Tuuri #include "btr0btr.h" #include "btr0sea.h" #include "trx0rec.h" +#include "trx0undo.h" #include "trx0roll.h" /* trx_is_recv() */ #include "que0que.h" #include "row0row.h" @@ -1557,18 +1558,31 @@ btr_cur_update_in_place_log( return; } - /* The code below assumes index is a clustered index: change index to - the clustered index if we are updating a secondary index record (or we - could as well skip writing the sys col values to the log in this case - because they are not needed for a secondary index record update) */ - - index = dict_table_get_first_index(index->table); + /* For secondary indexes, we could skip writing the dummy system fields + to the redo log but we have to change redo log parsing of + MLOG_REC_UPDATE_IN_PLACE/MLOG_COMP_REC_UPDATE_IN_PLACE or we have to add + new redo log record. For now, just write dummy sys fields to the redo + log if we are updating a secondary index record. + */ mach_write_to_1(log_ptr, flags); log_ptr++; - log_ptr = row_upd_write_sys_vals_to_log(index, trx, roll_ptr, log_ptr, - mtr); + if (index->type & DICT_CLUSTERED) { + log_ptr = row_upd_write_sys_vals_to_log( + index, trx, roll_ptr, log_ptr, mtr); + } else { + /* Dummy system fields for a secondary index */ + /* TRX_ID Position */ + log_ptr += mach_write_compressed(log_ptr, 0); + /* ROLL_PTR */ + trx_write_roll_ptr(log_ptr, ut_dulint_zero); + log_ptr += DATA_ROLL_PTR_LEN; + /* TRX_ID */ + log_ptr += mach_dulint_write_compressed(log_ptr, + ut_dulint_zero); + } + mach_write_to_2(log_ptr, page_offset(rec)); log_ptr += 2; diff --git a/storage/innodb_plugin/ibuf/ibuf0ibuf.c b/storage/innodb_plugin/ibuf/ibuf0ibuf.c index e084a61d5d3..5d018bcdbc9 100644 --- a/storage/innodb_plugin/ibuf/ibuf0ibuf.c +++ b/storage/innodb_plugin/ibuf/ibuf0ibuf.c @@ -3072,6 +3072,24 @@ updated_in_place: to btr_cur_update_in_place(). */ row_upd_rec_in_place(rec, index, offsets, update, page_zip); + + /* Log the update in place operation. During recovery + MLOG_COMP_REC_UPDATE_IN_PLACE/MLOG_REC_UPDATE_IN_PLACE + expects trx_id, roll_ptr for secondary indexes. So we + just write dummy trx_id(0), roll_ptr(0) */ + btr_cur_update_in_place_log(BTR_KEEP_SYS_FLAG, rec, + index, update, + NULL, + ut_dulint_zero, mtr); + DBUG_EXECUTE_IF( + "crash_after_log_ibuf_upd_inplace", + log_buffer_flush_to_disk(); + fprintf(stderr, + "InnoDB: Wrote log record for ibuf " + "update in place operation\n"); + DBUG_SUICIDE(); + ); + goto updated_in_place; } diff --git a/storage/innodb_plugin/include/btr0cur.h b/storage/innodb_plugin/include/btr0cur.h index 7744d2d1ee2..2321d718f03 100644 --- a/storage/innodb_plugin/include/btr0cur.h +++ b/storage/innodb_plugin/include/btr0cur.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -636,6 +636,21 @@ btr_push_update_extern_fields( mem_heap_t* heap) /*!< in: memory heap */ __attribute__((nonnull)); +/***********************************************************//** +Writes a redo log record of updating a record in-place. */ +UNIV_INLINE +void +btr_cur_update_in_place_log( +/*========================*/ + ulint flags, /*!< in: flags */ + rec_t* rec, /*!< in: record */ + dict_index_t* index, /*!< in: index where cursor + positioned */ + const upd_t* update, /*!< in: update vector */ + trx_t* trx, /*!< in: transaction */ + roll_ptr_t roll_ptr, /*!< in: roll ptr */ + mtr_t* mtr); /*!< in: mtr */ + /*######################################################################*/ /** In the pessimistic delete, if the page data size drops below this From 64a845e0a6e0baa355042c693db833b03e9b6106 Mon Sep 17 00:00:00 2001 From: Satya Bodapati Date: Thu, 12 Sep 2013 12:28:16 +0530 Subject: [PATCH 26/80] Additional Fix to BUG#16755251 for 5.1 build failure and disable testcase due to BUG#17446090 --- storage/innobase/btr/btr0cur.c | 1 - storage/innobase/include/btr0cur.h | 2 +- storage/innodb_plugin/btr/btr0cur.c | 2 +- storage/innodb_plugin/include/btr0cur.h | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c index 4ad4bacdc0f..8704e443099 100644 --- a/storage/innobase/btr/btr0cur.c +++ b/storage/innobase/btr/btr0cur.c @@ -1336,7 +1336,6 @@ btr_cur_upd_lock_and_undo( /*************************************************************** Writes a redo log record of updating a record in-place. */ -UNIV_INLINE void btr_cur_update_in_place_log( /*========================*/ diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h index bab405fa91e..5095fd5e875 100644 --- a/storage/innobase/include/btr0cur.h +++ b/storage/innobase/include/btr0cur.h @@ -560,7 +560,7 @@ btr_push_update_extern_fields( /*************************************************************** Writes a redo log record of updating a record in-place. */ -UNIV_INLINE + void btr_cur_update_in_place_log( /*========================*/ diff --git a/storage/innodb_plugin/btr/btr0cur.c b/storage/innodb_plugin/btr/btr0cur.c index f653929193a..93b150341b0 100644 --- a/storage/innodb_plugin/btr/btr0cur.c +++ b/storage/innodb_plugin/btr/btr0cur.c @@ -1530,7 +1530,7 @@ btr_cur_upd_lock_and_undo( /***********************************************************//** Writes a redo log record of updating a record in-place. */ -UNIV_INLINE +UNIV_INTERN void btr_cur_update_in_place_log( /*========================*/ diff --git a/storage/innodb_plugin/include/btr0cur.h b/storage/innodb_plugin/include/btr0cur.h index 2321d718f03..5d07fffbf8c 100644 --- a/storage/innodb_plugin/include/btr0cur.h +++ b/storage/innodb_plugin/include/btr0cur.h @@ -638,7 +638,7 @@ btr_push_update_extern_fields( /***********************************************************//** Writes a redo log record of updating a record in-place. */ -UNIV_INLINE +UNIV_INTERN void btr_cur_update_in_place_log( /*========================*/ From 87d5dc1388fd4819133d4cda5feeb87f99a1984d Mon Sep 17 00:00:00 2001 From: Satya Bodapati Date: Thu, 12 Sep 2013 17:59:14 +0530 Subject: [PATCH 27/80] Fix FreeBSD build failure due to BUG#16752251 (only in 5.5) --- storage/innobase/btr/btr0cur.c | 1 + 1 file changed, 1 insertion(+) diff --git a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c index 16d5016a9b5..7762907b6aa 100644 --- a/storage/innobase/btr/btr0cur.c +++ b/storage/innobase/btr/btr0cur.c @@ -61,6 +61,7 @@ Created 10/16/1994 Heikki Tuuri #include "row0upd.h" #include "trx0rec.h" #include "trx0roll.h" /* trx_is_recv() */ +#include "trx0undo.h" #include "que0que.h" #include "row0row.h" #include "srv0srv.h" From b7232337e9c2a4b449b8028415f027e82a65084d Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Thu, 12 Sep 2013 21:26:15 +0200 Subject: [PATCH 28/80] post-push fix for bug#53947 test change only. Removed --source include/not_windows_embedded.inc which was added due to that bug. --- mysql-test/suite/innodb/t/innodb.test | 6 ------ mysql-test/suite/sys_vars/t/identity_func.test | 6 ------ .../suite/sys_vars/t/innodb_autoinc_lock_mode_func.test | 6 ------ mysql-test/suite/sys_vars/t/last_insert_id_func.test | 6 ------ mysql-test/suite/sys_vars/t/storage_engine_basic.test | 6 ------ mysql-test/suite/sys_vars/t/tx_isolation_func.test | 6 ------ 6 files changed, 36 deletions(-) diff --git a/mysql-test/suite/innodb/t/innodb.test b/mysql-test/suite/innodb/t/innodb.test index 3038bb0331e..9c407759fd8 100644 --- a/mysql-test/suite/innodb/t/innodb.test +++ b/mysql-test/suite/innodb/t/innodb.test @@ -1,9 +1,3 @@ ---source include/not_windows_embedded.inc -# remove this when -# Bug#53947 InnoDB: Assertion failure in thread 4224 in file -# .\sync\sync0sync.c line 324 -# is fixed - ####################################################################### # # # Please, DO NOT TOUCH this file as well as the innodb.result file. # diff --git a/mysql-test/suite/sys_vars/t/identity_func.test b/mysql-test/suite/sys_vars/t/identity_func.test index 6f7b6bac18e..ff93607a2cd 100644 --- a/mysql-test/suite/sys_vars/t/identity_func.test +++ b/mysql-test/suite/sys_vars/t/identity_func.test @@ -1,9 +1,3 @@ ---source include/not_windows_embedded.inc -# remove this when -# Bug#53947 InnoDB: Assertion failure in thread 4224 in file -# .\sync\sync0sync.c line 324 -# is fixed - #################### mysql-test\t\identity_func.test ########################## # # # Variable Name: identity # diff --git a/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func.test b/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func.test index 082507efd07..89c1c80a6dc 100644 --- a/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func.test +++ b/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func.test @@ -1,9 +1,3 @@ ---source include/not_windows_embedded.inc -# remove this when -# Bug#53947 InnoDB: Assertion failure in thread 4224 in file -# .\sync\sync0sync.c line 324 -# is fixed - ################# mysql-test\t\innodb_autoinc_lock_mode_func.test ############ # # # Variable Name: innodb_autoinc_lock_mode # diff --git a/mysql-test/suite/sys_vars/t/last_insert_id_func.test b/mysql-test/suite/sys_vars/t/last_insert_id_func.test index bb3adbc1c64..2309c539bd9 100644 --- a/mysql-test/suite/sys_vars/t/last_insert_id_func.test +++ b/mysql-test/suite/sys_vars/t/last_insert_id_func.test @@ -1,9 +1,3 @@ ---source include/not_windows_embedded.inc -# remove this when -# Bug#53947 InnoDB: Assertion failure in thread 4224 in file -# .\sync\sync0sync.c line 324 -# is fixed - ################# mysql-test\t\last_insert_id_func.test ####################### # # # Variable Name: last_insert_id # diff --git a/mysql-test/suite/sys_vars/t/storage_engine_basic.test b/mysql-test/suite/sys_vars/t/storage_engine_basic.test index 49e8a52efea..6c8c777be98 100644 --- a/mysql-test/suite/sys_vars/t/storage_engine_basic.test +++ b/mysql-test/suite/sys_vars/t/storage_engine_basic.test @@ -1,9 +1,3 @@ ---source include/not_windows_embedded.inc -# remove this when -# Bug#53947 InnoDB: Assertion failure in thread 4224 in file -# .\sync\sync0sync.c line 324 -# is fixed - ############## mysql-test\t\storage_engine_basic.test ################## # # # # diff --git a/mysql-test/suite/sys_vars/t/tx_isolation_func.test b/mysql-test/suite/sys_vars/t/tx_isolation_func.test index 3a78d46e527..7072de6b086 100644 --- a/mysql-test/suite/sys_vars/t/tx_isolation_func.test +++ b/mysql-test/suite/sys_vars/t/tx_isolation_func.test @@ -1,9 +1,3 @@ ---source include/not_windows_embedded.inc -# remove this when -# Bug#53947 InnoDB: Assertion failure in thread 4224 in file -# .\sync\sync0sync.c line 324 -# is fixed - ############# mysql-test\t\tx_isolation_func.test ####################################### # # # Variable Name: tx_isolation # From d4ccf905bef7eca6329e2f439ac9fa0610b3aa92 Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Tue, 17 Sep 2013 12:43:34 +0200 Subject: [PATCH 29/80] Bug#16765410 FTS: STACK AROUND THE VARIABLE 'MYSTR' WAS CORRUPTED IN INNOBASE_STRNXFRM my_strnxfrm_win1250ch could write into dest[destlen] i.e. write a byte to the past-the-end of dest. --- strings/ctype-win1250ch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c index cbb1ad5e685..a8181afa776 100644 --- a/strings/ctype-win1250ch.c +++ b/strings/ctype-win1250ch.c @@ -500,7 +500,7 @@ static size_t my_strnxfrm_win1250ch(CHARSET_INFO * cs __attribute__((unused)), do { NEXT_CMP_VALUE(src, p, pass, value, (int)srclen); - if (totlen <= len) + if (totlen < len) dest[totlen] = value; totlen++; } while (value) ; From 1d40f2ad64ee87c1460a3578179dfbdc6896e2dd Mon Sep 17 00:00:00 2001 From: Vinay Fisrekar Date: Thu, 19 Sep 2013 13:52:01 +0530 Subject: [PATCH 30/80] Making rpl.rpl_spec_variables experimental for solaris till bug#17337114 is fixed. --- mysql-test/collections/default.experimental | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index e4c839ce705..ff4bc960acb 100644 --- a/mysql-test/collections/default.experimental +++ b/mysql-test/collections/default.experimental @@ -15,6 +15,7 @@ main.wait_timeout @solaris # Bug#11758972 2010-04-26 alik wait_tim rpl.rpl_innodb_bug28430 # Bug#11754425 rpl.rpl_row_sp011 @solaris # Bug#11753919 2011-07-25 sven Several test cases fail on Solaris with error Thread stack overrun +rpl.rpl_spec_variables @solaris # Bug #17337114 2013-08-20 Luis Soares failing on pb2 with timeout for 'CHECK WARNINGS' sys_vars.max_sp_recursion_depth_func @solaris # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun sys_vars.wait_timeout_func # Bug#11750645 2010-04-26 alik wait_timeout_func fails From 5897b81a5b4d2c3190ad343655327a394efe8495 Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Fri, 20 Sep 2013 16:10:31 +0200 Subject: [PATCH 31/80] Bug#17435338 ADD A -DWITH_ASAN SWITCH/OPTION TO OUR CMAKE SCRIPTS Tested with: gcc (GCC) 4.8.1 20130603 (Red Hat 4.8.1-1) clang version 3.1 (tags/RELEASE_31/final) Target: x86_64-apple-darwin10.8.0 --- CMakeLists.txt | 78 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aee0fb650e8..369a6b5c8f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -177,7 +177,83 @@ ENDIF() OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" ON) MARK_AS_ADVANCED(CYBOZU BACKUP_TEST WITHOUT_SERVER DISABLE_SHARED) - + + +include(CheckCSourceCompiles) +include(CheckCXXSourceCompiles) +# We need some extra FAIL_REGEX patterns +# Note that CHECK_C_SOURCE_COMPILES is a misnomer, it will also link. +MACRO (MY_CHECK_C_COMPILER_FLAG FLAG RESULT) + SET(SAVE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") + SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${FLAG}") + CHECK_C_SOURCE_COMPILES("int main(void) { return 0; }" ${RESULT} + FAIL_REGEX "argument unused during compilation" + FAIL_REGEX "unsupported .*option" + FAIL_REGEX "unknown .*option" + FAIL_REGEX "unrecognized .*option" + FAIL_REGEX "ignoring unknown option" + FAIL_REGEX "[Ww]arning: [Oo]ption" + ) + SET(CMAKE_REQUIRED_FLAGS "${SAVE_CMAKE_REQUIRED_FLAGS}") +ENDMACRO() + +MACRO (MY_CHECK_CXX_COMPILER_FLAG FLAG RESULT) + SET(SAVE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") + SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${FLAG}") + CHECK_CXX_SOURCE_COMPILES("int main(void) { return 0; }" ${RESULT} + FAIL_REGEX "argument unused during compilation" + FAIL_REGEX "unsupported .*option" + FAIL_REGEX "unknown .*option" + FAIL_REGEX "unrecognized .*option" + FAIL_REGEX "ignoring unknown option" + FAIL_REGEX "[Ww]arning: [Oo]ption" + ) + SET(CMAKE_REQUIRED_FLAGS "${SAVE_CMAKE_REQUIRED_FLAGS}") +ENDMACRO() + +OPTION(WITH_ASAN "Enable address sanitizer" OFF) +IF (WITH_ASAN) + # gcc 4.8.1 and new versions of clang + MY_CHECK_C_COMPILER_FLAG("-fsanitize=address" HAVE_C_FSANITIZE) + MY_CHECK_CXX_COMPILER_FLAG("-fsanitize=address" HAVE_CXX_FSANITIZE) + + IF(HAVE_C_FSANITIZE AND HAVE_CXX_FSANITIZE) + # We switch on basic optimization also for debug builds. + # With optimization we may get some warnings, so we switch off -Werror + SET(CMAKE_C_FLAGS_DEBUG + "${CMAKE_C_FLAGS_DEBUG} -fsanitize=address -O1 -Wno-error -fPIC") + SET(CMAKE_C_FLAGS_RELWITHDEBINFO + "${CMAKE_C_FLAGS_RELWITHDEBINFO} -fsanitize=address -fPIC") + SET(CMAKE_CXX_FLAGS_DEBUG + "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address -O1 -Wno-error -fPIC") + SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO + "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fsanitize=address -fPIC") + SET(WITH_ASAN_OK 1) + ELSE() + # older versions of clang + MY_CHECK_C_COMPILER_FLAG("-faddress-sanitizer" HAVE_C_FADDRESS) + MY_CHECK_CXX_COMPILER_FLAG("-faddress-sanitizer" HAVE_CXX_FFADDRESS) + + IF(HAVE_C_FADDRESS AND HAVE_CXX_FFADDRESS) + # We switch on basic optimization also for debug builds. + SET(CMAKE_C_FLAGS_DEBUG + "${CMAKE_C_FLAGS_DEBUG} -faddress-sanitizer -O1 -fPIC") + SET(CMAKE_C_FLAGS_RELWITHDEBINFO + "${CMAKE_C_FLAGS_RELWITHDEBINFO} -faddress-sanitizer -fPIC") + SET(CMAKE_CXX_FLAGS_DEBUG + "${CMAKE_CXX_FLAGS_DEBUG} -faddress-sanitizer -O1 -fPIC") + SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO + "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -faddress-sanitizer -fPIC") + SET(WITH_ASAN_OK 1) + ENDIF() + ENDIF() + + IF(NOT WITH_ASAN_OK) + MESSAGE(FATAL_ERROR "Do not know how to enable address sanitizer") + ENDIF() +ENDIF() + + OPTION(ENABLE_DEBUG_SYNC "Enable debug sync (debug builds only)" ON) IF(ENABLE_DEBUG_SYNC) SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC") From cc4043f013ba796050ba1a971e5806d3bc0ca572 Mon Sep 17 00:00:00 2001 From: Sujatha Sivakumar Date: Mon, 23 Sep 2013 12:13:37 +0530 Subject: [PATCH 32/80] Bug#17327454:SEMI-SYNC REPLICATION MASTER CRASH WHEN SET RPL_SEMI_SYNC_MASTER_ENABLED OFF. Problem: ======= If master is waiting for a reply from slave, at this time set global rpl_semi_sync_master_enabled=OFF, the master server will crash. Analysis: ======== When master is waiting for a reply from slave, at this time if semi sync is switched off on master, during switch off if active transactions are present the transactions will be cleared and "active_tranxs_" variable will be set to NULL. When the waiting master connection finds that semi sync is switched of it tries to access "active_tranxs_" without checking if the transaction list exists or not. Accessing NULL transaction list causes the crash. Fix: === A check has been added to see a valid list exists before accessing the "active_tranxs_". plugin/semisync/semisync_master.cc: Added check for the existence of valid 'active_transx_'. --- plugin/semisync/semisync_master.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugin/semisync/semisync_master.cc b/plugin/semisync/semisync_master.cc index 1be876d0f1b..87adbdcae79 100644 --- a/plugin/semisync/semisync_master.cc +++ b/plugin/semisync/semisync_master.cc @@ -752,7 +752,8 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, At this point, the binlog file and position of this transaction must have been removed from ActiveTranx. */ - assert(!active_tranxs_->is_tranx_end_pos(trx_wait_binlog_name, + assert(!getMasterEnabled() || + !active_tranxs_->is_tranx_end_pos(trx_wait_binlog_name, trx_wait_binlog_pos)); /* Update the status counter. */ From d4011a614411e67633cc75a6233c74a22dd32ff5 Mon Sep 17 00:00:00 2001 From: Shivji Kumar Jha Date: Fri, 27 Sep 2013 01:24:16 +0530 Subject: [PATCH 33/80] BUG#16580366- MTR TESTS FAILING SPORADICALLY ON PB2 (5.5, 5.6 AND 5.7) DURING INNODB RECOVERY Problem: ======= The connection 'master' is dropped by mysqltest after rpl_end.inc. At this point, dropping temporary tables at the connection 'master' are not synced at slave. So, the temporary tables replicated from master remain on slave leading to an inconsistent close of the test. The following test thus complains about the presence of temporary table(s) left over from the previous test. Fix: === - Put explicit drop commands in replication tests so that the temporary tables are dropped at slave as well. - Added the check for Slave_open_temp_tables in mtr_check.sql to warn about the remaining temporary table, if any, at the close of a test. --- .../extra/rpl_tests/rpl_drop_create_temp_table.inc | 10 +++++++--- mysql-test/extra/rpl_tests/rpl_innodb.test | 2 +- mysql-test/extra/rpl_tests/rpl_reset_slave.test | 3 +++ mysql-test/include/mtr_check.sql | 2 ++ .../rpl/r/rpl_create_tmp_table_if_not_exists.result | 3 +++ mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result | 1 + .../rpl/r/rpl_mixed_drop_create_temp_table.result | 6 ++++++ mysql-test/suite/rpl/r/rpl_rotate_logs.result | 1 + .../suite/rpl/r/rpl_row_drop_create_temp_table.result | 6 ++++++ mysql-test/suite/rpl/r/rpl_row_reset_slave.result | 1 + mysql-test/suite/rpl/r/rpl_stm_000001.result | 1 + .../suite/rpl/r/rpl_stm_drop_create_temp_table.result | 6 ++++++ mysql-test/suite/rpl/r/rpl_stm_innodb.result | 1 + mysql-test/suite/rpl/r/rpl_stm_reset_slave.result | 1 + .../rpl/t/rpl_create_tmp_table_if_not_exists.test | 4 ++++ mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test | 1 + mysql-test/suite/rpl/t/rpl_rotate_logs.test | 1 + mysql-test/suite/rpl/t/rpl_stm_000001.test | 2 +- 18 files changed, 47 insertions(+), 5 deletions(-) diff --git a/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc index 094e84537db..983851adfcd 100644 --- a/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc +++ b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc @@ -150,10 +150,9 @@ if (`SELECT HEX(@commands) = HEX('configure')`) } # -# Drops tables and synchronizes master and slave. Note that temporary -# tables are not explitcily dropped as they will be dropped while -# closing the connection. +# Drops tables and synchronizes master and slave. # + if (`SELECT HEX(@commands) = HEX('clean')`) { connection master; @@ -162,10 +161,15 @@ if (`SELECT HEX(@commands) = HEX('clean')`) DROP TABLE IF EXISTS nt_xx_1; + DROP TEMPORARY TABLE IF EXISTS tt_tmp_xx_1; + DROP TEMPORARY TABLE IF EXISTS nt_tmp_xx_1; + --let $n= $tot_table while ($n) { --eval DROP TABLE IF EXISTS nt_$n + --eval DROP TEMPORARY TABLE IF EXISTS tt_tmp_$n + --eval DROP TEMPORARY TABLE IF EXISTS nt_tmp_$n --dec $n } diff --git a/mysql-test/extra/rpl_tests/rpl_innodb.test b/mysql-test/extra/rpl_tests/rpl_innodb.test index e590bd70c88..11aa58f730f 100644 --- a/mysql-test/extra/rpl_tests/rpl_innodb.test +++ b/mysql-test/extra/rpl_tests/rpl_innodb.test @@ -112,7 +112,7 @@ FLUSH LOGS; --echo -------- switch to master -------- connection master; FLUSH LOGS; - +DROP TEMPORARY TABLE IF EXISTS mysqltest1.tmp2; DROP DATABASE mysqltest1; --echo End of 5.1 tests diff --git a/mysql-test/extra/rpl_tests/rpl_reset_slave.test b/mysql-test/extra/rpl_tests/rpl_reset_slave.test index 0d94f04ca44..44bd650682d 100644 --- a/mysql-test/extra/rpl_tests/rpl_reset_slave.test +++ b/mysql-test/extra/rpl_tests/rpl_reset_slave.test @@ -38,6 +38,9 @@ reset slave; source include/start_slave.inc; sync_with_master; show status like 'slave_open_temp_tables'; +connection master; +drop temporary table if exists t1; +sync_slave_with_master; # #Bug#34654 RESET SLAVE does not clear LAST_IO_Err* diff --git a/mysql-test/include/mtr_check.sql b/mysql-test/include/mtr_check.sql index fbe5df632c6..9c51b333ec6 100644 --- a/mysql-test/include/mtr_check.sql +++ b/mysql-test/include/mtr_check.sql @@ -72,6 +72,8 @@ BEGIN mysql.time_zone_transition_type, mysql.user; + show status like 'slave_open_temp_tables'; + END|| -- diff --git a/mysql-test/suite/rpl/r/rpl_create_tmp_table_if_not_exists.result b/mysql-test/suite/rpl/r/rpl_create_tmp_table_if_not_exists.result index 6bafbb32897..40a38ee8592 100644 --- a/mysql-test/suite/rpl/r/rpl_create_tmp_table_if_not_exists.result +++ b/mysql-test/suite/rpl/r/rpl_create_tmp_table_if_not_exists.result @@ -15,4 +15,7 @@ master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS t master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS tmp1 LIKE tmp master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS tmp1 LIKE tmp master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp +DROP TEMPORARY TABLE tmp; +DROP TEMPORARY TABLE tmp1; +DROP TEMPORARY TABLE tmp2; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result b/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result index 99c5846cea0..55c74b0b533 100644 --- a/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result +++ b/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result @@ -42,4 +42,5 @@ t5 CREATE TABLE `t5` ( `created` datetime DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t2,t3,t5; +drop temporary table t4; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result b/mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result index 761ff2f8e98..57c947c9333 100644 --- a/mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result +++ b/mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result @@ -1554,8 +1554,14 @@ master-bin.000001 # Query # # COMMIT SET @commands= 'clean'; DROP TABLE IF EXISTS tt_xx_1; DROP TABLE IF EXISTS nt_xx_1; +DROP TEMPORARY TABLE IF EXISTS tt_tmp_xx_1; +DROP TEMPORARY TABLE IF EXISTS nt_tmp_xx_1; DROP TABLE IF EXISTS nt_2; +DROP TEMPORARY TABLE IF EXISTS tt_tmp_2; +DROP TEMPORARY TABLE IF EXISTS nt_tmp_2; DROP TABLE IF EXISTS nt_1; +DROP TEMPORARY TABLE IF EXISTS tt_tmp_1; +DROP TEMPORARY TABLE IF EXISTS nt_tmp_1; DROP TABLE IF EXISTS tt_2; DROP TABLE IF EXISTS tt_1; SET @commands= ''; diff --git a/mysql-test/suite/rpl/r/rpl_rotate_logs.result b/mysql-test/suite/rpl/r/rpl_rotate_logs.result index 256ed4eaad2..9459361cb30 100644 --- a/mysql-test/suite/rpl/r/rpl_rotate_logs.result +++ b/mysql-test/suite/rpl/r/rpl_rotate_logs.result @@ -85,6 +85,7 @@ lock tables t3 read; include/assert.inc [Table t3 should contain 100 lines on the slave] unlock tables; drop table if exists t1,t2,t3,t4; +drop temporary table temp_table; End of 4.1 tests show binlog events in 'non existing_binlog_file'; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log diff --git a/mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result b/mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result index 88754e2cf8c..a55c8e2a2bc 100644 --- a/mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result +++ b/mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result @@ -1619,8 +1619,14 @@ master-bin.000001 # Query # # COMMIT SET @commands= 'clean'; DROP TABLE IF EXISTS tt_xx_1; DROP TABLE IF EXISTS nt_xx_1; +DROP TEMPORARY TABLE IF EXISTS tt_tmp_xx_1; +DROP TEMPORARY TABLE IF EXISTS nt_tmp_xx_1; DROP TABLE IF EXISTS nt_2; +DROP TEMPORARY TABLE IF EXISTS tt_tmp_2; +DROP TEMPORARY TABLE IF EXISTS nt_tmp_2; DROP TABLE IF EXISTS nt_1; +DROP TEMPORARY TABLE IF EXISTS tt_tmp_1; +DROP TEMPORARY TABLE IF EXISTS nt_tmp_1; DROP TABLE IF EXISTS tt_2; DROP TABLE IF EXISTS tt_1; SET @commands= ''; diff --git a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result index 41fe0b1a9f3..1cf70ba7e67 100644 --- a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result +++ b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result @@ -23,6 +23,7 @@ include/start_slave.inc show status like 'slave_open_temp_tables'; Variable_name Value Slave_open_temp_tables 0 +drop temporary table if exists t1; include/stop_slave.inc reset slave; include/check_slave_no_error.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_000001.result b/mysql-test/suite/rpl/r/rpl_stm_000001.result index 9493013a283..7aeff0d3d46 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_000001.result +++ b/mysql-test/suite/rpl/r/rpl_stm_000001.result @@ -48,6 +48,7 @@ select (@id := id) - id from t2; 0 kill @id; drop table t2; +drop temporary table t3; Got one of the listed errors include/wait_for_slave_sql_error_and_skip.inc [errno=1053] select count(*) from t1; diff --git a/mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result b/mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result index 42f16a4c175..08b318fbb43 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result +++ b/mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result @@ -1604,8 +1604,14 @@ master-bin.000001 # Query # # ROLLBACK SET @commands= 'clean'; DROP TABLE IF EXISTS tt_xx_1; DROP TABLE IF EXISTS nt_xx_1; +DROP TEMPORARY TABLE IF EXISTS tt_tmp_xx_1; +DROP TEMPORARY TABLE IF EXISTS nt_tmp_xx_1; DROP TABLE IF EXISTS nt_2; +DROP TEMPORARY TABLE IF EXISTS tt_tmp_2; +DROP TEMPORARY TABLE IF EXISTS nt_tmp_2; DROP TABLE IF EXISTS nt_1; +DROP TEMPORARY TABLE IF EXISTS tt_tmp_1; +DROP TEMPORARY TABLE IF EXISTS nt_tmp_1; DROP TABLE IF EXISTS tt_2; DROP TABLE IF EXISTS tt_1; SET @commands= ''; diff --git a/mysql-test/suite/rpl/r/rpl_stm_innodb.result b/mysql-test/suite/rpl/r/rpl_stm_innodb.result index 0e9531317b9..6f54b232e71 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_stm_innodb.result @@ -79,6 +79,7 @@ COUNT(*) FLUSH LOGS; -------- switch to master -------- FLUSH LOGS; +DROP TEMPORARY TABLE IF EXISTS mysqltest1.tmp2; DROP DATABASE mysqltest1; End of 5.1 tests # diff --git a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result index b1473c937a1..e5870cec2c9 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result +++ b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result @@ -23,6 +23,7 @@ include/start_slave.inc show status like 'slave_open_temp_tables'; Variable_name Value Slave_open_temp_tables 1 +drop temporary table if exists t1; include/stop_slave.inc reset slave; include/check_slave_no_error.inc diff --git a/mysql-test/suite/rpl/t/rpl_create_tmp_table_if_not_exists.test b/mysql-test/suite/rpl/t/rpl_create_tmp_table_if_not_exists.test index daf6b7e9ad8..bf2c5442d40 100644 --- a/mysql-test/suite/rpl/t/rpl_create_tmp_table_if_not_exists.test +++ b/mysql-test/suite/rpl/t/rpl_create_tmp_table_if_not_exists.test @@ -38,4 +38,8 @@ CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp; CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp; source include/show_binlog_events.inc; +DROP TEMPORARY TABLE tmp; +DROP TEMPORARY TABLE tmp1; +DROP TEMPORARY TABLE tmp2; + --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test b/mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test index cbd7e9c2558..4309dc3f9b1 100644 --- a/mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test +++ b/mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test @@ -43,6 +43,7 @@ show create table t3; show create table t5; connection master; drop table t2,t3,t5; +drop temporary table t4; sync_slave_with_master; # End of 4.1 tests diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs.test b/mysql-test/suite/rpl/t/rpl_rotate_logs.test index dc158d7ef92..4d0c93f46bd 100644 --- a/mysql-test/suite/rpl/t/rpl_rotate_logs.test +++ b/mysql-test/suite/rpl/t/rpl_rotate_logs.test @@ -218,6 +218,7 @@ unlock tables; #clean up connection master; drop table if exists t1,t2,t3,t4; +drop temporary table temp_table; sync_slave_with_master; --echo End of 4.1 tests diff --git a/mysql-test/suite/rpl/t/rpl_stm_000001.test b/mysql-test/suite/rpl/t/rpl_stm_000001.test index 268a10ad1fa..e7237af57c3 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_000001.test +++ b/mysql-test/suite/rpl/t/rpl_stm_000001.test @@ -91,8 +91,8 @@ connection master1; sleep 3; select (@id := id) - id from t2; kill @id; -# We don't drop t3 as this is a temporary table drop table t2; +drop temporary table t3; connection master; # The get_lock function causes warning for unsafe statement. --disable_warnings From 797a49f848f4c456a95be07781c493c710254b3a Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 Sep 2013 18:30:46 +0530 Subject: [PATCH 34/80] From e64b9e12509f7fc800a55864c83ea26e0f51d515 Mon Sep 17 00:00:00 2001 From: Yasufumi Kinoshita Date: Mon, 30 Sep 2013 13:41:48 +0900 Subject: [PATCH 35/80] Bug#11758196 : INNODB ASSERTION FAILURE WHEN CONVERTING FROM MYISAM TO INNODB Changed to try to extend log buffer instead of crash, when log size is too large for the size. Approved by Marko in rb#3229 --- storage/innobase/include/log0log.h | 2 + storage/innobase/log/log0log.c | 109 ++++++++++++++++++++++++++++- 2 files changed, 110 insertions(+), 1 deletion(-) diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h index 5524272d811..b0e5e9bda3b 100644 --- a/storage/innobase/include/log0log.h +++ b/storage/innobase/include/log0log.h @@ -809,6 +809,8 @@ struct log_struct{ later; this is advanced when a flush operation is completed to all the log groups */ + volatile ibool is_extending; /*!< this is set to true during extend + the log buffer size */ ib_uint64_t written_to_some_lsn; /*!< first log sequence number not yet written to any log group; for this to diff --git a/storage/innobase/log/log0log.c b/storage/innobase/log/log0log.c index 8bae95f0a5d..046c494c99d 100644 --- a/storage/innobase/log/log0log.c +++ b/storage/innobase/log/log0log.c @@ -213,6 +213,84 @@ log_buf_pool_get_oldest_modification(void) return(lsn); } +/** Extends the log buffer. +@param[in] len requested minimum size in bytes */ +static +void +log_buffer_extend( + ulint len) +{ + ulint move_start; + ulint move_end; + byte tmp_buf[OS_FILE_LOG_BLOCK_SIZE]; + + mutex_enter(&(log_sys->mutex)); + + while (log_sys->is_extending) { + /* Another thread is trying to extend already. + Needs to wait for. */ + mutex_exit(&(log_sys->mutex)); + + log_buffer_flush_to_disk(); + + mutex_enter(&(log_sys->mutex)); + + if (srv_log_buffer_size > len / UNIV_PAGE_SIZE) { + /* Already extended enough by the others */ + mutex_exit(&(log_sys->mutex)); + return; + } + } + + log_sys->is_extending = TRUE; + + while (log_sys->n_pending_writes != 0 + || ut_calc_align_down(log_sys->buf_free, + OS_FILE_LOG_BLOCK_SIZE) + != ut_calc_align_down(log_sys->buf_next_to_write, + OS_FILE_LOG_BLOCK_SIZE)) { + /* Buffer might have >1 blocks to write still. */ + mutex_exit(&(log_sys->mutex)); + + log_buffer_flush_to_disk(); + + mutex_enter(&(log_sys->mutex)); + } + + move_start = ut_calc_align_down( + log_sys->buf_free, + OS_FILE_LOG_BLOCK_SIZE); + move_end = log_sys->buf_free; + + /* store the last log block in buffer */ + ut_memcpy(tmp_buf, log_sys->buf + move_start, + move_end - move_start); + + log_sys->buf_free -= move_start; + log_sys->buf_next_to_write -= move_start; + + /* reallocate log buffer */ + srv_log_buffer_size = len / UNIV_PAGE_SIZE + 1; + mem_free(log_sys->buf_ptr); + log_sys->buf_ptr = mem_alloc(LOG_BUFFER_SIZE + OS_FILE_LOG_BLOCK_SIZE); + log_sys->buf = ut_align(log_sys->buf_ptr, OS_FILE_LOG_BLOCK_SIZE); + log_sys->buf_size = LOG_BUFFER_SIZE; + log_sys->max_buf_free = log_sys->buf_size / LOG_BUF_FLUSH_RATIO + - LOG_BUF_FLUSH_MARGIN; + + /* restore the last log block */ + ut_memcpy(log_sys->buf, tmp_buf, move_end - move_start); + + ut_ad(log_sys->is_extending); + log_sys->is_extending = FALSE; + + mutex_exit(&(log_sys->mutex)); + + fprintf(stderr, + "InnoDB: innodb_log_buffer_size was extended to %lu.\n", + LOG_BUFFER_SIZE); +} + /************************************************************//** Opens the log for log_write_low. The log must be closed with log_close and released with log_release. @@ -233,11 +311,39 @@ log_reserve_and_open( ulint count = 0; #endif /* UNIV_DEBUG */ - ut_a(len < log->buf_size / 2); + if (len >= log->buf_size / 2) { + DBUG_EXECUTE_IF("ib_log_buffer_is_short_crash", + DBUG_SUICIDE();); + + /* log_buffer is too small. try to extend instead of crash. */ + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Warning: " + "The transaction log size is too large" + " for innodb_log_buffer_size (%lu >= %lu / 2). " + "Trying to extend it.\n", + len, LOG_BUFFER_SIZE); + + log_buffer_extend((len + 1) * 2); + } loop: mutex_enter(&(log->mutex)); ut_ad(!recv_no_log_write); + if (log->is_extending) { + + mutex_exit(&(log->mutex)); + + /* Log buffer size is extending. Writing up to the next block + should wait for the extending finished. */ + + os_thread_sleep(100000); + + ut_ad(++count < 50); + + goto loop; + } + /* Calculate an upper limit for the space the string may take in the log buffer */ @@ -788,6 +894,7 @@ log_init(void) log_sys->buf = ut_align(log_sys->buf_ptr, OS_FILE_LOG_BLOCK_SIZE); log_sys->buf_size = LOG_BUFFER_SIZE; + log_sys->is_extending = FALSE; memset(log_sys->buf, '\0', LOG_BUFFER_SIZE); From d4800a57badc79d380492810b648db6e52511e14 Mon Sep 17 00:00:00 2001 From: Yasufumi Kinoshita Date: Mon, 30 Sep 2013 15:02:54 +0900 Subject: [PATCH 36/80] Adjustment for fix for Bug#11758196 log_buffer_extend() should fill the new buffer with 0. --- storage/innobase/log/log0log.c | 1 + 1 file changed, 1 insertion(+) diff --git a/storage/innobase/log/log0log.c b/storage/innobase/log/log0log.c index 046c494c99d..eacee12a2d4 100644 --- a/storage/innobase/log/log0log.c +++ b/storage/innobase/log/log0log.c @@ -275,6 +275,7 @@ log_buffer_extend( log_sys->buf_ptr = mem_alloc(LOG_BUFFER_SIZE + OS_FILE_LOG_BLOCK_SIZE); log_sys->buf = ut_align(log_sys->buf_ptr, OS_FILE_LOG_BLOCK_SIZE); log_sys->buf_size = LOG_BUFFER_SIZE; + memset(log_sys->buf, '\0', LOG_BUFFER_SIZE); log_sys->max_buf_free = log_sys->buf_size / LOG_BUF_FLUSH_RATIO - LOG_BUF_FLUSH_MARGIN; From 2ea00f9f6e3531336af254489c5061b01ff8dd44 Mon Sep 17 00:00:00 2001 From: "Sreedhar.S" Date: Mon, 30 Sep 2013 12:29:10 +0530 Subject: [PATCH 37/80] Fix to copy missing pdb files BUG 13878021 --- CMakeLists.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 369a6b5c8f9..0de56225155 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -464,6 +464,27 @@ IF(NOT INSTALL_LAYOUT MATCHES "RPM") ) INSTALL(FILES README DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme) INSTALL(FILES ${CMAKE_BINARY_DIR}/Docs/INFO_SRC ${CMAKE_BINARY_DIR}/Docs/INFO_BIN DESTINATION ${INSTALL_DOCDIR}) + + IF(WIN32) + SET(EXTRA_PDB_FILES + ${CMAKE_BINARY_DIR}/libmysql/authentication_win/${CMAKE_BUILD_TYPE}/auth_win_client.pdb + ${CMAKE_BINARY_DIR}/libmysql/${CMAKE_BUILD_TYPE}/clientlib.pdb + ${CMAKE_BINARY_DIR}/strings/${CMAKE_BUILD_TYPE}/strings.pdb + ${CMAKE_BINARY_DIR}/mysys/${CMAKE_BUILD_TYPE}/mysys.pdb + ${CMAKE_BINARY_DIR}/vio/${CMAKE_BUILD_TYPE}/vio.pdb + ${CMAKE_BINARY_DIR}/zlib/${CMAKE_BUILD_TYPE}/zlib.pdb + ${CMAKE_BINARY_DIR}/extra/yassl/${CMAKE_BUILD_TYPE}/yassl.pdb + ${CMAKE_BINARY_DIR}/extra/yassl/taocrypt/${CMAKE_BUILD_TYPE}/taocrypt.pdb + ) + INSTALL(FILES ${EXTRA_PDB_FILES} DESTINATION ${INSTALL_LIBDIR} COMPONENT DebugBinaries) + FOREACH(f ${EXTRA_PDB_FILES}) + STRING(REPLACE "RelWithDebInfo" "Debug" df ${f}) + IF(EXISTS ${df}) + INSTALL(FILES ${df} DESTINATION ${INSTALL_LIBDIR}/debug COMPONENT DebugBinaries) + ENDIF() + ENDFOREACH() + ENDIF() + IF(UNIX) INSTALL(FILES Docs/INSTALL-BINARY DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme) ENDIF() From bac7961358507bd617c18f3eb5ff6963dd9fac25 Mon Sep 17 00:00:00 2001 From: "Sreedhar.S" Date: Mon, 30 Sep 2013 12:41:22 +0530 Subject: [PATCH 38/80] Fix for Bug:16053094 Registry redirection was improper and hence not able to pick the value for the OLDERVERSION property. as a result in the install upgrade dialog null value wa being passed. --- packaging/WiX/mysql_server.wxs.in | 42 ++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/packaging/WiX/mysql_server.wxs.in b/packaging/WiX/mysql_server.wxs.in index 752dc15304e..65688838316 100644 --- a/packaging/WiX/mysql_server.wxs.in +++ b/packaging/WiX/mysql_server.wxs.in @@ -70,10 +70,10 @@ Installed - + - + @@ -83,31 +83,43 @@ Name="InstallLocation" Type="raw" /> - - - - + + + + + + + + + + - + - - - INSTALLDIR2 - + + + INSTALLDIR2 + From 99146a50560a282973615addf47c4287fc226e7f Mon Sep 17 00:00:00 2001 From: "Sreedhar.S" Date: Mon, 30 Sep 2013 13:01:17 +0530 Subject: [PATCH 39/80] Bug #16619754 - MYSQL_INSTALL_DB.PL FAILS TO CREATE DATABASE ON WINDOWS. As this mysql_install_db.pl file has always generated lots of confusion on Windows. This fix will make sure to get it removed only from Windows --- scripts/CMakeLists.txt | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 424d92e31e1..d5a3311d942 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -198,24 +198,17 @@ ELSE() SET(localstatedir ${MYSQL_DATADIR}) ENDIF() -IF(UNIX) -CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_install_db.sh - ${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db ESCAPE_QUOTES @ONLY) +IF(NOT WIN32) + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_install_db.pl.in + ${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db ESCAPE_QUOTES @ONLY) SET(DEST ${INSTALL_SCRIPTDIR}) - SET(EXT) -ELSE() - CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_install_db.pl.in - ${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db.pl ESCAPE_QUOTES @ONLY) - SET(DEST ${INSTALL_SCRIPTDIR}) - SET(EXT ".pl") -ENDIF() -INSTALL_SCRIPT( - "${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db${EXT}" - DESTINATION ${DEST} - COMPONENT Server + INSTALL_SCRIPT( + "${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db" + DESTINATION ${DEST} + COMPONENT Server ) - +ENDIF() SET(prefix "${CMAKE_INSTALL_PREFIX}") SET(sysconfdir ${prefix}) From 6ca4be9c03cd8d51b326389eeac6e767a36ec188 Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Tue, 1 Oct 2013 10:05:45 +0200 Subject: [PATCH 40/80] Bug#14621190: HA_INNOBASE::INDEX_NEXT SKIPS A RECORD IF PREVIOUS INDEX_READ_MAP HAD NO MATCH If index_read_map is called for exact search and no matching records exists it will position the cursor on the next record, but still having the relative position to BTR_PCUR_ON. This will make a call for index_next to read yet another next record, instead of returning the record the cursor points to. Fixed by setting pcur->rel_pos = BTR_PCUR_BEFORE if an exact [prefix] search is done, but failed. Also avoids optimistic restoration if rel_pos != BTR_PCUR_ON, since btr_cur may be different than old_rec. rb#3324, approved by Marko and Jimmy --- .../suite/innodb/r/innodb_bug13510739.result | 2 +- storage/innobase/btr/btr0pcur.c | 12 +++++----- storage/innobase/row/row0sel.c | 24 +++++++++++++++++++ 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb_bug13510739.result b/mysql-test/suite/innodb/r/innodb_bug13510739.result index 8aa4323eeb0..e1e6e27239c 100644 --- a/mysql-test/suite/innodb/r/innodb_bug13510739.result +++ b/mysql-test/suite/innodb/r/innodb_bug13510739.result @@ -6,5 +6,5 @@ HANDLER bug13510739 READ `primary` = (2); c HANDLER bug13510739 READ `primary` NEXT; c -4 +3 DROP TABLE bug13510739; diff --git a/storage/innobase/btr/btr0pcur.c b/storage/innobase/btr/btr0pcur.c index 0cfdf138bad..fbedc1e7d04 100644 --- a/storage/innobase/btr/btr0pcur.c +++ b/storage/innobase/btr/btr0pcur.c @@ -273,13 +273,15 @@ btr_pcur_restore_position_func( if (UNIV_LIKELY(latch_mode == BTR_SEARCH_LEAF) || UNIV_LIKELY(latch_mode == BTR_MODIFY_LEAF)) { - /* Try optimistic restoration */ + /* Try optimistic restoration if cursor is expected to be + positioned on the same btr record as before (BTR_PCUR_ON). */ - if (UNIV_LIKELY(buf_page_optimistic_get( + if (cursor->rel_pos == BTR_PCUR_ON + && buf_page_optimistic_get( latch_mode, cursor->block_when_stored, cursor->modify_clock, - file, line, mtr))) { + file, line, mtr)) { cursor->pos_state = BTR_PCUR_IS_POSITIONED; buf_block_dbg_add_level( @@ -287,7 +289,7 @@ btr_pcur_restore_position_func( dict_index_is_ibuf(index) ? SYNC_IBUF_TREE_NODE : SYNC_TREE_NODE); - if (cursor->rel_pos == BTR_PCUR_ON) { + { #ifdef UNIV_DEBUG const rec_t* rec; const ulint* offsets1; @@ -312,8 +314,6 @@ btr_pcur_restore_position_func( #endif /* UNIV_DEBUG */ return(TRUE); } - - return(FALSE); } } diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index 518eba975ab..28da1f69e8a 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -3116,6 +3116,13 @@ sel_restore_position_for_mysql( return(TRUE); } + /* success can only be TRUE for BTR_PCUR_ON! */ + ut_ad(!success); + + /* BTR_PCUR_BEFORE -> the position is now set to the record before + pcur->old_rec. + BTR_PCUR_AFTER-> positioned to record after pcur->old_rec. */ + if (relative_position == BTR_PCUR_AFTER || relative_position == BTR_PCUR_AFTER_LAST_IN_TREE) { @@ -4120,6 +4127,14 @@ wrong_offs: btr_pcur_store_position(pcur, &mtr); + /* The found record was not a match, but may be used + as NEXT record (index_next). Set the relative position + to BTR_PCUR_BEFORE, to reflect that the position of + the persistent cursor is before the found/stored row + (pcur->old_rec). */ + ut_ad(pcur->rel_pos == BTR_PCUR_ON); + pcur->rel_pos = BTR_PCUR_BEFORE; + err = DB_RECORD_NOT_FOUND; /* ut_print_name(stderr, index->name); fputs(" record not found 3\n", stderr); */ @@ -4159,6 +4174,14 @@ wrong_offs: btr_pcur_store_position(pcur, &mtr); + /* The found record was not a match, but may be used + as NEXT record (index_next). Set the relative position + to BTR_PCUR_BEFORE, to reflect that the position of + the persistent cursor is before the found/stored row + (pcur->old_rec). */ + ut_ad(pcur->rel_pos == BTR_PCUR_ON); + pcur->rel_pos = BTR_PCUR_BEFORE; + err = DB_RECORD_NOT_FOUND; /* ut_print_name(stderr, index->name); fputs(" record not found 4\n", stderr); */ @@ -4736,6 +4759,7 @@ normal_return: if (prebuilt->n_fetch_cached > 0) { row_sel_pop_cached_row_for_mysql(buf, prebuilt); + DEBUG_SYNC_C("row_search_cached_row"); err = DB_SUCCESS; } From 19689875f8b0a69d4f25a53c941b7880aa597988 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 1 Oct 2013 14:17:35 +0300 Subject: [PATCH 41/80] From 2f02f6cce1af08973183b39d4b1bca29f224692a Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 4 Oct 2013 13:51:13 +0200 Subject: [PATCH 42/80] From c904103b3fd115897b2b079db6829a11565936af Mon Sep 17 00:00:00 2001 From: Praveenkumar Hulakund Date: Sat, 5 Oct 2013 15:29:02 +0530 Subject: [PATCH 43/80] Bug#11745656 - KILL THREAD -> ERROR: "SERVER SHUTDOWN IN PROGRESS" Description: ------------ There are 2 issues reported in the bug report, 1. One session running a "long" select, then, from the other session, you kill that first one, while select is running, and it receives that message "Server shutdown in progress". Reported Date: 02-Apr-2006 => Looks like this isuse is already fixed in 2009 by the patch pushed for bug28141. 2. Killing query which goes to filesort, logs error entries like: 120416 9:17:28 [ERROR] mysqld: Sort aborted: Server shutdown in progress 120416 9:18:48 [ERROR] mysqld: Sort aborted: Server shutdown in progress 120416 9:19:39 [ERROR] mysqld: Sort aborted: Server shutdown in progress Reported Date: 16-Apr-2012 => This issue is introduced in 5.5+ versions. Fixing this issue in this patch. Analysis: --------- In function "filesort()", on error we are logging error message. To the error message, the message related THD::killed_errno is also appeneded, if it is set.(THD::kill_errno value is obtained by calling member function THD::killed_errno) In the scenario mentioned in this bug report, when we kill the connection, THD::kill_errno is set to the THD::KILL_CONNECTION. Enum type THD::KILL_CONNECTION corressponds to value ER_SERVER_SHUTDOWN. Because of this, "Server shutdown in ...." is appended to the message logged. Fix: ---- Modified code of "filesort()" function to append "KILL_QUERY" status to error message when thread is killed and server shutdown is not in progress. --- sql/filesort.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sql/filesort.cc b/sql/filesort.cc index e829721a29b..d877ff4a8a4 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -339,7 +339,10 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, "%s: %s", MYF(ME_ERROR + ME_WAITTANG), ER_THD(thd, ER_FILSORT_ABORT), - kill_errno ? ER(kill_errno) : thd->stmt_da->message()); + kill_errno ? ((kill_errno == THD::KILL_CONNECTION && + !shutdown_in_progress) ? ER(THD::KILL_QUERY) : + ER(kill_errno)) : + thd->stmt_da->message()); if (global_system_variables.log_warnings > 1) { From d8761fd62f1ff5e36136caa0ecf6c89f503c0543 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 7 Oct 2013 09:49:32 +0530 Subject: [PATCH 44/80] From 4db0c831a5a3b850fa554f77024feef092a4a45c Mon Sep 17 00:00:00 2001 From: Yasufumi Kinoshita Date: Mon, 7 Oct 2013 15:16:31 +0900 Subject: [PATCH 45/80] Bug#17431533 : FAILING ASSERTION: INDEX->PAGE != 0XFFFFFFFF AFTER DISCARDING TABLESPACE ha_innobase::records_in_range() should return HA_POS_ERROR for the table during discarded without requesting pages. The later other handler method should treat the error correctly. Approved by Sunny in rb#3433 --- storage/innobase/handler/ha_innodb.cc | 7 +++++++ storage/innodb_plugin/handler/ha_innodb.cc | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 9f5ba543a47..8c9fc33fa35 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -6454,6 +6454,11 @@ ha_innobase::records_in_range( index = dict_table_get_index_noninline(prebuilt->table, key->name); + if (prebuilt->table->ibd_file_missing) { + n_rows = HA_POS_ERROR; + goto func_exit; + } + range_start = dtuple_create_for_mysql(&heap1, key->key_parts); dict_index_copy_types(range_start, index, key->key_parts); @@ -6503,6 +6508,8 @@ ha_innobase::records_in_range( my_free(key_val_buff2, MYF(0)); +func_exit: + prebuilt->trx->op_info = (char*)""; /* The MySQL optimizer seems to believe an estimate of 0 rows is diff --git a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc index 971c55a623c..cde3c679766 100644 --- a/storage/innodb_plugin/handler/ha_innodb.cc +++ b/storage/innodb_plugin/handler/ha_innodb.cc @@ -7523,6 +7523,10 @@ ha_innobase::records_in_range( /* There exists possibility of not being able to find requested index due to inconsistency between MySQL and InoDB dictionary info. Necessary message should have been printed in innobase_get_index() */ + if (prebuilt->table->ibd_file_missing) { + n_rows = HA_POS_ERROR; + goto func_exit; + } if (UNIV_UNLIKELY(!index)) { n_rows = HA_POS_ERROR; goto func_exit; From 350d6e625e9680bc9217f8760aba3d4abd6e7c5b Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 7 Oct 2013 14:03:57 +0530 Subject: [PATCH 46/80] From af1082f44d7feafd5e9d1769655db5b45de43201 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 7 Oct 2013 18:17:26 +0530 Subject: [PATCH 47/80] From d97df1e8ff85b66640ed5ee90d4f08d249d73fce Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Tue, 8 Oct 2013 18:37:43 +0100 Subject: [PATCH 48/80] BUG#17508351: REDUNDANT CODE IN REPLSEMISYNCMASTER::UPDATESYNCHEADER ReplSemiSyncMaster::updateSyncHeader contains redundant assignments to the local variable sync. This patch removes them. --- plugin/semisync/semisync_master.cc | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/plugin/semisync/semisync_master.cc b/plugin/semisync/semisync_master.cc index 87adbdcae79..6b8bb915445 100644 --- a/plugin/semisync/semisync_master.cc +++ b/plugin/semisync/semisync_master.cc @@ -894,10 +894,7 @@ int ReplSemiSyncMaster::updateSyncHeader(unsigned char *packet, * target, do not request replies from the slave. */ if (!getMasterEnabled() || !is_semi_sync_slave()) - { - sync = false; return 0; - } function_enter(kWho); @@ -905,15 +902,12 @@ int ReplSemiSyncMaster::updateSyncHeader(unsigned char *packet, /* This is the real check inside the mutex. */ if (!getMasterEnabled()) - { - sync = false; - goto l_end; - } + goto l_end; // sync= false at this point in time if (is_on()) { /* semi-sync is ON */ - sync = false; /* No sync unless a transaction is involved. */ + /* sync= false; No sync unless a transaction is involved. */ if (reply_file_name_inited_) { From c8c948ffa6985e29752ffa7d851ede05037e148f Mon Sep 17 00:00:00 2001 From: "Sreedhar.S" Date: Wed, 9 Oct 2013 11:10:46 +0530 Subject: [PATCH 49/80] Bug 13878021 - WINDOWS PACKAGE THAT INCLUDES .PDB FILES FOR INTERMEDIATE LIBRARIES USED --- CMakeLists.txt | 20 -------------------- extra/yassl/CMakeLists.txt | 5 +++++ extra/yassl/taocrypt/CMakeLists.txt | 5 +++++ libmysql/CMakeLists.txt | 2 ++ libmysql/authentication_win/CMakeLists.txt | 5 +++++ mysys/CMakeLists.txt | 5 +++++ strings/CMakeLists.txt | 5 +++++ vio/CMakeLists.txt | 5 +++++ zlib/CMakeLists.txt | 5 +++++ 9 files changed, 37 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0de56225155..7f46c671f3f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -465,26 +465,6 @@ IF(NOT INSTALL_LAYOUT MATCHES "RPM") INSTALL(FILES README DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme) INSTALL(FILES ${CMAKE_BINARY_DIR}/Docs/INFO_SRC ${CMAKE_BINARY_DIR}/Docs/INFO_BIN DESTINATION ${INSTALL_DOCDIR}) - IF(WIN32) - SET(EXTRA_PDB_FILES - ${CMAKE_BINARY_DIR}/libmysql/authentication_win/${CMAKE_BUILD_TYPE}/auth_win_client.pdb - ${CMAKE_BINARY_DIR}/libmysql/${CMAKE_BUILD_TYPE}/clientlib.pdb - ${CMAKE_BINARY_DIR}/strings/${CMAKE_BUILD_TYPE}/strings.pdb - ${CMAKE_BINARY_DIR}/mysys/${CMAKE_BUILD_TYPE}/mysys.pdb - ${CMAKE_BINARY_DIR}/vio/${CMAKE_BUILD_TYPE}/vio.pdb - ${CMAKE_BINARY_DIR}/zlib/${CMAKE_BUILD_TYPE}/zlib.pdb - ${CMAKE_BINARY_DIR}/extra/yassl/${CMAKE_BUILD_TYPE}/yassl.pdb - ${CMAKE_BINARY_DIR}/extra/yassl/taocrypt/${CMAKE_BUILD_TYPE}/taocrypt.pdb - ) - INSTALL(FILES ${EXTRA_PDB_FILES} DESTINATION ${INSTALL_LIBDIR} COMPONENT DebugBinaries) - FOREACH(f ${EXTRA_PDB_FILES}) - STRING(REPLACE "RelWithDebInfo" "Debug" df ${f}) - IF(EXISTS ${df}) - INSTALL(FILES ${df} DESTINATION ${INSTALL_LIBDIR}/debug COMPONENT DebugBinaries) - ENDIF() - ENDFOREACH() - ENDIF() - IF(UNIX) INSTALL(FILES Docs/INSTALL-BINARY DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme) ENDIF() diff --git a/extra/yassl/CMakeLists.txt b/extra/yassl/CMakeLists.txt index b8432f06ac6..94a336c53dc 100644 --- a/extra/yassl/CMakeLists.txt +++ b/extra/yassl/CMakeLists.txt @@ -37,4 +37,9 @@ ENDIF() ADD_CONVENIENCE_LIBRARY(yassl ${YASSL_SOURCES}) RESTRICT_SYMBOL_EXPORTS(yassl) +INSTALL_DEBUG_SYMBOLS(yassl) +IF(MSVC) + INSTALL_DEBUG_TARGET(yassl DESTINATION ${INSTALL_LIBDIR}/debug) +ENDIF() + diff --git a/extra/yassl/taocrypt/CMakeLists.txt b/extra/yassl/taocrypt/CMakeLists.txt index 10ed614445e..9f1f2a102da 100644 --- a/extra/yassl/taocrypt/CMakeLists.txt +++ b/extra/yassl/taocrypt/CMakeLists.txt @@ -36,3 +36,8 @@ ENDIF() ADD_CONVENIENCE_LIBRARY(taocrypt ${TAOCRYPT_SOURCES}) RESTRICT_SYMBOL_EXPORTS(taocrypt) +INSTALL_DEBUG_SYMBOLS(taocrypt) +IF(MSVC) + INSTALL_DEBUG_TARGET(taocrypt DESTINATION ${INSTALL_LIBDIR}/debug) +ENDIF() + diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt index 1d7a134aefa..83386d8073a 100644 --- a/libmysql/CMakeLists.txt +++ b/libmysql/CMakeLists.txt @@ -168,8 +168,10 @@ ENDIF() MERGE_LIBRARIES(mysqlclient STATIC ${LIBS} COMPONENT Development) # Visual Studio users need debug static library for debug projects +INSTALL_DEBUG_SYMBOLS(clientlib) IF(MSVC) INSTALL_DEBUG_TARGET(mysqlclient DESTINATION ${INSTALL_LIBDIR}/debug) + INSTALL_DEBUG_TARGET(clientlib DESTINATION ${INSTALL_LIBDIR}/debug) ENDIF() IF(UNIX) diff --git a/libmysql/authentication_win/CMakeLists.txt b/libmysql/authentication_win/CMakeLists.txt index 80cd14780e6..cd790975b34 100644 --- a/libmysql/authentication_win/CMakeLists.txt +++ b/libmysql/authentication_win/CMakeLists.txt @@ -31,3 +31,8 @@ TARGET_LINK_LIBRARIES(auth_win_client Secur32) # In IDE, group headers in a separate folder. SOURCE_GROUP(Headers REGULAR_EXPRESSION ".*h$") + +INSTALL_DEBUG_SYMBOLS(auth_win_client) +IF(MSVC) + INSTALL_DEBUG_TARGET(auth_win_client DESTINATION ${INSTALL_LIBDIR}/debug) +ENDIF() diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt index 95d3e568be7..648a87d1e95 100644 --- a/mysys/CMakeLists.txt +++ b/mysys/CMakeLists.txt @@ -77,3 +77,8 @@ ENDIF() ADD_EXECUTABLE(thr_lock thr_lock.c) TARGET_LINK_LIBRARIES(thr_lock mysys) SET_TARGET_PROPERTIES(thr_lock PROPERTIES COMPILE_FLAGS "-DMAIN") + +INSTALL_DEBUG_SYMBOLS(mysys) +IF(MSVC) + INSTALL_DEBUG_TARGET(mysys DESTINATION ${INSTALL_LIBDIR}/debug) +ENDIF() diff --git a/strings/CMakeLists.txt b/strings/CMakeLists.txt index 552bf942700..77b093c4fb1 100644 --- a/strings/CMakeLists.txt +++ b/strings/CMakeLists.txt @@ -31,3 +31,8 @@ ENDIF() # Avoid dependencies on perschema data defined in mysys ADD_DEFINITIONS(-DDISABLE_MYSQL_THREAD_H) ADD_CONVENIENCE_LIBRARY(strings ${STRINGS_SOURCES}) + +INSTALL_DEBUG_SYMBOLS(strings) +IF(MSVC) + INSTALL_DEBUG_TARGET(strings DESTINATION ${INSTALL_LIBDIR}/debug) +ENDIF() diff --git a/vio/CMakeLists.txt b/vio/CMakeLists.txt index e61281a43d8..bf811a0de9b 100644 --- a/vio/CMakeLists.txt +++ b/vio/CMakeLists.txt @@ -20,3 +20,8 @@ ADD_DEFINITIONS(${SSL_DEFINES}) SET(VIO_SOURCES vio.c viosocket.c viossl.c viosslfactories.c) ADD_CONVENIENCE_LIBRARY(vio ${VIO_SOURCES}) TARGET_LINK_LIBRARIES(vio ${LIBSOCKET}) + +INSTALL_DEBUG_SYMBOLS(vio) +IF(MSVC) + INSTALL_DEBUG_TARGET(vio DESTINATION ${INSTALL_LIBDIR}/debug) +ENDIF() diff --git a/zlib/CMakeLists.txt b/zlib/CMakeLists.txt index 68799947e44..bcfacea4b0b 100644 --- a/zlib/CMakeLists.txt +++ b/zlib/CMakeLists.txt @@ -23,3 +23,8 @@ SET(ZLIB_SOURCES adler32.c compress.c crc32.c crc32.h deflate.c deflate.h gzio. ADD_CONVENIENCE_LIBRARY(zlib ${ZLIB_SOURCES}) RESTRICT_SYMBOL_EXPORTS(zlib) +INSTALL_DEBUG_SYMBOLS(zlib) +IF(MSVC) + INSTALL_DEBUG_TARGET(zlib DESTINATION ${INSTALL_LIBDIR}/debug) +ENDIF() + From c66a037dcaa757607acb7016be63d813a04d6d43 Mon Sep 17 00:00:00 2001 From: Praveenkumar Hulakund Date: Wed, 9 Oct 2013 13:32:31 +0530 Subject: [PATCH 50/80] Bug#17474166 - EXECUTING STATEMENT LIKE 'SHOW ENGINE INNODB' AND 'KILL SESSION' LEAD TO CRASH Analysis: -------- This situation occurs when the connection executes query "show engine innodb status" and this connection is killed by executing statement "kill " by another connection. In function "innodb_show_status", function "stat_print" is called to print the status but return value of function is not checked. After killing connection, if write to connection fails then error is returned and same is set in Diagnostic area. Since FALSE is returned from "innodb_show_status" now, assert to check no error is set in function "set_eof_status" (called from my_eof) is failing. Fix: ---- Changed code to check return value of function "stat_print" in "innodb_show_status". --- sql/handler.cc | 6 ++++++ sql/net_serv.cc | 8 +++++++- storage/innobase/handler/ha_innodb.cc | 8 +++++--- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/sql/handler.cc b/sql/handler.cc index c3ad1cade99..6307e95a194 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -4921,8 +4921,14 @@ bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat) "", 0, "DISABLED", 8) ? 1 : 0; } else + { + DBUG_EXECUTE_IF("simulate_show_status_failure", + DBUG_SET("+d,simulate_net_write_failure");); result= db_type->show_status && db_type->show_status(db_type, thd, stat_print, stat) ? 1 : 0; + DBUG_EXECUTE_IF("simulate_show_status_failure", + DBUG_SET("-d,simulate_net_write_failure");); + } } if (!result) diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 1a79679ed7c..8b44c7d443f 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -370,6 +370,12 @@ my_net_write(NET *net,const uchar *packet,size_t len) MYSQL_NET_WRITE_START(len); + DBUG_EXECUTE_IF("simulate_net_write_failure", { + my_error(ER_NET_ERROR_ON_WRITE, MYF(0)); + return 1; + }; + ); + /* Big packets are handled by splitting them in packets of MAX_PACKET_LENGTH length. The last packet is always a packet that is < MAX_PACKET_LENGTH. diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index cabea01c95a..7d0a363be69 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -9526,6 +9526,7 @@ innodb_show_status( const long MAX_STATUS_SIZE = 1048576; ulint trx_list_start = ULINT_UNDEFINED; ulint trx_list_end = ULINT_UNDEFINED; + bool ret_val; DBUG_ENTER("innodb_show_status"); DBUG_ASSERT(hton == innodb_hton_ptr); @@ -9590,12 +9591,13 @@ innodb_show_status( mutex_exit(&srv_monitor_file_mutex); - stat_print(thd, innobase_hton_name, (uint) strlen(innobase_hton_name), - STRING_WITH_LEN(""), str, flen); + ret_val= stat_print(thd, innobase_hton_name, + (uint) strlen(innobase_hton_name), + STRING_WITH_LEN(""), str, flen); my_free(str); - DBUG_RETURN(FALSE); + DBUG_RETURN(ret_val); } /************************************************************************//** From d8bcc6215e5295b99418cc5ba2efdb9ba81d5c18 Mon Sep 17 00:00:00 2001 From: "Sreedhar.S" Date: Wed, 9 Oct 2013 17:08:45 +0530 Subject: [PATCH 51/80] BUG 17560050 - MYSQL_INSTALL_DB SCRIPT FAILING WITH RESOLVEIP ISSUES. --- scripts/CMakeLists.txt | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index d5a3311d942..16d820e147e 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -198,18 +198,24 @@ ELSE() SET(localstatedir ${MYSQL_DATADIR}) ENDIF() -IF(NOT WIN32) - CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_install_db.pl.in - ${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db ESCAPE_QUOTES @ONLY) +IF(UNIX) +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_install_db.sh + ${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db ESCAPE_QUOTES @ONLY) SET(DEST ${INSTALL_SCRIPTDIR}) - - INSTALL_SCRIPT( - "${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db" - DESTINATION ${DEST} - COMPONENT Server - ) + SET(EXT) +ELSE() + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_install_db.pl.in + ${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db.pl ESCAPE_QUOTES @ONLY) + SET(DEST ${INSTALL_SCRIPTDIR}) + SET(EXT ".pl") ENDIF() +INSTALL_SCRIPT( + "${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db${EXT}" + DESTINATION ${DEST} + COMPONENT Server + ) + SET(prefix "${CMAKE_INSTALL_PREFIX}") SET(sysconfdir ${prefix}) SET(bindir ${prefix}/${INSTALL_BINDIR}) From 0e2689310119e0780b3dc3a5c95677fcbc18fb0d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 Oct 2013 18:42:27 +0530 Subject: [PATCH 52/80] From 3399194cefc7fcffcba4c304bbb3badec1afc21e Mon Sep 17 00:00:00 2001 From: Nuno Carvalho Date: Mon, 14 Oct 2013 15:45:12 +0100 Subject: [PATCH 53/80] WL#7266: Dump-thread additional concurrency tests This worklog aims at testing the two following scenarios: 1) Whenever the mysql_binlog_send method (dump thread) reaches the end of file when reading events from the binlog, before checking if it should wait for more events, there was a test to check if the file being read was still active, i.e, it was the last known binlog. However, it was possible that something was written to the binary log and then a rotation would happen, after EOF was detected and before the check for active was performed. In this case, the end of the binary log would not be read by the dump thread, and this would cause the slave to lose updates. This test verifies that the problem has been fixed. It waits during this window while forcing a rotation in the binlog. 2) Verify dump thread can send events in active file, correctly after encountering an IO error. --- .../rpl/r/rpl_dump_events_twice_bug.result | 15 ++++++ .../rpl/r/rpl_lost_events_on_rotate.result | 14 +++++ .../rpl/t/rpl_dump_events_twice_bug.test | 28 ++++++++++ .../rpl/t/rpl_lost_events_on_rotate.test | 51 +++++++++++++++++++ 4 files changed, 108 insertions(+) create mode 100644 mysql-test/suite/rpl/r/rpl_dump_events_twice_bug.result create mode 100644 mysql-test/suite/rpl/r/rpl_lost_events_on_rotate.result create mode 100644 mysql-test/suite/rpl/t/rpl_dump_events_twice_bug.test create mode 100644 mysql-test/suite/rpl/t/rpl_lost_events_on_rotate.test diff --git a/mysql-test/suite/rpl/r/rpl_dump_events_twice_bug.result b/mysql-test/suite/rpl/r/rpl_dump_events_twice_bug.result new file mode 100644 index 00000000000..8e6c8c122b5 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_dump_events_twice_bug.result @@ -0,0 +1,15 @@ +include/master-slave.inc +[connection master] +CALL mtr.add_suppression("Failed to read an event from active binlog.*"); +SET @debug_saved= @@GLOBAL.DEBUG; +CREATE TABLE t1(c1 INT); +INSERT INTO t1 VALUES(1); +[connection master] +SET GLOBAL debug='+d,dump_fake_io_error'; +INSERT INTO t1 VALUES(2); +INSERT INTO t1 VALUES(3); +include/diff_tables.inc [master:t1, slave:t1] +[connection master] +SET @@GLOBAL.DEBUG= @debug_saved; +DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_lost_events_on_rotate.result b/mysql-test/suite/rpl/r/rpl_lost_events_on_rotate.result new file mode 100644 index 00000000000..eee2effccea --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_lost_events_on_rotate.result @@ -0,0 +1,14 @@ +include/master-slave.inc +[connection master] +SET @debug_saved= @@GLOBAL.DEBUG; +CREATE TABLE t (i INT); +SET GLOBAL DEBUG= "d,wait_after_binlog_EOF"; +INSERT INTO t VALUES (1); +INSERT INTO t VALUES (2); +FLUSH LOGS; +SET DEBUG_SYNC= 'now SIGNAL signal.rotate_finished'; +include/diff_tables.inc [master:t,slave:t] +SET @@GLOBAL.DEBUG= @debug_saved; +SET DEBUG_SYNC= 'RESET'; +DROP TABLE t; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_dump_events_twice_bug.test b/mysql-test/suite/rpl/t/rpl_dump_events_twice_bug.test new file mode 100644 index 00000000000..de82769010e --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_dump_events_twice_bug.test @@ -0,0 +1,28 @@ +# +# Verify dump thread can send events in active file, correctly after +# encountering an IO error. +# +--source include/have_debug.inc +--source include/master-slave.inc + +CALL mtr.add_suppression("Failed to read an event from active binlog.*"); +SET @debug_saved= @@GLOBAL.DEBUG; + +CREATE TABLE t1(c1 INT); +INSERT INTO t1 VALUES(1); + +--sync_slave_with_master + +--source include/rpl_connection_master.inc +SET GLOBAL debug='+d,dump_fake_io_error'; +INSERT INTO t1 VALUES(2); +INSERT INTO t1 VALUES(3); + +--sync_slave_with_master +--let $diff_tables= master:t1, slave:t1 +--source include/diff_tables.inc + +--source include/rpl_connection_master.inc +SET @@GLOBAL.DEBUG= @debug_saved; +DROP TABLE t1; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_lost_events_on_rotate.test b/mysql-test/suite/rpl/t/rpl_lost_events_on_rotate.test new file mode 100644 index 00000000000..08884ee8e26 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_lost_events_on_rotate.test @@ -0,0 +1,51 @@ +# +# Whenever the mysql_binlog_send method (dump thread) reaches the +# end of file when reading events from the binlog, before checking +# if it should wait for more events, there was a test to check if +# the file being read was still active, i.e, it was the last known +# binlog. However, it was possible that something was written to +# the binary log and then a rotation would happen, after EOF was +# detected and before the check for active was performed. In this +# case, the end of the binary log would not be read by the dump +# thread, and this would cause the slave to lose updates. +# +# This test verifies that the problem has been fixed. It waits +# during this window while forcing a rotation in the binlog. +# +--source include/have_debug.inc +--source include/master-slave.inc + +--connection master + +SET @debug_saved= @@GLOBAL.DEBUG; + +CREATE TABLE t (i INT); + +# When reaching the EOF the dump thread will wait before deciding if +# it should move to a new binlong file. +SET GLOBAL DEBUG= "d,wait_after_binlog_EOF"; + +INSERT INTO t VALUES (1); + +--sleep 1 + +# A insert and a rotate happens before the decision +INSERT INTO t VALUES (2); +FLUSH LOGS; + +SET DEBUG_SYNC= 'now SIGNAL signal.rotate_finished'; + +--sync_slave_with_master + +# All the rows should be sent to the slave. +--let $diff_tables=master:t,slave:t +--source include/diff_tables.inc + +##Clean up +--connection master + +SET @@GLOBAL.DEBUG= @debug_saved; +SET DEBUG_SYNC= 'RESET'; + +DROP TABLE t; +--source include/rpl_end.inc From 821249420e0a9c4e0ba71ce974ed515adef504f6 Mon Sep 17 00:00:00 2001 From: "Sreedhar.S" Date: Wed, 16 Oct 2013 11:05:20 +0530 Subject: [PATCH 54/80] Fix for Bug 17584523 - LICENSE AND DOCUMENTATION FILES MISSING FROM WINDOWS MSI PACKAGE --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f46c671f3f..2a85f630d21 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -449,7 +449,6 @@ ADD_SUBDIRECTORY(packaging/solaris) # (see http://public.kitware.com/Bug/view.php?id=11452) SET(CPACK_MONOLITHIC_INSTALL 1 CACHE INTERNAL "") -INCLUDE(CPack) IF(UNIX) INSTALL(FILES Docs/mysql.info DESTINATION ${INSTALL_INFODIR} OPTIONAL COMPONENT Info) ENDIF() @@ -482,3 +481,5 @@ IF(NOT INSTALL_LAYOUT MATCHES "RPM") PATTERN "sp-imp-spec.txt" EXCLUDE ) ENDIF() + +INCLUDE(CPack) From 4522a8704fcfdc392fce408ebeb25e3f40060ec7 Mon Sep 17 00:00:00 2001 From: Sujatha Sivakumar Date: Wed, 16 Oct 2013 11:49:00 +0530 Subject: [PATCH 55/80] Bug#17429677:LAST ARGUMENT OF LOAD DATA ...SET ...STATEMENT REPEATED TWICE IN BINLOG Problem: ======= If LOAD DATA ... SET ... is used the last argument of SET is repeated twice in replication binlog. Analysis: ======== LOAD DATA statements are reconstructed once again before they are written to the binary log. When SET clauses are specified as part of LOAD DATA statement, these SET clause user command strings need to be stored in order to rebuild the original user command. During parsing each column and the value in the SET command are stored in two differenet lists. All the values are stored in a string list. When SET expression has more than one value as shown in the following example: SET a = @a, b = CONCAT(@b, '| 123456789'); Parser extracts values in the following manner i.e Item name , value string, actual length of the value of the item with in the string. Item a: Value for a:"= @a, b = CONCAT(@b, '| 123456789') str_length = 4 Item b: Value for b:"= CONCAT(@b, '| 123456789') str_length = 27 During reconstructing the LOAD DATA command the above strings are retrived as it is and appended to the LOAD DATA statement. Hence it becomes as shown below. SET `a`= @a, b = CONCAT(@b, '| 123456789'), `b`= CONCAT(@b, '| 123456789') Fix: === During reconstruction of SET command, retrieve exact item value string rather than reading the entire string. sql/sql_load.cc: Added code to extract the exact Item value. --- sql/sql_load.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 2e85cb105b0..b593412c559 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -738,8 +738,16 @@ static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex, if (n++) pfields.append(", "); append_identifier(thd, &pfields, item->name, strlen(item->name)); + // Extract exact Item value + str->copy(); pfields.append((char *)str->ptr()); + str->free(); } + /* + Clear the SET string list once the SET command is reconstructed + as we donot require the list anymore. + */ + thd->lex->load_set_str_list.empty(); } p= pfields.c_ptr_safe(); From de0e8a02d18b4593e11b282b7c8641603b7cbfe9 Mon Sep 17 00:00:00 2001 From: Venkata Sidagam Date: Wed, 16 Oct 2013 14:14:44 +0530 Subject: [PATCH 56/80] Bug#16900358 FIX FOR CVE-2012-5611 IS INCOMPLETE Description: Fix for bug CVE-2012-5611 (bug 67685) is incomplete. The ACL_KEY_LENGTH-sized buffers in acl_get() and check_grant_db() can be overflown by up to two bytes. That's probably not enough to do anything more serious than crashing mysqld. Analysis: In acl_get() when "copy_length" is calculated it just adding the variable lengths. But when we are using them with strmov() we are adding +1 to each. This will lead to a three byte buffer overflow (i.e two +1's at strmov() and one byte for the null added by strmov() function). Similarly it happens for check_grant_db() function as well. Fix: We need to add "+2" to "copy_length" in acl_get() and "+1" to "copy_length" in check_grant_db(). --- sql/sql_acl.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 2458a7120da..cf150439391 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1363,7 +1363,8 @@ ulong acl_get(const char *host, const char *ip, copy_length= (size_t) (strlen(ip ? ip : "") + strlen(user ? user : "") + - strlen(db ? db : "")); + strlen(db ? db : "")) + 2; /* Added 2 at the end to avoid + buffer overflow at strmov()*/ /* Make sure that strmov() operations do not result in buffer overflow. */ @@ -4353,7 +4354,8 @@ bool check_grant_db(THD *thd,const char *db) size_t copy_length; copy_length= (size_t) (strlen(sctx->priv_user ? sctx->priv_user : "") + - strlen(db ? db : "")); + strlen(db ? db : "")) + 1; /* Added 1 at the end to avoid + buffer overflow at strmov()*/ /* Make sure that strmov() operations do not result in buffer overflow. From 2b07397b2021ce598f0bde23a15b1e7983722463 Mon Sep 17 00:00:00 2001 From: Venkatesh Duggirala Date: Wed, 16 Oct 2013 22:12:23 +0530 Subject: [PATCH 57/80] Bug#17234370 LAST_INSERT_ID IS REPLICATED INCORRECTLY IF REPLICATION FILTERS ARE USED. Problem: When Filtered-slave applies Int_var_log_event and when it tries to write the event to its own binlog, LAST_INSERT_ID value is written wrongly. Analysis: THD::stmt_depends_on_first_successful_insert_id_in_prev_stmt is a variable which is set when LAST_INSERT_ID() is used by a statement. If it is set, first_successful_insert_id_in_ prev_stmt_for_binlog will be stored in the statement-based binlog. This variable is CUMULATIVE along the execution of a stored function or trigger: if one substatement sets it to 1 it will stay 1 until the function/trigger ends, thus making sure that first_successful_insert_id_in_ prev_stmt_for_binlog does not change anymore and is propagated to the caller for binlogging. This is achieved using the following code if(!stmt_depends_on_first_successful_insert_id_in_prev_stmt) { /* It's the first time we read it */ first_successful_insert_id_in_prev_stmt_for_binlog= first_successful_insert_id_in_prev_stmt; stmt_depends_on_first_successful_insert_id_in_prev_stmt= 1; } Slave server, after receiving Int_var_log_event event from master, it is setting stmt_depends_on_first_successful_insert_id_in_prev_stmt to true(*which is wrong*) and not setting first_successful_insert_id_in_prev_stmt_for_binlog. Because of this problem, when the actual DML statement with LAST_INSERT_ID() is parsed by slave SQL thread, first_successful_insert_id_in_prev_stmt_for_binlog is not set. Hence the value zero (default value) is written to slave's binlog. Why only *Filtered slave* is effected when the code is in common place: ------------------------------------------------------- In Query_log_event::do_apply_event, THD::stmt_depends_on_first_successful_insert_id_in_prev_stmt is reset to zero at the end of the function. In case of normal slave (No Filters), this variable will be reset. In Filtered slave, Slave SQL thread defers all IRU events's execution until IRU's Query_log event is received. Once it receives Query_log_event it executes all pending IRU events and then it executes Query_log_event. Hence the variable is not getting reset to 0, causing this bug. Fix: As described above, the root cause was setting THD::stmt_depends_on_first_successful_insert_id_in_prev_stmt when Int_var_log_event was executed by a SQL thread. Hence removing the problematic line from the code. --- sql/log_event.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/sql/log_event.cc b/sql/log_event.cc index d7e912cfe1a..7a557c42154 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -5397,7 +5397,6 @@ int Intvar_log_event::do_apply_event(Relay_log_info const *rli) switch (type) { case LAST_INSERT_ID_EVENT: - thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt= 1; thd->first_successful_insert_id_in_prev_stmt= val; break; case INSERT_ID_EVENT: From 1b199c144dee341833cb6c4e28721f5db67a1f74 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 Oct 2013 17:59:45 +0530 Subject: [PATCH 58/80] From 7c3d3f192ed893ae0990aeeedf4d0307084c77bf Mon Sep 17 00:00:00 2001 From: Anil Toshniwal Date: Thu, 17 Oct 2013 18:09:04 +0530 Subject: [PATCH 59/80] Bug#17513737 INTRODUCE CHECK TABLE...QUICK --Implemented CHECK TABLE...QUICK. Introduce CHECK TABLE...QUICK that would skip the btr_validate_index() and btr_search_validate() call, and count the no. of records in each index. Approved by Marko and Kevin. (rb#3567). --- include/my_check_opt.h | 69 ++++++++++++++++++++++++++ include/myisam.h | 47 +----------------- storage/innobase/dict/dict0dict.c | 2 + storage/innobase/handler/ha_innodb.cc | 70 ++++++++++++++++----------- storage/innobase/include/btr0sea.h | 2 - 5 files changed, 113 insertions(+), 77 deletions(-) create mode 100644 include/my_check_opt.h diff --git a/include/my_check_opt.h b/include/my_check_opt.h new file mode 100644 index 00000000000..7b064f69ef1 --- /dev/null +++ b/include/my_check_opt.h @@ -0,0 +1,69 @@ +/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ + +#ifndef _my_check_opt_h +#define _my_check_opt_h + +#ifdef __cplusplus +extern "C" { +#endif + +/* + All given definitions needed for MyISAM storage engine: + myisamchk.c or/and ha_myisam.cc or/and micheck.c + Some definitions are needed by the MySQL parser. +*/ + +#define T_AUTO_INC (1UL << 0) +#define T_AUTO_REPAIR (1UL << 1) +#define T_BACKUP_DATA (1UL << 2) +#define T_CALC_CHECKSUM (1UL << 3) +#define T_CHECK (1UL << 4) +#define T_CHECK_ONLY_CHANGED (1UL << 5) +#define T_CREATE_MISSING_KEYS (1UL << 6) +#define T_DESCRIPT (1UL << 7) +#define T_DONT_CHECK_CHECKSUM (1UL << 8) +#define T_EXTEND (1UL << 9) +#define T_FAST (1UL << 10) +#define T_FORCE_CREATE (1UL << 11) +#define T_FORCE_UNIQUENESS (1UL << 12) +#define T_INFO (1UL << 13) +/** CHECK TABLE...MEDIUM (the default) */ +#define T_MEDIUM (1UL << 14) +/** CHECK TABLE...QUICK */ +#define T_QUICK (1UL << 15) +#define T_READONLY (1UL << 16) +#define T_REP (1UL << 17) +#define T_REP_BY_SORT (1UL << 18) +#define T_REP_PARALLEL (1UL << 19) +#define T_RETRY_WITHOUT_QUICK (1UL << 20) +#define T_SAFE_REPAIR (1UL << 21) +#define T_SILENT (1UL << 22) +#define T_SORT_INDEX (1UL << 23) +#define T_SORT_RECORDS (1UL << 24) +#define T_STATISTICS (1UL << 25) +#define T_UNPACK (1UL << 26) +#define T_UPDATE_STATE (1UL << 27) +#define T_VERBOSE (1UL << 28) +#define T_VERY_SILENT (1UL << 29) +#define T_WAIT_FOREVER (1UL << 30) +#define T_WRITE_LOOP (1UL << 31) + +#define T_REP_ANY (T_REP | T_REP_BY_SORT | T_REP_PARALLEL) + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/myisam.h b/include/myisam.h index dc9eac8f100..bf94fd7d8cd 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -33,7 +33,7 @@ extern "C" { #endif #include "my_compare.h" #include - +#include /* Limit max keys according to HA_MAX_POSSIBLE_KEY */ @@ -311,51 +311,6 @@ extern uint mi_get_pointer_length(ulonglong file_length, uint def); #define MYISAMCHK_REPAIR 1 /* equivalent to myisamchk -r */ #define MYISAMCHK_VERIFY 2 /* Verify, run repair if failure */ -/* - Definitions needed for myisamchk.c - - Entries marked as "QQ to be removed" are NOT used to - pass check/repair options to mi_check.c. They are used - internally by myisamchk.c or/and ha_myisam.cc and should NOT - be stored together with other flags. They should be removed - from the following list to make addition of new flags possible. -*/ - -#define T_AUTO_INC 1 -#define T_AUTO_REPAIR 2 /* QQ to be removed */ -#define T_BACKUP_DATA 4 -#define T_CALC_CHECKSUM 8 -#define T_CHECK 16 /* QQ to be removed */ -#define T_CHECK_ONLY_CHANGED 32 /* QQ to be removed */ -#define T_CREATE_MISSING_KEYS 64 -#define T_DESCRIPT 128 -#define T_DONT_CHECK_CHECKSUM 256 -#define T_EXTEND 512 -#define T_FAST (1L << 10) /* QQ to be removed */ -#define T_FORCE_CREATE (1L << 11) /* QQ to be removed */ -#define T_FORCE_UNIQUENESS (1L << 12) -#define T_INFO (1L << 13) -#define T_MEDIUM (1L << 14) -#define T_QUICK (1L << 15) /* QQ to be removed */ -#define T_READONLY (1L << 16) /* QQ to be removed */ -#define T_REP (1L << 17) -#define T_REP_BY_SORT (1L << 18) /* QQ to be removed */ -#define T_REP_PARALLEL (1L << 19) /* QQ to be removed */ -#define T_RETRY_WITHOUT_QUICK (1L << 20) -#define T_SAFE_REPAIR (1L << 21) -#define T_SILENT (1L << 22) -#define T_SORT_INDEX (1L << 23) /* QQ to be removed */ -#define T_SORT_RECORDS (1L << 24) /* QQ to be removed */ -#define T_STATISTICS (1L << 25) -#define T_UNPACK (1L << 26) -#define T_UPDATE_STATE (1L << 27) -#define T_VERBOSE (1L << 28) -#define T_VERY_SILENT (1L << 29) -#define T_WAIT_FOREVER (1L << 30) -#define T_WRITE_LOOP ((ulong) 1L << 31) - -#define T_REP_ANY (T_REP | T_REP_BY_SORT | T_REP_PARALLEL) - /* Flags used by myisamchk.c or/and ha_myisam.cc that are NOT passed to mi_check.c follows: diff --git a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c index 1fe7000f718..546794be26c 100644 --- a/storage/innobase/dict/dict0dict.c +++ b/storage/innobase/dict/dict0dict.c @@ -4485,6 +4485,8 @@ dict_update_statistics( dict_index_t* index; ulint sum_of_index_sizes = 0; + DBUG_EXECUTE_IF("skip_innodb_statistics", return;); + if (table->ibd_file_missing) { ut_print_timestamp(stderr); fprintf(stderr, diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 7d0a363be69..546b0b8905b 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -53,6 +53,7 @@ this program; if not, write to the Free Software Foundation, Inc., #include #include #include +#include /** @file ha_innodb.cc */ @@ -8466,8 +8467,7 @@ int ha_innobase::check( /*===============*/ THD* thd, /*!< in: user thread handle */ - HA_CHECK_OPT* check_opt) /*!< in: check options, currently - ignored */ + HA_CHECK_OPT* check_opt) /*!< in: check options */ { dict_index_t* index; ulint n_rows; @@ -8524,11 +8524,6 @@ ha_innobase::check( do additional check */ prebuilt->table->corrupted = FALSE; - /* Enlarge the fatal lock wait timeout during CHECK TABLE. */ - mutex_enter(&kernel_mutex); - srv_fatal_semaphore_wait_threshold += SRV_SEMAPHORE_WAIT_EXTENSION; - mutex_exit(&kernel_mutex); - for (index = dict_table_get_first_index(prebuilt->table); index != NULL; index = dict_table_get_next_index(index)) { @@ -8541,21 +8536,42 @@ ha_innobase::check( /* If this is an index being created, break */ if (*index->name == TEMP_INDEX_PREFIX) { - break; - } else if (!btr_validate_index(index, prebuilt->trx)) { - is_ok = FALSE; - - innobase_format_name( - index_name, sizeof index_name, - prebuilt->index->name, TRUE); - - push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_NOT_KEYFILE, - "InnoDB: The B-tree of" - " index %s is corrupted.", - index_name); continue; } + if (!(check_opt->flags & T_QUICK)) { + /* Enlarge the fatal lock wait timeout during + CHECK TABLE. */ + mutex_enter(&kernel_mutex); + srv_fatal_semaphore_wait_threshold += + SRV_SEMAPHORE_WAIT_EXTENSION; + mutex_exit(&kernel_mutex); + + ibool valid = TRUE; + valid = btr_validate_index(index, prebuilt->trx); + + /* Restore the fatal lock wait timeout after + CHECK TABLE. */ + mutex_enter(&kernel_mutex); + srv_fatal_semaphore_wait_threshold -= + SRV_SEMAPHORE_WAIT_EXTENSION; + mutex_exit(&kernel_mutex); + + if (!valid) { + is_ok = FALSE; + + innobase_format_name( + index_name, sizeof index_name, + index->name, TRUE); + push_warning_printf(thd, + MYSQL_ERROR::WARN_LEVEL_WARN, + ER_NOT_KEYFILE, + "InnoDB: The B-tree of" + " index %s is corrupted.", + index_name); + + continue; + } + } /* Instead of invoking change_active_index(), set up a dummy template for non-locking reads, disabling @@ -8658,21 +8674,17 @@ ha_innobase::check( /* Restore the original isolation level */ prebuilt->trx->isolation_level = old_isolation_level; - /* We validate also the whole adaptive hash index for all tables - at every CHECK TABLE */ +#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG + /* We validate the whole adaptive hash index for all tables + at every CHECK TABLE only when QUICK flag is not present. */ - if (!btr_search_validate()) { + if (!(check_opt->flags & T_QUICK) && !btr_search_validate()) { push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_NOT_KEYFILE, "InnoDB: The adaptive hash index is corrupted."); is_ok = FALSE; } - - /* Restore the fatal lock wait timeout after CHECK TABLE. */ - mutex_enter(&kernel_mutex); - srv_fatal_semaphore_wait_threshold -= SRV_SEMAPHORE_WAIT_EXTENSION; - mutex_exit(&kernel_mutex); - +#endif /* defined UNIV_AHI_DEBUG || defined UNIV_DEBUG */ prebuilt->trx->op_info = ""; if (thd_killed(user_thd)) { my_error(ER_QUERY_INTERRUPTED, MYF(0)); diff --git a/storage/innobase/include/btr0sea.h b/storage/innobase/include/btr0sea.h index 0ee68101ee7..081dc88435e 100644 --- a/storage/innobase/include/btr0sea.h +++ b/storage/innobase/include/btr0sea.h @@ -188,8 +188,6 @@ UNIV_INTERN ibool btr_search_validate(void); /*======================*/ -#else -# define btr_search_validate() TRUE #endif /* defined UNIV_AHI_DEBUG || defined UNIV_DEBUG */ /** The search info struct in an index */ From 863d67e3acbc31951c9cf52cd49be1eb8e1e28b8 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Thu, 17 Oct 2013 17:48:26 +0100 Subject: [PATCH 60/80] BUG#17460821: ASSERTION ERROR WHEN STOPPING SLAVE AFTER SEMI-SYNC ON MASTER IS DISABLED The assertion happens when: (i) the master and slave are configured to use the semisync plugin; (ii) the DBA disables semisync on the master; (iii) and he also unsets the option to wait for slaves ACK even if the semisync slave count reaches 0 during the waiting period. This combination of factors makes the server run into an assertion as soon as the last semisync slave disconnects and its dump thread exits. The root of the problem is the fact that when the dump thread disconnects and calls the observer hook transmit_stop, which ends up calling ReplSemiSyncMaster::remove_slave, there is no check whether the master has already disabled semisync or not. If it has, the then a second call to the switch_off member function must be avoided. The quick fix is to avoid calling switch_off if the DBA has disabled the semisync plugin interactively on the master. Also, the switch_off member function should only be called if the plugin has not been switched off already. This is basically the pattern throughout the rest of the semisync plugin and no other calls seem vulnerable to similar crashes/assertions. (This a backport of the patch to 5.5, which is also vulnerable.) --- plugin/semisync/semisync_master.cc | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/plugin/semisync/semisync_master.cc b/plugin/semisync/semisync_master.cc index 6b8bb915445..2e40fc8b5c5 100644 --- a/plugin/semisync/semisync_master.cc +++ b/plugin/semisync/semisync_master.cc @@ -482,13 +482,17 @@ void ReplSemiSyncMaster::remove_slave() lock(); rpl_semi_sync_master_clients--; - /* If user has chosen not to wait if no semi-sync slave available - and the last semi-sync slave exits, turn off semi-sync on master - immediately. - */ - if (!rpl_semi_sync_master_wait_no_slave && - rpl_semi_sync_master_clients == 0) - switch_off(); + /* Only switch off if semi-sync is enabled and is on */ + if (getMasterEnabled() && is_on()) + { + /* If user has chosen not to wait if no semi-sync slave available + and the last semi-sync slave exits, turn off semi-sync on master + immediately. + */ + if (!rpl_semi_sync_master_wait_no_slave && + rpl_semi_sync_master_clients == 0) + switch_off(); + } unlock(); } From cd6f3b55dab602069f43ed08fd3949d1226c2c50 Mon Sep 17 00:00:00 2001 From: Aditya A Date: Fri, 18 Oct 2013 12:26:28 +0530 Subject: [PATCH 61/80] Bug#17559867 AFTER REBUILDING,A MYISAM PARTITION ENDS UP AS A INNODB PARTITTION. PROBLEM ------- The correct engine_type was not being set during rebuild of the partition due to which the handler was always created with the default engine, which is innodb for 5.5+ ,therefore even if the table was myisam, after rebuilding the partitions ended up as innodb partitions. FIX --- Set the correct engine type during rebuild. [Approved by mattiasj #rb3599] --- sql/sql_partition.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index a3ad138043c..aa367abe22a 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -4725,6 +4725,8 @@ that are reorganised. { uint no_parts_found; uint no_parts_opt= alter_info->partition_names.elements; + set_engine_all_partitions(tab_part_info, + tab_part_info->default_engine_type); no_parts_found= set_part_state(alter_info, tab_part_info, PART_CHANGED); if (no_parts_found != no_parts_opt && (!(alter_info->flags & ALTER_ALL_PARTITION))) From 18079ac9b82a3af4e0686a8da58499523e5677ef Mon Sep 17 00:00:00 2001 From: Anirudh Mangipudi Date: Fri, 18 Oct 2013 17:14:39 +0530 Subject: [PATCH 62/80] Bug #17357535 BACKPORT BUG#16241992 TO 5.5 Problem: COM_CHANGE_USER allows brute-force attempts to crack a password at a very high rate as it does not cause any significant delay after a login attempt has failed. This issue was reproduced using John-The-Ripper password cracking tool through which about 5000 passwords per second could be attempted. Solution: The non-GA version's solution was to disconnect the connection when a login attempt failed. Now since our aim to to reduce the rate at which passwords are tested, we introduced a sleep(1) after every login attempt failed. This significantly increased the delay with which the password was cracked. --- sql/sql_parse.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index f787fe4058f..6e2b422bd44 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -971,6 +971,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, thd->variables.collation_connection= save_collation_connection; thd->variables.character_set_results= save_character_set_results; thd->update_charset(); + sleep(1); } else { From 20f579ea162afd751576e9ed6ab8c8a49eb833f1 Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Fri, 18 Oct 2013 19:25:59 +0200 Subject: [PATCH 63/80] Bug#17565888: UP TO 75% INCREASE IN DBT3 QUERY (Q7) EXECUTION TIME Regression from bug#14621190 due to disabled optimistic restoration of cursor, which required full key lookup instead of verifying if previously positioned btree cursor could be reused. Fixed by enable optimistic restore and adjust cursor afterward. rb#3324 approved by Marko. --- storage/innobase/btr/btr0pcur.c | 44 ++++++-------- storage/innobase/include/btr0pcur.h | 44 ++++++++------ storage/innobase/include/btr0pcur.ic | 7 ++- storage/innobase/row/row0sel.c | 91 +++++++++++++++++----------- 4 files changed, 102 insertions(+), 84 deletions(-) diff --git a/storage/innobase/btr/btr0pcur.c b/storage/innobase/btr/btr0pcur.c index fbedc1e7d04..d8f43a9ae75 100644 --- a/storage/innobase/btr/btr0pcur.c +++ b/storage/innobase/btr/btr0pcur.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -110,7 +110,7 @@ btr_pcur_store_position( page_t* page; ulint offs; - ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED); + ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); ut_ad(cursor->latch_mode != BTR_NO_LATCHES); block = btr_pcur_get_block(cursor); @@ -235,21 +235,12 @@ btr_pcur_restore_position_func( ut_ad(mtr); ut_ad(mtr->state == MTR_ACTIVE); + ut_ad(cursor->old_stored == BTR_PCUR_OLD_STORED); + ut_ad(cursor->pos_state == BTR_PCUR_WAS_POSITIONED + || cursor->pos_state == BTR_PCUR_IS_POSITIONED); index = btr_cur_get_index(btr_pcur_get_btr_cur(cursor)); - if (UNIV_UNLIKELY(cursor->old_stored != BTR_PCUR_OLD_STORED) - || UNIV_UNLIKELY(cursor->pos_state != BTR_PCUR_WAS_POSITIONED - && cursor->pos_state != BTR_PCUR_IS_POSITIONED)) { - ut_print_buf(stderr, cursor, sizeof(btr_pcur_t)); - putc('\n', stderr); - if (cursor->trx_if_known) { - trx_print(stderr, cursor->trx_if_known, 0); - } - - ut_error; - } - if (UNIV_UNLIKELY (cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE || cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE)) { @@ -273,29 +264,26 @@ btr_pcur_restore_position_func( if (UNIV_LIKELY(latch_mode == BTR_SEARCH_LEAF) || UNIV_LIKELY(latch_mode == BTR_MODIFY_LEAF)) { - /* Try optimistic restoration if cursor is expected to be - positioned on the same btr record as before (BTR_PCUR_ON). */ + /* Try optimistic restoration. */ - if (cursor->rel_pos == BTR_PCUR_ON - && buf_page_optimistic_get( - latch_mode, - cursor->block_when_stored, - cursor->modify_clock, - file, line, mtr)) { - cursor->pos_state = BTR_PCUR_IS_POSITIONED; + if (buf_page_optimistic_get(latch_mode, + cursor->block_when_stored, + cursor->modify_clock, + file, line, mtr)) { buf_block_dbg_add_level( btr_pcur_get_block(cursor), dict_index_is_ibuf(index) ? SYNC_IBUF_TREE_NODE : SYNC_TREE_NODE); - { + if (cursor->rel_pos == BTR_PCUR_ON) { #ifdef UNIV_DEBUG const rec_t* rec; const ulint* offsets1; const ulint* offsets2; #endif /* UNIV_DEBUG */ cursor->latch_mode = latch_mode; + cursor->pos_state = BTR_PCUR_IS_POSITIONED; #ifdef UNIV_DEBUG rec = btr_pcur_get_rec(cursor); @@ -314,6 +302,11 @@ btr_pcur_restore_position_func( #endif /* UNIV_DEBUG */ return(TRUE); } + /* This is the same record as stored, + may need to be adjusted for BTR_PCUR_BEFORE/AFTER, + depending on search mode and direction. */ + cursor->pos_state = BTR_PCUR_IS_POSITIONED_OPTIMISTIC; + return(FALSE); } } @@ -414,7 +407,7 @@ btr_pcur_move_to_next_page( buf_block_t* next_block; page_t* next_page; - ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED); + ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); ut_ad(cursor->latch_mode != BTR_NO_LATCHES); ut_ad(btr_pcur_is_after_last_on_page(cursor)); @@ -469,7 +462,6 @@ btr_pcur_move_backward_from_page( ulint latch_mode; ulint latch_mode2; - ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED); ut_ad(cursor->latch_mode != BTR_NO_LATCHES); ut_ad(btr_pcur_is_before_first_on_page(cursor)); ut_ad(!btr_pcur_is_before_first_in_tree(cursor, mtr)); diff --git a/storage/innobase/include/btr0pcur.h b/storage/innobase/include/btr0pcur.h index 4312f73ca4a..d9ce02283d7 100644 --- a/storage/innobase/include/btr0pcur.h +++ b/storage/innobase/include/btr0pcur.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -447,6 +447,27 @@ btr_pcur_move_to_prev_on_page( /*==========================*/ btr_pcur_t* cursor);/*!< in/out: persistent cursor */ +/** Position state of persistent B-tree cursor. */ +enum pcur_pos_t { + /** The persistent cursor is not positioned. */ + BTR_PCUR_NOT_POSITIONED = 0, + /** The persistent cursor was previously positioned. + TODO: currently, the state can be BTR_PCUR_IS_POSITIONED, + though it really should be BTR_PCUR_WAS_POSITIONED, + because we have no obligation to commit the cursor with + mtr; similarly latch_mode may be out of date. This can + lead to problems if btr_pcur is not used the right way; + all current code should be ok. */ + BTR_PCUR_WAS_POSITIONED, + /** The persistent cursor is positioned by optimistic get to the same + record as it was positioned at. Not used for rel_pos == BTR_PCUR_ON. + It may need adjustment depending on previous/current search direction + and rel_pos. */ + BTR_PCUR_IS_POSITIONED_OPTIMISTIC, + /** The persistent cursor is positioned by index search. + Or optimistic get for rel_pos == BTR_PCUR_ON. */ + BTR_PCUR_IS_POSITIONED +}; /* The persistent B-tree cursor structure. This is used mainly for SQL selects, updates, and deletes. */ @@ -480,10 +501,8 @@ struct btr_pcur_struct{ ib_uint64_t modify_clock; /*!< the modify clock value of the buffer block when the cursor position was stored */ - ulint pos_state; /*!< see TODO note below! - BTR_PCUR_IS_POSITIONED, - BTR_PCUR_WAS_POSITIONED, - BTR_PCUR_NOT_POSITIONED */ + enum pcur_pos_t pos_state; /*!< btr_pcur_store_position() and + btr_pcur_restore_position() state. */ ulint search_mode; /*!< PAGE_CUR_G, ... */ trx_t* trx_if_known; /*!< the transaction, if we know it; otherwise this field is not defined; @@ -499,21 +518,6 @@ struct btr_pcur_struct{ is not NULL */ }; -#define BTR_PCUR_IS_POSITIONED 1997660512 /* TODO: currently, the state - can be BTR_PCUR_IS_POSITIONED, - though it really should be - BTR_PCUR_WAS_POSITIONED, - because we have no obligation - to commit the cursor with - mtr; similarly latch_mode may - be out of date. This can - lead to problems if btr_pcur - is not used the right way; - all current code should be - ok. */ -#define BTR_PCUR_WAS_POSITIONED 1187549791 -#define BTR_PCUR_NOT_POSITIONED 1328997689 - #define BTR_PCUR_OLD_STORED 908467085 #define BTR_PCUR_OLD_NOT_STORED 122766467 diff --git a/storage/innobase/include/btr0pcur.ic b/storage/innobase/include/btr0pcur.ic index 696dfc728dc..5eb8ed0f32d 100644 --- a/storage/innobase/include/btr0pcur.ic +++ b/storage/innobase/include/btr0pcur.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -309,7 +309,8 @@ btr_pcur_move_to_next_user_rec( function may release the page latch */ mtr_t* mtr) /*!< in: mtr */ { - ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); + ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED_OPTIMISTIC + || cursor->pos_state == BTR_PCUR_IS_POSITIONED); ut_ad(cursor->latch_mode != BTR_NO_LATCHES); cursor->old_stored = BTR_PCUR_OLD_NOT_STORED; loop: @@ -379,7 +380,7 @@ btr_pcur_commit_specify_mtr( btr_pcur_t* pcur, /*!< in: persistent cursor */ mtr_t* mtr) /*!< in: mtr to commit */ { - ut_a(pcur->pos_state == BTR_PCUR_IS_POSITIONED); + ut_ad(pcur->pos_state == BTR_PCUR_IS_POSITIONED); pcur->latch_mode = BTR_NO_LATCHES; diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index 28da1f69e8a..c8e293080c1 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -3095,55 +3095,76 @@ sel_restore_position_for_mysql( mtr_t* mtr) /*!< in: mtr; CAUTION: may commit mtr temporarily! */ { - ibool success; - ulint relative_position; - - relative_position = pcur->rel_pos; + ibool success; success = btr_pcur_restore_position(latch_mode, pcur, mtr); *same_user_rec = success; - if (relative_position == BTR_PCUR_ON) { - if (success) { - return(FALSE); - } - - if (moves_up) { - btr_pcur_move_to_next(pcur, mtr); - } - - return(TRUE); + ut_ad(!success || pcur->rel_pos == BTR_PCUR_ON); +#ifdef UNIV_DEBUG + if (pcur->pos_state == BTR_PCUR_IS_POSITIONED_OPTIMISTIC) { + ut_ad(pcur->rel_pos == BTR_PCUR_BEFORE + || pcur->rel_pos == BTR_PCUR_AFTER); + } else { + ut_ad(pcur->pos_state == BTR_PCUR_IS_POSITIONED); } +#endif - /* success can only be TRUE for BTR_PCUR_ON! */ - ut_ad(!success); + /* The position may need be adjusted for rel_pos and moves_up. */ - /* BTR_PCUR_BEFORE -> the position is now set to the record before - pcur->old_rec. - BTR_PCUR_AFTER-> positioned to record after pcur->old_rec. */ - - if (relative_position == BTR_PCUR_AFTER - || relative_position == BTR_PCUR_AFTER_LAST_IN_TREE) { - - if (moves_up) { + switch (pcur->rel_pos) { + case BTR_PCUR_ON: + if (!success && moves_up) { +next: + btr_pcur_move_to_next(pcur, mtr); return(TRUE); } - - if (btr_pcur_is_on_user_rec(pcur)) { + return(!success); + case BTR_PCUR_AFTER_LAST_IN_TREE: + case BTR_PCUR_BEFORE_FIRST_IN_TREE: + return(TRUE); + case BTR_PCUR_AFTER: + /* positioned to record after pcur->old_rec. */ + pcur->pos_state = BTR_PCUR_IS_POSITIONED; +prev: + if (btr_pcur_is_on_user_rec(pcur) && !moves_up) { btr_pcur_move_to_prev(pcur, mtr); } - return(TRUE); + case BTR_PCUR_BEFORE: + /* For non optimistic restoration: + The position is now set to the record before pcur->old_rec. + + For optimistic restoration: + The position also needs to take the previous search_mode into + consideration. */ + + switch (pcur->pos_state) { + case BTR_PCUR_IS_POSITIONED_OPTIMISTIC: + pcur->pos_state = BTR_PCUR_IS_POSITIONED; + if (pcur->search_mode == PAGE_CUR_GE) { + /* Positioned during Greater or Equal search + with BTR_PCUR_BEFORE. Optimistic restore to + the same record. If scanning for lower then + we must move to previous record. + This can happen with: + HANDLER READ idx a = (const); + HANDLER READ idx PREV; */ + goto prev; + } + return(TRUE); + case BTR_PCUR_IS_POSITIONED: + if (moves_up && btr_pcur_is_on_user_rec(pcur)) { + goto next; + } + return(TRUE); + case BTR_PCUR_WAS_POSITIONED: + case BTR_PCUR_NOT_POSITIONED: + break; + } } - - ut_ad(relative_position == BTR_PCUR_BEFORE - || relative_position == BTR_PCUR_BEFORE_FIRST_IN_TREE); - - if (moves_up && btr_pcur_is_on_user_rec(pcur)) { - btr_pcur_move_to_next(pcur, mtr); - } - + ut_ad(0); return(TRUE); } From e6a734a7cf1fd678fbc22a9d920efac0bc601123 Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Fri, 18 Oct 2013 23:39:15 +0200 Subject: [PATCH 64/80] post-push fix for bug17565888. Too restrictive assertion, can fail during purge --- storage/innobase/include/btr0pcur.ic | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/storage/innobase/include/btr0pcur.ic b/storage/innobase/include/btr0pcur.ic index 5eb8ed0f32d..f5880e0564a 100644 --- a/storage/innobase/include/btr0pcur.ic +++ b/storage/innobase/include/btr0pcur.ic @@ -164,7 +164,8 @@ btr_pcur_is_after_last_on_page( /*===========================*/ const btr_pcur_t* cursor) /*!< in: persistent cursor */ { - ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); + ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED_OPTIMISTIC + || cursor->pos_state == BTR_PCUR_IS_POSITIONED); ut_ad(cursor->latch_mode != BTR_NO_LATCHES); return(page_cur_is_after_last(btr_pcur_get_page_cur(cursor))); From a91fcaf460f686b1fb7eb005fa22ab136ff7210d Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Fri, 18 Oct 2013 23:49:35 +0200 Subject: [PATCH 65/80] post-push fix for bug17565888. Too restrictive assertion, failing during purge --- storage/innobase/include/btr0pcur.ic | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/storage/innobase/include/btr0pcur.ic b/storage/innobase/include/btr0pcur.ic index f5880e0564a..db3145132af 100644 --- a/storage/innobase/include/btr0pcur.ic +++ b/storage/innobase/include/btr0pcur.ic @@ -91,7 +91,8 @@ btr_pcur_get_block( /*===============*/ const btr_pcur_t* cursor) /*!< in: persistent cursor */ { - ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); + ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED_OPTIMISTIC + || cursor->pos_state == BTR_PCUR_IS_POSITIONED); return(btr_cur_get_block(btr_pcur_get_btr_cur(cursor))); } From 7a524cee32e3a7d457fa6a0e86351ddac1c219fb Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Sat, 19 Oct 2013 15:29:51 +0200 Subject: [PATCH 66/80] post-push fix for bug17565888. --- storage/innobase/btr/btr0pcur.c | 2 +- storage/innobase/include/btr0pcur.ic | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/storage/innobase/btr/btr0pcur.c b/storage/innobase/btr/btr0pcur.c index d8f43a9ae75..ea187305656 100644 --- a/storage/innobase/btr/btr0pcur.c +++ b/storage/innobase/btr/btr0pcur.c @@ -270,6 +270,7 @@ btr_pcur_restore_position_func( cursor->block_when_stored, cursor->modify_clock, file, line, mtr)) { + cursor->pos_state = BTR_PCUR_IS_POSITIONED; buf_block_dbg_add_level( btr_pcur_get_block(cursor), @@ -283,7 +284,6 @@ btr_pcur_restore_position_func( const ulint* offsets2; #endif /* UNIV_DEBUG */ cursor->latch_mode = latch_mode; - cursor->pos_state = BTR_PCUR_IS_POSITIONED; #ifdef UNIV_DEBUG rec = btr_pcur_get_rec(cursor); diff --git a/storage/innobase/include/btr0pcur.ic b/storage/innobase/include/btr0pcur.ic index db3145132af..647e8d0cde9 100644 --- a/storage/innobase/include/btr0pcur.ic +++ b/storage/innobase/include/btr0pcur.ic @@ -91,8 +91,7 @@ btr_pcur_get_block( /*===============*/ const btr_pcur_t* cursor) /*!< in: persistent cursor */ { - ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED_OPTIMISTIC - || cursor->pos_state == BTR_PCUR_IS_POSITIONED); + ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); return(btr_cur_get_block(btr_pcur_get_btr_cur(cursor))); } @@ -165,8 +164,7 @@ btr_pcur_is_after_last_on_page( /*===========================*/ const btr_pcur_t* cursor) /*!< in: persistent cursor */ { - ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED_OPTIMISTIC - || cursor->pos_state == BTR_PCUR_IS_POSITIONED); + ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); ut_ad(cursor->latch_mode != BTR_NO_LATCHES); return(page_cur_is_after_last(btr_pcur_get_page_cur(cursor))); @@ -311,8 +309,7 @@ btr_pcur_move_to_next_user_rec( function may release the page latch */ mtr_t* mtr) /*!< in: mtr */ { - ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED_OPTIMISTIC - || cursor->pos_state == BTR_PCUR_IS_POSITIONED); + ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); ut_ad(cursor->latch_mode != BTR_NO_LATCHES); cursor->old_stored = BTR_PCUR_OLD_NOT_STORED; loop: From c5896384bda582ec6f43ceb3fe9e7530e0bf819d Mon Sep 17 00:00:00 2001 From: Aditya A Date: Mon, 21 Oct 2013 12:07:02 +0530 Subject: [PATCH 67/80] Bug #16051817 GOT ERROR 124 FROM STORAGE ENGINE ON DELETE FROM A PARTITIONED TABLE PROBLEM ------- The user first disables all the non unique indexes in the table and then rebuilds one partition. During rebuild the indexes on that particular partition are enabled. Now when we give a query the optimizer is unaware that on one partition indexes are enabled and if the optimizer selects that index,myisam thinks that the index is not active and gives an error. FIX --- Before rebuilding a partition check whether non unique indexes are disabled on the partitons. If they are disabled then after rebuild disable the index on the partition. [Approved by Mattiasj #rb3469] --- sql/ha_partition.cc | 23 ++++++++++++++++++++--- sql/ha_partition.h | 3 ++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index c3f2af27282..507f202e349 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -1337,7 +1337,8 @@ bool ha_partition::is_crashed() const int ha_partition::prepare_new_partition(TABLE *tbl, HA_CREATE_INFO *create_info, handler *file, const char *part_name, - partition_element *p_elem) + partition_element *p_elem, + uint disable_non_uniq_indexes) { int error; DBUG_ENTER("prepare_new_partition"); @@ -1362,6 +1363,7 @@ int ha_partition::prepare_new_partition(TABLE *tbl, if ((error= file->ha_open(tbl, part_name, m_mode, m_open_test_lock))) goto error_open; DBUG_PRINT("info", ("partition %s opened", part_name)); + /* Note: if you plan to add another call that may return failure, better to do it before external_lock() as cleanup_new_partition() @@ -1372,6 +1374,9 @@ int ha_partition::prepare_new_partition(TABLE *tbl, goto error_external_lock; DBUG_PRINT("info", ("partition %s external locked", part_name)); + if (disable_non_uniq_indexes) + file->ha_disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE); + DBUG_RETURN(0); error_external_lock: (void) file->close(); @@ -1649,6 +1654,14 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, on them to prepare them for copy phase and also for later close calls */ + + /* + Before creating new partitions check whether indexes are disabled + in the partitions. + */ + + uint disable_non_uniq_indexes = indexes_are_disabled(); + i= 0; part_count= 0; part_it.rewind(); @@ -1683,11 +1696,13 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, if ((error= prepare_new_partition(table, create_info, new_file_array[part], (const char *)part_name_buff, - sub_elem))) + sub_elem, + disable_non_uniq_indexes))) { cleanup_new_partition(part_count); DBUG_RETURN(error); } + m_added_file[part_count++]= new_file_array[part]; } while (++j < num_subparts); } @@ -1700,11 +1715,13 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, if ((error= prepare_new_partition(table, create_info, new_file_array[i], (const char *)part_name_buff, - part_elem))) + part_elem, + disable_non_uniq_indexes))) { cleanup_new_partition(part_count); DBUG_RETURN(error); } + m_added_file[part_count++]= new_file_array[i]; } } diff --git a/sql/ha_partition.h b/sql/ha_partition.h index eef93e056ef..153e610d86f 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -270,7 +270,8 @@ private: void cleanup_new_partition(uint part_count); int prepare_new_partition(TABLE *table, HA_CREATE_INFO *create_info, handler *file, const char *part_name, - partition_element *p_elem); + partition_element *p_elem, + uint disable_non_uniq_indexes); /* delete_table, rename_table and create uses very similar logic which is packed into this routine. From 63a205d4a00670298f0c3568ba7af8c5a1b3fee2 Mon Sep 17 00:00:00 2001 From: Jon Olav Hauglid Date: Mon, 21 Oct 2013 13:14:46 +0200 Subject: [PATCH 68/80] Bug#17632386: WITH_ASAN CONFLICTS WITH -WL,--NO-UNDEFINED MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Wl,--no-undefined (=-z defs) gives linking errors when used with WITH_ASAN. According to the documentation: "When linking shared libraries, the AddressSanitizer run-time is not linked, so -Wl,-z,defs may cause link errors (don’t use it with AddressSanitizer)." This patch turns off -Wl,--no-undefined if WITH_ASAN is used. --- cmake/os/Linux.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmake/os/Linux.cmake b/cmake/os/Linux.cmake index 61361d1d48b..5a1bd2f2d0d 100644 --- a/cmake/os/Linux.cmake +++ b/cmake/os/Linux.cmake @@ -1,5 +1,5 @@ -# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -33,7 +33,10 @@ ENDFOREACH() # Ensure we have clean build for shared libraries # without unresolved symbols -SET(LINK_FLAG_NO_UNDEFINED "-Wl,--no-undefined") +# Not supported with AddressSanitizer +IF(NOT WITH_ASAN) + SET(LINK_FLAG_NO_UNDEFINED "-Wl,--no-undefined") +ENDIF() # 64 bit file offset support flag SET(_FILE_OFFSET_BITS 64) From 0121bdc8d40bc57d8cc19fb805f8ab5f5103a874 Mon Sep 17 00:00:00 2001 From: sayantan dutta Date: Fri, 25 Oct 2013 11:38:34 +0530 Subject: [PATCH 69/80] Bug #17654275 - MTR EXTRACT_WARNING_LINES IS NOT REMOVING TIMESTAMP IN UTC FORMAT WITH TIMEZONES --- mysql-test/mysql-test-run.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 54dcd982a4c..27f99941637 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -4353,7 +4353,7 @@ sub extract_warning_lines ($$) { { # Remove initial timestamp and look for consecutive identical lines my $line_pat= $line; - $line_pat =~ s/^[0-9: ]*//; + $line_pat =~ s/^[0-9:\-\+\.TZ ]*//; if ($line_pat eq $last_pat) { $num_rep++; } else { From 1aa1eb912d73253c61d9fcf5b7db54a5e09c83a0 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 25 Oct 2013 09:42:59 +0100 Subject: [PATCH 70/80] From 6d483cf3abb093546fbea512019258ffaed3aac5 Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Mon, 28 Oct 2013 17:08:31 +0100 Subject: [PATCH 71/80] post-push fix for bug#17565888/bug#14621190 --- storage/innobase/btr/btr0pcur.c | 10 +++++----- storage/innobase/row/row0sel.c | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/storage/innobase/btr/btr0pcur.c b/storage/innobase/btr/btr0pcur.c index ea187305656..09b3715e096 100644 --- a/storage/innobase/btr/btr0pcur.c +++ b/storage/innobase/btr/btr0pcur.c @@ -124,7 +124,6 @@ btr_pcur_store_position( ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_S_FIX) || mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); - ut_a(cursor->latch_mode != BTR_NO_LATCHES); if (UNIV_UNLIKELY(page_get_n_recs(page) == 0)) { /* It must be an empty index tree; NOTE that in this case @@ -271,6 +270,7 @@ btr_pcur_restore_position_func( cursor->modify_clock, file, line, mtr)) { cursor->pos_state = BTR_PCUR_IS_POSITIONED; + cursor->latch_mode = latch_mode; buf_block_dbg_add_level( btr_pcur_get_block(cursor), @@ -282,9 +282,6 @@ btr_pcur_restore_position_func( const rec_t* rec; const ulint* offsets1; const ulint* offsets2; -#endif /* UNIV_DEBUG */ - cursor->latch_mode = latch_mode; -#ifdef UNIV_DEBUG rec = btr_pcur_get_rec(cursor); heap = mem_heap_create(256); @@ -305,7 +302,10 @@ btr_pcur_restore_position_func( /* This is the same record as stored, may need to be adjusted for BTR_PCUR_BEFORE/AFTER, depending on search mode and direction. */ - cursor->pos_state = BTR_PCUR_IS_POSITIONED_OPTIMISTIC; + if (btr_pcur_is_on_user_rec(cursor)) { + cursor->pos_state + = BTR_PCUR_IS_POSITIONED_OPTIMISTIC; + } return(FALSE); } } diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index c8e293080c1..b8336f88532 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -3108,6 +3108,8 @@ sel_restore_position_for_mysql( || pcur->rel_pos == BTR_PCUR_AFTER); } else { ut_ad(pcur->pos_state == BTR_PCUR_IS_POSITIONED); + ut_ad((pcur->rel_pos == BTR_PCUR_ON) + == btr_pcur_is_on_user_rec(pcur)); } #endif From a44794d05eb03d8ed996281dfee0161c8bd137a7 Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Tue, 29 Oct 2013 17:26:20 +0100 Subject: [PATCH 72/80] Bug#17326567 MYSQL SERVER FILESORT IMPLEMENTATION HAS A VERY SERIOUS BUG The filesort implementation needs space for at least 15 records (plus some internal overhead) in its main sort buffer. --- sql/filesort.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sql/filesort.cc b/sql/filesort.cc index 3a2102fa62b..a067f0236ed 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -216,7 +216,10 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, goto err; memavl= thd->variables.sortbuff_size; - min_sort_memory= max(MIN_SORT_MEMORY, param.sort_length*MERGEBUFF2); + min_sort_memory= + max(MIN_SORT_MEMORY, + ALIGN_SIZE(MERGEBUFF2 * (param.rec_length + sizeof(uchar*)))); + while (memavl >= min_sort_memory) { ulong old_memavl; From f4cf756204c304ebd9b7487409557aefeaad0e0d Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 29 Oct 2013 11:39:04 -0500 Subject: [PATCH 73/80] Testcase i_innodb.innodb-alter-restart.test fails on some Windows platforms possibly since it was introduced in the patch for Bug#16720368 around 2013-04-30. This fix is simply to adjust the mtr.add_suppression() lines in the testcase and to add a missing "\n" in the error message. Approved by Marko in RB 3746 --- storage/innobase/fil/fil0fil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c index be7d43c132d..9dfc3bb1d21 100644 --- a/storage/innobase/fil/fil0fil.c +++ b/storage/innobase/fil/fil0fil.c @@ -3531,7 +3531,7 @@ fil_load_single_table_tablespace( if (check_msg) { fprintf(stderr, - "InnoDB: Error: %s in file %s", + "InnoDB: Error: %s in file %s\n", check_msg, filepath); goto func_exit; } From d73f2a82245b80bba8cb41ebf06c43e7fb01791b Mon Sep 17 00:00:00 2001 From: Balasubramanian Kandasamy Date: Wed, 30 Oct 2013 04:07:07 +0100 Subject: [PATCH 74/80] Removed non gpl file docs/mysql.info from community packages --- support-files/mysql.spec.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 8fbf9f08b9e..c8b8941af4a 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -956,7 +956,9 @@ fi %doc mysql-release-%{mysql_version}/support-files/ndb-*.ini %endif +%if 0%{?commercial} %doc %attr(644, root, root) %{_infodir}/mysql.info* +%endif %if %{INNODB_BUILD} %doc %attr(644, root, man) %{_mandir}/man1/innochecksum.1* @@ -1195,6 +1197,9 @@ fi # merging BK trees) ############################################################################## %changelog +* Wed Oct 30 2013 Balasubramanian Kandasamy +- Removed non gpl file docs/mysql.info from community packages + * Mon Sep 09 2013 Balasubramanian Kandasamy - Updated logic to get the correct count of PID files From 6e059fd16df1903945769fac303a6568a0fffa3e Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 31 Oct 2013 09:01:09 +0530 Subject: [PATCH 75/80] From 19990c92197c64588ac489fda6c23e34702d7db0 Mon Sep 17 00:00:00 2001 From: Venkata Sidagam Date: Thu, 31 Oct 2013 23:02:44 +0530 Subject: [PATCH 76/80] Bug #12917164 DROP USER CAN'T DROP USERS WITH LEGACY UPPER CASE HOST NAME ANYMORE Description: It is not possible to drop users with host names with upper case letters in them. i.e DROP USER 'root'@'Tmp_Host_Name'; is failing with error. Analysis: Since the fix 11748570 we came up with lower case hostnames as standard. But in the current bug the hostname is created by mysql_install_db script is still having upper case hostnames. So, if we have the hostname with upper case letters like(Tmp_Host_Name) then we will have as it is stored in the mysql.user table. In this case if use "'DROP USER 'root'@'Tmp_Host_Name';" it gives error because we do compare with the lower case of hostname since the 11748570 fix. Fix: We need to convert the hostname to lower case before storing into the mysql.user table when we run the mysql_install_db script. --- scripts/mysql_system_tables_data.sql | 7 +++---- scripts/mysql_system_tables_fix.sql | 3 +++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/mysql_system_tables_data.sql b/scripts/mysql_system_tables_data.sql index 7203e250656..82b185ebefc 100644 --- a/scripts/mysql_system_tables_data.sql +++ b/scripts/mysql_system_tables_data.sql @@ -25,8 +25,7 @@ -- Get the hostname, if the hostname has any wildcard character like "_" or "%" -- add escape character in front of wildcard character to convert "_" or "%" to -- a plain character -SET @get_hostname= @@hostname; -SELECT REPLACE((SELECT REPLACE(@get_hostname,'_','\_')),'%','\%') INTO @current_hostname; +SELECT LOWER( REPLACE((SELECT REPLACE(@@hostname,'_','\_')),'%','\%') )INTO @current_hostname; -- Fill "db" table with default grants for anyone to @@ -42,9 +41,9 @@ DROP TABLE tmp_db; -- from local machine if "user" table didn't exist before CREATE TEMPORARY TABLE tmp_user LIKE user; INSERT INTO tmp_user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); -REPLACE INTO tmp_user SELECT @current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0 FROM dual WHERE LOWER( @current_hostname) != 'localhost'; +REPLACE INTO tmp_user SELECT @current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0 FROM dual WHERE @current_hostname != 'localhost'; REPLACE INTO tmp_user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); INSERT INTO tmp_user (host,user) VALUES ('localhost',''); -INSERT INTO tmp_user (host,user) SELECT @current_hostname,'' FROM dual WHERE LOWER(@current_hostname ) != 'localhost'; +INSERT INTO tmp_user (host,user) SELECT @current_hostname,'' FROM dual WHERE @current_hostname != 'localhost'; INSERT INTO user SELECT * FROM tmp_user WHERE @had_user_table=0; DROP TABLE tmp_user; diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql index 09f66c79c3f..56f6a64211a 100644 --- a/scripts/mysql_system_tables_fix.sql +++ b/scripts/mysql_system_tables_fix.sql @@ -601,6 +601,9 @@ ALTER TABLE db MODIFY Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT UPDATE user SET Trigger_priv=Super_priv WHERE @hadTriggerPriv = 0; +# Convering the host name to lower case for existing users +UPDATE user SET host=LOWER( host ) WHERE LOWER( host ) <> host; + # Activate the new, possible modified privilege tables # This should not be needed, but gives us some extra testing that the above # changes was correct From e87a37a2de41c6d0316fe501a33b57fa9a382abb Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 31 Oct 2013 22:53:56 +0000 Subject: [PATCH 77/80] From 2c4ac8e0935297f7fae9e0711f859687e1546435 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 1 Nov 2013 13:48:24 +0530 Subject: [PATCH 78/80] From e0f3a0fae98bea144b962ef8dbbe62e0935aebb1 Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Fri, 1 Nov 2013 16:39:19 +0100 Subject: [PATCH 79/80] Bug#17617945 BUFFER OVERFLOW IN GET_MERGE_MANY_BUFFS_COST WITH SMALL SORT_BUFFER_SIZE get_cost_calc_buff_size() could return wrong value for the size of imerge_cost_buff. --- sql/sql_class.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sql/sql_class.h b/sql/sql_class.h index 9a9b2058e2b..fd83930a8e9 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -2987,11 +2987,13 @@ public: bool get(TABLE *table); static double get_use_cost(uint *buffer, uint nkeys, uint key_size, ulonglong max_in_memory_size); + + // Returns the number of bytes needed in imerge_cost_buf. inline static int get_cost_calc_buff_size(ulong nkeys, uint key_size, ulonglong max_in_memory_size) { register ulonglong max_elems_in_tree= - (1 + max_in_memory_size / ALIGN_SIZE(sizeof(TREE_ELEMENT)+key_size)); + (max_in_memory_size / ALIGN_SIZE(sizeof(TREE_ELEMENT)+key_size)); return (int) (sizeof(uint)*(1 + nkeys/max_elems_in_tree)); } From 5caddbfd5b4a7ec377f3d40a5830436e0e6e993b Mon Sep 17 00:00:00 2001 From: Balasubramanian Kandasamy Date: Tue, 5 Nov 2013 08:03:43 +0100 Subject: [PATCH 80/80] Removed non gpl file mysql.info from uln community package --- packaging/rpm-uln/mysql.spec.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packaging/rpm-uln/mysql.spec.sh b/packaging/rpm-uln/mysql.spec.sh index 3fcbd5c1234..34aed51048f 100644 --- a/packaging/rpm-uln/mysql.spec.sh +++ b/packaging/rpm-uln/mysql.spec.sh @@ -858,7 +858,9 @@ fi %files -n mysql-server%{product_suffix} -f release/support-files/plugins.files %defattr(-,root,root) %doc release/support-files/*.cnf -%doc %{_datadir}/info/mysql.info* +%if 0%{?commercial} + %doc %{_datadir}/info/mysql.info* +%endif %doc %{src_dir}/Docs/ChangeLog %doc %{src_dir}/Docs/INFO_SRC* %doc release/Docs/INFO_BIN* @@ -981,6 +983,9 @@ fi %{_mandir}/man1/mysql_client_test.1* %changelog +* Tue Nov 05 2013 Balasubramanian Kandasamy +- Removed non gpl file mysql.info from community packages + * Wed Jul 10 2013 Balasubramanian Kandasamy - Removed directory /usr/share/mysql/solaris/postinstall-solaris to resolve build error