#At file:///home/bm136801/my/mtr-tr/ based on revid:bjorn.munch@stripped
3057 Bjorn Munch 2011-04-05 [merge]
merge from trunk
removed:
extra/yassl/src/template_instnt.cpp
extra/yassl/taocrypt/src/template_instnt.cpp
modified:
cmake/ssl.cmake
config.h.cmake
configure.cmake
extra/yassl/CMakeLists.txt
extra/yassl/src/crypto_wrapper.cpp
extra/yassl/src/yassl_int.cpp
extra/yassl/taocrypt/CMakeLists.txt
extra/yassl/taocrypt/src/algebra.cpp
extra/yassl/taocrypt/src/integer.cpp
include/my_global.h
mysql-test/include/mtr_warnings.sql
mysql-test/r/func_group.result
mysql-test/r/order_by_icp_mrr.result
mysql-test/r/order_by_none.result
mysql-test/suite/rpl/r/rpl_migration_crash_safe.result
mysql-test/suite/rpl/r/rpl_rotate_logs.result
mysql-test/suite/rpl/t/rpl_migration_crash_safe.test
mysql-test/suite/rpl/t/rpl_rotate_logs.test
mysql-test/suite/sys_vars/r/master_info_repository_basic.result
mysql-test/suite/sys_vars/r/relay_log_info_repository_basic.result
mysql-test/suite/sys_vars/t/master_info_repository_basic.test
mysql-test/suite/sys_vars/t/relay_log_info_repository_basic.test
mysql-test/t/func_group.test
plugin/auth/auth_socket.c
scripts/mysql_install_db.pl.in
scripts/mysql_install_db.sh
sql/binlog.cc
sql/field.cc
sql/filesort.cc
sql/item.cc
sql/item_buff.cc
sql/item_sum.cc
sql/keycaches.cc
sql/mysqld.cc
sql/opt_range.cc
sql/opt_range.h
sql/rpl_info.cc
sql/rpl_info.h
sql/rpl_info_factory.cc
sql/rpl_info_factory.h
sql/rpl_info_file.cc
sql/rpl_info_file.h
sql/rpl_info_handler.cc
sql/rpl_info_handler.h
sql/rpl_info_table.cc
sql/rpl_info_table.h
sql/rpl_info_table_access.cc
sql/rpl_info_values.cc
sql/rpl_mi.cc
sql/rpl_mi.h
sql/rpl_rli.cc
sql/rpl_rli.h
sql/rpl_slave.cc
sql/rpl_slave.h
sql/share/errmsg-utf8.txt
sql/sql_acl.cc
sql/sql_binlog.cc
sql/sql_class.cc
sql/sql_class.h
sql/sql_insert.cc
sql/sql_lex.cc
sql/sql_parse.cc
sql/sql_select.cc
sql/sql_show.cc
sql/sql_update.cc
sql/sys_vars.cc
sql/sys_vars.h
sql/table.cc
sql/table.h
storage/innobase/handler/handler0alter.cc
storage/innobase/include/sync0arr.h
storage/innobase/include/trx0roll.h
storage/innobase/row/row0merge.c
storage/innobase/row/row0mysql.c
storage/innobase/srv/srv0srv.c
storage/innobase/sync/sync0arr.c
storage/innobase/trx/trx0roll.c
storage/perfschema/ha_perfschema.h
storage/perfschema/pfs.h
storage/perfschema/pfs_atomic.h
storage/perfschema/pfs_column_types.h
storage/perfschema/pfs_column_values.h
storage/perfschema/pfs_con_slice.h
storage/perfschema/pfs_defaults.h
storage/perfschema/pfs_engine_table.h
storage/perfschema/pfs_events_statements.h
storage/perfschema/pfs_global.h
storage/perfschema/pfs_instr.h
storage/perfschema/pfs_server.h
storage/perfschema/pfs_setup_actor.cc
storage/perfschema/pfs_timer.h
unittest/gunit/CMakeLists.txt
=== modified file 'cmake/ssl.cmake'
--- a/cmake/ssl.cmake 2010-07-19 14:17:07 +0000
+++ b/cmake/ssl.cmake 2011-04-04 08:47:25 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
+# Copyright (c) 2009, 2011, 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
@@ -27,16 +27,8 @@ MACRO (MYSQL_USE_BUNDLED_SSL)
SET(SSL_INTERNAL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL)
SET(SSL_DEFINES "-DHAVE_YASSL -DYASSL_PURE_C -DYASSL_PREFIX -DHAVE_OPENSSL -DYASSL_THREAD_SAFE")
CHANGE_SSL_SETTINGS("bundled")
- #Remove -fno-implicit-templates
- #(yassl sources cannot be compiled with it)
- SET(SAVE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
- IF(CMAKE_CXX_FLAGS)
- STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS
- ${CMAKE_CXX_FLAGS})
- ENDIF()
ADD_SUBDIRECTORY(extra/yassl)
ADD_SUBDIRECTORY(extra/yassl/taocrypt)
- SET(CMAKE_CXX_FLAGS ${SAVE_CXX_FLAGS})
GET_TARGET_PROPERTY(src yassl SOURCES)
FOREACH(file ${src})
SET(SSL_SOURCES ${SSL_SOURCES} ${CMAKE_SOURCE_DIR}/extra/yassl/${file})
=== modified file 'config.h.cmake'
--- a/config.h.cmake 2011-02-02 18:31:39 +0000
+++ b/config.h.cmake 2011-04-04 08:47:25 +0000
@@ -40,7 +40,6 @@
#cmakedefine HAVE_FNMATCH_H 1
#cmakedefine HAVE_FPU_CONTROL_H 1
#cmakedefine HAVE_GRP_H 1
-#cmakedefine HAVE_EXPLICIT_TEMPLATE_INSTANTIATION 1
#cmakedefine HAVE_IA64INTRIN_H 1
#cmakedefine HAVE_IEEEFP_H 1
#cmakedefine HAVE_INTTYPES_H 1
=== modified file 'configure.cmake'
--- a/configure.cmake 2011-02-02 18:31:39 +0000
+++ b/configure.cmake 2011-04-04 08:47:25 +0000
@@ -1,5 +1,4 @@
-
-# Copyright (C) 2009 Sun Microsystems,Inc
+# Copyright (c) 2009, 2011, 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
@@ -67,15 +66,7 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
# MySQL "canonical" GCC flags. At least -fno-rtti flag affects
# ABI and cannot be simply removed.
SET(CMAKE_CXX_FLAGS
- "${CMAKE_CXX_FLAGS} -fno-implicit-templates -fno-exceptions -fno-rtti")
- IF(CMAKE_CXX_FLAGS)
- STRING(REGEX MATCH "fno-implicit-templates" NO_IMPLICIT_TEMPLATES
- ${CMAKE_CXX_FLAGS})
- IF (NO_IMPLICIT_TEMPLATES)
- SET(HAVE_EXPLICIT_TEMPLATE_INSTANTIATION TRUE)
- ENDIF()
- ENDIF()
-
+ "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti")
IF (CMAKE_EXE_LINKER_FLAGS MATCHES " -static "
OR CMAKE_EXE_LINKER_FLAGS MATCHES " -static$")
SET(HAVE_DLOPEN FALSE CACHE "Disable dlopen due to -static flag" FORCE)
=== modified file 'extra/yassl/CMakeLists.txt'
--- a/extra/yassl/CMakeLists.txt 2010-12-29 00:26:31 +0000
+++ b/extra/yassl/CMakeLists.txt 2011-04-04 08:47:25 +0000
@@ -1,4 +1,4 @@
-# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2011, 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
@@ -20,20 +20,11 @@ INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL)
ADD_DEFINITIONS(${SSL_DEFINES})
-IF(CMAKE_COMPILER_IS_GNUXX)
- #Remove -fno-implicit-templates
- #(yassl sources cannot be compiled with it)
- STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS
-${CMAKE_CXX_FLAGS})
-ENDIF()
+
SET(YASSL_SOURCES src/buffer.cpp src/cert_wrapper.cpp src/crypto_wrapper.cpp src/handshake.cpp src/lock.cpp
src/log.cpp src/socket_wrapper.cpp src/ssl.cpp src/timer.cpp src/yassl_error.cpp
src/yassl_imp.cpp src/yassl_int.cpp)
-IF(HAVE_EXPLICIT_TEMPLATE_INSTANTIATION)
- SET(YASSL_SOURCES ${YASSL_SOURCES} src/template_instnt.cpp)
-ENDIF()
-
ADD_CONVENIENCE_LIBRARY(yassl ${YASSL_SOURCES})
RESTRICT_SYMBOL_EXPORTS(yassl)
=== modified file 'extra/yassl/src/crypto_wrapper.cpp'
--- a/extra/yassl/src/crypto_wrapper.cpp 2010-07-02 18:30:47 +0000
+++ b/extra/yassl/src/crypto_wrapper.cpp 2011-04-04 08:47:25 +0000
@@ -1,5 +1,4 @@
-/*
- Copyright (C) 2000-2007 MySQL AB
+/* Copyright (c) 2000, 2011, 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
@@ -11,10 +10,8 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- MA 02110-1301 USA.
-*/
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* The crypto wrapper source implements the policies for the cipher
* components used by SSL.
@@ -991,24 +988,4 @@ x509* PemToDer(FILE* file, CertType type
} // namespace
-#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-namespace yaSSL {
-template void ysDelete<DiffieHellman::DHImpl>(DiffieHellman::DHImpl*);
-template void ysDelete<Integer::IntegerImpl>(Integer::IntegerImpl*);
-template void ysDelete<RSA::RSAImpl>(RSA::RSAImpl*);
-template void ysDelete<DSS::DSSImpl>(DSS::DSSImpl*);
-template void ysDelete<RandomPool::RandomImpl>(RandomPool::RandomImpl*);
-template void ysDelete<AES::AESImpl>(AES::AESImpl*);
-template void ysDelete<RC4::RC4Impl>(RC4::RC4Impl*);
-template void ysDelete<DES_EDE::DES_EDEImpl>(DES_EDE::DES_EDEImpl*);
-template void ysDelete<DES::DESImpl>(DES::DESImpl*);
-template void ysDelete<HMAC_RMD::HMAC_RMDImpl>(HMAC_RMD::HMAC_RMDImpl*);
-template void ysDelete<HMAC_SHA::HMAC_SHAImpl>(HMAC_SHA::HMAC_SHAImpl*);
-template void ysDelete<HMAC_MD5::HMAC_MD5Impl>(HMAC_MD5::HMAC_MD5Impl*);
-template void ysDelete<RMD::RMDImpl>(RMD::RMDImpl*);
-template void ysDelete<SHA::SHAImpl>(SHA::SHAImpl*);
-template void ysDelete<MD5::MD5Impl>(MD5::MD5Impl*);
-}
-#endif // HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-
#endif // !USE_CRYPTOPP_LIB
=== removed file 'extra/yassl/src/template_instnt.cpp'
--- a/extra/yassl/src/template_instnt.cpp 2009-05-15 12:57:51 +0000
+++ b/extra/yassl/src/template_instnt.cpp 1970-01-01 00:00:00 +0000
@@ -1,110 +0,0 @@
-/*
- Copyright (C) 2000-2007 MySQL AB
-
- 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; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- MA 02110-1301 USA.
-*/
-
-
-/* Explicit template instantiation requests
- */
-
-
-#include "runtime.hpp"
-#include "handshake.hpp"
-#include "yassl_int.hpp"
-#include "crypto_wrapper.hpp"
-#include "hmac.hpp"
-#include "md5.hpp"
-#include "sha.hpp"
-#include "ripemd.hpp"
-#include "openssl/ssl.h"
-
-#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-
-namespace mySTL {
-template class list<unsigned char*>;
-template yaSSL::del_ptr_zero for_each(mySTL::list<unsigned char*>::iterator, mySTL::list<unsigned char*>::iterator, yaSSL::del_ptr_zero);
-template pair<int, yaSSL::Message* (*)()>* uninit_copy<mySTL::pair<int, yaSSL::Message* (*)()>*, mySTL::pair<int, yaSSL::Message* (*)()>*>(mySTL::pair<int, yaSSL::Message* (*)()>*, mySTL::pair<int, yaSSL::Message* (*)()>*, mySTL::pair<int, yaSSL::Message* (*)()>*);
-template pair<int, yaSSL::HandShakeBase* (*)()>* uninit_copy<mySTL::pair<int, yaSSL::HandShakeBase* (*)()>*, mySTL::pair<int, yaSSL::HandShakeBase* (*)()>*>(mySTL::pair<int, yaSSL::HandShakeBase* (*)()>*, mySTL::pair<int, yaSSL::HandShakeBase* (*)()>*, mySTL::pair<int, yaSSL::HandShakeBase* (*)()>*);
-template void destroy<mySTL::pair<int, yaSSL::Message* (*)()>*>(mySTL::pair<int, yaSSL::Message* (*)()>*, mySTL::pair<int, yaSSL::Message* (*)()>*);
-template void destroy<mySTL::pair<int, yaSSL::HandShakeBase* (*)()>*>(mySTL::pair<int, yaSSL::HandShakeBase* (*)()>*, mySTL::pair<int, yaSSL::HandShakeBase* (*)()>*);
-template pair<int, yaSSL::ServerKeyBase* (*)()>* uninit_copy<mySTL::pair<int, yaSSL::ServerKeyBase* (*)()>*, mySTL::pair<int, yaSSL::ServerKeyBase* (*)()>*>(mySTL::pair<int, yaSSL::ServerKeyBase* (*)()>*, mySTL::pair<int, yaSSL::ServerKeyBase* (*)()>*, mySTL::pair<int, yaSSL::ServerKeyBase* (*)()>*);
-template void destroy<mySTL::pair<int, yaSSL::ServerKeyBase* (*)()>*>(mySTL::pair<int, yaSSL::ServerKeyBase* (*)()>*, mySTL::pair<int, yaSSL::ServerKeyBase* (*)()>*);
-template pair<int, yaSSL::ClientKeyBase* (*)()>* uninit_copy<mySTL::pair<int, yaSSL::ClientKeyBase* (*)()>*, mySTL::pair<int, yaSSL::ClientKeyBase* (*)()>*>(mySTL::pair<int, yaSSL::ClientKeyBase* (*)()>*, mySTL::pair<int, yaSSL::ClientKeyBase* (*)()>*, mySTL::pair<int, yaSSL::ClientKeyBase* (*)()>*);
-template class list<TaoCrypt::Signer*>;
-template class list<yaSSL::SSL_SESSION*>;
-template class list<yaSSL::input_buffer*>;
-template class list<yaSSL::output_buffer*>;
-template class list<yaSSL::x509*>;
-template class list<yaSSL::Digest*>;
-template class list<yaSSL::BulkCipher*>;
-template void destroy<mySTL::pair<int, yaSSL::ClientKeyBase* (*)()>*>(mySTL::pair<int, yaSSL::ClientKeyBase* (*)()>*, mySTL::pair<int, yaSSL::ClientKeyBase* (*)()>*);
-template yaSSL::del_ptr_zero for_each<mySTL::list<TaoCrypt::Signer*>::iterator, yaSSL::del_ptr_zero>(mySTL::list<TaoCrypt::Signer*>::iterator, mySTL::list<TaoCrypt::Signer*>::iterator, yaSSL::del_ptr_zero);
-template yaSSL::del_ptr_zero for_each<mySTL::list<yaSSL::SSL_SESSION*>::iterator, yaSSL::del_ptr_zero>(mySTL::list<yaSSL::SSL_SESSION*>::iterator, mySTL::list<yaSSL::SSL_SESSION*>::iterator, yaSSL::del_ptr_zero);
-template yaSSL::del_ptr_zero for_each<mySTL::list<yaSSL::input_buffer*>::iterator, yaSSL::del_ptr_zero>(mySTL::list<yaSSL::input_buffer*>::iterator, mySTL::list<yaSSL::input_buffer*>::iterator, yaSSL::del_ptr_zero);
-template yaSSL::del_ptr_zero for_each<mySTL::list<yaSSL::output_buffer*>::iterator, yaSSL::del_ptr_zero>(mySTL::list<yaSSL::output_buffer*>::iterator, mySTL::list<yaSSL::output_buffer*>::iterator, yaSSL::del_ptr_zero);
-template yaSSL::del_ptr_zero for_each<mySTL::list<yaSSL::x509*>::iterator, yaSSL::del_ptr_zero>(mySTL::list<yaSSL::x509*>::iterator, mySTL::list<yaSSL::x509*>::iterator, yaSSL::del_ptr_zero);
-template yaSSL::del_ptr_zero for_each<mySTL::list<yaSSL::Digest*>::iterator, yaSSL::del_ptr_zero>(mySTL::list<yaSSL::Digest*>::iterator, mySTL::list<yaSSL::Digest*>::iterator, yaSSL::del_ptr_zero);
-template yaSSL::del_ptr_zero for_each<mySTL::list<yaSSL::BulkCipher*>::iterator, yaSSL::del_ptr_zero>(mySTL::list<yaSSL::BulkCipher*>::iterator, mySTL::list<yaSSL::BulkCipher*>::iterator, yaSSL::del_ptr_zero);
-template bool list<yaSSL::ThreadError>::erase(list<yaSSL::ThreadError>::iterator);
-template void list<yaSSL::ThreadError>::push_back(yaSSL::ThreadError);
-template void list<yaSSL::ThreadError>::pop_front();
-template void list<yaSSL::ThreadError>::pop_back();
-template list<yaSSL::ThreadError>::~list();
-template pair<int, yaSSL::Message* (*)()>* GetArrayMemory<pair<int, yaSSL::Message* (*)()> >(size_t);
-template void FreeArrayMemory<pair<int, yaSSL::Message* (*)()> >(pair<int, yaSSL::Message* (*)()>*);
-template pair<int, yaSSL::HandShakeBase* (*)()>* GetArrayMemory<pair<int, yaSSL::HandShakeBase* (*)()> >(size_t);
-template void FreeArrayMemory<pair<int, yaSSL::HandShakeBase* (*)()> >(pair<int, yaSSL::HandShakeBase* (*)()>*);
-template pair<int, yaSSL::ServerKeyBase* (*)()>* GetArrayMemory<pair<int, yaSSL::ServerKeyBase* (*)()> >(size_t);
-template void FreeArrayMemory<pair<int, yaSSL::ServerKeyBase* (*)()> >(pair<int, yaSSL::ServerKeyBase* (*)()>*);
-template pair<int, yaSSL::ClientKeyBase* (*)()>* GetArrayMemory<pair<int, yaSSL::ClientKeyBase* (*)()> >(size_t);
-template void FreeArrayMemory<pair<int, yaSSL::ClientKeyBase* (*)()> >(pair<int, yaSSL::ClientKeyBase* (*)()>*);
-}
-
-namespace yaSSL {
-template void ysDelete<SSL_CTX>(yaSSL::SSL_CTX*);
-template void ysDelete<SSL>(yaSSL::SSL*);
-template void ysDelete<BIGNUM>(yaSSL::BIGNUM*);
-template void ysDelete<unsigned char>(unsigned char*);
-template void ysDelete<DH>(yaSSL::DH*);
-template void ysDelete<TaoCrypt::Signer>(TaoCrypt::Signer*);
-template void ysDelete<SSL_SESSION>(yaSSL::SSL_SESSION*);
-template void ysDelete<input_buffer>(input_buffer*);
-template void ysDelete<output_buffer>(output_buffer*);
-template void ysDelete<x509>(x509*);
-template void ysDelete<Auth>(Auth*);
-template void ysDelete<HandShakeBase>(HandShakeBase*);
-template void ysDelete<ServerKeyBase>(ServerKeyBase*);
-template void ysDelete<ClientKeyBase>(ClientKeyBase*);
-template void ysDelete<SSL_METHOD>(SSL_METHOD*);
-template void ysDelete<DiffieHellman>(DiffieHellman*);
-template void ysDelete<BulkCipher>(BulkCipher*);
-template void ysDelete<Digest>(Digest*);
-template void ysDelete<X509>(X509*);
-template void ysDelete<Message>(Message*);
-template void ysDelete<sslFactory>(sslFactory*);
-template void ysDelete<Sessions>(Sessions*);
-template void ysDelete<Errors>(Errors*);
-template void ysArrayDelete<unsigned char>(unsigned char*);
-template void ysArrayDelete<char>(char*);
-
-template int min<int>(int, int);
-template uint16 min<uint16>(uint16, uint16);
-template unsigned int min<unsigned int>(unsigned int, unsigned int);
-template unsigned long min<unsigned long>(unsigned long, unsigned long);
-}
-
-#endif // HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-
=== modified file 'extra/yassl/src/yassl_int.cpp'
--- a/extra/yassl/src/yassl_int.cpp 2011-03-29 08:01:07 +0000
+++ b/extra/yassl/src/yassl_int.cpp 2011-04-04 08:47:25 +0000
@@ -1,5 +1,4 @@
-/*
- Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
+/* Copyright (c) 2000, 2011, 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
@@ -11,11 +10,8 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- MA 02110-1301 USA.
-*/
-
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* yaSSL internal source implements SSL supporting types not specified in the
* draft along with type conversion functions.
@@ -2568,14 +2564,3 @@ extern "C" void yaSSL_CleanUp()
yaSSL::sessionsInstance = 0;
yaSSL::errorsInstance = 0;
}
-
-
-#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-namespace mySTL {
-template yaSSL::yassl_int_cpp_local1::SumData for_each<mySTL::list<yaSSL::input_buffer*>::iterator, yaSSL::yassl_int_cpp_local1::SumData>(mySTL::list<yaSSL::input_buffer*>::iterator, mySTL::list<yaSSL::input_buffer*>::iterator, yaSSL::yassl_int_cpp_local1::SumData);
-template yaSSL::yassl_int_cpp_local1::SumBuffer for_each<mySTL::list<yaSSL::output_buffer*>::iterator, yaSSL::yassl_int_cpp_local1::SumBuffer>(mySTL::list<yaSSL::output_buffer*>::iterator, mySTL::list<yaSSL::output_buffer*>::iterator, yaSSL::yassl_int_cpp_local1::SumBuffer);
-template mySTL::list<yaSSL::SSL_SESSION*>::iterator find_if<mySTL::list<yaSSL::SSL_SESSION*>::iterator, yaSSL::yassl_int_cpp_local2::sess_match>(mySTL::list<yaSSL::SSL_SESSION*>::iterator, mySTL::list<yaSSL::SSL_SESSION*>::iterator, yaSSL::yassl_int_cpp_local2::sess_match);
-template mySTL::list<yaSSL::ThreadError>::iterator find_if<mySTL::list<yaSSL::ThreadError>::iterator, yaSSL::yassl_int_cpp_local2::thr_match>(mySTL::list<yaSSL::ThreadError>::iterator, mySTL::list<yaSSL::ThreadError>::iterator, yaSSL::yassl_int_cpp_local2::thr_match);
-}
-#endif
-
=== modified file 'extra/yassl/taocrypt/CMakeLists.txt'
--- a/extra/yassl/taocrypt/CMakeLists.txt 2010-12-29 00:26:31 +0000
+++ b/extra/yassl/taocrypt/CMakeLists.txt 2011-04-04 08:47:25 +0000
@@ -1,4 +1,4 @@
-# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2011, 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
@@ -27,10 +27,6 @@ SET(TAOCRYPT_SOURCES src/aes.cpp src/ae
include/md2.hpp include/md5.hpp include/misc.hpp include/modarith.hpp include/modes.hpp
include/random.hpp include/ripemd.hpp include/rsa.hpp include/sha.hpp)
-IF(HAVE_EXPLICIT_TEMPLATE_INSTANTIATION)
- SET(TAOCRYPT_SOURCES ${TAOCRYPT_SOURCES} src/template_instnt.cpp)
-ENDIF()
-
ADD_CONVENIENCE_LIBRARY(taocrypt ${TAOCRYPT_SOURCES})
RESTRICT_SYMBOL_EXPORTS(taocrypt)
=== modified file 'extra/yassl/taocrypt/src/algebra.cpp'
--- a/extra/yassl/taocrypt/src/algebra.cpp 2010-07-02 18:30:47 +0000
+++ b/extra/yassl/taocrypt/src/algebra.cpp 2011-04-04 08:47:25 +0000
@@ -1,5 +1,4 @@
-/*
- Copyright (C) 2000-2007 MySQL AB
+/* Copyright (c) 2000, 2011, 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
@@ -11,10 +10,8 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- MA 02110-1301 USA.
-*/
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* based on Wei Dai's algebra.cpp from CryptoPP */
#undef NDEBUG
@@ -326,14 +323,3 @@ void AbstractRing::SimultaneousExponenti
} // namespace
-
-
-#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-namespace mySTL {
-template TaoCrypt::WindowSlider* uninit_copy<TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*>(TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*);
-template void destroy<TaoCrypt::WindowSlider*>(TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*);
-template TaoCrypt::WindowSlider* GetArrayMemory<TaoCrypt::WindowSlider>(size_t);
-template void FreeArrayMemory<TaoCrypt::WindowSlider>(TaoCrypt::WindowSlider*);
-}
-#endif
-
=== modified file 'extra/yassl/taocrypt/src/integer.cpp'
--- a/extra/yassl/taocrypt/src/integer.cpp 2010-07-02 18:30:47 +0000
+++ b/extra/yassl/taocrypt/src/integer.cpp 2011-04-04 08:47:25 +0000
@@ -1,5 +1,4 @@
-/*
- Copyright (C) 2000-2007 MySQL AB
+/* Copyright (c) 2000, 2011, 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
@@ -11,12 +10,8 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- MA 02110-1301 USA.
-*/
-
-
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* based on Wei Dai's integer.cpp from CryptoPP */
@@ -3953,18 +3948,5 @@ Integer CRT(const Integer &xp, const Int
// isn't operator overloading great?
return p * (u * (xq-xp) % q) + xp;
}
-
-
-#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-#ifndef TAOCRYPT_NATIVE_DWORD_AVAILABLE
-template hword DivideThreeWordsByTwo<hword, Word>(hword*, hword, hword, Word*);
-#endif
-template word DivideThreeWordsByTwo<word, DWord>(word*, word, word, DWord*);
-#ifdef SSE2_INTRINSICS_AVAILABLE
-template class AlignedAllocator<word>;
-#endif
-#endif
-
-
} // namespace
=== removed file 'extra/yassl/taocrypt/src/template_instnt.cpp'
--- a/extra/yassl/taocrypt/src/template_instnt.cpp 2007-01-29 15:54:40 +0000
+++ b/extra/yassl/taocrypt/src/template_instnt.cpp 1970-01-01 00:00:00 +0000
@@ -1,82 +0,0 @@
-/*
- Copyright (C) 2000-2007 MySQL AB
-
- 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; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- MA 02110-1301 USA.
-*/
-
-
-/* Explicit template instantiation requests
- */
-
-
-#include "runtime.hpp"
-#include "integer.hpp"
-#include "rsa.hpp"
-#include "sha.hpp"
-#include "md5.hpp"
-#include "hmac.hpp"
-#include "ripemd.hpp"
-#include "pwdbased.hpp"
-#include "algebra.hpp"
-#include "vector.hpp"
-#include "hash.hpp"
-
-#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-namespace TaoCrypt {
-
-#if defined(SSE2_INTRINSICS_AVAILABLE)
-template AlignedAllocator<unsigned int>::pointer StdReallocate<unsigned int, AlignedAllocator<unsigned int> >(AlignedAllocator<unsigned int>&, unsigned int*, AlignedAllocator<unsigned int>::size_type, AlignedAllocator<unsigned int>::size_type, bool);
-#endif
-
-template class RSA_Decryptor<RSA_BlockType2>;
-template class RSA_Encryptor<RSA_BlockType1>;
-template class RSA_Encryptor<RSA_BlockType2>;
-template void tcDelete<HASH>(HASH*);
-template void tcDelete<Integer>(Integer*);
-template void tcArrayDelete<byte>(byte*);
-template AllocatorWithCleanup<byte>::pointer StdReallocate<byte, AllocatorWithCleanup<byte> >(AllocatorWithCleanup<byte>&, byte*, AllocatorWithCleanup<byte>::size_type, AllocatorWithCleanup<byte>::size_type, bool);
-template void tcArrayDelete<word>(word*);
-template AllocatorWithCleanup<word>::pointer StdReallocate<word, AllocatorWithCleanup<word> >(AllocatorWithCleanup<word>&, word*, AllocatorWithCleanup<word>::size_type, AllocatorWithCleanup<word>::size_type, bool);
-
-#ifndef TAOCRYPT_SLOW_WORD64 // defined when word != word32
-template void tcArrayDelete<word32>(word32*);
-template AllocatorWithCleanup<word32>::pointer StdReallocate<word32, AllocatorWithCleanup<word32> >(AllocatorWithCleanup<word32>&, word32*, AllocatorWithCleanup<word32>::size_type, AllocatorWithCleanup<word32>::size_type, bool);
-#endif
-
-template void tcArrayDelete<char>(char*);
-
-template class PBKDF2_HMAC<SHA>;
-template class HMAC<MD5>;
-template class HMAC<SHA>;
-template class HMAC<RIPEMD160>;
-
-}
-
-namespace mySTL {
-template vector<TaoCrypt::Integer>* uninit_fill_n<vector<TaoCrypt::Integer>*, size_t, vector<TaoCrypt::Integer> >(vector<TaoCrypt::Integer>*, size_t, vector<TaoCrypt::Integer> const&);
-template void destroy<vector<TaoCrypt::Integer>*>(vector<TaoCrypt::Integer>*, vector<TaoCrypt::Integer>*);
-template TaoCrypt::Integer* uninit_copy<TaoCrypt::Integer*, TaoCrypt::Integer*>(TaoCrypt::Integer*, TaoCrypt::Integer*, TaoCrypt::Integer*);
-template TaoCrypt::Integer* uninit_fill_n<TaoCrypt::Integer*, size_t, TaoCrypt::Integer>(TaoCrypt::Integer*, size_t, TaoCrypt::Integer const&);
-template void destroy<TaoCrypt::Integer*>(TaoCrypt::Integer*, TaoCrypt::Integer*);
-template TaoCrypt::byte* GetArrayMemory<TaoCrypt::byte>(size_t);
-template void FreeArrayMemory<TaoCrypt::byte>(TaoCrypt::byte*);
-template TaoCrypt::Integer* GetArrayMemory<TaoCrypt::Integer>(size_t);
-template void FreeArrayMemory<TaoCrypt::Integer>(TaoCrypt::Integer*);
-template vector<TaoCrypt::Integer>* GetArrayMemory<vector<TaoCrypt::Integer> >(size_t);
-template void FreeArrayMemory<vector<TaoCrypt::Integer> >(vector<TaoCrypt::Integer>*);
-template void FreeArrayMemory<void>(void*);
-}
-
-#endif
=== modified file 'include/my_global.h'
--- a/include/my_global.h 2011-03-29 12:56:34 +0000
+++ b/include/my_global.h 2011-04-04 13:49:51 +0000
@@ -126,6 +126,7 @@
/* Define missing access() modes. */
#define F_OK 0
#define W_OK 2
+#define R_OK 4 /* Test for read permission. */
/* Define missing file locking constants. */
#define F_RDLCK 1
=== modified file 'mysql-test/include/mtr_warnings.sql'
--- a/mysql-test/include/mtr_warnings.sql 2011-03-30 13:33:29 +0000
+++ b/mysql-test/include/mtr_warnings.sql 2011-04-05 13:28:34 +0000
@@ -205,6 +205,17 @@ INSERT INTO global_suppressions VALUES
*/
("Found lock of type 6 that is write and read locked"),
+ /*
+ Warning message is printed out whenever a slave is started with
+ a configuration that is not crash-safe.
+ */
+ (".*If a crash happens this configuration does not guarantee.*"),
+ /*
+ Warning message is printed out whenever a repository is checked
+ and is not ready to be used.
+ */
+ ("Info file is not ready to be used."),
+
("THE_LAST_SUPPRESSION")||
=== modified file 'mysql-test/r/func_group.result'
--- a/mysql-test/r/func_group.result 2011-02-02 09:21:41 +0000
+++ b/mysql-test/r/func_group.result 2011-04-02 19:42:50 +0000
@@ -1737,6 +1737,15 @@ SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',
SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b1111111111111111111111111111111111111111111111111111111111111111111111111' ^ (RAND()));
SELECT RELEASE_LOCK('aaaaaaaaaaaaaaaaa');
#
+# Bug #11766094 - 59132: MIN() AND MAX() REMOVE UNSIGNEDNESS
+#
+CREATE TABLE t1 (a BIGINT UNSIGNED);
+INSERT INTO t1 VALUES (18446668621106209655);
+SELECT MAX(LENGTH(a)), LENGTH(MAX(a)), MIN(a), MAX(a), CONCAT(MIN(a)), CONCAT(MAX(a)) FROM t1;
+MAX(LENGTH(a)) LENGTH(MAX(a)) MIN(a) MAX(a) CONCAT(MIN(a)) CONCAT(MAX(a))
+20 20 18446668621106209655 18446668621106209655 18446668621106209655 18446668621106209655
+DROP TABLE t1;
+#
End of 5.1 tests
#
# Bug#52123 Assertion failed: aggregator == aggr->Aggrtype(),
=== modified file 'mysql-test/r/order_by_icp_mrr.result'
--- a/mysql-test/r/order_by_icp_mrr.result 2011-03-30 13:33:29 +0000
+++ b/mysql-test/r/order_by_icp_mrr.result 2011-04-05 13:28:34 +0000
@@ -2537,7 +2537,7 @@ CREATE TABLE t1 (a INT,KEY (a));
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
EXPLAIN SELECT DISTINCT a,1 FROM t1 WHERE a <> 1 ORDER BY a DESC;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index a a 5 NULL 10 Using where; Using index; Using filesort
+1 SIMPLE t1 index a a 5 NULL 10 Using where; Using index
SELECT DISTINCT a,1 FROM t1 WHERE a <> 1 ORDER BY a DESC;
a 1
10 1
=== modified file 'mysql-test/r/order_by_none.result'
--- a/mysql-test/r/order_by_none.result 2011-03-30 13:33:29 +0000
+++ b/mysql-test/r/order_by_none.result 2011-04-05 13:28:34 +0000
@@ -2536,7 +2536,7 @@ CREATE TABLE t1 (a INT,KEY (a));
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
EXPLAIN SELECT DISTINCT a,1 FROM t1 WHERE a <> 1 ORDER BY a DESC;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index a a 5 NULL 10 Using where; Using index; Using filesort
+1 SIMPLE t1 index a a 5 NULL 10 Using where; Using index
SELECT DISTINCT a,1 FROM t1 WHERE a <> 1 ORDER BY a DESC;
a 1
10 1
=== modified file 'mysql-test/suite/rpl/r/rpl_migration_crash_safe.result'
--- a/mysql-test/suite/rpl/r/rpl_migration_crash_safe.result 2010-12-19 17:22:30 +0000
+++ b/mysql-test/suite/rpl/r/rpl_migration_crash_safe.result 2011-03-23 23:28:49 +0000
@@ -5,5 +5,10 @@ CREATE TABLE test(id INTEGER NOT NULL PR
INSERT INTO test VALUES (1), (2), (3);
include/rpl_restart_server.inc [server_number=2 parameters: --relay-log-info-repository=TABLE --skip-slave-start]
include/rpl_restart_server.inc [server_number=2 parameters: --relay-log-info-repository=FILE --skip-slave-start]
+SET @@GLOBAL.relay_log_info_repository= "TABLE";
+SET @@GLOBAL.relay_log_info_repository= "FILE";
+SET @@GLOBAL.relay_log_info_repository= "FILE";
include/start_slave.inc
+SET @@GLOBAL.relay_log_info_repository= "TABLE";
+ERROR HY000: This operation cannot be performed with a running slave; run STOP SLAVE first
DROP TABLE test;
=== modified file 'mysql-test/suite/rpl/r/rpl_rotate_logs.result'
--- a/mysql-test/suite/rpl/r/rpl_rotate_logs.result 2011-02-23 20:01:27 +0000
+++ b/mysql-test/suite/rpl/r/rpl_rotate_logs.result 2011-04-04 09:42:22 +0000
@@ -1,5 +1,6 @@
CALL mtr.add_suppression("Failed to open the existing info file");
CALL mtr.add_suppression("Error while reading from master info file");
+CALL mtr.add_suppression("Failed to create a new info file");
start slave;
Got one of the listed errors
start slave;
=== modified file 'mysql-test/suite/rpl/t/rpl_migration_crash_safe.test'
--- a/mysql-test/suite/rpl/t/rpl_migration_crash_safe.test 2010-12-20 14:27:17 +0000
+++ b/mysql-test/suite/rpl/t/rpl_migration_crash_safe.test 2011-03-23 23:28:49 +0000
@@ -22,16 +22,33 @@
# if data is replicated correctly.
# 1.3. Assertions AF1 and AF2 are verified.
#
-# 2. Migration from FILE to TABLE
+# 2. Migration from FILE to TABLE by restarting the SERVER
# 2.1. The slave is stopped and restarted with --relay-log-info-repository=TABLE
# 2.2. Assertions AT1 and AT2 are verified.
#
-# 3. Migration from TABLE to FILE with success
+# 3. Migration from TABLE to FILE by restarting the SERVER
# 4.1. The slave is stopped and restarted with --relay-log-info-repository=FILE
# 4.2. Assertions AF1 and AF2 are verified.
#
-# 4. Check consistency
-# 4.1. The replication is started and the master is compared to the slave.
+# 4. Migration from FILE to TALBE by using SET
+# 4.1. SET @GLOBAL.relay_log_info_repository=TABLE is exectued.
+# 4.2. Assertions AT1 and AT2 are verified.
+#
+# 5. Migration from TABLE to FILE by using SET
+# 5.1. SET @GLOBAL.relay_log_info_repository=FILE is executed.
+# 5.2. Assertions AF1 and AF2 are verified.
+#
+# 6. Migration from FILE to FILE by using SET
+# 6.1. SET @GLOBAL.relay_log_info_repository=FILE is executed.
+# 6.2. Assertions AF1 and AF2 are verified.
+#
+# 7. Migration while slave is running by using SET
+# 7.1 Slave is started.
+# 7.2. SET @GLOBAL.relay_log_info_repository=FILE is executed and fails.
+# 7.3. Assertions AF1 and AF2 are verified.
+#
+# 8. Check consistency
+# 8.1. The replication is started and the master is compared to the slave.
########################################################################################
########################################################################################
# 1. Preparation
@@ -62,7 +79,7 @@ CREATE TABLE test(id INTEGER NOT NULL PR
INSERT INTO test VALUES (1), (2), (3);
########################################################################################
-# 2. Migration from FILE to TABLE
+# 2. Migration from FILE to TABLE by restarting the SERVER
########################################################################################
--connection slave
@@ -74,15 +91,16 @@ let $exp_slave= 1;
let $got_slave= `SELECT COUNT(*) FROM mysql.slave_relay_log_info`;
if ($got_slave != $exp_slave)
{
- --echo "The mysql.slave_relay_log_info has information and this is not expected."
+ --echo "The mysql.slave_relay_log_info has no information and this is not expected."
--die
}
--error 1
file_exists $MYSQLD_DATADIR/relay-log.info;
########################################################################################
-# 3. Migration from TABLE to FILE
+# 3. Migration from TABLE to FILE by restarting the SERVER
########################################################################################
+--connection slave
--let $rpl_server_number= 2
--let $rpl_server_parameters= --relay-log-info-repository=FILE --skip-slave-start
@@ -98,12 +116,67 @@ if ($got_slave != $exp_slave)
file_exists $MYSQLD_DATADIR/relay-log.info;
########################################################################################
-# 4. Check consistency
+# 4. Migration FROM FILE TO TABLE by using SET
+########################################################################################
+--connection slave
+
+SET @@GLOBAL.relay_log_info_repository= "TABLE";
+
+let $exp_slave= 1;
+let $got_slave= `SELECT COUNT(*) FROM mysql.slave_relay_log_info`;
+if ($got_slave != $exp_slave)
+{
+ --echo "The mysql.slave_relay_log_info has no information and this is not expected."
+ --die
+}
+--error 1
+file_exists $MYSQLD_DATADIR/relay-log.info;
+
+########################################################################################
+# 5. Migration FROM TABLE TO FILE by using SET
+########################################################################################
+--connection slave
+
+SET @@GLOBAL.relay_log_info_repository= "FILE";
+
+let $exp_slave= 0;
+let $got_slave= `SELECT COUNT(*) FROM mysql.slave_relay_log_info`;
+if ($got_slave != $exp_slave)
+{
+ --echo "The mysql.slave_relay_log_info has information and this is not expected."
+ --die
+}
+file_exists $MYSQLD_DATADIR/relay-log.info;
+
+########################################################################################
+# 6. Migration FROM FILE TO FILE by using SET
+########################################################################################
+--connection slave
+
+SET @@GLOBAL.relay_log_info_repository= "FILE";
+
+let $exp_slave= 0;
+let $got_slave= `SELECT COUNT(*) FROM mysql.slave_relay_log_info`;
+if ($got_slave != $exp_slave)
+{
+ --echo "The mysql.slave_relay_log_info has information and this is not expected."
+ --die
+}
+file_exists $MYSQLD_DATADIR/relay-log.info;
+
+########################################################################################
+# 7. Migration while slave is running by using SET
########################################################################################
--connection slave
--source include/start_slave.inc
+--error ER_SLAVE_MUST_STOP
+SET @@GLOBAL.relay_log_info_repository= "TABLE";
+
+########################################################################################
+# 8. Check consistency
+########################################################################################
--connection master
sync_slave_with_master;
=== modified file 'mysql-test/suite/rpl/t/rpl_rotate_logs.test'
--- a/mysql-test/suite/rpl/t/rpl_rotate_logs.test 2011-02-23 20:01:27 +0000
+++ b/mysql-test/suite/rpl/t/rpl_rotate_logs.test 2011-04-04 09:42:22 +0000
@@ -30,6 +30,7 @@ connection slave;
--disable_result_log
CALL mtr.add_suppression("Failed to open the existing info file");
CALL mtr.add_suppression("Error while reading from master info file");
+CALL mtr.add_suppression("Failed to create a new info file");
--enable_result_log
# START SLAVE will fail because it can't read the file (mode 000)
=== modified file 'mysql-test/suite/sys_vars/r/master_info_repository_basic.result'
--- a/mysql-test/suite/sys_vars/r/master_info_repository_basic.result 2010-07-06 22:01:07 +0000
+++ b/mysql-test/suite/sys_vars/r/master_info_repository_basic.result 2011-03-23 23:28:49 +0000
@@ -10,10 +10,9 @@ SELECT COUNT(@@SESSION.master_info_repos
ERROR HY000: Variable 'master_info_repository' is a GLOBAL variable
'#---------------------BS_STVARS_002_02----------------------#'
SET @@GLOBAL.master_info_repository= "TABLE";
-ERROR HY000: Variable 'master_info_repository' is a read only variable
SELECT @@GLOBAL.master_info_repository;
@@GLOBAL.master_info_repository
-FILE
+TABLE
'#---------------------BS_STVARS_002_03----------------------#'
SELECT @@GLOBAL.master_info_repository = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
@@ -42,3 +41,5 @@ SELECT COUNT(@@GLOBAL.master_info_reposi
COUNT(@@GLOBAL.master_info_repository)
1
1 Expected
+'#---------------------BS_STVARS_002_06----------------------#'
+SET @@GLOBAL.master_info_repository= "FILE";
=== modified file 'mysql-test/suite/sys_vars/r/relay_log_info_repository_basic.result'
--- a/mysql-test/suite/sys_vars/r/relay_log_info_repository_basic.result 2010-07-06 22:01:07 +0000
+++ b/mysql-test/suite/sys_vars/r/relay_log_info_repository_basic.result 2011-03-23 23:28:49 +0000
@@ -10,10 +10,9 @@ SELECT COUNT(@@SESSION.relay_log_info_re
ERROR HY000: Variable 'relay_log_info_repository' is a GLOBAL variable
'#---------------------BS_STVARS_002_02----------------------#'
SET @@GLOBAL.relay_log_info_repository= "TABLE";
-ERROR HY000: Variable 'relay_log_info_repository' is a read only variable
SELECT @@GLOBAL.relay_log_info_repository;
@@GLOBAL.relay_log_info_repository
-FILE
+TABLE
'#---------------------BS_STVARS_002_03----------------------#'
SELECT @@GLOBAL.relay_log_info_repository = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
@@ -42,3 +41,5 @@ SELECT COUNT(@@GLOBAL.relay_log_info_rep
COUNT(@@GLOBAL.relay_log_info_repository)
1
1 Expected
+'#---------------------BS_STVARS_002_06----------------------#'
+SET @@GLOBAL.relay_log_info_repository= "FILE";
=== modified file 'mysql-test/suite/sys_vars/t/master_info_repository_basic.test'
--- a/mysql-test/suite/sys_vars/t/master_info_repository_basic.test 2010-10-25 10:39:01 +0000
+++ b/mysql-test/suite/sys_vars/t/master_info_repository_basic.test 2011-03-23 23:28:49 +0000
@@ -37,7 +37,6 @@ SELECT COUNT(@@SESSION.master_info_repos
####################################################################
# Check if Value can set #
####################################################################
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@GLOBAL.master_info_repository= "TABLE";
SELECT @@GLOBAL.master_info_repository;
@@ -74,3 +73,10 @@ SELECT COUNT(@@local.master_info_reposit
SELECT COUNT(@@GLOBAL.master_info_repository);
--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_002_06----------------------#'
+################################################################################
+# Clean up #
+################################################################################
+SET @@GLOBAL.master_info_repository= "FILE";
=== modified file 'mysql-test/suite/sys_vars/t/relay_log_info_repository_basic.test'
--- a/mysql-test/suite/sys_vars/t/relay_log_info_repository_basic.test 2010-10-25 10:39:01 +0000
+++ b/mysql-test/suite/sys_vars/t/relay_log_info_repository_basic.test 2011-03-23 23:28:49 +0000
@@ -37,7 +37,6 @@ SELECT COUNT(@@SESSION.relay_log_info_re
####################################################################
# Check if Value can set #
####################################################################
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@GLOBAL.relay_log_info_repository= "TABLE";
SELECT @@GLOBAL.relay_log_info_repository;
@@ -74,3 +73,10 @@ SELECT COUNT(@@local.relay_log_info_repo
SELECT COUNT(@@GLOBAL.relay_log_info_repository);
--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_002_06----------------------#'
+################################################################################
+# Clean up #
+################################################################################
+SET @@GLOBAL.relay_log_info_repository= "FILE";
=== modified file 'mysql-test/t/func_group.test'
--- a/mysql-test/t/func_group.test 2011-02-02 09:21:41 +0000
+++ b/mysql-test/t/func_group.test 2011-04-02 19:42:50 +0000
@@ -1118,6 +1118,16 @@ SELECT RELEASE_LOCK('aaaaaaaaaaaaaaaaa')
--enable_result_log
+
+--echo #
+--echo # Bug #11766094 - 59132: MIN() AND MAX() REMOVE UNSIGNEDNESS
+--echo #
+
+CREATE TABLE t1 (a BIGINT UNSIGNED);
+INSERT INTO t1 VALUES (18446668621106209655);
+SELECT MAX(LENGTH(a)), LENGTH(MAX(a)), MIN(a), MAX(a), CONCAT(MIN(a)), CONCAT(MAX(a)) FROM t1;
+DROP TABLE t1;
+
--echo #
--echo End of 5.1 tests
=== modified file 'plugin/auth/auth_socket.c'
--- a/plugin/auth/auth_socket.c 2011-01-11 14:53:14 +0000
+++ b/plugin/auth/auth_socket.c 2011-04-05 12:25:19 +0000
@@ -17,7 +17,7 @@
/**
@file
- socket_peercred authentication plugin.
+ auth_socket authentication plugin.
Authentication is successful if the connection is done via a unix socket and
the owner of the client process matches the user name that was used when
=== modified file 'scripts/mysql_install_db.pl.in'
--- a/scripts/mysql_install_db.pl.in 2010-10-25 10:39:01 +0000
+++ b/scripts/mysql_install_db.pl.in 2011-03-23 23:28:49 +0000
@@ -79,11 +79,6 @@ Usage: $0 [OPTIONS]
user. You must be root to use this option. By default
mysqld runs using your current login name and files and
directories that it creates will be owned by you.
- --rpl-engine=engine The storage engine used for the mysql.slave_master_info and
- mysql.slave_relay_log_info tables. By default, both tables are
- created using the MyISAM storage engine. However, any storage
- engine available to the server may be used. If a crash-safe
- slave is required, the storage engine must be transactional.
All other options are passed to the mysqld program
@@ -122,7 +117,6 @@ sub parse_arguments
"builddir=s", # FIXME not documented
"srcdir=s",
"ldata|datadir=s",
- "rpl-engine=s",
# Note that the user will be passed to mysqld so that it runs
# as 'user' (crucial e.g. if log-bin=/some_other_path/
@@ -459,29 +453,6 @@ if ( open(PIPE, "| $mysqld_install_cmd_l
report_verbose($opt,"OK");
# ----------------------------------------------------------------------
- # Pipe ALTER TABLE mysql.slave_master_info|slave_relay_log_info to "mysqld --bootstrap"
- # ----------------------------------------------------------------------
-
- if ($opt->{'rpl-engine'})
- {
- report_verbose_wait($opt,"Setting engine for mysql.slave_master_info mysql.slave_relay_log_info tables...");
- if ( open(PIPE, "| $mysqld_install_cmd_line") )
- {
- print PIPE "use mysql;\n";
- print PIPE "ALTER TABLE mysql.slave_master_info ENGINE= " . $opt->{'rpl-engine'} . ";\n";
- print PIPE "ALTER TABLE mysql.slave_relay_log_info ENGINE= " . $opt->{'$rpl-engine'} . ";\n";
- close PIPE;
-
- report_verbose($opt,"OK");
- }
- else
- {
- warning($opt,"CRASH-SAFE SLAVE IS NOT COMPLETELY CONFIGURED!",
- "The \"CRASH-SAFE SLAVE\" might not work properly.");
- }
- }
-
- # ----------------------------------------------------------------------
# Pipe fill_help_tables.sql to "mysqld --bootstrap"
# ----------------------------------------------------------------------
=== modified file 'scripts/mysql_install_db.sh'
--- a/scripts/mysql_install_db.sh 2010-10-25 10:39:01 +0000
+++ b/scripts/mysql_install_db.sh 2011-03-23 23:28:49 +0000
@@ -63,11 +63,6 @@ Usage: $0 [OPTIONS]
user. You must be root to use this option. By default
mysqld runs using your current login name and files and
directories that it creates will be owned by you.
- --rpl-engine=engine The storage engine used for the mysql.slave_master_info and
- mysql.slave_relay_log_info tables. By default, both tables are
- created using the MyISAM storage engine. However, any storage
- engine available to the server may be used. If a crash-safe
- slave is required, the storage engine must be transactional.
All other options are passed to the mysqld program
@@ -120,8 +115,6 @@ parse_arguments()
--no-defaults|--defaults-file=*|--defaults-extra-file=*)
defaults="$arg" ;;
- --rpl-engine=*) rpl_engine=`parse_arg "$arg"` ;;
-
--cross-bootstrap|--windows)
# Used when building the MySQL system tables on a different host than
# the target. The platform-independent files that are created in
@@ -434,19 +427,6 @@ else
exit 1
fi
-if test -n "$rpl_engine"
-then
- s_echo "Setting engine for mysql.slave_master_info mysql.slave_relay_log_info tables..."
- if { echo "use mysql;"; echo "ALTER TABLE mysql.slave_master_info ENGINE= $rpl_engine;"; echo "ALTER TABLE mysql.slave_relay_log_info ENGINE= $rpl_engine;"; } | $mysqld_install_cmd_line > /dev/null
- then
- s_echo "OK"
- else
- echo
- echo "WARNING: CRASH-SAFE SLAVE IS NOT COMPLETELY CONFIGURED!"
- echo "The \"CRASH-SAFE SLAVE\" might not work properly."
- fi
-fi
-
s_echo "Filling help tables..."
if { echo "use mysql;"; cat $fill_help_tables; } | $mysqld_install_cmd_line > /dev/null
then
=== modified file 'sql/binlog.cc'
--- a/sql/binlog.cc 2011-03-14 17:55:26 +0000
+++ b/sql/binlog.cc 2011-04-04 08:47:25 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2009, 2011, 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
@@ -5379,24 +5379,6 @@ THD::binlog_prepare_pending_rows_event(T
DBUG_RETURN(pending); /* This is the current pending event */
}
-#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-/*
- Instantiate the versions we need, we have -fno-implicit-template as
- compiling option.
-*/
-template Rows_log_event*
-THD::binlog_prepare_pending_rows_event(TABLE*, uint32, size_t, bool,
- Write_rows_log_event*);
-
-template Rows_log_event*
-THD::binlog_prepare_pending_rows_event(TABLE*, uint32, size_t, bool,
- Delete_rows_log_event *);
-
-template Rows_log_event*
-THD::binlog_prepare_pending_rows_event(TABLE*, uint32, size_t, bool,
- Update_rows_log_event *);
-#endif
-
/* Declare in unnamed namespace. */
CPP_UNNAMED_NS_START
=== modified file 'sql/field.cc'
--- a/sql/field.cc 2011-03-22 11:44:40 +0000
+++ b/sql/field.cc 2011-04-04 08:47:25 +0000
@@ -40,15 +40,9 @@
// Maximum allowed exponent value for converting string to decimal
#define MAX_EXPONENT 1024
-/*****************************************************************************
- Instansiate templates and static variables
-*****************************************************************************/
-
-#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-template class List<Create_field>;
-template class List_iterator<Create_field>;
-#endif
-
+/**
+ Static variables
+*/
uchar Field_null::null[1]={1};
const char field_separator=',';
=== modified file 'sql/filesort.cc'
--- a/sql/filesort.cc 2011-03-17 17:39:31 +0000
+++ b/sql/filesort.cc 2011-04-04 08:47:25 +0000
@@ -37,10 +37,6 @@
#include "sql_select.h"
#include "debug_sync.h"
-#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-template class Bounded_queue<uchar, uchar>;
-#endif
-
/* functions defined in this file */
static void make_char_array(FILESORT_INFO *info, uint fields, uint length);
=== modified file 'sql/item.cc'
--- a/sql/item.cc 2011-03-30 07:42:03 +0000
+++ b/sql/item.cc 2011-04-04 08:47:25 +0000
@@ -7601,7 +7601,7 @@ String *Item_cache_int::val_str(String *
DBUG_ASSERT(fixed == 1);
if (!has_value())
return NULL;
- str->set(value, default_charset());
+ str->set_int(value, unsigned_flag, default_charset());
return str;
}
@@ -8501,14 +8501,3 @@ void view_error_processor(THD *thd, void
((TABLE_LIST *)data)->hide_view_error(thd);
}
-/*****************************************************************************
-** Instantiate templates
-*****************************************************************************/
-
-#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-template class List<Item>;
-template class List_iterator<Item>;
-template class List_iterator_fast<Item>;
-template class List_iterator_fast<Item_field>;
-template class List<List_item>;
-#endif
=== modified file 'sql/item_buff.cc'
--- a/sql/item_buff.cc 2010-08-16 06:58:42 +0000
+++ b/sql/item_buff.cc 2011-04-04 08:47:25 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2011, 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
@@ -175,13 +175,3 @@ bool Cached_item_decimal::cmp()
}
return FALSE;
}
-
-
-/*****************************************************************************
-** Instansiate templates
-*****************************************************************************/
-
-#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-template class List<Cached_item>;
-template class List_iterator<Cached_item>;
-#endif
=== modified file 'sql/item_sum.cc'
--- a/sql/item_sum.cc 2011-03-22 11:44:40 +0000
+++ b/sql/item_sum.cc 2011-04-01 14:04:52 +0000
@@ -2891,7 +2891,8 @@ int group_concat_key_cmp_with_order(cons
uint offset= (field->offset(field->table->record[0]) -
table->s->null_bytes);
if ((res= field->cmp((uchar*)key1 + offset, (uchar*)key2 + offset)))
- return (*order_item)->asc ? res : -res;
+ return ((*order_item)->direction == ORDER::ORDER_ASC) ? res : -res;
+
}
}
/*
@@ -3432,7 +3433,7 @@ void Item_func_group_concat::print(Strin
if (i)
str->append(',');
orig_args[i + arg_count_field]->print(str, query_type);
- if (order[i]->asc)
+ if (order[i]->direction == ORDER::ORDER_ASC)
str->append(STRING_WITH_LEN(" ASC"));
else
str->append(STRING_WITH_LEN(" DESC"));
=== modified file 'sql/keycaches.cc'
--- a/sql/keycaches.cc 2010-07-08 21:42:23 +0000
+++ b/sql/keycaches.cc 2011-04-04 08:47:25 +0000
@@ -157,7 +157,3 @@ bool process_key_caches(process_key_cach
return 0;
}
-#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-template class I_List_iterator<NAMED_ILINK>;
-#endif
-
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2011-03-29 08:01:07 +0000
+++ b/sql/mysqld.cc 2011-04-04 08:47:25 +0000
@@ -8130,20 +8130,6 @@ void refresh_status(THD *thd)
This section should go away soon
*****************************************************************************/
-/*****************************************************************************
- Instantiate templates
-*****************************************************************************/
-
-#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-/* Used templates */
-template class I_List<THD>;
-template class I_List_iterator<THD>;
-template class I_List<i_string>;
-template class I_List<i_string_pair>;
-template class I_List<Statement>;
-template class I_List_iterator<Statement>;
-#endif
-
#ifdef HAVE_PSI_INTERFACE
#ifdef HAVE_MMAP
PSI_mutex_key key_PAGE_lock, key_LOCK_sync, key_LOCK_active, key_LOCK_pool;
=== modified file 'sql/opt_range.cc'
--- a/sql/opt_range.cc 2011-03-22 11:44:40 +0000
+++ b/sql/opt_range.cc 2011-04-04 08:47:25 +0000
@@ -742,6 +742,12 @@ public:
bool is_ror_scan;
/* Number of ranges in the last checked tree->key */
uint n_ranges;
+
+ /*
+ The sort order the range access method must be able
+ to provide. Three-value logic: asc/desc/don't care
+ */
+ ORDER::enum_order order_direction;
};
class TABLE_READ_PLAN;
@@ -2142,6 +2148,8 @@ static int fill_used_fields_bitmap(PARAM
limit Query limit
force_quick_range Prefer to use range (instead of full table scan) even
if it is more expensive.
+ interesting_order The sort order the range access method must be able
+ to provide. Three-value logic: asc/desc/don't care
NOTES
Updates the following in the select parameter:
@@ -2197,9 +2205,9 @@ static int fill_used_fields_bitmap(PARAM
*/
int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
- table_map prev_tables,
- ha_rows limit, bool force_quick_range,
- bool ordered_output)
+ table_map prev_tables,
+ ha_rows limit, bool force_quick_range,
+ const ORDER::enum_order interesting_order)
{
uint idx;
double scan_time;
@@ -2260,7 +2268,8 @@ int SQL_SELECT::test_quick_select(THD *t
param.imerge_cost_buff_size= 0;
param.using_real_indexes= TRUE;
param.remove_jump_scans= TRUE;
- param.force_default_mrr= ordered_output;
+ param.force_default_mrr= (interesting_order != ORDER::ORDER_NOT_RELEVANT);
+ param.order_direction= interesting_order;
thd->no_errors=1; // Don't warn about NULL
init_sql_alloc(&alloc, thd->variables.range_alloc_block_size, 0);
@@ -2386,10 +2395,12 @@ int SQL_SELECT::test_quick_select(THD *t
/*
Simultaneous key scans and row deletes on several handler
objects are not allowed so don't use ROR-intersection for
- table deletes.
+ table deletes. Also, ROR-intersection cannot return rows in
+ descending order
*/
if ((thd->lex->sql_command != SQLCOM_DELETE) &&
- thd->optimizer_switch_flag(OPTIMIZER_SWITCH_INDEX_MERGE))
+ thd->optimizer_switch_flag(OPTIMIZER_SWITCH_INDEX_MERGE) &&
+ interesting_order != ORDER::ORDER_DESC)
{
/*
Get best non-covering ROR-intersection plan and prepare data for
@@ -2413,7 +2424,9 @@ int SQL_SELECT::test_quick_select(THD *t
}
else
{
- if (thd->optimizer_switch_flag(OPTIMIZER_SWITCH_INDEX_MERGE))
+ // Cannot return rows in descending order.
+ if (thd->optimizer_switch_flag(OPTIMIZER_SWITCH_INDEX_MERGE) &&
+ interesting_order != ORDER::ORDER_DESC)
{
/* Try creating index_merge/ROR-union scan. */
SEL_IMERGE *imerge;
@@ -4576,6 +4589,9 @@ TRP_ROR_INTERSECT *get_best_ror_intersec
!param->thd->optimizer_switch_flag(OPTIMIZER_SWITCH_INDEX_MERGE_INTERSECT))
DBUG_RETURN(NULL);
+ if (param->order_direction == ORDER::ORDER_DESC)
+ DBUG_RETURN(NULL);
+
/*
Step1: Collect ROR-able SEL_ARGs and create ROR_SCAN_INFO for each of
them. Also find and save clustered PK scan if there is one.
@@ -9653,6 +9669,9 @@ get_best_group_min_max(PARAM *param, SEL
DBUG_RETURN(NULL);
if (table->s->keys == 0) /* There are no indexes to use. */
DBUG_RETURN(NULL);
+ /* Cannot do reverse ordering */
+ if (param->order_direction == ORDER::ORDER_DESC)
+ DBUG_RETURN(NULL);
/* Check (SA1,SA4) and store the only MIN/MAX argument - the C attribute.*/
if (join->make_sum_func_list(join->all_fields, join->fields_list, 1))
@@ -11944,12 +11963,3 @@ void QUICK_GROUP_MIN_MAX_SELECT::dbug_du
#endif /* !DBUG_OFF */
-
-/*****************************************************************************
-** Instantiate templates
-*****************************************************************************/
-
-#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-template class List<QUICK_RANGE>;
-template class List_iterator<QUICK_RANGE>;
-#endif
=== modified file 'sql/opt_range.h'
--- a/sql/opt_range.h 2011-03-22 11:44:40 +0000
+++ b/sql/opt_range.h 2011-04-01 14:04:52 +0000
@@ -276,7 +276,15 @@ public:
/* Range end should be called when we have looped over the whole index */
virtual void range_end() {}
- virtual bool reverse_sorted() = 0;
+ /**
+ Whether the range access method returns records in reverse order.
+ */
+ virtual bool reverse_sorted() const = 0;
+ /**
+ Whether the range access method is capable of returning records
+ in reverse order.
+ */
+ virtual bool reverse_sort_possible() const = 0;
virtual bool unique_key_range() { return false; }
virtual bool clustered_pk_range() { return false; }
@@ -472,7 +480,8 @@ public:
void range_end();
int get_next_prefix(uint prefix_length, uint group_key_parts,
uchar *cur_prefix);
- bool reverse_sorted() { return 0; }
+ bool reverse_sorted() const { return false; }
+ bool reverse_sort_possible() const { return true; }
bool unique_key_range();
int init_ror_merged_scan(bool reuse_handler);
void save_last_pos()
@@ -572,7 +581,8 @@ public:
void need_sorted_output(bool sort) { DBUG_ASSERT(!sort); /* Can't do it */ }
int reset(void);
int get_next();
- bool reverse_sorted() { return false; }
+ bool reverse_sorted() const { return false; }
+ bool reverse_sort_possible() const { return false; }
bool unique_key_range() { return false; }
int get_type() { return QS_TYPE_INDEX_MERGE; }
void add_keys_and_lengths(String *key_names, String *used_lengths);
@@ -650,7 +660,8 @@ public:
void need_sorted_output(bool sort) { DBUG_ASSERT(!sort); /* Can't do it */ }
int reset(void);
int get_next();
- bool reverse_sorted() { return false; }
+ bool reverse_sorted() const { return false; }
+ bool reverse_sort_possible() const { return false; }
bool unique_key_range() { return false; }
int get_type() { return QS_TYPE_ROR_INTERSECT; }
void add_keys_and_lengths(String *key_names, String *used_lengths);
@@ -721,7 +732,8 @@ public:
void need_sorted_output(bool sort) { DBUG_ASSERT(!sort); /* Can't do it */ }
int reset(void);
int get_next();
- bool reverse_sorted() { return false; }
+ bool reverse_sorted() const { return false; }
+ bool reverse_sort_possible() const { return false; }
bool unique_key_range() { return false; }
int get_type() { return QS_TYPE_ROR_UNION; }
void add_keys_and_lengths(String *key_names, String *used_lengths);
@@ -863,7 +875,8 @@ public:
void need_sorted_output(bool sort) { /* always do it */ }
int reset();
int get_next();
- bool reverse_sorted() { return false; }
+ bool reverse_sorted() const { return false; }
+ bool reverse_sort_possible() const { return false; }
bool unique_key_range() { return false; }
int get_type() { return QS_TYPE_GROUP_MIN_MAX; }
void add_keys_and_lengths(String *key_names, String *used_lengths);
@@ -885,7 +898,8 @@ public:
QUICK_SELECT_DESC(QUICK_RANGE_SELECT *q, uint used_key_parts,
bool *create_err);
int get_next();
- bool reverse_sorted() { return 1; }
+ bool reverse_sorted() const { return true; }
+ bool reverse_sort_possible() const { return true; }
int get_type() { return QS_TYPE_RANGE_DESC; }
QUICK_SELECT_I *make_reverse(uint used_key_parts_arg)
{
@@ -921,7 +935,8 @@ class SQL_SELECT :public Sql_alloc {
bool check_quick(THD *thd, bool force_quick_range, ha_rows limit)
{
key_map tmp(key_map::ALL_BITS);
- return test_quick_select(thd, tmp, 0, limit, force_quick_range, FALSE) < 0;
+ return test_quick_select(thd, tmp, 0, limit, force_quick_range,
+ ORDER::ORDER_NOT_RELEVANT) < 0;
}
inline bool skip_record(THD *thd, bool *skip_record)
{
@@ -929,8 +944,8 @@ class SQL_SELECT :public Sql_alloc {
return thd->is_error();
}
int test_quick_select(THD *thd, key_map keys, table_map prev_tables,
- ha_rows limit, bool force_quick_range,
- bool ordered_output);
+ ha_rows limit, bool force_quick_range,
+ const ORDER::enum_order interesting_order);
};
=== modified file 'sql/rpl_info.cc'
--- a/sql/rpl_info.cc 2010-12-21 09:33:41 +0000
+++ b/sql/rpl_info.cc 2011-03-23 23:28:49 +0000
@@ -36,7 +36,7 @@ Rpl_info::Rpl_info(const char* type
#endif
info_thd(0), inited(0), abort_slave(0),
slave_running(0), slave_run_id(0),
- handler(0)
+ handler(0), rpl_info_type(INVALID_INFO_REPOSITORY)
{
#ifdef HAVE_PSI_INTERFACE
mysql_mutex_init(*key_info_run_lock,
@@ -65,13 +65,7 @@ Rpl_info::~Rpl_info()
mysql_cond_destroy(&start_cond);
mysql_cond_destroy(&stop_cond);
- if (handler)
- delete handler;
+ delete handler;
DBUG_VOID_RETURN;
}
-
-void Rpl_info::set_rpl_info_handler(Rpl_info_handler * param_handler)
-{
- handler= param_handler;
-}
=== modified file 'sql/rpl_info.h'
--- a/sql/rpl_info.h 2010-12-21 09:33:41 +0000
+++ b/sql/rpl_info.h 2011-03-23 23:28:49 +0000
@@ -21,9 +21,18 @@
#include "rpl_info_handler.h"
#include "rpl_reporting.h"
+enum enum_info_repository
+{
+ INVALID_INFO_REPOSITORY= -1,
+ INFO_REPOSITORY_FILE= 0,
+ INFO_REPOSITORY_TABLE= 1
+};
+
class Rpl_info : public Slave_reporting_capability
{
public:
+ virtual ~Rpl_info();
+
/*
standard lock acquisition order to avoid deadlocks:
run_lock, data_lock, relay_log.LOCK_log, relay_log.LOCK_index
@@ -53,16 +62,45 @@ public:
int events_until_exit;
#endif
- Rpl_info(const char* type
-#ifdef HAVE_PSI_INTERFACE
- ,PSI_mutex_key *param_key_info_run_lock,
- PSI_mutex_key *param_key_info_data_lock,
- PSI_mutex_key *param_key_info_data_cond,
- PSI_mutex_key *param_key_info_start_cond,
- PSI_mutex_key *param_key_info_stop_cond
-#endif
- );
- virtual ~Rpl_info();
+ /**
+ Defines the type of the repository that is used.
+
+ @param param_rpl_info_type Type of repository.
+ */
+ void set_rpl_info_type(uint param_rpl_info_type)
+ {
+ rpl_info_type= param_rpl_info_type;
+ }
+
+ /**
+ Gets the type of the repository that is used.
+
+ @return Type of repository.
+ */
+ uint get_rpl_info_type()
+ {
+ return(rpl_info_type);
+ }
+
+ /**
+ Sets the persistency component/handler.
+
+ @param[in] hanlder Pointer to the handler.
+ */
+ void set_rpl_info_handler(Rpl_info_handler * param_handler)
+ {
+ handler= param_handler;
+ }
+
+ /**
+ Gets the persistency component/handler.
+
+ @return the handler if there is one.
+ */
+ Rpl_info_handler *get_rpl_info_handler()
+ {
+ return (handler);
+ }
int check_info()
{
@@ -79,6 +117,11 @@ public:
return (handler->is_transactional());
}
+ bool update_is_transactional()
+ {
+ return (handler->update_is_transactional());
+ }
+
char *get_description_info()
{
return (handler->get_description_info());
@@ -92,21 +135,26 @@ public:
return(FALSE);
}
- /**
- Sets the persistency component/handler.
-
- @param[in] hanlder Pointer to the handler.
- */
- void set_rpl_info_handler(Rpl_info_handler * handler);
-
protected:
Rpl_info_handler *handler;
+ uint rpl_info_type;
+
+ Rpl_info(const char* type
+#ifdef HAVE_PSI_INTERFACE
+ ,PSI_mutex_key *param_key_info_run_lock,
+ PSI_mutex_key *param_key_info_data_lock,
+ PSI_mutex_key *param_key_info_data_cond,
+ PSI_mutex_key *param_key_info_start_cond,
+ PSI_mutex_key *param_key_info_stop_cond
+#endif
+ );
+
private:
virtual bool read_info(Rpl_info_handler *from)= 0;
virtual bool write_info(Rpl_info_handler *to, bool force)= 0;
- Rpl_info& operator=(const Rpl_info& info);
Rpl_info(const Rpl_info& info);
+ Rpl_info& operator=(const Rpl_info& info);
};
#endif /* RPL_INFO_H */
=== modified file 'sql/rpl_info_factory.cc'
--- a/sql/rpl_info_factory.cc 2010-12-21 09:33:41 +0000
+++ b/sql/rpl_info_factory.cc 2011-03-23 23:28:49 +0000
@@ -18,13 +18,6 @@
#include "rpl_slave.h"
#include "rpl_info_factory.h"
-/*
- We need to replace these definitions by an option that states the
- engine one wants to use in the master info repository.
-*/
-#define master_info_engine NULL
-#define relay_log_info_engine NULL
-
/**
Creates both a Master info and a Relay log info repository whose types are
defined as parameters.
@@ -42,7 +35,7 @@
bool Rpl_info_factory::create(uint mi_option, Master_info **mi,
uint rli_option, Relay_log_info **rli)
{
- DBUG_ENTER("Rpl_info_factory::Rpl_info_factory");
+ DBUG_ENTER("Rpl_info_factory::create");
if (!((*mi)= Rpl_info_factory::create_mi(mi_option)))
DBUG_RETURN(TRUE);
@@ -80,12 +73,12 @@ bool Rpl_info_factory::create(uint mi_op
Master_info *Rpl_info_factory::create_mi(uint mi_option)
{
Master_info* mi= NULL;
- Rpl_info_file* mi_file= NULL;
- Rpl_info_table* mi_table= NULL;
+ Rpl_info_handler* handler_src= NULL;
+ Rpl_info_handler* handler_dest= NULL;
const char *msg= "Failed to allocate memory for the master info "
"structure";
- DBUG_ENTER("Rpl_info_factory::Rpl_info_factory");
+ DBUG_ENTER("Rpl_info_factory::create_mi");
if (!(mi= new Master_info(
#ifdef HAVE_PSI_INTERFACE
@@ -98,36 +91,17 @@ Master_info *Rpl_info_factory::create_mi
)))
goto err;
- /*
- Now we instantiate all info repos and later decide which one to take,
- but not without first checking if there is already existing data for
- a repo different from the one that is being requested.
- */
- if (!(mi_file= new Rpl_info_file(mi->get_number_info_mi_fields(),
- master_info_file)))
- goto err;
-
- if (!(mi_table= new Rpl_info_table(mi->get_number_info_mi_fields() + 1,
- MI_FIELD_ID, MI_SCHEMA, MI_TABLE)))
- goto err;
-
- DBUG_ASSERT(mi_option == MI_REPOSITORY_FILE ||
- mi_option == MI_REPOSITORY_TABLE);
-
- if (decide_repository(mi, &mi_table, &mi_file,
- mi_option == MI_REPOSITORY_TABLE, &msg))
+ if(init_mi_repositories(mi, mi_option, &handler_src, &handler_dest, &msg))
goto err;
- if ((mi_option == MI_REPOSITORY_TABLE) &&
- change_engine(static_cast<Rpl_info_table *>(mi_table),
- master_info_engine, &msg))
+ if (decide_repository(mi, mi_option, &handler_src, &handler_dest, &msg))
goto err;
DBUG_RETURN(mi);
err:
- if (mi_file) delete mi_file;
- if (mi_table) delete mi_table;
+ delete handler_src;
+ delete handler_dest;
if (mi)
{
/*
@@ -135,13 +109,51 @@ err:
any reference to it.
*/
mi->set_rpl_info_handler(NULL);
- delete (mi);
+ mi->set_rpl_info_type(INVALID_INFO_REPOSITORY);
+ delete mi;
}
- sql_print_error("%s", msg);
+ sql_print_error("Error creating master info: %s.", msg);
DBUG_RETURN(NULL);
}
/**
+ Allows to change the master info repository after startup.
+
+ @param[in] mi Pointer to Master_info.
+ @param[in] mi_option Type of the repository, e.g. FILE TABLE.
+ @param[out] msg Error message if something goes wrong.
+
+ @retval FALSE No error
+ @retval TRUE Failure
+*/
+bool Rpl_info_factory::change_mi_repository(Master_info *mi,
+ const uint mi_option,
+ const char **msg)
+{
+ DBUG_ENTER("Rpl_info_factory::change_mi_repository");
+
+ Rpl_info_handler* handler_src= mi->get_rpl_info_handler();
+ Rpl_info_handler* handler_dest= NULL;
+
+ if (mi->get_rpl_info_type() == mi_option)
+ DBUG_RETURN(FALSE);
+
+ if (init_mi_repositories(mi, mi_option, NULL, &handler_dest, msg))
+ goto err;
+
+ if (change_repository(mi, mi_option, &handler_src, &handler_dest, msg))
+ goto err;
+
+ DBUG_RETURN(FALSE);
+
+err:
+ delete handler_dest;
+
+ sql_print_error("Error changing the type of master info's repository: %s.", *msg);
+ DBUG_RETURN(TRUE);
+}
+
+/**
Creates a Relay log info repository whose type is defined as a parameter.
@param[in] rli_option Type of the Relay log info repository
@@ -160,8 +172,8 @@ err:
Relay_log_info *Rpl_info_factory::create_rli(uint rli_option, bool is_slave_recovery)
{
Relay_log_info *rli= NULL;
- Rpl_info_file* rli_file= NULL;
- Rpl_info_table* rli_table= NULL;
+ Rpl_info_handler* handler_src= NULL;
+ Rpl_info_handler* handler_dest= NULL;
const char *msg= "Failed to allocate memory for the relay log info "
"structure";
@@ -178,36 +190,17 @@ Relay_log_info *Rpl_info_factory::create
)))
goto err;
- /*
- Now we instantiate all info repos and later decide which one to take,
- but not without first checking if there is already existing data for
- a repo different from the one that is being requested.
- */
- if (!(rli_file= new Rpl_info_file(rli->get_number_info_rli_fields(),
- relay_log_info_file)))
- goto err;
-
- if (!(rli_table= new Rpl_info_table(rli->get_number_info_rli_fields() + 1,
- RLI_FIELD_ID, RLI_SCHEMA, RLI_TABLE)))
- goto err;
-
- DBUG_ASSERT(rli_option == RLI_REPOSITORY_FILE ||
- rli_option == RLI_REPOSITORY_TABLE);
-
- if (decide_repository(rli, &rli_table, &rli_file,
- rli_option == RLI_REPOSITORY_TABLE, &msg))
+ if(init_rli_repositories(rli, rli_option, &handler_src, &handler_dest, &msg))
goto err;
- if ((rli_option == RLI_REPOSITORY_TABLE) &&
- change_engine(static_cast<Rpl_info_table *>(rli_table),
- relay_log_info_engine, &msg))
+ if (decide_repository(rli, rli_option, &handler_src, &handler_dest, &msg))
goto err;
DBUG_RETURN(rli);
err:
- if (rli_file) delete rli_file;
- if (rli_table) delete rli_table;
+ delete handler_src;
+ delete handler_dest;
if (rli)
{
/*
@@ -215,142 +208,341 @@ err:
any reference to it.
*/
rli->set_rpl_info_handler(NULL);
- delete (rli);
+ rli->set_rpl_info_type(INVALID_INFO_REPOSITORY);
+ delete rli;
}
- sql_print_error("%s", msg);
+ sql_print_error("Error creating relay log info: %s.", msg);
DBUG_RETURN(NULL);
}
/**
- Decides what repository will be used based on the following decision table:
+ Allows to change the relay log info repository after startup.
- \code
- |--------------+-----------------------+-----------------------|
- | Exists \ Opt | TABLE | FILE |
- |--------------+-----------------------+-----------------------|
- | ~is_t, is_f | Update T and delete F | Read F |
- | is_t, is_f | ERROR | ERROR |
- | ~is_t, ~is_f | Fill in T | Create and Fill in F |
- | is_t, ~is_f | Read T | Update F and delete T |
- |--------------+-----------------------+-----------------------|
- \endcode
+ @param[in] mi Pointer to Relay_log_info.
+ @param[in] mi_option Type of the repository, e.g. FILE TABLE.
+ @param[out] msg Error message if something goes wrong.
+
+ @retval FALSE No error
+ @retval TRUE Failure
+*/
+bool Rpl_info_factory::change_rli_repository(Relay_log_info *rli,
+ const uint rli_option,
+ const char **msg)
+{
+ DBUG_ENTER("Rpl_info_factory::change_rli_repository");
- <ul>
- \li F --> file
+ Rpl_info_handler* handler_src= rli->get_rpl_info_handler();
+ Rpl_info_handler* handler_dest= NULL;
- \li T --> table
+ if (rli->get_rpl_info_type() == rli_option)
+ DBUG_RETURN(FALSE);
- \li is_t --> table with data
+ if (init_rli_repositories(rli, rli_option, NULL, &handler_dest, msg))
+ goto err;
- \li is_f --> file with data
+ if (change_repository(rli, rli_option, &handler_src, &handler_dest, msg))
+ goto err;
- \li ~is_t --> no data in the table
+ DBUG_RETURN(FALSE);
- \li ~is_f --> no file
- </ul>
+err:
+ delete handler_dest;
+ handler_dest= NULL;
- @param[in] info Either master info or relay log info.
- @param[in] table Table handler.
- @param[in] file File handler.
- @param[in] is_table True if a table handler was requested.
- @param[out] msg Message specifying what went wrong, if there is any error.
+ sql_print_error("Error changing the type of relay log info's repository: %s.", *msg);
+ DBUG_RETURN(TRUE);
+}
+
+/**
+ Decides during startup what repository will be used based on the following
+ decision table:
+
+ \code
+ |--------------+-----------------------+-----------------------|
+ | Exists \ Opt | SOURCE | DESTINATION |
+ |--------------+-----------------------+-----------------------|
+ | ~is_s, ~is_d | - | Create/Update D |
+ | ~is_s, is_d | - | Continue with D |
+ | is_s, ~is_d | Copy S into D | Create/Update D |
+ | is_s, is_d | Error | Error |
+ |--------------+-----------------------+-----------------------|
+ \endcode
+
+ @param[in] info Either master info or relay log info.
+ @param[in] option Identifies the type of the repository that will
+ be used, i.e., destination repository.
+ @param[out] handler_src Source repository from where information is
+ copied into the destination repository.
+ @param[out] handler_dest Destination repository to where informaiton is
+ copied.
+ @param[out] msg Error message if something goes wrong.
@retval FALSE No error
@retval TRUE Failure
*/
-bool Rpl_info_factory::decide_repository(Rpl_info *info, Rpl_info_table **table,
- Rpl_info_file **file, bool is_table,
+bool Rpl_info_factory::decide_repository(Rpl_info *info,
+ uint option,
+ Rpl_info_handler **handler_src,
+ Rpl_info_handler **handler_dest,
const char **msg)
{
DBUG_ENTER("Rpl_info_factory::decide_repository");
bool error= TRUE;
- bool is_t= !((*table)->check_info());
- bool is_f= !((*file)->check_info());
+ /*
+ check_info() returns FALSE if the repository exists. If a FILE,
+ for example, this means that FALSE is returned if a file exists.
+ If a TABLE, for example, this means that FALSE is returned if
+ the table exists and is populated. Otherwise, TRUE is returned.
+
+ The check_info() behavior is odd and we are going to fix this
+ in the future.
+
+ So,
- if (is_t && is_f)
+ . is_src == TRUE, means that the source repository exists.
+ . is_dest == TRUE, means that the destination repository
+ exists.
+
+ /Alfranio
+ */
+ bool is_src= !((*handler_src)->check_info());
+ bool is_dest= !((*handler_dest)->check_info());
+
+ DBUG_ASSERT((*handler_dest) != NULL && (*handler_dest) != NULL);
+ if (is_src && is_dest)
{
*msg= "Multiple replication metadata repository instances "
"found with data in them. Unable to decide which is "
- "the correct one to choose.";
+ "the correct one to choose";
DBUG_RETURN(error);
}
- if (is_table)
+ if (!is_dest && is_src)
{
- if (!is_t && is_f)
+ if ((*handler_src)->init_info() || (*handler_dest)->init_info())
{
- if ((*table)->init_info() || (*file)->init_info())
- {
- *msg= "Error transfering information from a file to a table.";
- goto err;
- }
- /*
- Transfer the information from the file to the table and delete the
- file, i.e. Update the table (T) and delete the file (F).
- */
- if (info->copy_info(*file, *table) || (*file)->remove_info())
- {
- *msg= "Error transfering information from a file to a table.";
- goto err;
- }
+ *msg= "Error transfering information";
+ goto err;
+ }
+ /*
+ Transfer the information from source to destination and delete the
+ source. Note this is not fault-tolerant and a crash before removing
+ source may cause the next restart to fail as is_src and is_dest may
+ be true. Moreover, any failure in removing the source may lead to
+ the same.
+
+ /Alfranio
+ */
+ if (info->copy_info(*handler_src, *handler_dest) || (*handler_src)->remove_info())
+ {
+ *msg= "Error transfering information";
+ goto err;
+ }
+ }
+
+ delete (*handler_src);
+ *handler_src= NULL;
+ info->set_rpl_info_handler(*handler_dest);
+ info->set_rpl_info_type(option);
+ error= FALSE;
+
+err:
+ DBUG_RETURN(error);
+}
+
+/**
+ Changes the type of the repository after startup based on the following
+ decision table:
+
+ \code
+ |--------------+-----------------------+-----------------------|
+ | Exists \ Opt | SOURCE | DESTINATION |
+ |--------------+-----------------------+-----------------------|
+ | ~is_s, ~is_d | - | Create/Update D |
+ | ~is_s, is_d | - | Continue with D |
+ | is_s, ~is_d | Copy S into D | Create/Update D |
+ | is_s, is_d | Copy S into D | Continue with D |
+ |--------------+-----------------------+-----------------------|
+ \endcode
+
+ @param[in] info Either master info or relay log info.
+ @param[in] option Identifies the type of the repository that will
+ be used, i.e., destination repository.
+ @param[out] handler_src Source repository from where information is
+ copied into the destination repository.
+ @param[out] handler_dest Destination repository to where informaiton is
+ copied.
+ @param[out] msg Error message if something goes wrong.
+
+ @retval FALSE No error
+ @retval TRUE Failure
+*/
+bool Rpl_info_factory::change_repository(Rpl_info *info,
+ uint option,
+ Rpl_info_handler **handler_src,
+ Rpl_info_handler **handler_dest,
+ const char **msg)
+{
+ bool error= TRUE;
+
+ DBUG_ENTER("Rpl_info_factory::change_repository");
+
+ DBUG_ASSERT((*handler_dest) != NULL && (*handler_dest) != NULL);
+ if (!(*handler_src)->check_info())
+ {
+ if ((*handler_dest)->init_info())
+ {
+ *msg= "Error initializing new repository";
+ goto err;
+ }
+
+ /*
+ Transfer the information from source to destination and delete the
+ source. Note this is not fault-tolerant and a crash before removing
+ source may cause the next restart to fail as is_src and is_dest may
+ be true. Moreover, any failure in removing the source may lead to
+ the same.
+
+ /Alfranio
+ */
+ if (info->copy_info(*handler_src, *handler_dest) || (*handler_src)->remove_info())
+ {
+ *msg= "Error transfering information";
+ goto err;
}
- delete (*file);
- info->set_rpl_info_handler(*table);
- error= FALSE;
- *file= NULL;
}
else
{
- if (is_t && !is_f)
+ if ((*handler_src)->remove_info())
{
- if ((*table)->init_info() || (*file)->init_info())
- {
- *msg= "Error transfering information from a file to a table.";
+ *msg= "Error removing old repository";
+ goto err;
+ }
+ }
+
+ info->set_rpl_info_handler(NULL);
+ delete (*handler_src);
+ *handler_src= NULL;
+ info->set_rpl_info_handler(*handler_dest);
+ info->set_rpl_info_type(option);
+ error= FALSE;
+
+err:
+ DBUG_RETURN(error);
+}
+
+/**
+ Creates repositories that will be associated to the master info.
+
+ @param[in] mi Pointer to the class Master info.
+ @param[in] rli_option Identifies the type of the repository that will
+ be used, i.e., destination repository.
+ @param[out] handler_src Source repository from where information is
+ copied into the destination repository.
+ @param[out] handler_dest Destination repository to where informaiton is
+ copied.
+ @param[out] msg Error message if something goes wrong.
+
+ @retval FALSE No error
+ @retval TRUE Failure
+*/
+bool Rpl_info_factory::init_mi_repositories(Master_info *mi,
+ uint mi_option,
+ Rpl_info_handler **handler_src,
+ Rpl_info_handler **handler_dest,
+ const char **msg)
+{
+ bool error= TRUE;
+ *msg= "Failed to allocate memory for master info repositories";
+
+ DBUG_ENTER("Rpl_info_factory::init_mi_repositories");
+
+ DBUG_ASSERT(handler_dest != NULL);
+ switch (mi_option)
+ {
+ case INFO_REPOSITORY_FILE:
+ if (!(*handler_dest= new Rpl_info_file(mi->get_number_info_mi_fields(),
+ master_info_file)))
goto err;
- }
- /*
- Transfer the information from the table to the file and delete
- entries in the table, i.e. Update the file (F) and delete the
- table (T).
- */
- if (info->copy_info(*table, *file) || (*table)->remove_info())
- {
- *msg= "Error transfering information from a table to a file.";
+ if (handler_src &&
+ !(*handler_src= new Rpl_info_table(mi->get_number_info_mi_fields() + 1,
+ MI_FIELD_ID, MYSQL_SCHEMA_NAME.str, MI_INFO_NAME.str)))
goto err;
- }
- }
- delete (*table);
- info->set_rpl_info_handler(*file);
- error= FALSE;
- *table= NULL;
+ break;
+
+ case INFO_REPOSITORY_TABLE:
+ if (!(*handler_dest= new Rpl_info_table(mi->get_number_info_mi_fields() + 1,
+ MI_FIELD_ID, MYSQL_SCHEMA_NAME.str, MI_INFO_NAME.str)))
+ goto err;
+ if (handler_src &&
+ !(*handler_src= new Rpl_info_file(mi->get_number_info_mi_fields(),
+ master_info_file)))
+ goto err;
+ break;
+ default:
+ DBUG_ASSERT(0);
}
+ error= FALSE;
err:
- DBUG_RETURN(error);
+ DBUG_RETURN(error);
}
/**
- Changes the engine in use by a handler.
-
- @param[in] handler Reference to a handler.
- @param[in] engine Type of the engine, e.g. Innodb, MyIsam.
- @param[out] msg Message specifying what went wrong, if there is any error.
+ Creates repositories that will be associated to the relay log info.
+
+ @param[in] rli Pointer to the class Relay_log_info.
+ @param[in] rli_option Identifies the type of the repository that will
+ be used, i.e., destination repository.
+ @param[out] handler_src Source repository from where information is
+ copied into the destination repository.
+ @param[out] handler_dest Destination repository to where informaiton is
+ copied.
+ @param[out] msg Error message if something goes wrong.
@retval FALSE No error
@retval TRUE Failure
*/
-bool Rpl_info_factory::change_engine(Rpl_info_table *table, const char *engine,
- const char **msg)
+bool Rpl_info_factory::init_rli_repositories(Relay_log_info *rli,
+ uint rli_option,
+ Rpl_info_handler **handler_src,
+ Rpl_info_handler **handler_dest,
+ const char **msg)
{
- DBUG_ENTER("Rpl_info_factory::decide_engine");
+ bool error= TRUE;
+ *msg= "Failed to allocate memory for relay log info repositories";
+
+ DBUG_ENTER("Rpl_info_factory::init_rli_repositories");
- if (engine && table->change_engine(engine))
+ DBUG_ASSERT(handler_dest != NULL);
+ switch (rli_option)
{
- *msg= "Error changing the engine for a respository.";
- DBUG_RETURN(TRUE);
+ case INFO_REPOSITORY_FILE:
+ if (!(*handler_dest= new Rpl_info_file(rli->get_number_info_rli_fields(),
+ relay_log_info_file)))
+ goto err;
+ if (handler_src &&
+ !(*handler_src= new Rpl_info_table(rli->get_number_info_rli_fields() + 1,
+ RLI_FIELD_ID, MYSQL_SCHEMA_NAME.str, RLI_INFO_NAME.str)))
+ goto err;
+ break;
+
+ case INFO_REPOSITORY_TABLE:
+ if (!(*handler_dest= new Rpl_info_table(rli->get_number_info_rli_fields() + 1,
+ RLI_FIELD_ID, MYSQL_SCHEMA_NAME.str, RLI_INFO_NAME.str)))
+ goto err;
+ if (handler_src &&
+ !(*handler_src= new Rpl_info_file(rli->get_number_info_rli_fields(),
+ relay_log_info_file)))
+ goto err;
+ break;
+ default:
+ DBUG_ASSERT(0);
}
+ error= FALSE;
- DBUG_RETURN(FALSE);
+err:
+ DBUG_RETURN(error);
}
=== modified file 'sql/rpl_info_factory.h'
--- a/sql/rpl_info_factory.h 2010-10-25 10:39:01 +0000
+++ b/sql/rpl_info_factory.h 2011-03-23 23:28:49 +0000
@@ -16,6 +16,7 @@
#ifndef RPL_INFO_FACTORY_H
#define RPL_INFO_FACTORY_H
+#include "table.h"
#include "rpl_info.h"
#include "rpl_mi.h"
#include "rpl_rli.h"
@@ -23,42 +24,43 @@
#include "rpl_info_table.h"
#include "rpl_info_handler.h"
-enum enum_mi_repository
-{
- MI_REPOSITORY_FILE= 0,
- MI_REPOSITORY_TABLE= 1
-};
extern ulong opt_mi_repository_id;
-
-enum enum_rli_repository
-{
- RLI_REPOSITORY_FILE= 0,
- RLI_REPOSITORY_TABLE= 1
-};
extern ulong opt_rli_repository_id;
#define MI_FIELD_ID 0
-
-#define MI_SCHEMA "mysql"
-#define MI_TABLE "slave_master_info"
-
#define RLI_FIELD_ID 0
-#define RLI_SCHEMA "mysql"
-#define RLI_TABLE "slave_relay_log_info"
-
class Rpl_info_factory
{
- public:
-
+public:
static bool create(uint mi_option, Master_info **mi,
uint rli_option, Relay_log_info **rli);
static Master_info *create_mi(uint rli_option);
+ static bool change_mi_repository(Master_info *mi, uint mi_option,
+ const char **msg);
static Relay_log_info *create_rli(uint rli_option, bool is_slave_recovery);
- static bool decide_repository(Rpl_info *info, Rpl_info_table **table,
- Rpl_info_file **file, bool is_table,
+ static bool change_rli_repository(Relay_log_info *mi, uint mi_option,
+ const char **msg);
+private:
+ static bool decide_repository(Rpl_info *info,
+ uint option,
+ Rpl_info_handler **handler_src,
+ Rpl_info_handler **handler_dest,
+ const char **msg);
+ static bool change_repository(Rpl_info *info,
+ uint option,
+ Rpl_info_handler **handler_src,
+ Rpl_info_handler **handler_dest,
const char **msg);
- static bool change_engine(Rpl_info_table *table, const char *engine,
- const char **msg);
+ static bool init_mi_repositories(Master_info *mi,
+ uint mi_option,
+ Rpl_info_handler **handler_src,
+ Rpl_info_handler **handler_dest,
+ const char **msg);
+ static bool init_rli_repositories(Relay_log_info *rli,
+ uint rli_option,
+ Rpl_info_handler **handler_src,
+ Rpl_info_handler **handler_dest,
+ const char **msg);
};
#endif
=== modified file 'sql/rpl_info_file.cc'
--- a/sql/rpl_info_file.cc 2010-10-29 09:07:21 +0000
+++ b/sql/rpl_info_file.cc 2011-04-04 20:59:28 +0000
@@ -122,7 +122,25 @@ int Rpl_info_file::do_prepare_info_for_w
int Rpl_info_file::do_check_info()
{
- return (access(info_fname,F_OK));
+ /*
+ This function checks if the file exists and in other modules
+ further actions are taken based on this. If the file exists
+ but users do not have the appropriated rights to access it,
+ other modules will assume that the file does not exist and
+ will take the appropriate actions and most likely will fail
+ safely after trying to create it.
+
+ This is behavior is not a problem. However, in other modules,
+ it is not possible to print out what is the root of the
+ failure as a detailed error code is not returned. For that
+ reason, we print out such information in here.
+ */
+ if (my_access(info_fname, F_OK | R_OK | W_OK))
+ sql_print_warning("Info file is not ready to be used. Info file "
+ "'%s' cannot be accessed (errno %d).", info_fname,
+ errno);
+
+ return my_access(info_fname, F_OK);
}
int Rpl_info_file::do_flush_info(const bool force)
@@ -294,6 +312,11 @@ bool Rpl_info_file::do_is_transactional(
{
return FALSE;
}
+
+bool Rpl_info_file::do_update_is_transactional()
+{
+ return FALSE;
+}
int init_strvar_from_file(char *var, int max_size, IO_CACHE *f,
const char *default_val)
=== modified file 'sql/rpl_info_file.h'
--- a/sql/rpl_info_file.h 2010-10-25 10:39:01 +0000
+++ b/sql/rpl_info_file.h 2011-03-23 23:28:49 +0000
@@ -20,13 +20,16 @@
#include <sql_priv.h>
#include "rpl_info_handler.h"
+class Rpl_info_factory;
+
/**
Defines a file hander.
*/
class Rpl_info_file : public Rpl_info_handler
{
+ friend class Rpl_info_factory;
+
public:
- Rpl_info_file(int const nparam, const char* param_info_fname);
virtual ~Rpl_info_file() { };
private:
@@ -66,8 +69,11 @@ private:
const Server_ids *default_value);
char* do_get_description_info();
bool do_is_transactional();
+ bool do_update_is_transactional();
- Rpl_info_file& operator=(const Rpl_info_file& info);
+ Rpl_info_file(int const nparam, const char* param_info_fname);
Rpl_info_file(const Rpl_info_file& info);
+
+ Rpl_info_file& operator=(const Rpl_info_file& info);
};
#endif /* RPL_INFO_FILE_H */
=== modified file 'sql/rpl_info_handler.cc'
--- a/sql/rpl_info_handler.cc 2010-10-25 10:39:01 +0000
+++ b/sql/rpl_info_handler.cc 2011-03-23 23:28:49 +0000
@@ -35,10 +35,7 @@ Rpl_info_handler::Rpl_info_handler(const
Rpl_info_handler::~Rpl_info_handler()
{
- if (field_values)
- {
- delete field_values;
- }
+ delete field_values;
}
void Rpl_info_handler::set_sync_period(uint period)
=== modified file 'sql/rpl_info_handler.h'
--- a/sql/rpl_info_handler.h 2011-02-04 11:55:17 +0000
+++ b/sql/rpl_info_handler.h 2011-03-23 23:28:49 +0000
@@ -23,9 +23,6 @@
class Rpl_info_handler
{
public:
- Rpl_info_handler(const int nparam);
- virtual ~Rpl_info_handler();
-
/**
After creating an object and assembling components, this method is
used to initialize internal structures. Everything that does not
@@ -260,6 +257,21 @@ public:
*/
bool is_transactional() { return do_is_transactional(); }
+ /**
+ Updates the value returned by the member function is_transactional()
+ because it may be expensive to compute it whenever is_transactional()
+ is called.
+
+ In the current implementation, the type of the repository can only be
+ changed when replication, i.e. slave, is stopped. For that reason,
+ this member function, i.e. update_is__transactional(), must be called
+ when slave is starting.
+
+ @retval FALSE No error
+ @retval TRUE Failure
+ */
+ bool update_is_transactional() { return do_update_is_transactional(); }
+
/*
Pre-store information before writing it to the repository and if
necessary after reading it from the repository. The decision is
@@ -267,6 +279,8 @@ public:
*/
Rpl_info_values *field_values;
+ virtual ~Rpl_info_handler();
+
protected:
/* Number of fields to be stored in the repository. */
int ninfo;
@@ -289,6 +303,8 @@ protected:
*/
uint sync_period;
+ Rpl_info_handler(const int nparam);
+
private:
virtual int do_init_info()= 0;
virtual int do_check_info()= 0;
@@ -315,8 +331,10 @@ private:
const Server_ids *default_value)= 0;
virtual char* do_get_description_info()= 0;
virtual bool do_is_transactional()= 0;
+ virtual bool do_update_is_transactional()= 0;
- Rpl_info_handler& operator=(const Rpl_info_handler& handler);
Rpl_info_handler(const Rpl_info_handler& handler);
+
+ Rpl_info_handler& operator=(const Rpl_info_handler& handler);
};
#endif /* RPL_INFO_HANDLER_H */
=== modified file 'sql/rpl_info_table.cc'
--- a/sql/rpl_info_table.cc 2010-12-03 00:15:40 +0000
+++ b/sql/rpl_info_table.cc 2011-04-04 10:06:13 +0000
@@ -15,12 +15,12 @@
#include "rpl_info_table.h"
#include "rpl_utility.h"
-#include "sql_parse.h"
Rpl_info_table::Rpl_info_table(uint nparam, uint param_field_idx,
const char* param_schema,
const char *param_table)
-:Rpl_info_handler(nparam), field_idx(param_field_idx)
+:Rpl_info_handler(nparam), field_idx(param_field_idx),
+ is_transactional(FALSE)
{
str_schema.str= str_table.str= NULL;
str_schema.length= str_table.length= 0;
@@ -52,17 +52,13 @@ Rpl_info_table::Rpl_info_table(uint npar
Rpl_info_table::~Rpl_info_table()
{
- if (access)
- delete access;
+ delete access;
- if (description)
- my_free(description);
+ my_free(description);
- if (str_table.str)
- my_free(str_table.str);
+ my_free(str_table.str);
- if (str_schema.str)
- my_free(str_schema.str);
+ my_free(str_schema.str);
}
int Rpl_info_table::do_init_info()
@@ -285,7 +281,12 @@ int Rpl_info_table::do_check_info()
if (access->open_table(thd, str_schema, str_table,
get_number_info(), TL_READ,
&table, &backup))
+ {
+ sql_print_warning("Info table is not ready to be used. Table "
+ "'%s.%s' cannot be opened.", str_schema.str,
+ str_table.str);
goto end;
+ }
/*
Points the cursor at the row to be deleted where the the master_id
@@ -447,47 +448,35 @@ char* Rpl_info_table::do_get_description
bool Rpl_info_table::do_is_transactional()
{
- ulong saved_mode;
- TABLE *table= NULL;
- Open_tables_backup backup;
- bool is_trans= FALSE;
-
- DBUG_ENTER("Rpl_info_table::do_is_transactional");
-
- THD *thd= access->create_thd();
-
- saved_mode= thd->variables.sql_mode;
-
- /*
- Opens and locks the rpl_info table before accessing it.
- */
- if (!access->open_table(thd, str_schema, str_table,
- get_number_info(), TL_READ,
- &table, &backup))
- is_trans= table->file->has_transactions();
-
- access->close_table(thd, table, &backup, 0);
- thd->variables.sql_mode= saved_mode;
- access->drop_thd(thd);
- DBUG_RETURN(is_trans);
+ return is_transactional;
}
-bool Rpl_info_table::change_engine(const char *engine)
+bool Rpl_info_table::do_update_is_transactional()
{
bool error= TRUE;
ulong saved_mode;
-
- DBUG_ENTER("Rpl_info_table::do_check_info");
+ TABLE *table= NULL;
+ Open_tables_backup backup;
+
+ DBUG_ENTER("Rpl_info_table::do_update_is_transactional");
THD *thd= access->create_thd();
-
saved_mode= thd->variables.sql_mode;
tmp_disable_binlog(thd);
- /* TODO: Change the engine using internal functions */
-
+ /*
+ Opens and locks the rpl_info table before accessing it.
+ */
+ if (access->open_table(thd, str_schema, str_table,
+ get_number_info(), TL_READ,
+ &table, &backup))
+ goto end;
+
+ is_transactional= table->file->has_transactions();
error= FALSE;
+end:
+ access->close_table(thd, table, &backup, 0);
reenable_binlog(thd);
thd->variables.sql_mode= saved_mode;
access->drop_thd(thd);
=== modified file 'sql/rpl_info_table.h'
--- a/sql/rpl_info_table.h 2010-10-25 10:39:01 +0000
+++ b/sql/rpl_info_table.h 2011-03-23 23:28:49 +0000
@@ -19,22 +19,15 @@
#include "rpl_info_handler.h"
#include "rpl_info_table_access.h"
+class Rpl_info_factory;
+
class Rpl_info_table : public Rpl_info_handler
{
+ friend class Rpl_info_factory;
+
public:
- Rpl_info_table(uint nparam, uint param_field_id, const char* param_schema,
- const char *param_table);
virtual ~Rpl_info_table();
- /*
- This enables to change the engine in use by internally executing
- an ALTER TABLE ENGINE= engine.
-
- @param[in] engine Type of the engine, e.g. Innodb, MyIsam.
- @retval FALSE No error
- @retval TRUE Failure
- */
- bool change_engine(const char* engine);
private:
/*
This property identifies the name of the schema where a
@@ -65,6 +58,12 @@ private:
*/
Rpl_info_table_access *access;
+ /*
+ Identifies if a table is transactional or non-transactional.
+ This is used to provide a crash-safe behaviour.
+ */
+ bool is_transactional;
+
int do_init_info();
int do_check_info();
void do_end_info();
@@ -90,9 +89,12 @@ private:
const Server_ids *default_value);
char* do_get_description_info();
bool do_is_transactional();
+ bool do_update_is_transactional();
- Rpl_info_table& operator=(const Rpl_info_table& info);
+ Rpl_info_table(uint nparam, uint param_field_id, const char* param_schema,
+ const char *param_table);
Rpl_info_table(const Rpl_info_table& info);
-};
+ Rpl_info_table& operator=(const Rpl_info_table& info);
+};
#endif /* RPL_INFO_TABLE_H */
=== modified file 'sql/rpl_info_table_access.cc'
--- a/sql/rpl_info_table_access.cc 2010-10-27 11:20:32 +0000
+++ b/sql/rpl_info_table_access.cc 2011-03-23 23:28:49 +0000
@@ -288,6 +288,8 @@ THD *Rpl_info_table_access::create_thd()
thd= new THD;
thd->thread_stack= (char*) &thd;
thd->store_globals();
+ thd->security_ctx->skip_grants();
+ thd->system_thread= SYSTEM_THREAD_INFO_REPOSITORY;
}
else
thd= current_thd;
=== modified file 'sql/rpl_info_values.cc'
--- a/sql/rpl_info_values.cc 2010-10-27 09:04:21 +0000
+++ b/sql/rpl_info_values.cc 2011-03-23 23:28:49 +0000
@@ -39,8 +39,5 @@ bool Rpl_info_values::init()
Rpl_info_values::~Rpl_info_values()
{
- for (int pos= 0; pos < ninfo; pos++)
- value[pos].~String();
-
delete [] value;
}
=== modified file 'sql/rpl_mi.cc'
--- a/sql/rpl_mi.cc 2010-12-21 09:33:41 +0000
+++ b/sql/rpl_mi.cc 2011-04-04 09:42:22 +0000
@@ -263,12 +263,10 @@ int Master_info::init_info()
if (necessary_to_configure)
{
init_master_log_pos();
- goto end;
}
else if (read_info(handler))
goto err;
-end:
if (flush_info(TRUE))
goto err;
@@ -276,7 +274,7 @@ end:
DBUG_RETURN(0);
err:
- sql_print_error("Error reading master configuration");
+ sql_print_error("Error reading master configuration.");
DBUG_RETURN(1);
}
=== modified file 'sql/rpl_mi.h'
--- a/sql/rpl_mi.h 2010-12-21 09:33:41 +0000
+++ b/sql/rpl_mi.h 2011-03-23 23:28:49 +0000
@@ -27,6 +27,7 @@
#include "my_sys.h"
typedef struct st_mysql MYSQL;
+class Rpl_info_factory;
/*****************************************************************************
Replication IO Thread
@@ -62,18 +63,9 @@ typedef struct st_mysql MYSQL;
class Master_info : public Rpl_info
{
- public:
- Master_info(
-#ifdef HAVE_PSI_INTERFACE
- PSI_mutex_key *param_key_info_run_lock,
- PSI_mutex_key *param_key_info_data_lock,
- PSI_mutex_key *param_key_info_data_cond,
- PSI_mutex_key *param_key_info_start_cond,
- PSI_mutex_key *param_key_info_stop_cond
-#endif
- );
- virtual ~Master_info();
+ friend class Rpl_info_factory;
+public:
/* the variables below are needed because we can change masters on the fly */
char host[HOSTNAME_LENGTH+1];
char user[USERNAME_LENGTH+1];
@@ -120,6 +112,8 @@ class Master_info : public Rpl_info
bool shall_ignore_server_id(ulong s_id);
+ virtual ~Master_info();
+
protected:
char master_log_name[FN_REFLEN];
my_off_t master_log_pos;
@@ -146,8 +140,18 @@ private:
bool read_info(Rpl_info_handler *from);
bool write_info(Rpl_info_handler *to, bool force);
- Master_info& operator=(const Master_info& info);
+ Master_info(
+#ifdef HAVE_PSI_INTERFACE
+ PSI_mutex_key *param_key_info_run_lock,
+ PSI_mutex_key *param_key_info_data_lock,
+ PSI_mutex_key *param_key_info_data_cond,
+ PSI_mutex_key *param_key_info_start_cond,
+ PSI_mutex_key *param_key_info_stop_cond
+#endif
+ );
Master_info(const Master_info& info);
+
+ Master_info& operator=(const Master_info& info);
};
int change_master_server_id_cmp(ulong *id1, ulong *id2);
=== modified file 'sql/rpl_rli.cc'
--- a/sql/rpl_rli.cc 2011-03-10 10:08:09 +0000
+++ b/sql/rpl_rli.cc 2011-04-04 09:42:22 +0000
@@ -114,7 +114,7 @@ static inline int add_relay_log(Relay_lo
if (!mysql_file_stat(key_file_relaylog,
linfo->log_file_name, &s, MYF(0)))
{
- sql_print_error("log %s listed in the index, but failed to stat",
+ sql_print_error("log %s listed in the index, but failed to stat.",
linfo->log_file_name);
DBUG_RETURN(1);
}
@@ -133,7 +133,7 @@ int Relay_log_info::count_relay_log_spac
log_space_total= 0;
if (relay_log.find_log_pos(&flinfo, NullS, 1))
{
- sql_print_error("Could not find first log while counting relay log space");
+ sql_print_error("Could not find first log while counting relay log space.");
DBUG_RETURN(1);
}
do
@@ -1102,7 +1102,7 @@ int Relay_log_info::init_info()
if (fn_format(pattern, PREFIX_SQL_LOAD, pattern, "",
MY_SAFE_PATH | MY_RETURN_REAL_PATH) == NullS)
{
- sql_print_error("Unable to use slave's temporary directory %s",
+ sql_print_error("Unable to use slave's temporary directory '%s'.",
slave_load_tmpdir);
DBUG_RETURN(1);
}
@@ -1130,7 +1130,7 @@ int Relay_log_info::init_info()
opt_relay_logname[strlen(opt_relay_logname) - 1] == FN_LIBCHAR)
{
sql_print_error("Path '%s' is a directory name, please specify \
-a file name for --relay-log option", opt_relay_logname);
+a file name for --relay-log option.", opt_relay_logname);
DBUG_RETURN(1);
}
@@ -1141,7 +1141,7 @@ a file name for --relay-log option", opt
== FN_LIBCHAR)
{
sql_print_error("Path '%s' is a directory name, please specify \
-a file name for --relay-log-index option", opt_relaylog_index_name);
+a file name for --relay-log-index option.", opt_relaylog_index_name);
DBUG_RETURN(1);
}
@@ -1179,7 +1179,7 @@ a file name for --relay-log-index option
(max_relay_log_size ? max_relay_log_size :
max_binlog_size), 1, TRUE))
{
- sql_print_error("Failed in open_log() called from Relay_log_info::init_info()");
+ sql_print_error("Failed in open_log() called from Relay_log_info::init_info().");
DBUG_RETURN(1);
}
}
@@ -1230,7 +1230,7 @@ a file name for --relay-log-index option
&msg, 0))
{
char llbuf[22];
- sql_print_error("Failed to open the relay log '%s' (relay_log_pos %s)",
+ sql_print_error("Failed to open the relay log '%s' (relay_log_pos %s).",
group_relay_log_name,
llstr(group_relay_log_pos, llbuf));
error= 1;
@@ -1268,7 +1268,7 @@ a file name for --relay-log-index option
DBUG_RETURN(error);
err:
- sql_print_error("%s", msg);
+ sql_print_error("%s.", msg);
relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT);
DBUG_RETURN(error);
}
@@ -1391,7 +1391,7 @@ int Relay_log_info::flush_info(bool forc
DBUG_RETURN(0);
err:
- sql_print_error("Error writing relay log configuration");
+ sql_print_error("Error writing relay log configuration.");
DBUG_RETURN(1);
}
=== modified file 'sql/rpl_rli.h'
--- a/sql/rpl_rli.h 2010-12-21 09:33:41 +0000
+++ b/sql/rpl_rli.h 2011-03-23 23:28:49 +0000
@@ -28,6 +28,7 @@
struct RPL_TABLE_LIST;
class Master_info;
+class Rpl_info_factory;
extern uint sql_slave_skip_counter;
/*******************************************************************************
@@ -104,6 +105,8 @@ tables along with the --relay-log-recove
*******************************************************************************/
class Relay_log_info : public Rpl_info
{
+ friend class Rpl_info_factory;
+
public:
/**
Flags for the state of the replication.
@@ -328,17 +331,6 @@ public:
char slave_patternload_file[FN_REFLEN];
size_t slave_patternload_file_size;
- Relay_log_info(bool is_slave_recovery
-#ifdef HAVE_PSI_INTERFACE
- ,PSI_mutex_key *param_key_info_run_lock,
- PSI_mutex_key *param_key_info_data_lock,
- PSI_mutex_key *param_key_info_data_cond,
- PSI_mutex_key *param_key_info_start_cond,
- PSI_mutex_key *param_key_info_stop_cond
-#endif
- );
- virtual ~Relay_log_info();
-
/**
Invalidates cached until_log_name and group_relay_log_name comparison
result. Should be called after any update of group_realy_log_name if
@@ -585,8 +577,9 @@ public:
void set_sql_delay(time_t _sql_delay) { sql_delay= _sql_delay; }
time_t get_sql_delay_end() { return sql_delay_end; }
-private:
+ virtual ~Relay_log_info();
+private:
/**
Delay slave SQL thread by this amount, compared to master (in
seconds). This is set with CHANGE MASTER TO MASTER_DELAY=X.
@@ -610,6 +603,7 @@ private:
*/
time_t sql_delay_end;
+ uint32 m_flags;
/*
Before the MASTER_DELAY parameter was added (WL#344), relay_log.info
had 4 lines. Now it has 5 lines.
@@ -619,10 +613,18 @@ private:
bool read_info(Rpl_info_handler *from);
bool write_info(Rpl_info_handler *to, bool force);
- Relay_log_info& operator=(const Relay_log_info& info);
+ Relay_log_info(bool is_slave_recovery
+#ifdef HAVE_PSI_INTERFACE
+ ,PSI_mutex_key *param_key_info_run_lock,
+ PSI_mutex_key *param_key_info_data_lock,
+ PSI_mutex_key *param_key_info_data_cond,
+ PSI_mutex_key *param_key_info_start_cond,
+ PSI_mutex_key *param_key_info_stop_cond
+#endif
+ );
Relay_log_info(const Relay_log_info& info);
- uint32 m_flags;
+ Relay_log_info& operator=(const Relay_log_info& info);
};
bool mysql_show_relaylog_events(THD* thd);
=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc 2011-03-29 14:56:01 +0000
+++ b/sql/rpl_slave.cc 2011-04-04 10:06:13 +0000
@@ -141,8 +141,6 @@ failed read"
};
-typedef enum { SLAVE_THD_IO, SLAVE_THD_SQL} SLAVE_THD_TYPE;
-
static int process_io_rotate(Master_info* mi, Rotate_log_event* rev);
static int process_io_create_file(Master_info* mi, Create_file_log_event* cev);
static bool wait_for_relay_log_space(Relay_log_info* rli);
@@ -3534,7 +3532,7 @@ pthread_handler_t handle_slave_sql(void
Relay_log_info* rli = ((Master_info*)arg)->rli;
const char *errmsg;
-
+
// needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff
my_thread_init();
DBUG_ENTER("handle_slave_sql");
@@ -3596,6 +3594,20 @@ pthread_handler_t handle_slave_sql(void
*/
rli->clear_error();
+ if (rli->update_is_transactional())
+ {
+ mysql_cond_broadcast(&rli->start_cond);
+ mysql_mutex_unlock(&rli->run_lock);
+ rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
+ "Error checking if the relay log repository is transactional.");
+ goto err;
+ }
+
+ if (!rli->is_transactional())
+ rli->report(WARNING_LEVEL, 0,
+ "If a crash happens this configuration does not guarantee that the relay "
+ "log info will be consistent");
+
mysql_mutex_unlock(&rli->run_lock);
mysql_cond_broadcast(&rli->start_cond);
@@ -5486,11 +5498,6 @@ bool rpl_master_erroneous_autoinc(THD *t
return FALSE;
}
-#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-template class I_List_iterator<i_string>;
-template class I_List_iterator<i_string_pair>;
-#endif
-
/**
a copy of active_mi->rli->slave_skip_counter, for showing in SHOW VARIABLES,
INFORMATION_SCHEMA.GLOBAL_VARIABLES and @@sql_slave_skip_counter without
=== modified file 'sql/rpl_slave.h'
--- a/sql/rpl_slave.h 2011-03-28 13:19:08 +0000
+++ b/sql/rpl_slave.h 2011-04-04 10:06:13 +0000
@@ -16,6 +16,8 @@
#ifndef RPL_SLAVE_H
#define RPL_SLAVE_H
+typedef enum {SLAVE_THD_IO, SLAVE_THD_SQL} SLAVE_THD_TYPE;
+
/**
MASTER_DELAY can be at most (1 << 31) - 1.
*/
=== modified file 'sql/share/errmsg-utf8.txt'
--- a/sql/share/errmsg-utf8.txt 2011-03-25 14:35:13 +0000
+++ b/sql/share/errmsg-utf8.txt 2011-04-04 10:06:13 +0000
@@ -6495,3 +6495,6 @@ ER_TABLE_NEEDS_REBUILD
WARN_OPTION_BELOW_LIMIT
eng "The value of '%s' should be no less than the value of '%s'"
+
+ER_CHANGE_RPL_INFO_REPOSITORY_FAILURE
+ eng "Failure while changing the type of replication repository: %s."
=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc 2011-03-23 22:51:19 +0000
+++ b/sql/sql_acl.cc 2011-04-04 08:47:25 +0000
@@ -7191,17 +7191,6 @@ bool sp_grant_privileges(THD *thd, const
}
-/*****************************************************************************
- Instantiate used templates
-*****************************************************************************/
-
-#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-template class List_iterator<LEX_COLUMN>;
-template class List_iterator<LEX_USER>;
-template class List<LEX_COLUMN>;
-template class List<LEX_USER>;
-#endif
-
/**
Validate if a user can proxy as another user
=== modified file 'sql/sql_binlog.cc'
--- a/sql/sql_binlog.cc 2010-12-02 13:44:21 +0000
+++ b/sql/sql_binlog.cc 2011-03-23 23:28:49 +0000
@@ -158,7 +158,7 @@ void mysql_client_binlog_statement(THD*
Relay_log_info *rli= thd->rli_fake;
if (!rli)
{
- if ((rli= Rpl_info_factory::create_rli(RLI_REPOSITORY_FILE, FALSE)))
+ if ((rli= Rpl_info_factory::create_rli(INFO_REPOSITORY_FILE, FALSE)))
{
thd->rli_fake= rli;
rli->info_thd= thd;
=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc 2011-03-24 08:00:03 +0000
+++ b/sql/sql_class.cc 2011-04-04 08:47:25 +0000
@@ -67,23 +67,6 @@ char empty_c_string[1]= {0}; /* used
const char * const THD::DEFAULT_WHERE= "field list";
-
-/*****************************************************************************
-** Instansiate templates
-*****************************************************************************/
-
-#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-/* Used templates */
-template class List<Key>;
-template class List_iterator<Key>;
-template class List<Key_part_spec>;
-template class List_iterator<Key_part_spec>;
-template class List<Alter_drop>;
-template class List_iterator<Alter_drop>;
-template class List<Alter_column>;
-template class List_iterator<Alter_column>;
-#endif
-
/****************************************************************************
** User variables
****************************************************************************/
=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h 2011-03-24 08:00:03 +0000
+++ b/sql/sql_class.h 2011-04-04 10:06:13 +0000
@@ -1193,7 +1193,8 @@ enum enum_thread_type
SYSTEM_THREAD_SLAVE_SQL= 4,
SYSTEM_THREAD_NDBCLUSTER_BINLOG= 8,
SYSTEM_THREAD_EVENT_SCHEDULER= 16,
- SYSTEM_THREAD_EVENT_WORKER= 32
+ SYSTEM_THREAD_EVENT_WORKER= 32,
+ SYSTEM_THREAD_INFO_REPOSITORY= 64
};
inline char const *
@@ -1209,6 +1210,7 @@ show_system_thread(enum_thread_type thre
RETURN_NAME_AS_STRING(SYSTEM_THREAD_NDBCLUSTER_BINLOG);
RETURN_NAME_AS_STRING(SYSTEM_THREAD_EVENT_SCHEDULER);
RETURN_NAME_AS_STRING(SYSTEM_THREAD_EVENT_WORKER);
+ RETURN_NAME_AS_STRING(SYSTEM_THREAD_INFO_REPOSITORY);
default:
sprintf(buf, "<UNKNOWN SYSTEM THREAD: %d>", thread);
return buf;
=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc 2011-02-15 17:14:15 +0000
+++ b/sql/sql_insert.cc 2011-04-04 08:47:25 +0000
@@ -4138,17 +4138,3 @@ void select_create::abort_result_set()
}
DBUG_VOID_RETURN;
}
-
-
-/*****************************************************************************
- Instansiate templates
-*****************************************************************************/
-
-#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-template class List_iterator_fast<List_item>;
-#ifndef EMBEDDED_LIBRARY
-template class I_List<Delayed_insert>;
-template class I_List_iterator<Delayed_insert>;
-template class I_List<delayed_row>;
-#endif /* EMBEDDED_LIBRARY */
-#endif /* HAVE_EXPLICIT_TEMPLATE_INSTANTIATION */
=== modified file 'sql/sql_lex.cc'
--- a/sql/sql_lex.cc 2011-03-11 09:35:38 +0000
+++ b/sql/sql_lex.cc 2011-04-01 14:04:52 +0000
@@ -2196,7 +2196,7 @@ void st_select_lex::print_order(String *
}
else
(*order->item)->print(str, query_type);
- if (!order->asc)
+ if (order->direction == ORDER::ORDER_DESC)
str->append(STRING_WITH_LEN(" desc"));
if (order->next)
str->append(',');
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc 2011-03-17 17:39:31 +0000
+++ b/sql/sql_parse.cc 2011-04-01 14:04:52 +0000
@@ -5796,7 +5796,7 @@ bool add_to_list(THD *thd, SQL_I_List<OR
DBUG_RETURN(1);
order->item_ptr= item;
order->item= &order->item_ptr;
- order->asc = asc;
+ order->direction= (asc ? ORDER::ORDER_ASC : ORDER::ORDER_DESC);
order->free_me=0;
order->used=0;
order->counter_used= 0;
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2011-03-29 07:20:17 +0000
+++ b/sql/sql_select.cc 2011-04-04 08:47:25 +0000
@@ -4516,7 +4516,6 @@ static ha_rows get_quick_record_count(TH
TABLE *table,
const key_map *keys,ha_rows limit)
{
- int error;
DBUG_ENTER("get_quick_record_count");
uchar buff[STACK_BUFF_ALLOC];
if (check_stack_overrun(thd, STACK_MIN_SIZE, buff))
@@ -4524,8 +4523,13 @@ static ha_rows get_quick_record_count(TH
if (select)
{
select->head=table;
- if ((error= select->test_quick_select(thd, *(key_map *)keys,(table_map) 0,
- limit, 0, FALSE)) == 1)
+ int error= select->test_quick_select(thd,
+ *keys,
+ 0, //empty table_map
+ limit,
+ false, //don't force quick range
+ ORDER::ORDER_NOT_RELEVANT);
+ if (error == 1)
DBUG_RETURN(select->quick->records);
if (error == -1)
{
@@ -9895,13 +9899,14 @@ static bool make_join_select(JOIN *join,
if (sel->cond && !sel->cond->fixed)
sel->cond->quick_fix_field();
- if (sel->test_quick_select(thd, tab->keys,
- used_tables & ~ current_map,
- (join->select_options &
- OPTION_FOUND_ROWS ?
- HA_POS_ERROR :
- join->unit->select_limit_cnt), 0,
- FALSE) < 0)
+ if (sel->test_quick_select(thd, tab->keys,
+ used_tables & ~ current_map,
+ (join->select_options &
+ OPTION_FOUND_ROWS ?
+ HA_POS_ERROR :
+ join->unit->select_limit_cnt),
+ false, // don't force quick range
+ ORDER::ORDER_NOT_RELEVANT) < 0)
{
/*
Before reporting "Impossible WHERE" for the whole query
@@ -9914,8 +9919,9 @@ static bool make_join_select(JOIN *join,
(join->select_options &
OPTION_FOUND_ROWS ?
HA_POS_ERROR :
- join->unit->select_limit_cnt),0,
- FALSE) < 0)
+ join->unit->select_limit_cnt),
+ false, //don't force quick range
+ ORDER::ORDER_NOT_RELEVANT) < 0)
DBUG_RETURN(1); // Impossible WHERE
}
else
@@ -12009,13 +12015,6 @@ public:
COND_CMP(Item *a,Item_func *b) :and_level(a),cmp_func(b) {}
};
-#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-template class I_List<COND_CMP>;
-template class I_List_iterator<COND_CMP>;
-template class List<Item_func_match>;
-template class List_iterator<Item_func_match>;
-#endif
-
/**
Find the multiple equality predicate containing a field.
@@ -18424,9 +18423,12 @@ test_if_quick_select(JOIN_TAB *tab)
{
delete tab->select->quick;
tab->select->quick=0;
- return tab->select->test_quick_select(tab->join->thd, tab->keys,
- (table_map) 0, HA_POS_ERROR, 0,
- FALSE);
+ return tab->select->test_quick_select(tab->join->thd,
+ tab->keys,
+ 0, // empty table map
+ HA_POS_ERROR,
+ false, // don't force quick range
+ ORDER::ORDER_NOT_RELEVANT);
}
@@ -19651,9 +19653,11 @@ static int test_if_order_by_key(ORDER *o
if (key_part->field != field || !field->part_of_sortkey.is_set(idx))
DBUG_RETURN(0);
+ const ORDER::enum_order keypart_order=
+ (key_part->key_part_flag & HA_REVERSE_SORT) ?
+ ORDER::ORDER_DESC : ORDER::ORDER_ASC;
/* set flag to 1 if we can use read-next on key, else to -1 */
- flag= ((order->asc == !(key_part->key_part_flag & HA_REVERSE_SORT)) ?
- 1 : -1);
+ flag= (order->direction == keypart_order) ? 1 : -1;
if (reverse && flag != reverse)
DBUG_RETURN(0);
reverse=flag; // Remember if reverse
@@ -20110,13 +20114,15 @@ test_if_skip_sort_order(JOIN_TAB *tab,OR
new_ref_key_map.set_bit(new_ref_key); // only for new_ref_key.
select->quick= 0;
- if (select->test_quick_select(tab->join->thd, new_ref_key_map, 0,
+ if (select->test_quick_select(tab->join->thd,
+ new_ref_key_map,
+ 0, // empty table_map
(tab->join->select_options &
OPTION_FOUND_ROWS) ?
HA_POS_ERROR :
- tab->join->unit->select_limit_cnt,0,
- TRUE) <=
- 0)
+ tab->join->unit->select_limit_cnt,
+ false, // don't force quick range
+ order->direction) <= 0)
goto use_filesort;
}
ref_key= new_ref_key;
@@ -20161,11 +20167,14 @@ test_if_skip_sort_order(JOIN_TAB *tab,OR
key_map map; // Force the creation of quick select
map.set_bit(best_key); // only best_key.
select->quick= 0;
- select->test_quick_select(join->thd, map, 0,
+ select->test_quick_select(join->thd,
+ map,
+ 0, // empty table_map
join->select_options & OPTION_FOUND_ROWS ?
HA_POS_ERROR :
join->unit->select_limit_cnt,
- TRUE, FALSE);
+ true, // force quick range
+ order->direction);
}
order_direction= best_key_direction;
/*
@@ -20195,18 +20204,13 @@ check_reverse_order:
*/
if (select->quick->reverse_sorted())
goto skipped_filesort;
- else
- {
- int quick_type= select->quick->get_type();
- if (quick_type == QUICK_SELECT_I::QS_TYPE_INDEX_MERGE ||
- quick_type == QUICK_SELECT_I::QS_TYPE_ROR_INTERSECT ||
- quick_type == QUICK_SELECT_I::QS_TYPE_ROR_UNION ||
- quick_type == QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX)
- {
- tab->limit= 0;
- goto use_filesort; // Use filesort
- }
- }
+
+ /*
+ test_quick_select() should not create a quick that cannot do
+ reverse ordering
+ */
+ DBUG_ASSERT((select->quick == save_quick) ||
+ select->quick->reverse_sort_possible());
}
}
@@ -20316,7 +20320,7 @@ check_reverse_order:
/*
Cleanup:
We may have both a 'select->quick' and 'save_quick' (original)
- at this point. Delete the one that we wan't use.
+ at this point. Delete the one that we won't use.
*/
skipped_filesort:
@@ -20823,7 +20827,7 @@ SORT_FIELD *make_unireg_sortorder(ORDER
}
else
pos->item= *order->item;
- pos->reverse=! order->asc;
+ pos->reverse= (order->direction == ORDER::ORDER_DESC);
DBUG_ASSERT(pos->field != NULL || pos->item != NULL);
}
*length=count;
@@ -21336,7 +21340,7 @@ create_distinct_group(THD *thd, Item **r
*/
ord->item= ref_pointer_array;
}
- ord->asc=1;
+ ord->direction= ORDER::ORDER_ASC;
*prev=ord;
prev= &ord->next;
}
@@ -21413,7 +21417,7 @@ test_if_subpart(ORDER *a,ORDER *b)
for (; a && b; a=a->next,b=b->next)
{
if ((*a->item)->eq(*b->item,1))
- a->asc=b->asc;
+ a->direction= b->direction;
else
return 0;
}
=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc 2011-03-28 08:10:39 +0000
+++ b/sql/sql_show.cc 2011-04-04 08:47:25 +0000
@@ -1751,10 +1751,6 @@ public:
CSET_STRING query_string;
};
-#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-template class I_List<thread_info>;
-#endif
-
static const char *thread_state_info(THD *tmp)
{
#ifndef EMBEDDED_LIBRARY
@@ -7522,11 +7518,6 @@ ST_SCHEMA_TABLE schema_tables[]=
};
-#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-template class List_iterator_fast<char>;
-template class List<char>;
-#endif
-
int initialize_schema_table(st_plugin_int *plugin)
{
ST_SCHEMA_TABLE *schema_table;
=== modified file 'sql/sql_update.cc'
--- a/sql/sql_update.cc 2011-02-25 16:41:57 +0000
+++ b/sql/sql_update.cc 2011-04-01 14:04:52 +0000
@@ -1732,7 +1732,7 @@ loop_end:
/* Make an unique key over the first field to avoid duplicated updates */
bzero((char*) &group, sizeof(group));
- group.asc= 1;
+ group.direction= ORDER::ORDER_ASC;
group.item= (Item**) temp_fields.head_ref();
tmp_param->quick_group=1;
=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc 2011-03-25 14:35:13 +0000
+++ b/sql/sys_vars.cc 2011-04-04 10:06:13 +0000
@@ -36,6 +36,8 @@
#include <thr_alarm.h>
#include "rpl_slave.h"
#include "rpl_mi.h"
+#include "rpl_rli.h"
+#include "rpl_slave.h"
#include "rpl_info_factory.h"
#include "transaction.h"
#include "mysqld.h"
@@ -490,6 +492,73 @@ static Sys_var_mybool Sys_binlog_direct(
CMD_LINE(OPT_ARG), DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(binlog_direct_check));
+static bool repository_check(sys_var *self, THD *thd, set_var *var, SLAVE_THD_TYPE thread_mask)
+{
+ bool ret= FALSE;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ if (!(thd->security_ctx->master_access & SUPER_ACL))
+ {
+ my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER");
+ return TRUE;
+ }
+#endif
+#ifdef HAVE_REPLICATION
+ int running= 0;
+ const char *msg= NULL;
+ mysql_mutex_lock(&LOCK_active_mi);
+ if (active_mi)
+ {
+ lock_slave_threads(active_mi);
+ init_thread_mask(&running, active_mi, FALSE);
+ if(!running)
+ {
+ switch (thread_mask)
+ {
+ case SLAVE_THD_IO:
+ if (Rpl_info_factory::change_mi_repository(active_mi,
+ var->save_result.ulonglong_value,
+ &msg))
+ {
+ ret= TRUE;
+ my_error(ER_CHANGE_RPL_INFO_REPOSITORY_FAILURE, MYF(0), msg);
+ }
+ break;
+ case SLAVE_THD_SQL:
+ if (Rpl_info_factory::change_rli_repository(active_mi->rli,
+ var->save_result.ulonglong_value,
+ &msg))
+ {
+ ret= TRUE;
+ my_error(ER_CHANGE_RPL_INFO_REPOSITORY_FAILURE, MYF(0), msg);
+ }
+ break;
+ default:
+ assert(0);
+ break;
+ }
+ }
+ else
+ {
+ ret= TRUE;
+ my_error(ER_SLAVE_MUST_STOP, MYF(0));
+ }
+ unlock_slave_threads(active_mi);
+ }
+ mysql_mutex_unlock(&LOCK_active_mi);
+#endif
+ return ret;
+}
+
+static bool relay_log_info_repository_check(sys_var *self, THD *thd, set_var *var)
+{
+ return repository_check(self, thd, var, SLAVE_THD_SQL);
+}
+
+static bool master_info_repository_check(sys_var *self, THD *thd, set_var *var)
+{
+ return repository_check(self, thd, var, SLAVE_THD_IO);
+}
+
static const char *repository_names[]=
{
"FILE", "TABLE", 0
@@ -499,15 +568,19 @@ ulong opt_mi_repository_id;
static Sys_var_enum Sys_mi_repository(
"master_info_repository",
"Defines the type of the repository for the master information."
- , READ_ONLY GLOBAL_VAR(opt_mi_repository_id), CMD_LINE(REQUIRED_ARG),
- repository_names, DEFAULT(0));
+ ,GLOBAL_VAR(opt_mi_repository_id), CMD_LINE(REQUIRED_ARG),
+ repository_names, DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
+ ON_CHECK(master_info_repository_check),
+ ON_UPDATE(0));
ulong opt_rli_repository_id;
static Sys_var_enum Sys_rli_repository(
"relay_log_info_repository",
"Defines the type of the repository for the relay log information."
- , READ_ONLY GLOBAL_VAR(opt_rli_repository_id), CMD_LINE(REQUIRED_ARG),
- repository_names, DEFAULT(0));
+ ,GLOBAL_VAR(opt_rli_repository_id), CMD_LINE(REQUIRED_ARG),
+ repository_names, DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
+ ON_CHECK(relay_log_info_repository_check),
+ ON_UPDATE(0));
static Sys_var_mybool Sys_binlog_rows_query(
"binlog_rows_query_log_events",
=== modified file 'sql/sys_vars.h'
--- a/sql/sys_vars.h 2011-03-09 20:54:55 +0000
+++ b/sql/sys_vars.h 2011-04-04 08:47:25 +0000
@@ -1725,16 +1725,3 @@ public:
virtual bool global_update(THD *thd, set_var *var);
};
-/****************************************************************************
- Used templates
-****************************************************************************/
-
-#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-template class List<set_var_base>;
-template class List_iterator_fast<set_var_base>;
-template class Sys_var_unsigned<uint, GET_UINT, SHOW_INT>;
-template class Sys_var_unsigned<ulong, GET_ULONG, SHOW_LONG>;
-template class Sys_var_unsigned<ha_rows, GET_HA_ROWS, SHOW_HA_ROWS>;
-template class Sys_var_unsigned<ulonglong, GET_ULL, SHOW_LONGLONG>;
-#endif
-
=== modified file 'sql/table.cc'
--- a/sql/table.cc 2011-03-28 08:10:39 +0000
+++ b/sql/table.cc 2011-04-04 08:47:25 +0000
@@ -5488,13 +5488,3 @@ bool is_simple_order(ORDER *order)
}
return TRUE;
}
-
-
-/*****************************************************************************
-** Instansiate templates
-*****************************************************************************/
-
-#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-template class List<String>;
-template class List_iterator<String>;
-#endif
=== modified file 'sql/table.h'
--- a/sql/table.h 2011-03-30 11:43:32 +0000
+++ b/sql/table.h 2011-04-04 10:06:13 +0000
@@ -190,16 +190,22 @@ private:
typedef struct st_order {
struct st_order *next;
- Item **item; /* Point at item in select fields */
- Item *item_ptr; /* Storage for initial item */
+ Item **item; /* Point at item in select fields */
+ Item *item_ptr; /* Storage for initial item */
int counter; /* position in SELECT list, correct
- only if counter_used is true*/
- bool asc; /* true if ascending */
- bool free_me; /* true if item isn't shared */
- bool in_field_list; /* true if in select field list */
+ only if counter_used is true */
+ enum enum_order {
+ ORDER_NOT_RELEVANT,
+ ORDER_ASC,
+ ORDER_DESC
+ };
+
+ enum_order direction; /* Requested direction of ordering */
+ bool free_me; /* true if item isn't shared */
+ bool in_field_list; /* true if in select field list */
bool counter_used; /* parameter was counter of columns */
- Field *field; /* If tmp-table group */
- char *buff; /* If tmp-table group */
+ Field *field; /* If tmp-table group */
+ char *buff; /* If tmp-table group */
table_map used, depend_map;
} ORDER;
@@ -2197,6 +2203,10 @@ extern LEX_STRING SLOW_LOG_NAME;
extern LEX_STRING INFORMATION_SCHEMA_NAME;
extern LEX_STRING MYSQL_SCHEMA_NAME;
+/* replication's tables */
+extern LEX_STRING RLI_INFO_NAME;
+extern LEX_STRING MI_INFO_NAME;
+
inline bool is_infoschema_db(const char *name, size_t len)
{
return (INFORMATION_SCHEMA_NAME.length == len &&
=== modified file 'storage/innobase/handler/handler0alter.cc'
--- a/storage/innobase/handler/handler0alter.cc 2011-02-14 10:26:00 +0000
+++ b/storage/innobase/handler/handler0alter.cc 2011-03-30 12:20:45 +0000
@@ -638,7 +638,7 @@ innobase_add_index_cleanup(
{
mem_heap_free(heap);
- trx_general_rollback_for_mysql(trx, NULL);
+ trx_rollback_to_savepoint(trx, NULL);
ut_a(trx != prebuilt->trx);
=== modified file 'storage/innobase/include/sync0arr.h'
--- a/storage/innobase/include/sync0arr.h 2010-07-16 21:00:50 +0000
+++ b/storage/innobase/include/sync0arr.h 2011-03-30 12:02:53 +0000
@@ -115,8 +115,11 @@ Prints warnings of long semaphore waits
@return TRUE if fatal semaphore wait threshold was exceeded */
UNIV_INTERN
ibool
-sync_array_print_long_waits(void);
-/*=============================*/
+sync_array_print_long_waits(
+/*========================*/
+ os_thread_id_t* waiter, /*!< out: longest waiting thread */
+ const void** sema) /*!< out: longest-waited-for semaphore */
+ __attribute__((nonnull));
/********************************************************************//**
Validates the integrity of the wait array. Checks
that the number of reserved cells equals the count variable. */
=== modified file 'storage/innobase/include/trx0roll.h'
--- a/storage/innobase/include/trx0roll.h 2011-01-24 10:28:28 +0000
+++ b/storage/innobase/include/trx0roll.h 2011-03-30 12:20:45 +0000
@@ -159,12 +159,12 @@ trx_rollback_last_sql_stat_for_mysql(
/*=================================*/
trx_t* trx); /*!< in/out: transaction */
/*******************************************************************//**
-Rollback a transaction used in MySQL.
+Rollback a transaction to a given savepoint or do a complete rollback.
@return error code or DB_SUCCESS */
UNIV_INTERN
int
-trx_general_rollback_for_mysql(
-/*===========================*/
+trx_rollback_to_savepoint(
+/*======================*/
trx_t* trx, /*!< in: transaction handle */
trx_savept_t* savept);/*!< in: pointer to savepoint undo number, if
partial rollback requested, or NULL for
=== modified file 'storage/innobase/row/row0merge.c'
--- a/storage/innobase/row/row0merge.c 2011-03-18 15:48:14 +0000
+++ b/storage/innobase/row/row0merge.c 2011-03-30 12:20:45 +0000
@@ -2461,7 +2461,7 @@ row_merge_rename_tables(
if (err != DB_SUCCESS) {
err_exit:
trx->error_state = DB_SUCCESS;
- trx_general_rollback_for_mysql(trx, NULL);
+ trx_rollback_to_savepoint(trx, NULL);
trx->error_state = DB_SUCCESS;
}
=== modified file 'storage/innobase/row/row0mysql.c'
--- a/storage/innobase/row/row0mysql.c 2011-03-18 15:48:14 +0000
+++ b/storage/innobase/row/row0mysql.c 2011-03-30 12:20:45 +0000
@@ -579,7 +579,7 @@ handle_new_error:
switch (err) {
case DB_LOCK_WAIT_TIMEOUT:
if (row_rollback_on_timeout) {
- trx_general_rollback_for_mysql(trx, NULL);
+ trx_rollback_to_savepoint(trx, NULL);
break;
}
/* fall through */
@@ -596,7 +596,7 @@ handle_new_error:
/* Roll back the latest, possibly incomplete
insertion or update */
- trx_general_rollback_for_mysql(trx, savept);
+ trx_rollback_to_savepoint(trx, savept);
}
/* MySQL will roll back the latest SQL statement */
break;
@@ -618,7 +618,7 @@ handle_new_error:
/* Roll back the whole transaction; this resolution was added
to version 3.23.43 */
- trx_general_rollback_for_mysql(trx, NULL);
+ trx_rollback_to_savepoint(trx, NULL);
break;
case DB_MUST_GET_MORE_FILE_SPACE:
@@ -1941,7 +1941,7 @@ err_exit:
break;
case DB_OUT_OF_FILE_SPACE:
trx->error_state = DB_SUCCESS;
- trx_general_rollback_for_mysql(trx, NULL);
+ trx_rollback_to_savepoint(trx, NULL);
ut_print_timestamp(stderr);
fputs(" InnoDB: Warning: cannot create table ",
@@ -1971,7 +1971,7 @@ err_exit:
table already exists */
trx->error_state = DB_SUCCESS;
- trx_general_rollback_for_mysql(trx, NULL);
+ trx_rollback_to_savepoint(trx, NULL);
dict_mem_table_free(table);
break;
}
@@ -2095,7 +2095,7 @@ error_handling:
trx->error_state = DB_SUCCESS;
- trx_general_rollback_for_mysql(trx, NULL);
+ trx_rollback_to_savepoint(trx, NULL);
row_drop_table_for_mysql(table_name, trx, FALSE);
@@ -2164,7 +2164,7 @@ row_table_add_foreign_constraints(
trx->error_state = DB_SUCCESS;
- trx_general_rollback_for_mysql(trx, NULL);
+ trx_rollback_to_savepoint(trx, NULL);
row_drop_table_for_mysql(name, trx, FALSE);
@@ -2533,7 +2533,7 @@ row_discard_tablespace_for_mysql(
if (err != DB_SUCCESS) {
trx->error_state = DB_SUCCESS;
- trx_general_rollback_for_mysql(trx, NULL);
+ trx_rollback_to_savepoint(trx, NULL);
trx->error_state = DB_SUCCESS;
} else {
dict_table_change_id_in_cache(table, new_id);
@@ -2542,7 +2542,7 @@ row_discard_tablespace_for_mysql(
if (!success) {
trx->error_state = DB_SUCCESS;
- trx_general_rollback_for_mysql(trx, NULL);
+ trx_rollback_to_savepoint(trx, NULL);
trx->error_state = DB_SUCCESS;
err = DB_ERROR;
@@ -3028,7 +3028,7 @@ next_rec:
if (err != DB_SUCCESS) {
trx->error_state = DB_SUCCESS;
- trx_general_rollback_for_mysql(trx, NULL);
+ trx_rollback_to_savepoint(trx, NULL);
trx->error_state = DB_SUCCESS;
ut_print_timestamp(stderr);
fputs(" InnoDB: Unable to assign a new identifier to table ",
@@ -3494,7 +3494,7 @@ check_next_foreign:
fprintf(stderr, ".\n");
trx->error_state = DB_SUCCESS;
- trx_general_rollback_for_mysql(trx, NULL);
+ trx_rollback_to_savepoint(trx, NULL);
trx->error_state = DB_SUCCESS;
}
@@ -4085,7 +4085,7 @@ end:
"InnoDB: succeed.\n", stderr);
}
trx->error_state = DB_SUCCESS;
- trx_general_rollback_for_mysql(trx, NULL);
+ trx_rollback_to_savepoint(trx, NULL);
trx->error_state = DB_SUCCESS;
} else {
/* The following call will also rename the .ibd data file if
@@ -4094,7 +4094,7 @@ end:
if (!dict_table_rename_in_cache(table, new_name,
!new_is_tmp)) {
trx->error_state = DB_SUCCESS;
- trx_general_rollback_for_mysql(trx, NULL);
+ trx_rollback_to_savepoint(trx, NULL);
trx->error_state = DB_SUCCESS;
goto funct_exit;
}
@@ -4134,7 +4134,7 @@ end:
ut_a(dict_table_rename_in_cache(table,
old_name, FALSE));
trx->error_state = DB_SUCCESS;
- trx_general_rollback_for_mysql(trx, NULL);
+ trx_rollback_to_savepoint(trx, NULL);
trx->error_state = DB_SUCCESS;
}
}
=== modified file 'storage/innobase/srv/srv0srv.c'
--- a/storage/innobase/srv/srv0srv.c 2011-03-24 12:24:08 +0000
+++ b/storage/innobase/srv/srv0srv.c 2011-03-30 12:02:53 +0000
@@ -1867,6 +1867,12 @@ srv_error_monitor_thread(
lsn_t old_lsn;
lsn_t new_lsn;
ib_int64_t sig_count;
+ /* longest waiting thread for a semaphore */
+ os_thread_id_t waiter = os_thread_get_curr_id();
+ os_thread_id_t old_waiter = waiter;
+ /* the semaphore that is being waited for */
+ const void* sema = NULL;
+ const void* old_sema = NULL;
old_lsn = srv_start_lsn;
@@ -1919,7 +1925,8 @@ loop:
sync_arr_wake_threads_if_sema_free();
- if (sync_array_print_long_waits()) {
+ if (sync_array_print_long_waits(&waiter, &sema)
+ && sema == old_sema && os_thread_eq(waiter, old_waiter)) {
fatal_cnt++;
if (fatal_cnt > 10) {
@@ -1934,6 +1941,8 @@ loop:
}
} else {
fatal_cnt = 0;
+ old_waiter = waiter;
+ old_sema = sema;
}
/* Flush stderr so that a database user gets the output
=== modified file 'storage/innobase/sync/sync0arr.c'
--- a/storage/innobase/sync/sync0arr.c 2011-02-25 09:27:27 +0000
+++ b/storage/innobase/sync/sync0arr.c 2011-03-30 12:02:53 +0000
@@ -915,8 +915,10 @@ Prints warnings of long semaphore waits
@return TRUE if fatal semaphore wait threshold was exceeded */
UNIV_INTERN
ibool
-sync_array_print_long_waits(void)
-/*=============================*/
+sync_array_print_long_waits(
+/*========================*/
+ os_thread_id_t* waiter, /*!< out: longest waiting thread */
+ const void** sema) /*!< out: longest-waited-for semaphore */
{
sync_cell_t* cell;
ibool old_val;
@@ -924,6 +926,7 @@ sync_array_print_long_waits(void)
ulint i;
ulint fatal_timeout = srv_fatal_semaphore_wait_threshold;
ibool fatal = FALSE;
+ double longest_diff = 0;
#ifdef UNIV_DEBUG_VALGRIND
/* Increase the timeouts if running under valgrind because it executes
@@ -939,22 +942,36 @@ sync_array_print_long_waits(void)
for (i = 0; i < sync_primary_wait_array->n_cells; i++) {
+ double diff;
+ void* wait_object;
+
cell = sync_array_get_nth_cell(sync_primary_wait_array, i);
- if (cell->wait_object != NULL && cell->waiting
- && difftime(time(NULL), cell->reservation_time)
- > SYNC_ARRAY_TIMEOUT) {
+ wait_object = cell->wait_object;
+
+ if (wait_object == NULL || !cell->waiting) {
+
+ continue;
+ }
+
+ diff = difftime(time(NULL), cell->reservation_time);
+
+ if (diff > SYNC_ARRAY_TIMEOUT) {
fputs("InnoDB: Warning: a long semaphore wait:\n",
stderr);
sync_array_cell_print(stderr, cell);
noticed = TRUE;
}
- if (cell->wait_object != NULL && cell->waiting
- && difftime(time(NULL), cell->reservation_time)
- > fatal_timeout) {
+ if (diff > fatal_timeout) {
fatal = TRUE;
}
+
+ if (diff > longest_diff) {
+ longest_diff = diff;
+ *sema = wait_object;
+ *waiter = cell->thread;
+ }
}
if (noticed) {
=== modified file 'storage/innobase/trx/trx0roll.c'
--- a/storage/innobase/trx/trx0roll.c 2011-02-17 14:06:09 +0000
+++ b/storage/innobase/trx/trx0roll.c 2011-03-30 12:20:45 +0000
@@ -72,8 +72,8 @@ trx_rollback_finish(
Rollback a transaction used in MySQL. */
static
void
-trx_general_rollback_for_mysql_low(
-/*===============================*/
+trx_rollback_to_savepoint_low(
+/*==========================*/
trx_t* trx, /*!< in: transaction handle */
trx_savept_t* savept) /*!< in: pointer to savepoint undo number, if
partial rollback requested, or NULL for
@@ -122,12 +122,12 @@ trx_general_rollback_for_mysql_low(
}
/*******************************************************************//**
-Rollback a transaction used in MySQL.
+Rollback a transaction to a given savepoint or do a complete rollback.
@return error code or DB_SUCCESS */
UNIV_INTERN
int
-trx_general_rollback_for_mysql(
-/*===========================*/
+trx_rollback_to_savepoint(
+/*======================*/
trx_t* trx, /*!< in: transaction handle */
trx_savept_t* savept) /*!< in: pointer to savepoint undo number, if
partial rollback requested, or NULL for
@@ -142,7 +142,7 @@ trx_general_rollback_for_mysql(
trx_start_if_not_started_xa(trx);
- trx_general_rollback_for_mysql_low(trx, savept);
+ trx_rollback_to_savepoint_low(trx, savept);
/* Tell Innobase server that there might be work for
utility threads: */
@@ -185,7 +185,7 @@ trx_rollback_for_mysql(
object, and we set a dummy session that we use for all MySQL
transactions. */
- trx_general_rollback_for_mysql_low(trx, NULL);
+ trx_rollback_to_savepoint_low(trx, NULL);
trx->op_info = "";
@@ -227,7 +227,7 @@ trx_rollback_last_sql_stat_for_mysql(
trx->op_info = "rollback of SQL statement";
- err = trx_general_rollback_for_mysql(
+ err = trx_rollback_to_savepoint(
trx, &trx->last_sql_stat_start);
/* The following call should not be needed,
@@ -316,10 +316,10 @@ the row, these locks are naturally relea
were set after this savepoint are deleted.
@return if no savepoint of the name found then DB_NO_SAVEPOINT,
otherwise DB_SUCCESS */
-UNIV_INTERN
+static
ulint
-trx_rollback_to_savepoint_low(
-/*==========================*/
+trx_rollback_to_savepoint_for_mysql_low(
+/*====================================*/
trx_t* trx, /*!< in/out: transaction */
trx_named_savept_t* savep, /*!< in/out: savepoint */
ib_int64_t* mysql_binlog_cache_pos)
@@ -344,7 +344,7 @@ trx_rollback_to_savepoint_low(
trx->op_info = "rollback to a savepoint";
- err = trx_general_rollback_for_mysql(trx, &savep->savept);
+ err = trx_rollback_to_savepoint(trx, &savep->savept);
/* Store the current undo_no of the transaction so that
we know where to roll back if we have to roll back the
@@ -401,8 +401,8 @@ trx_rollback_to_savepoint_for_mysql(
fputs(" though it is not started\n", stderr);
return(DB_ERROR);
case TRX_STATE_ACTIVE:
- return(trx_rollback_to_savepoint_low(trx, savep,
- mysql_binlog_cache_pos));
+ return(trx_rollback_to_savepoint_for_mysql_low(
+ trx, savep, mysql_binlog_cache_pos));
case TRX_STATE_PREPARED:
case TRX_STATE_COMMITTED_IN_MEMORY:
/* The savepoint rollback is only allowed on an ACTIVE
=== modified file 'storage/perfschema/ha_perfschema.h'
--- a/storage/perfschema/ha_perfschema.h 2011-03-22 11:44:40 +0000
+++ b/storage/perfschema/ha_perfschema.h 2011-04-04 14:34:42 +0000
@@ -28,12 +28,18 @@
*/
struct PFS_engine_table_share;
class PFS_engine_table;
+/** Name of the performance schema engine. */
extern const char *pfs_engine_name;
/** A handler for a PERFORMANCE_SCHEMA table. */
class ha_perfschema : public handler
{
public:
+ /**
+ Create a new performance schema table handle on a table.
+ @param hton storage engine handler singleton
+ @param share table share
+ */
ha_perfschema(handlerton *hton, TABLE_SHARE *share);
~ha_perfschema();
@@ -97,26 +103,72 @@ public:
double scan_time(void)
{ return 1.0; }
+ /**
+ Open a performance schema table.
+ @param name the table to open
+ @param mode unused
+ @param test_if_locked unused
+ @return 0 on success
+ */
int open(const char *name, int mode, uint test_if_locked);
+ /**
+ Close a table handle.
+ @sa open.
+ */
int close(void);
+ /**
+ Write a row.
+ @param buf the row to write
+ @return 0 on success
+ */
int write_row(uchar *buf);
void use_hidden_primary_key();
+ /**
+ Update a row.
+ @param old_data the row old values
+ @param new_data the row new values
+ @return 0 on success
+ */
int update_row(const uchar *old_data, uchar *new_data);
+ /**
+ Delete a row.
+ @param buf the row to delete
+ @return 0 on success
+ */
int delete_row(const uchar *buf);
int rnd_init(bool scan);
+ /**
+ Scan end.
+ @sa rnd_init.
+ */
int rnd_end(void);
+ /**
+ Iterator, fetch the next row.
+ @param[out] buf the row fetched.
+ @return 0 on success
+ */
int rnd_next(uchar *buf);
+ /**
+ Iterator, fetch the row at a given position.
+ @param[out] buf the row fetched.
+ @param pos the row position
+ @return 0 on success
+ */
int rnd_pos(uchar *buf, uchar *pos);
+ /**
+ Read the row current position.
+ @param record the current row
+ */
void position(const uchar *record);
int info(uint);
=== modified file 'storage/perfschema/pfs.h'
--- a/storage/perfschema/pfs.h 2010-07-16 01:28:30 +0000
+++ b/storage/perfschema/pfs.h 2011-04-04 14:34:42 +0000
@@ -27,8 +27,14 @@
#include <my_pthread.h>
#include <mysql/psi/psi.h>
+/**
+ Entry point to the performance schema implementation.
+ This singleton is used to discover the performance schema services.
+*/
extern struct PSI_bootstrap PFS_bootstrap;
+/** Performance schema Thread Local Storage key. */
extern pthread_key(PFS_thread*, THR_PFS);
+/** True when @c THR_PFS is initialized. */
extern bool THR_PFS_initialized;
#endif
=== modified file 'storage/perfschema/pfs_atomic.h'
--- a/storage/perfschema/pfs_atomic.h 2010-07-16 01:28:30 +0000
+++ b/storage/perfschema/pfs_atomic.h 2011-04-04 14:34:42 +0000
@@ -27,7 +27,9 @@
class PFS_atomic
{
public:
+ /** Initialise the PFS_atomic component. */
static void init();
+ /** Cleanup the PFS_atomic component. */
static void cleanup();
/** Atomic load. */
@@ -112,6 +114,10 @@ public:
private:
static my_atomic_rwlock_t m_rwlock_array[256];
+ /**
+ Helper used only with non native atomic implementations.
+ @sa MY_ATOMIC_MODE_RWLOCKS
+ */
static inline my_atomic_rwlock_t *get_rwlock(volatile void *ptr)
{
/*
@@ -123,21 +129,37 @@ private:
return result;
}
+ /**
+ Helper used only with non native atomic implementations.
+ @sa MY_ATOMIC_MODE_RWLOCKS
+ */
static inline void rdlock(volatile void *ptr)
{
my_atomic_rwlock_rdlock(get_rwlock(ptr));
}
+ /**
+ Helper used only with non native atomic implementations.
+ @sa MY_ATOMIC_MODE_RWLOCKS
+ */
static inline void wrlock(volatile void *ptr)
{
my_atomic_rwlock_wrlock(get_rwlock(ptr));
}
+ /**
+ Helper used only with non native atomic implementations.
+ @sa MY_ATOMIC_MODE_RWLOCKS
+ */
static inline void rdunlock(volatile void *ptr)
{
my_atomic_rwlock_rdunlock(get_rwlock(ptr));
}
+ /**
+ Helper used only with non native atomic implementations.
+ @sa MY_ATOMIC_MODE_RWLOCKS
+ */
static inline void wrunlock(volatile void *ptr)
{
my_atomic_rwlock_wrunlock(get_rwlock(ptr));
=== modified file 'storage/perfschema/pfs_column_types.h'
--- a/storage/perfschema/pfs_column_types.h 2011-02-14 14:23:55 +0000
+++ b/storage/perfschema/pfs_column_types.h 2011-04-04 14:34:42 +0000
@@ -68,8 +68,11 @@ enum enum_timer_name
TIMER_NAME_TICK= 5
};
+/** Integer, first value of @sa enum_timer_name. */
#define FIRST_TIMER_NAME (static_cast<int> (TIMER_NAME_CYCLE))
+/** Integer, last value of @sa enum_timer_name. */
#define LAST_TIMER_NAME (static_cast<int> (TIMER_NAME_TICK))
+/** Integer, number of values of @sa enum_timer_name. */
#define COUNT_TIMER_NAME (LAST_TIMER_NAME - FIRST_TIMER_NAME + 1)
/**
@@ -146,17 +149,26 @@ enum enum_operation_type
OPERATION_TYPE_TL_READ_EXTERNAL= 39,
OPERATION_TYPE_TL_WRITE_EXTERNAL= 40
};
+/** Integer, first value of @sa enum_operation_type. */
#define FIRST_OPERATION_TYPE (static_cast<int> (OPERATION_TYPE_LOCK))
+/** Integer, last value of @sa enum_operation_type. */
#define LAST_OPERATION_TYPE (static_cast<int> (OPERATION_TYPE_TL_WRITE_EXTERNAL))
+/** Integer, number of values of @sa enum_operation_type. */
#define COUNT_OPERATION_TYPE (LAST_OPERATION_TYPE - FIRST_OPERATION_TYPE + 1)
+/**
+ Enum values for the various OBJECT_TYPE columns.
+*/
enum enum_object_type
{
OBJECT_TYPE_TABLE= 1,
OBJECT_TYPE_TEMPORARY_TABLE= 2
};
+/** Integer, first value of @sa enum_object_type. */
#define FIRST_OBJECT_TYPE (static_cast<int> (OBJECT_TYPE_TABLE))
+/** Integer, last value of @sa enum_object_type. */
#define LAST_OBJECT_TYPE (static_cast<int> (OBJECT_TYPE_TEMPORARY_TABLE))
+/** Integer, number of values of @sa enum_object_type. */
#define COUNT_OBJECT_TYPE (LAST_OBJECT_TYPE - FIRST_OBJECT_TYPE + 1)
/**
@@ -173,8 +185,11 @@ enum enum_event_type
EVENT_TYPE_WAIT= 3
};
+/** Integer, first value of @sa enum_event_type. */
#define FIRST_EVENT_TYPE (static_cast<int> (EVENT_TYPE_STATEMENT))
+/** Integer, last value of @sa enum_event_type. */
#define LAST_EVENT_TYPE (static_cast<int> (EVENT_TYPE_WAIT))
+/** Integer, number of values of @sa enum_event_type. */
#define COUNT_EVENT_TYPE (LAST_EVENT_TYPE - FIRST_EVENT_TYPE + 1)
#endif
=== modified file 'storage/perfschema/pfs_column_values.h'
--- a/storage/perfschema/pfs_column_values.h 2011-02-14 14:23:55 +0000
+++ b/storage/perfschema/pfs_column_values.h 2011-04-04 14:34:42 +0000
@@ -24,14 +24,22 @@
performance schema tables (declarations).
*/
+/** String, "PERFORMANCE_SCHEMA". */
extern LEX_STRING PERFORMANCE_SCHEMA_str;
+/** String prefix for all mutex instruments. */
extern LEX_STRING mutex_instrument_prefix;
+/** String prefix for all rwlock instruments. */
extern LEX_STRING rwlock_instrument_prefix;
+/** String prefix for all cond instruments. */
extern LEX_STRING cond_instrument_prefix;
+/** String prefix for all thread instruments. */
extern LEX_STRING thread_instrument_prefix;
+/** String prefix for all file instruments. */
extern LEX_STRING file_instrument_prefix;
+/** String prefix for all stage instruments. */
extern LEX_STRING stage_instrument_prefix;
+/** String prefix for all statement instruments. */
extern LEX_STRING statement_instrument_prefix;
#endif
=== modified file 'storage/perfschema/pfs_con_slice.h'
--- a/storage/perfschema/pfs_con_slice.h 2011-02-14 14:23:55 +0000
+++ b/storage/perfschema/pfs_con_slice.h 2011-04-04 14:34:42 +0000
@@ -33,12 +33,32 @@ struct PFS_statement_stat;
@{
*/
+/**
+ A connection slice, an arbitrary grouping of several connections.
+ This structure holds statistics for grouping of connections.
+*/
struct PFS_connection_slice
{
+ /**
+ Allocate memory for waits statistics.
+ @param sizing the number of wait classes.
+ @return wait statistics for this slice.
+ */
static PFS_single_stat *alloc_waits_slice(uint sizing);
+ /**
+ Allocate memory for stages statistics.
+ @param sizing the number of stage classes.
+ @return stage statistics for this slice.
+ */
static PFS_stage_stat *alloc_stages_slice(uint sizing);
+ /**
+ Allocate memory for statement statistics.
+ @param sizing the number of statement classes.
+ @return statement statistics for this slice.
+ */
static PFS_statement_stat *alloc_statements_slice(uint sizing);
+ /** Reset all statistics. */
inline void reset_stats()
{
reset_waits_stats();
@@ -46,8 +66,11 @@ struct PFS_connection_slice
reset_statements_stats();
}
+ /** Reset all wait statistics. */
void reset_waits_stats();
+ /** Reset all stages statistics. */
void reset_stages_stats();
+ /** Reset all statements statistics. */
void reset_statements_stats();
/**
=== modified file 'storage/perfschema/pfs_defaults.h'
--- a/storage/perfschema/pfs_defaults.h 2010-07-02 16:15:37 +0000
+++ b/storage/perfschema/pfs_defaults.h 2011-04-04 14:34:42 +0000
@@ -21,6 +21,12 @@
Default setup (declarations).
*/
+/**
+ Configure the performance schema setup tables with default content.
+ The tables populated are:
+ - SETUP_ACTORS
+ - SETUP_OBJECTS
+*/
void install_default_setup(PSI_bootstrap *boot);
#endif
=== modified file 'storage/perfschema/pfs_engine_table.h'
--- a/storage/perfschema/pfs_engine_table.h 2011-02-04 11:55:17 +0000
+++ b/storage/perfschema/pfs_engine_table.h 2011-04-04 14:34:42 +0000
@@ -46,6 +46,13 @@ public:
int update_row(TABLE *table, const unsigned char *old_buf,
unsigned char *new_buf, Field **fields);
+ /**
+ Delete a row from this table.
+ @param table Table handle
+ @param buf the row buffer to delete
+ @param fields Table fields
+ @return 0 on success
+ */
int delete_row(TABLE *table, const unsigned char *buf, Field **fields);
/** Fetch the next row in this cursor. */
@@ -58,21 +65,71 @@ public:
void get_position(void *ref);
void set_position(const void *ref);
+ /** Reset the cursor position to the beginning of the table. */
virtual void reset_position(void)= 0;
/** Destructor. */
virtual ~PFS_engine_table()
{}
+ /**
+ Helper, assign a value to a ulong field.
+ @param f the field to set
+ @param value the value to assign
+ */
static void set_field_ulong(Field *f, ulong value);
+ /**
+ Helper, assign a value to a ulonglong field.
+ @param f the field to set
+ @param value the value to assign
+ */
static void set_field_ulonglong(Field *f, ulonglong value);
+ /**
+ Helper, assign a value to a char utf8 field.
+ @param f the field to set
+ @param str the string to assign
+ @param len the length of the string to assign
+ */
static void set_field_char_utf8(Field *f, const char *str, uint len);
+ /**
+ Helper, assign a value to a varchar utf8 field.
+ @param f the field to set
+ @param str the string to assign
+ @param len the length of the string to assign
+ */
static void set_field_varchar_utf8(Field *f, const char *str, uint len);
+ /**
+ Helper, assign a value to a longtext utf8 field.
+ @param f the field to set
+ @param str the string to assign
+ @param len the length of the string to assign
+ */
static void set_field_longtext_utf8(Field *f, const char *str, uint len);
+ /**
+ Helper, assign a value to an enum field.
+ @param f the field to set
+ @param value the value to assign
+ */
static void set_field_enum(Field *f, ulonglong value);
-
+ /**
+ Helper, read a value from an enum field.
+ @param f the field to read
+ @return the field value
+ */
static ulonglong get_field_enum(Field *f);
+ /**
+ Helper, read a value from a char utf8 field.
+ @param f the field to read
+ @param[out] val the field value
+ @return the field value
+ */
static String *get_field_char_utf8(Field *f, String *val);
+ /**
+ Helper, read a value from a varchar utf8 field.
+ @param f the field to read
+ @param[out] val the field value
+ @return the field value
+ */
static String *get_field_varchar_utf8(Field *f, String *val);
protected:
@@ -274,16 +331,29 @@ struct PFS_simple_index
/** Current row index. */
uint m_index;
+ /**
+ Constructor.
+ @param index the index initial value.
+ */
PFS_simple_index(uint index)
: m_index(index)
{}
+ /**
+ Set this index at a given position.
+ @param other a position
+ */
void set_at(const struct PFS_simple_index *other)
{ m_index= other->m_index; }
+ /**
+ Set this index after a given position.
+ @param other a position
+ */
void set_after(const struct PFS_simple_index *other)
{ m_index= other->m_index + 1; }
+ /** Set this index to the next record. */
void next(void)
{ m_index++; }
};
@@ -296,16 +366,29 @@ struct PFS_double_index
/** Current index within index_1. */
uint m_index_2;
+ /**
+ Constructor.
+ @param index_1 the first index initial value.
+ @param index_2 the second index initial value.
+ */
PFS_double_index(uint index_1, uint index_2)
: m_index_1(index_1), m_index_2(index_2)
{}
+ /**
+ Set this index at a given position.
+ @param other a position
+ */
void set_at(const struct PFS_double_index *other)
{
m_index_1= other->m_index_1;
m_index_2= other->m_index_2;
}
+ /**
+ Set this index after a given position.
+ @param other a position
+ */
void set_after(const struct PFS_double_index *other)
{
m_index_1= other->m_index_1;
@@ -323,10 +406,20 @@ struct PFS_triple_index
/** Current index within index_2. */
uint m_index_3;
+ /**
+ Constructor.
+ @param index_1 the first index initial value.
+ @param index_2 the second index initial value.
+ @param index_3 the third index initial value.
+ */
PFS_triple_index(uint index_1, uint index_2, uint index_3)
: m_index_1(index_1), m_index_2(index_2), m_index_3(index_3)
{}
+ /**
+ Set this index at a given position.
+ @param other a position
+ */
void set_at(const struct PFS_triple_index *other)
{
m_index_1= other->m_index_1;
@@ -334,6 +427,10 @@ struct PFS_triple_index
m_index_3= other->m_index_3;
}
+ /**
+ Set this index after a given position.
+ @param other a position
+ */
void set_after(const struct PFS_triple_index *other)
{
m_index_1= other->m_index_1;
=== modified file 'storage/perfschema/pfs_events_statements.h'
--- a/storage/perfschema/pfs_events_statements.h 2011-02-14 14:23:55 +0000
+++ b/storage/perfschema/pfs_events_statements.h 2011-04-04 14:34:42 +0000
@@ -41,32 +41,51 @@ struct PFS_events_statements : public PF
/** Length of @ m_info. */
uint m_sqltext_length;
- /* Lock */
+ /** Locked time. */
ulonglong m_lock_time;
- /* Diagnostics area */
+ /** Diagnostics area, message text. */
char m_message_text[MYSQL_ERRMSG_SIZE+1];
+ /** Diagnostics area, error number. */
uint m_sql_errno;
+ /** Diagnostics area, SQLSTATE. */
char m_sqlstate[SQLSTATE_LENGTH];
+ /** Diagnostics area, error count. */
uint m_error_count;
+ /** Diagnostics area, warning count. */
uint m_warning_count;
+ /** Diagnostics area, rows affected. */
ulonglong m_rows_affected;
- /* Optimizer */
+ /** Optimizer metric, number of rows sent. */
ulonglong m_rows_sent;
+ /** Optimizer metric, number of rows examined. */
ulonglong m_rows_examined;
+ /** Optimizer metric, number of temporary tables created on disk. */
ulonglong m_created_tmp_disk_tables;
+ /** Optimizer metric, number of temporary tables created. */
ulonglong m_created_tmp_tables;
+ /** Optimizer metric, number of full join. */
ulonglong m_select_full_join;
+ /** Optimizer metric, number of full range join. */
ulonglong m_select_full_range_join;
+ /** Optimizer metric, number of select range. */
ulonglong m_select_range;
+ /** Optimizer metric, number of select range checks. */
ulonglong m_select_range_check;
+ /** Optimizer metric, number of select scans. */
ulonglong m_select_scan;
+ /** Optimizer metric, number of sort merge passes. */
ulonglong m_sort_merge_passes;
+ /** Optimizer metric, number of sort ranges. */
ulonglong m_sort_range;
+ /** Optimizer metric, number of sort rows. */
ulonglong m_sort_rows;
+ /** Optimizer metric, number of sort scans. */
ulonglong m_sort_scan;
+ /** Optimizer metric, number of 'no index used'. */
ulonglong m_no_index_used;
+ /** Optimizer metric, number of 'no good index used'. */
ulonglong m_no_good_index_used;
};
=== modified file 'storage/perfschema/pfs_global.h'
--- a/storage/perfschema/pfs_global.h 2010-11-16 06:27:18 +0000
+++ b/storage/perfschema/pfs_global.h 2011-04-04 14:34:42 +0000
@@ -21,14 +21,31 @@
Miscellaneous global dependencies (declarations).
*/
+/** True when the performance schema is initialized. */
extern bool pfs_initialized;
+/** Total memory allocated by the performance schema, in bytes. */
extern ulonglong pfs_allocated_memory;
void *pfs_malloc(size_t size, myf flags);
+
+/**
+ Helper, to allocate an array of structures.
+ @param n number of elements in the array.
+ @param T type of an element.
+ @param f flags to use when allocating memory
+*/
#define PFS_MALLOC_ARRAY(n, T, f) \
reinterpret_cast<T*> (pfs_malloc((n) * sizeof(T), (f)))
+
+/** Free memory allocated with @sa pfs_malloc. */
void pfs_free(void *ptr);
+/**
+ Compute a random index value in an interval.
+ @param ptr seed address
+ @param max_size maximun size of the interval
+ @return a random value in [0, max_size-1]
+*/
inline uint randomized_index(const void *ptr, uint max_size)
{
static uint seed1= 0;
=== modified file 'storage/perfschema/pfs_instr.h'
--- a/storage/perfschema/pfs_instr.h 2011-02-14 14:23:55 +0000
+++ b/storage/perfschema/pfs_instr.h 2011-04-04 14:34:42 +0000
@@ -219,6 +219,7 @@ extern uint statement_stack_max;
*/
#define PFS_MAX_ALLOC_RETRY 1000
+/** The maximun number of passes in @sa PFS_scan. */
#define PFS_MAX_SCAN_PASS 2
/**
@@ -232,24 +233,42 @@ extern uint statement_stack_max;
struct PFS_scan
{
public:
+ /**
+ Initialize a new scan.
+ @param random a random index to start from
+ @param max_size the max size of the interval to scan
+ */
void init(uint random, uint max_size);
+ /**
+ Predicate, has a next pass.
+ @return true if there is a next pass to perform.
+ */
bool has_pass() const
{ return (m_pass < m_pass_max); }
+ /**
+ Iterator, proceed to the next pass.
+ */
void next_pass()
{ m_pass++; }
+ /** First index for this pass. */
uint first() const
{ return m_first[m_pass]; }
+ /** Last index for this pass. */
uint last() const
{ return m_last[m_pass]; }
private:
+ /** Current pass. */
uint m_pass;
+ /** Maximum number of passes. */
uint m_pass_max;
+ /** First element for each pass. */
uint m_first[PFS_MAX_SCAN_PASS];
+ /** Last element for each pass. */
uint m_last[PFS_MAX_SCAN_PASS];
};
=== modified file 'storage/perfschema/pfs_server.h'
--- a/storage/perfschema/pfs_server.h 2011-02-14 14:23:55 +0000
+++ b/storage/perfschema/pfs_server.h 2011-04-04 14:34:42 +0000
@@ -91,54 +91,134 @@
#define PFS_STATEMENTS_STACK_SIZE 10
#endif
-
/** Performance schema global sizing parameters. */
struct PFS_global_param
{
+ /** True if the performance schema is enabled. */
bool m_enabled;
+ /**
+ Maximum number of instrumented mutex classes.
+ @sa mutex_class_lost.
+ */
ulong m_mutex_class_sizing;
+ /**
+ Maximum number of instrumented rwlock classes.
+ @sa rwlock_class_lost.
+ */
ulong m_rwlock_class_sizing;
+ /**
+ Maximum number of instrumented cond classes.
+ @sa cond_class_lost.
+ */
ulong m_cond_class_sizing;
+ /**
+ Maximum number of instrumented thread classes.
+ @sa thread_class_lost.
+ */
ulong m_thread_class_sizing;
/**
Maximum number of instrumented table share.
@sa table_share_lost.
*/
ulong m_table_share_sizing;
+ /**
+ Maximum number of instrumented file classes.
+ @sa file_class_lost.
+ */
ulong m_file_class_sizing;
+ /**
+ Maximum number of instrumented mutex instances.
+ @sa mutex_lost.
+ */
ulong m_mutex_sizing;
+ /**
+ Maximum number of instrumented rwlock instances.
+ @sa rwlock_lost.
+ */
ulong m_rwlock_sizing;
+ /**
+ Maximum number of instrumented cond instances.
+ @sa cond_lost.
+ */
ulong m_cond_sizing;
+ /**
+ Maximum number of instrumented thread instances.
+ @sa thread_lost.
+ */
ulong m_thread_sizing;
/**
Maximum number of instrumented table handles.
@sa table_lost.
*/
ulong m_table_sizing;
+ /**
+ Maximum number of instrumented file instances.
+ @sa file_lost.
+ */
ulong m_file_sizing;
+ /**
+ Maximum number of instrumented file handles.
+ @sa file_handle_lost.
+ */
ulong m_file_handle_sizing;
+ /** Maximum number of rows per thread in table EVENTS_WAITS_HISTORY. */
ulong m_events_waits_history_sizing;
+ /** Maximum number of rows in table EVENTS_WAITS_HISTORY_LONG. */
ulong m_events_waits_history_long_sizing;
+ /** Maximum number of rows in table SETUP_ACTORS. */
ulong m_setup_actor_sizing;
- /** Maximum number of setup object records. */
+ /** Maximum number of rows in table SETUP_OBJECTS. */
ulong m_setup_object_sizing;
+ /**
+ Maximum number of instrumented stage classes.
+ @sa stage_class_lost.
+ */
ulong m_stage_class_sizing;
+ /** Maximum number of rows per thread in table EVENTS_STAGES_HISTORY. */
ulong m_events_stages_history_sizing;
+ /** Maximum number of rows in table EVENTS_STAGES_HISTORY_LONG. */
ulong m_events_stages_history_long_sizing;
+ /**
+ Maximum number of instrumented statement classes.
+ @sa statement_class_lost.
+ */
ulong m_statement_class_sizing;
+ /** Maximum number of rows per thread in table EVENTS_STATEMENT_HISTORY. */
ulong m_events_statements_history_sizing;
+ /** Maximum number of rows in table EVENTS_STATEMENTS_HISTORY_LONG. */
ulong m_events_statements_history_long_sizing;
};
+/**
+ Performance schema sizing values for the server.
+ This global variable is set when parsing server startup options.
+*/
extern PFS_global_param pfs_param;
+/**
+ Initialize the performance schema.
+ @param param Size parameters to use.
+ @return A boostrap handle, or NULL.
+*/
struct PSI_bootstrap*
initialize_performance_schema(const PFS_global_param *param);
+/**
+ Initialize the performance schema ACL.
+ ACL is strictly enforced when the server is running in normal mode,
+ to enforce that only legal operations are allowed.
+ When running in boostrap mode, ACL restrictions are relaxed,
+ to allow the boostrap scripts to DROP / CREATE performance schema tables.
+ @sa ACL_internal_schema_registry
+ @param bootstrap True if the server is starting in bootstrap mode.
+*/
void initialize_performance_schema_acl(bool bootstrap);
void check_performance_schema();
+/**
+ Shutdown the performance schema.
+*/
void shutdown_performance_schema();
#endif
=== modified file 'storage/perfschema/pfs_setup_actor.cc'
--- a/storage/perfschema/pfs_setup_actor.cc 2010-07-02 16:15:37 +0000
+++ b/storage/perfschema/pfs_setup_actor.cc 2011-04-04 14:34:42 +0000
@@ -32,11 +32,19 @@
@{
*/
+/** Size of the setup_actor instances array. @sa setup_actor_array */
ulong setup_actor_max;
+/**
+ Setup_actor instances array.
+ @sa setup_actor_max
+*/
+
PFS_setup_actor *setup_actor_array= NULL;
+/** Hash table for setup_actor records. */
static LF_HASH setup_actor_hash;
+/** True if @c setup_actor_hash is initialized. */
static bool setup_actor_hash_inited= false;
/**
=== modified file 'storage/perfschema/pfs_timer.h'
--- a/storage/perfschema/pfs_timer.h 2011-02-14 14:23:55 +0000
+++ b/storage/perfschema/pfs_timer.h 2011-04-04 14:34:42 +0000
@@ -23,6 +23,7 @@
#include <my_rdtsc.h>
#include "pfs_column_types.h"
+/** Conversion factor, from micro seconds to pico seconds. */
#define MICROSEC_TO_PICOSEC 1000000
/**
@@ -33,41 +34,102 @@
*/
struct time_normalizer
{
+ /**
+ Get a time normalizer for a given timer.
+ @param timer_name the timer name
+ @return the normalizer for the timer
+ */
static time_normalizer* get(enum_timer_name timer_name);
+ /** Timer value at server statup. */
ulonglong m_v0;
+ /** Conversion factor from timer values to pico seconds. */
ulonglong m_factor;
+ /**
+ Convert a wait from timer units to pico seconds.
+ @param wait a wait, expressed in timer units
+ @return the wait, expressed in pico seconds
+ */
inline ulonglong wait_to_pico(ulonglong wait)
{
return wait * m_factor;
}
+ /**
+ Convert a time from timer units to pico seconds.
+ @param t a time, expressed in timer units
+ @return the time, expressed in pico seconds
+ */
inline ulonglong time_to_pico(ulonglong t)
{
return (t == 0 ? 0 : (t - m_v0) * m_factor);
}
+ /**
+ Convert start / end times from timer units to pico seconds.
+ @param start start time, expressed in timer units
+ @param end end time, expressed in timer units
+ @param[out] pico_start start time, expressed in pico seconds
+ @param[out] pico_end end time, expressed in pico seconds
+ @param[out] pico_wait wait time, expressed in pico seconds
+ */
void to_pico(ulonglong start, ulonglong end,
ulonglong *pico_start, ulonglong *pico_end, ulonglong *pico_wait);
};
+/**
+ Wait timer.
+ The timer used to measure all wait events.
+*/
extern enum_timer_name wait_timer;
+/**
+ Stage timer.
+ The timer used to measure all stage events.
+*/
extern enum_timer_name stage_timer;
+/**
+ Statement timer.
+ The timer used to measure all statement events.
+*/
extern enum_timer_name statement_timer;
+/**
+ Timer information data.
+ Characteristics about each suported timer.
+*/
extern MY_TIMER_INFO pfs_timer_info;
+/** Initialize the timer component. */
void init_timers();
extern "C"
{
+ /** A timer function. */
typedef ulonglong (*timer_fct_t)(void);
}
+/**
+ Get a timer value, in pico seconds.
+ @param timer_name the timer to use
+ @return timer value, in pico seconds
+*/
ulonglong get_timer_pico_value(enum_timer_name timer_name);
+/**
+ Get a timer value, in timer units.
+ @param timer_name the timer to use
+ @return timer value, in timer units
+*/
ulonglong get_timer_raw_value(enum_timer_name timer_name);
+/**
+ Get a timer value and function, in timer units.
+ This function is useful when code needs to call the same timer several times.
+ The returned timer function can be invoked directly, which avoids having to
+ resolve the timer by name for each call.
+ @param timer_name the timer to use
+ @param[out] fct the timer function
+ @return timer value, in timer units
+*/
ulonglong get_timer_raw_value_and_function(enum_timer_name timer_name, timer_fct_t *fct);
-
#endif
=== modified file 'unittest/gunit/CMakeLists.txt'
--- a/unittest/gunit/CMakeLists.txt 2011-02-17 14:39:47 +0000
+++ b/unittest/gunit/CMakeLists.txt 2011-04-04 08:47:25 +0000
@@ -25,10 +25,6 @@ ELSE()
ENDIF()
IF(CMAKE_COMPILER_IS_GNUCXX)
- # Remove -fno-implicit-templates, gunit sources cannot be compiled with it.
- STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS
- ${CMAKE_CXX_FLAGS})
-
# MySQL is often compiled/linked with gcc rather than g++
# (to avoid dependencies on libstdc++.so)
# This does not work for googletest binaries.
No bundle (reason: revision is a merge).
| Thread |
|---|
| • bzr commit into mysql-trunk-mtr branch (bjorn.munch:3057) | Bjorn Munch | 5 Apr |