diff --git a/.bzrfileids b/.bzrfileids index eca7689f8d4..697da9b4d15 100644 Binary files a/.bzrfileids and b/.bzrfileids differ diff --git a/CMakeLists.txt b/CMakeLists.txt index 69f57f48e59..056341f8859 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") @@ -375,7 +451,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() @@ -390,6 +465,7 @@ IF(NOT INSTALL_LAYOUT MATCHES "RPM") ) INSTALL(FILES README-MySQL DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme RENAME README) INSTALL(FILES ${CMAKE_BINARY_DIR}/Docs/INFO_SRC ${CMAKE_BINARY_DIR}/Docs/INFO_BIN DESTINATION ${INSTALL_DOCDIR}) + IF(UNIX) INSTALL(FILES Docs/INSTALL-BINARY DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme) ENDIF() @@ -407,3 +483,5 @@ IF(NOT INSTALL_LAYOUT MATCHES "RPM") PATTERN "sp-imp-spec.txt" EXCLUDE ) ENDIF() + +INCLUDE(CPack) diff --git a/VERSION b/VERSION index 4a3cbb876c1..100cc668c60 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=.t14 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) diff --git a/configure.cmake b/configure.cmake index c12ba7b48f3..425b2f5bac3 100644 --- a/configure.cmake +++ b/configure.cmake @@ -150,6 +150,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/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/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/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt index 31def3b738f..4a5065cf98a 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/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 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/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/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index ba8bce64675..789df935b2f 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -4368,7 +4368,7 @@ ($$) { # 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 { @@ -6013,7 +6013,7 @@ () # 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; } 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); 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/mysql-test/suite/innodb/t/innodb.test b/mysql-test/suite/innodb/t/innodb.test index ba06dc3dd77..1cdad22d170 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/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_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/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_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 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 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 # diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt index a614b196f17..74e79b60e95 100644 --- a/mysys/CMakeLists.txt +++ b/mysys/CMakeLists.txt @@ -85,3 +85,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/mysys/mf_iocache2.c b/mysys/mf_iocache2.c index 6790489e786..04d2bc34ae4 100644 --- a/mysys/mf_iocache2.c +++ b/mysys/mf_iocache2.c @@ -419,7 +419,7 @@ size_t my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args) { register int iarg; size_t length2; - char buff[17]; + char buff[32]; iarg = va_arg(args, int); if (*fmt == 'd') @@ -454,7 +454,7 @@ size_t my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args) { register long iarg; size_t length2; - char buff[17]; + char buff[32]; iarg = va_arg(args, long); if (*++fmt == 'd') 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 + 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 diff --git a/plugin/semisync/semisync_master.cc b/plugin/semisync/semisync_master.cc index 73b91c6264f..dd546e37a9a 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(); } @@ -752,7 +756,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. */ @@ -893,10 +898,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); @@ -904,15 +906,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_) { diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 424d92e31e1..16d820e147e 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -216,7 +216,6 @@ INSTALL_SCRIPT( COMPONENT Server ) - SET(prefix "${CMAKE_INSTALL_PREFIX}") SET(sysconfdir ${prefix}) SET(bindir ${prefix}/${INSTALL_BINDIR}) diff --git a/scripts/mysql_system_tables_data.sql b/scripts/mysql_system_tables_data.sql index e659ed0288c..bb1461b70cc 100644 --- a/scripts/mysql_system_tables_data.sql +++ b/scripts/mysql_system_tables_data.sql @@ -24,8 +24,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,11 +41,11 @@ DROP TABLE tmp_db; CREATE TEMPORARY TABLE tmp_user LIKE user; set @current_hostname= @@hostname; 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','Y','Y','','','','',0,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','Y','Y','','','','',0,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','Y','Y','','','','',0,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','Y','Y','','','','',0,0,0,0,'','',0); REPLACE INTO tmp_user VALUES ('::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','Y','Y','','','','',0,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 2fd90db3b7c..e1a302df348 100644 --- a/scripts/mysql_system_tables_fix.sql +++ b/scripts/mysql_system_tables_fix.sql @@ -669,6 +669,9 @@ DROP TABLE tmp_proxies_priv; -- ALTER TABLE user ADD max_statement_time int(11) unsigned DEFAULT 0 NOT NULL; +# 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 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: diff --git a/sql/filesort.cc b/sql/filesort.cc index e829721a29b..6f59c505615 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -1,4 +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 @@ -199,7 +200,8 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, { const ulong min_sort_memory= - max(MIN_SORT_MEMORY, param.sort_length * MERGEBUFF2); + max(MIN_SORT_MEMORY, + ALIGN_SIZE(MERGEBUFF2 * (param.rec_length + sizeof(uchar*)))); while (memory_available >= min_sort_memory) { ulong keys= memory_available / (param.rec_length + sizeof(char*)); @@ -339,7 +341,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) { 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 @@ class ha_partition :public handler 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. diff --git a/sql/handler.cc b/sql/handler.cc index b58e91d6b44..0446c67c4a5 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -4990,8 +4990,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/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())) { 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; } diff --git a/sql/log_event.cc b/sql/log_event.cc index 5aeab358892..379eb8a7bb5 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -5484,7 +5484,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: 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/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() 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 @@ int sql_set_variables(THD *thd, List *var_list) 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 fb60b6c3299..d12d7037aeb 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -143,6 +143,7 @@ class sys_var 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 @@ class sys_var 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/sql_acl.cc b/sql/sql_acl.cc index df90644ca9e..949dae09fed 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1606,7 +1606,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. */ @@ -4987,7 +4988,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. diff --git a/sql/sql_class.h b/sql/sql_class.h index 1e5fabeba9e..2d3706780e0 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -3482,11 +3482,13 @@ class Unique :public Sql_alloc 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)); } diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index b81c729e002..fba1928dbc5 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; diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 7a588d73df6..e47f9d4fd5d 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -747,8 +747,16 @@ static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex, pfields.append("`"); pfields.append(item->name); pfields.append("`"); + // 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(); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index cc60a8772db..96f72010c7e 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1099,7 +1099,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, thd->variables.character_set_results= save_character_set_results; thd->update_charset(); thd->failed_com_change_user++; - my_sleep(1000000); + sleep(1); } else { diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 4cf1a07d8bb..c4b9a597b06 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -5178,6 +5178,8 @@ that are reorganised. } else if (alter_info->flags & ALTER_REBUILD_PARTITION) { + set_engine_all_partitions(tab_part_info, + tab_part_info->default_engine_type); if (set_part_state(alter_info, tab_part_info, PART_CHANGED)) { my_error(ER_DROP_PARTITION_NON_EXISTENT, MYF(0), "REBUILD"); 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; diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 07e19277f5c..d28498e7b77 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 @@ -1849,9 +1849,13 @@ static Sys_var_mybool Sys_super_only( 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", diff --git a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c index 9ff2ca906ae..8958d163b8f 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" @@ -1668,7 +1669,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( /*========================*/ @@ -1696,18 +1697,30 @@ 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 (dict_index_is_clust(index)) { + 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, 0); + log_ptr += DATA_ROLL_PTR_LEN; + /* TRX_ID */ + log_ptr += mach_ull_write_compressed(log_ptr, 0); + } + mach_write_to_2(log_ptr, page_offset(rec)); log_ptr += 2; diff --git a/storage/innobase/btr/btr0pcur.c b/storage/innobase/btr/btr0pcur.c index 0cfdf138bad..09b3715e096 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); @@ -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 @@ -235,21 +234,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,14 +263,14 @@ 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 (UNIV_LIKELY(buf_page_optimistic_get( - latch_mode, - cursor->block_when_stored, - cursor->modify_clock, - file, line, mtr))) { + if (buf_page_optimistic_get(latch_mode, + cursor->block_when_stored, + 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), @@ -292,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); @@ -312,7 +299,13 @@ 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. */ + if (btr_pcur_is_on_user_rec(cursor)) { + 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/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c index c3f64046da0..546794be26c 100644 --- a/storage/innobase/dict/dict0dict.c +++ b/storage/innobase/dict/dict0dict.c @@ -36,6 +36,11 @@ UNIV_INTERN dict_index_t* dict_ind_redundant; /** dummy index for ROW_FORMAT=COMPACT supremum and infimum records */ UNIV_INTERN dict_index_t* dict_ind_compact; +#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG +/** Flag to control insert buffer debugging. */ +UNIV_INTERN uint ibuf_debug; +#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ + #ifndef UNIV_HOTBACKUP #include "buf0buf.h" #include "data0type.h" @@ -4480,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, @@ -4520,6 +4527,12 @@ dict_update_statistics( continue; } +#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG + if (ibuf_debug && !dict_index_is_clust(index)) { + goto fake_statistics; + } +#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ + if (UNIV_LIKELY (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE || (srv_force_recovery < SRV_FORCE_NO_LOG_REDO diff --git a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c index 9ba7981ca97..268077c944e 100644 --- a/storage/innobase/fil/fil0fil.c +++ b/storage/innobase/fil/fil0fil.c @@ -3561,7 +3561,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; } diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 18c654192a4..24ac1768a1d 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -56,6 +56,7 @@ this program; if not, write to the Free Software Foundation, Inc., #include #include #include +#include #ifdef MYSQL_SERVER #include @@ -8455,6 +8456,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; @@ -9139,8 +9144,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; @@ -9197,11 +9201,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)) { @@ -9214,20 +9213,41 @@ 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; + 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, - prebuilt->index->name, TRUE); + 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); - push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_NOT_KEYFILE, - "InnoDB: The B-tree of" - " index %s is corrupted.", - index_name); - continue; + continue; + } } /* Instead of invoking change_active_index(), set up @@ -9331,21 +9351,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)) { thd_set_kill_status(user_thd); @@ -10199,6 +10215,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); @@ -10263,12 +10280,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); } /************************************************************************//** diff --git a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c index 37259bd03e2..6ed77d44b91 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.c +++ b/storage/innobase/ibuf/ibuf0ibuf.c @@ -193,11 +193,6 @@ access order rules. */ /** Operations that can currently be buffered. */ UNIV_INTERN ibuf_use_t ibuf_use = IBUF_USE_ALL; -#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG -/** Flag to control insert buffer debugging. */ -UNIV_INTERN uint ibuf_debug; -#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ - /** The insert buffer control structure */ UNIV_INTERN ibuf_t* ibuf = NULL; @@ -2649,6 +2644,12 @@ ibuf_contract_ext( return(0); } +#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG + if (ibuf_debug) { + return(0); + } +#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ + ibuf_mtr_start(&mtr); /* Open a cursor to a randomly chosen leaf of the tree, at a random @@ -4016,6 +4017,24 @@ ibuf_insert_to_index_page( 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, 0, 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 283a6eec852..78637ea7295 100644 --- a/storage/innobase/include/btr0cur.h +++ b/storage/innobase/include/btr0cur.h @@ -636,6 +636,21 @@ btr_cur_set_deleted_flag_for_ibuf( uncompressed */ ibool val, /*!< in: value to set */ mtr_t* mtr); /*!< in/out: mini-transaction */ + +/***********************************************************//** +Writes a redo log record of updating a record in-place. */ +UNIV_INTERN +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 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..647e8d0cde9 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 @@ -379,7 +379,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/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 */ diff --git a/storage/innobase/include/dict0types.h b/storage/innobase/include/dict0types.h index 330e6a25114..22407e2408e 100644 --- a/storage/innobase/include/dict0types.h +++ b/storage/innobase/include/dict0types.h @@ -63,4 +63,9 @@ typedef enum dict_err_ignore dict_err_ignore_t; #define TEMP_TABLE_PREFIX "#sql" #define TEMP_TABLE_PATH_PREFIX "/" TEMP_TABLE_PREFIX +#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG +/** Flag to control insert buffer debugging. */ +extern uint ibuf_debug; +#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ + #endif 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 4f195556e58..41a9ec604c0 100644 --- a/storage/innobase/log/log0log.c +++ b/storage/innobase/log/log0log.c @@ -213,6 +213,85 @@ 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; + 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; + + /* 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 +312,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 +895,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); diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index 518eba975ab..b8336f88532 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -3095,48 +3095,78 @@ 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); + ut_ad((pcur->rel_pos == BTR_PCUR_ON) + == btr_pcur_is_on_user_rec(pcur)); } +#endif - if (relative_position == BTR_PCUR_AFTER - || relative_position == BTR_PCUR_AFTER_LAST_IN_TREE) { + /* The position may need be adjusted for rel_pos and moves_up. */ - 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); } @@ -4120,6 +4150,14 @@ row_search_for_mysql( 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 +4197,14 @@ row_search_for_mysql( 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 +4782,7 @@ row_search_for_mysql( 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; } 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/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) ; diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 77f6497b452..1bad8725bf9 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -1068,7 +1068,9 @@ echo "=====" >> $STATUS_HISTORY %doc release/Docs/INFO_BIN* %doc release/support-files/my-*.cnf +%if 0%{?commercial} %doc %attr(644, root, root) %{_infodir}/mysql.info* +%endif %doc %attr(644, root, man) %{_mandir}/man1/innochecksum.1* %doc %attr(644, root, man) %{_mandir}/man1/my_print_defaults.1* @@ -1232,6 +1234,9 @@ echo "=====" >> $STATUS_HISTORY - Comment off MySQL-embedded-* stuffs because we discontinue building MySQL-embedded RPM package. +* 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 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/vio/viosslfactories.c b/vio/viosslfactories.c index 43975b9e3c4..55cd7ba24bb 100644 --- a/vio/viosslfactories.c +++ b/vio/viosslfactories.c @@ -78,7 +78,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" 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() +