Merge 10.0 to galera-10.0

This commit is contained in:
Jan Lindström 2013-09-03 17:50:36 +03:00
commit ba3ff50ab2
3269 changed files with 158427 additions and 57354 deletions

View file

@ -1158,3 +1158,4 @@ storage/perfschema/pfs_lex_token.h
*.OLD *.OLD
mysql-test/collections/default.release.done mysql-test/collections/default.release.done
sql/sql_yacc.hh sql/sql_yacc.hh
packaging/solaris/postinstall-solaris

View file

@ -14,8 +14,9 @@
# #
# You should have received a copy of the GNU Library General Public # You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free # License along with this library; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, # Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02111-1307, USA # MA 02110-1301, USA
######################################################################## ########################################################################
get_key_value() get_key_value()
@ -164,8 +165,7 @@ valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
valgrind_configs="--with-valgrind" valgrind_configs="--with-valgrind"
# #
# Used in -debug builds # Used in -debug builds
debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG" debug_cflags="-DEXTRA_DEBUG -DSAFE_MUTEX -DSAFEMALLOC"
debug_cflags="$debug_cflags -DSAFE_MUTEX -DSAFEMALLOC"
error_inject="--with-error-inject " error_inject="--with-error-inject "
# #
# Base C++ flags for all builds # Base C++ flags for all builds

View file

@ -13,7 +13,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -13,7 +13,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -14,7 +14,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -14,8 +14,8 @@
# #
# You should have received a copy of the GNU Library General Public # You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free # License along with this library; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, # Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02111-1307, USA # MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -13,7 +13,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -13,7 +13,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -14,7 +14,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -13,7 +13,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -14,8 +14,8 @@
# #
# You should have received a copy of the GNU Library General Public # You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free # License along with this library; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, # Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02111-1307, USA # MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -14,7 +14,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -14,7 +14,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
if [ ! -f "sql/mysqld.cc" ]; then if [ ! -f "sql/mysqld.cc" ]; then
echo "You must run this script from the MySQL top-level directory." echo "You must run this script from the MySQL top-level directory."

View file

@ -14,7 +14,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
if [ ! -f "sql/mysqld.cc" ]; then if [ ! -f "sql/mysqld.cc" ]; then
echo "You must run this script from the MySQL top-level directory." echo "You must run this script from the MySQL top-level directory."

View file

@ -13,7 +13,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -14,7 +14,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -13,7 +13,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -14,7 +14,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -13,7 +13,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -13,7 +13,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
# Need to disable ccache, or we loose the gcov-needed compiler output files. # Need to disable ccache, or we loose the gcov-needed compiler output files.

View file

@ -13,7 +13,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -13,7 +13,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -13,7 +13,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -14,7 +14,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -13,7 +13,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -14,8 +14,8 @@
# #
# You should have received a copy of the GNU Library General Public # You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free # License along with this library; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, # Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02111-1307, USA # MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -13,7 +13,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -13,7 +13,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -14,8 +14,8 @@
# #
# You should have received a copy of the GNU Library General Public # You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free # License along with this library; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, # Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02111-1307, USA # MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -13,7 +13,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -13,7 +13,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -14,7 +14,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -14,7 +14,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -14,7 +14,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -14,7 +14,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -13,7 +13,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"

View file

@ -1,5 +1,5 @@
# Copyright (c) 2006, 2012, Oracle and/or its affiliates. # Copyright (c) 2006, 2013, Oracle and/or its affiliates.
# Copyright (c) 2008, 2012 Monty Program Ab # Copyright (c) 2008, 2013, Monty Program Ab
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -139,7 +139,9 @@ INCLUDE(cpack_rpm)
# Add macros # Add macros
INCLUDE(character_sets) INCLUDE(character_sets)
INCLUDE(cpu_info)
INCLUDE(zlib) INCLUDE(zlib)
INCLUDE(libevent)
INCLUDE(ssl) INCLUDE(ssl)
INCLUDE(readline) INCLUDE(readline)
INCLUDE(libutils) INCLUDE(libutils)
@ -211,7 +213,7 @@ ENDFOREACH()
# Add safemutex for debug configurations, except on Windows # Add safemutex for debug configurations, except on Windows
# (safemutex has never worked on Windows) # (safemutex has never worked on Windows)
IF(NOT WIN32) IF(NOT WIN32 AND NOT WITH_INNODB_MEMCACHED)
FOREACH(LANG C CXX) FOREACH(LANG C CXX)
SET(CMAKE_${LANG}_FLAGS_DEBUG "${CMAKE_${LANG}_FLAGS_DEBUG} -DSAFE_MUTEX") SET(CMAKE_${LANG}_FLAGS_DEBUG "${CMAKE_${LANG}_FLAGS_DEBUG} -DSAFE_MUTEX")
ENDFOREACH() ENDFOREACH()
@ -263,10 +265,12 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/include)
# Add bundled or system zlib. # Add bundled or system zlib.
MYSQL_CHECK_ZLIB_WITH_COMPRESS() MYSQL_CHECK_ZLIB_WITH_COMPRESS()
# Optionally add bundled yassl/taocrypt or system openssl. # Add bundled yassl/taocrypt or system openssl.
MYSQL_CHECK_SSL() MYSQL_CHECK_SSL()
# Add readline or libedit. # Add readline or libedit.
MYSQL_CHECK_READLINE() MYSQL_CHECK_READLINE()
# Add libevent
MYSQL_CHECK_LIBEVENT()
# #
# Setup maintainer mode options. Platform checks are # Setup maintainer mode options. Platform checks are
@ -304,6 +308,7 @@ ADD_SUBDIRECTORY(strings)
ADD_SUBDIRECTORY(vio) ADD_SUBDIRECTORY(vio)
ADD_SUBDIRECTORY(regex) ADD_SUBDIRECTORY(regex)
ADD_SUBDIRECTORY(mysys) ADD_SUBDIRECTORY(mysys)
ADD_SUBDIRECTORY(mysys_ssl)
ADD_SUBDIRECTORY(libmysql) ADD_SUBDIRECTORY(libmysql)
IF(WITH_WSREP) IF(WITH_WSREP)
ADD_SUBDIRECTORY(wsrep) ADD_SUBDIRECTORY(wsrep)
@ -345,6 +350,7 @@ IF(WIN32)
ADD_SUBDIRECTORY(win/upgrade_wizard) ADD_SUBDIRECTORY(win/upgrade_wizard)
ADD_SUBDIRECTORY(win/packaging) ADD_SUBDIRECTORY(win/packaging)
ENDIF() ENDIF()
ADD_SUBDIRECTORY(packaging/solaris)
CONFIGURE_FILE(config.h.cmake ${CMAKE_BINARY_DIR}/include/my_config.h) CONFIGURE_FILE(config.h.cmake ${CMAKE_BINARY_DIR}/include/my_config.h)
CONFIGURE_FILE(config.h.cmake ${CMAKE_BINARY_DIR}/include/config.h) CONFIGURE_FILE(config.h.cmake ${CMAKE_BINARY_DIR}/include/config.h)

488
Docs/README-wsrep Normal file
View file

@ -0,0 +1,488 @@
Codership Oy
http://www.codership.com
<info@codership.com>
DISCLAIMER
THIS SOFTWARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL CODERSHIP OY BE HELD LIABLE TO ANY PARTY FOR ANY DAMAGES
RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE.
Trademark Information.
MySQL is a trademark or registered trademark of Oracle and/or its affiliates.
Other trademarks are the property of their respective owners.
Licensing Information.
Please see file COPYING that came with this distribution
Source code can be found at
wsrep API: https://launchpad.net/wsrep
MySQL patch: https://launchpad.net/codership-mysql
ABOUT THIS DOCUMENT
This document covers installation and configuration issues specific to this
wsrep-patched MySQL distribution by Codership. It does not cover the use or
administration of MySQL server per se. The reader is assumed to know how to
install, configure, administer and use standard MySQL server version 5.1.xx.
MYSQL-5.5.x/wsrep-23.x
CONTENTS:
=========
1. WHAT IS WSREP PATCH FOR MYSQL
2. INSTALLATION
3. FIRST TIME SETUP
3.1 CONFIGURATION FILES
3.2 DATABASE PRIVILEGES
3.3 CHECK AND CORRECT FIREWALL SETTINGS
3.4 SELINUX
3.5 APPARMOR
3.6 CONNECT TO CLUSTER
4. UPGRADING FROM MySQL 5.1.x
5. CONFIGURATION OPTIONS
5.1 MANDATORY MYSQL OPTIONS
5.2 WSREP OPTIONS
6. ONLINE SCHEMA UPGRADE
6.1 TOTAL ORDER ISOLATION (TOI)
6.2 ROLLING SCHEMA UPGRADE (RSU)
7. LIMITATIONS
1. WHAT IS WSREP PATCH FOR MYSQL/INNODB
Wsrep API developed by Codership Oy is a modern generic (database-agnostic)
replication API for transactional databases with a goal to make database
replication/logging subsystem completely modular and pluggable. It is developed
with flexibility and completeness in mind to satisfy broad range of modern
replication scenarios. It is equally suitable for synchronous and asynchronous,
master-slave and multi-master replication.
wsrep stands for Write Set REPlication.
Wsrep patch for MySQL/InnoDB allows MySQL server to load and use various wsrep
API implementations ("wsrep providers") with different qualities of service.
Without wsrep provider MySQL-wsrep server will function like a regular
standalone server.
2. INSTALLATION
In the examples below mysql authentication options are omitted for brevity.
2.1 Download and install mysql-wsrep package.
Download binary package for your Linux distribution from
https://launchpad.net/codership-mysql/
2.1.1 On Debian and Debian-derived distributions.
Upgrade from mysql-server-5.0 to mysql-wsrep is not supported yet, please
upgrade to mysql-server-5.1 first.
If you're installing over an existing mysql installation, mysql-server-wsrep
will conflict with mysql-server-5.1 package, so remove it first:
$ sudo apt-get remove mysql-server-5.1 mysql-server-core-5.1
mysql-server-wsrep requires psmisc and mysql-client-5.1.47 (or later).
MySQL 5.1 packages can be found from backports repositories.
For further information about configuring and using Debian or Ubuntu
backports, see:
* http://backports.debian.org
* https://help.ubuntu.com/community/UbuntuBackports
For example, installation of required packages on Debian Lenny:
$ sudo apt-get install psmisc
$ sudo apt-get -t lenny-backports install mysql-client-5.1
Now you should be able to install mysql-wsrep package:
$ sudo dpkg -i <mysql-server-wsrep DEB>
2.1.2 On CentOS and similar RPM-based distributions.
If you're migrating from existing MySQL installation, there are two variants:
a) If you're already using official MySQL-server-community 5.1.x RPM from
Oracle:
# rpm -e mysql-server
b) If you're upgrading from the stock mysql-5.0.77 on CentOS:
1) Make sure that the following packages are not installed:
# rpm --nodeps --allmatches -e mysql-server mysql-test mysql-bench
2) Install *official* MySQL-shared-compat-5.1.x from
http://dev.mysql.com/downloads/mysql/5.1.html
Actual installation:
# rpm -Uvh <MySQL-server-wsrep RPM>
If this fails due to unsatisfied dependencies, install missing packages
(e.g. yum install perl-DBI) and retry.
Additional packages to consider (if not yet installed):
* galera (multi-master replication provider, https://launchpad.net/galera)
* MySQL-client-community (for connecting to server and mysqldump-based SST)
* rsync (for rsync-based SST)
* xtrabackup and nc (for xtrabackup-based SST)
2.2 Upgrade system tables.
If you're upgrading a previous MySQL installation, it might be advisable to
upgrade system tables. To do that start mysqld and run mysql_upgrade command.
Consult MySQL documentation in case of errors. Normally they are not critical
and can be ignored unless specific functionality is needed.
3. FIRST TIME SETUP
Unless you're upgrading an already installed mysql-wsrep package, you will need
to set up a few things to prepare server for operation.
3.1 CONFIGURATION FILES
* Make sure system-wide my.cnf does not bind mysqld to 127.0.0.1. That is, if
you have the following line in [mysqld] section, comment it out:
#bind-address = 127.0.0.1
* Make sure system-wide my.cnf contains "!includedir /etc/mysql/conf.d/" line.
* Edit /etc/mysql/conf.d/wsrep.cnf and set wsrep_provider option by specifying
a path to provider library. If you don't have a provider, leave it as it is.
* When a new node joins the cluster it'll have to receive a state snapshot from
one of the peers. This requires a privileged MySQL account with access from
the rest of the cluster. Edit /etc/mysql/conf.d/wsrep.cnf and set mysql
login/password pair for SST, for example:
wsrep_sst_auth=wsrep_sst:wspass
* See CONFIGURATION section below about other configuration parameters that you
might want to change at this point.
3.2 DATABASE PRIVILEGES
Restart MySQL server and connect to it as root to grant privileges to SST
account (empty users confuse MySQL authentication matching rules, we need to
delete them too):
$ mysql -e "SET wsrep_on=OFF; DELETE FROM mysql.user WHERE user='';"
$ mysql -e "SET wsrep_on=OFF; GRANT ALL ON *.* TO wsrep_sst@'%' IDENTIFIED BY 'wspass'";
3.3 CHECK AND CORRECT FIREWALL SETTINGS.
MySQL-wsrep server needs to be accessible from other cluster members through
its client listening socket and through wsrep provider socket. See your
distribution and wsrep provider documentation for details. For example on
CentOS you might need to do something along these lines:
# iptables --insert RH-Firewall-1-INPUT 1 --proto tcp --source <my IP>/24 --destination <my IP>/32 --dport 3306 -j ACCEPT
# iptables --insert RH-Firewall-1-INPUT 1 --proto tcp --source <my IP>/24 --destination <my IP>/32 --dport 4567 -j ACCEPT
If there is a NAT firewall between the nodes, it must be configured to allow
direct connections between the nodes (e.g. via port forwarding).
3.4 SELINUX
If you have SELinux enabled, it may block mysqld from doing required operations.
You'll need to either disable it or configure to allow mysqld to run external
programs and open listen sockets at unprivileged ports (i.e. things that
an unprivileged user can do). See SELinux documentation about it.
To quickly disable SELinux:
1) run 'setenforce 0' as root.
2) set 'SELINUX=permissive' in /etc/selinux/config
3.5 APPARMOR
AppArmor automatically comes with Ubuntu and may also prevent mysqld to from
opening additional ports or run scripts. See AppArmor documentation about its
configuration. To disable AppArmor for mysqld:
$ cd /etc/apparmor.d/disable/
$ sudo ln -s /etc/apparmor.d/usr.sbin.mysqld
$ sudo service apparmor restart
3.6 CONNECT TO CLUSTER
Now you're ready to connect to cluster by setting wsrep_cluster_address variable
and monitor status of wsrep provider:
mysql> SET GLOBAL wsrep_cluster_address='<cluster address string>';
mysql> SHOW STATUS LIKE 'wsrep%';
4 UPGRADING FROM MySQL 5.1.x
!!! THESE INSTRUCTIONS ARE PRELIMINARY AND INCOMPLETE !!!
1) BEFORE UPGRADE (while running 5.1.x):
- comment out 'wsrep_provider' setting from configuration files
(my.cnf and/or wsrep.cnf)
- If performing a rolling upgrade on a running cluster, set
wsrep_sst_method=mysqldump.
You might also need to configure wsrep_sst_receive_address and
wsrep_sst_auth appropriately. mysqldump is the only way to transfer data
from 5.1.x to 5.5.x reliably.
- remove innodb_plugin settings from configuration files.
2) Perform upgrade as usual:
http://dev.mysql.com/doc/refman/5.5/en/upgrading-from-previous-series.html
Don't forget to run 'mysql_upgrade' command.
3) AFTER UPGRADING individual node:
- uncomment 'wsrep_provider' line in configuration file.
- restart the server and join the cluster.
4) AFTER UPGRADING the whole cluster:
- revert to usual wsrep SST settings if not 'mysqldump'.
5. CONFIGURATION OPTIONS
5.1 MANDATORY MYSQL OPTIONS
binlog_format=ROW
This option is required to use row-level replication as opposed to
statement-level. For performance and consistency considerations don't change
that. As a side effect, binlog, if turned on, can be ROW only. In future this
option won't have special meaning.
innodb_autoinc_lock_mode=2
This is a required parameter. Without it INSERTs into tables with
AUTO_INCREMENT column may fail.
autoinc lock modes 0 and 1 can cause unresolved deadlock, and make
system unresponsive.
innodb_locks_unsafe_for_binlog=1
This option is required for parallel applying.
5.2 WSREP OPTIONS
All options are optional except for wsrep_provider, wsrep_cluster_address, and
wsrep_sst_auth.
wsrep_provider=none
A full path to the library that implements WSREP interface. If none is
specified, the server behaves like a regular mysqld.
wsrep_provider_options=
Provider-specific option string. Check wsrep provider documentation or
http://www.codership.com/wiki
wsrep_cluster_address=
Provider-specific cluster address string. This is used to connect a node to
the desired cluster. This option can be given either on mysqld startup or set
during runtime. See wsrep provider documentation for possible values.
wsrep_cluster_name="my_wsrep_cluster"
Logical cluster name, must be the same for all nodes of the cluster.
wsrep_node_address=
An option to explicitly specify the network address of the node in the form
<address>[:port] if autoguessing for some reason does not produce desirable
results (multiple network interfaces, NAT, etc.)
If not explicitly overridden by wsrep_sst_receive_address, the <address> part
will be used to listen for SST (see below). And the whole <address>[:port]
will be passed to wsrep provider to be used as a base address in its
communications.
wsrep_node_name=
Human readable node name (for easier log reading only). Defaults to hostname.
wsrep_slave_threads=1
Number of threads dedicated to processing of writesets from other nodes.
For best performance should be few per CPU core.
wsrep_dbug_option
Options for the built-in DBUG library (independent from what MySQL uses).
Empty by default. Not currently in use.
wsrep_debug=0
Enable debug-level logging.
wsrep_convert_LOCK_to_trx=0
Implicitly convert locking sessions into transactions inside mysqld. By
itself it does not mean support for locking sessions, but it prevents the
database from going into logically inconsistent state. Note however, that
loading large database dump with LOCK statements might result in abnormally
large transactions and cause an out-of-memory condition
wsrep_retry_autocommit=1
Retry autocommit queries and single statement transactions should they fail
certification test. This is analogous to rescheduling an autocommit query
should it go into deadlock with other transactions in the database lock
manager.
wsrep_auto_increment_control=1
Automatically adjust auto_increment_increment and auto_increment_offset
variables based on the number of nodes in the cluster. Significantly reduces
certification conflict rate for INSERTS.
wsrep_drupal_282555_workaround=1
MySQL seems to have an obscure bug when INSERT into table with
AUTO_INCREMENT column with NULL value for that column can fail with a
duplicate key error. When this option is on, it retries such INSERTs.
Required for stable Drupal operation. Documented at:
http://bugs.mysql.com/bug.php?id=41984
http://drupal.org/node/282555
wsrep_causal_reads=0
Enforce strict READ COMMITTED semantics on reads and transactions. May
result in additional latencies. It is a session variable.
wsrep_OSU_method=TOI
Online Schema Upgrade (OSU) can be performed with two alternative methods:
Total Order Isolation (TOI) runs DDL statement in all cluster nodes in
same total order sequence locking the affected table for the duration of the
operation. This may result in the whole cluster being blocked for the
duration of the operation.
Rolling Schema Upgrade (RSU) executes the DDL statement only locally, thus
blocking only one cluster node. During the DDL processing, the node
is not replicating and may be unable to process replication events (due to
table lock). Once DDL operation is complete, the node will catch up and sync
with the cluster to become fully operational again. The DDL statement or
its effects are not replicated, so it is user's responsibility to manually
perform this operation on each of the nodes.
wsrep_forced_binlog_format=none
Force every transaction to use given binlog format. When this variable is
set to something else than NONE, all transactions will use the given forced
format, regardless of what the client session has specified in binlog_format.
Valid choices for wsrep_forced_binlog_format are: ROW, STATEMENT, MIXED and
special value NONE, meaning that there is no forced binlog format in effect.
This variable was intruduced to support STATEMENT format replication during
rolling schema upgrade processing. However, in most cases ROW replication
is valid for asymmetrict schema replication.
State snapshot transfer options.
When a new node joins the cluster it has to synchronize its initial state with
the other cluster members by transferring state snapshot from one of them.
The options below govern how this happens and should be set up before attempting
to join or start a cluster.
wsrep_sst_method=rsync
What method to use to copy database state to a newly joined node. Supported
methods:
- mysqldump: slow (except for small datasets) but allows for upgrade
between major MySQL versions or InnoDB features.
- rsync: much faster on large datasets (default).
- rsync_wan: same as rsync but with deltaxfer to minimize network traffic.
- xtrabackup: very fast and practically non-blocking SST method based on
Percona's xtrabackup tool.
(for xtrabackup to work the following settings must be present in my.cnf
on all nodes:
[mysqld]
wsrep_sst_auth=root:<root password>
datadir=<path to data dir>
[client]
socket=<path to socket>
)
wsrep_sst_receive_address=
Address (hostname:port) at which this node wants to receive state snapshot.
Defaults to mysqld bind address, and if that is not specified (0.0.0.0) -
to the first IP of eth0 + mysqld bind port.
NOTE: check that your firewall allows connections to this address from other
cluster nodes.
wsrep_sst_auth=
Authentication information needed for state transfer. Depends on the state
transfer method. For mysqldump-based SST it is
<mysql_root_user>:<mysql_root_password>
and should be the same on all nodes - it is used to authenticate with both
state snapshot receiver and state snapshot donor.
wsrep_sst_donor=
A name of the node which should serve as state snapshot donor. This allows
to control which node will serve state snapshot request. By default the
most suitable node is chosen by wsrep provider. This is the same as given in
wsrep_node_name.
6. ONLINE SCHEMA UPGRADE
Schema upgrades mean any data definition statements (DDL statemnents) run
for the database. They change the database structure and are non-
transactional.
Release 22.3 brings a new method for performing schema upgrades. User can
now choose whether to use the traditional total order isolation or new
rolling schema upgrade method. The OSU method choice is done by global
parameter: 'wsrep_OSU_method'.
6.1 Total Order Isolation (TOI)
With earlier releases, DDL processing happened always by Total Order
Isolation (TOI) method. With TOI, the DDL was scheduled to be processed in
same transaction seqeuncing 'slot' in each cluster node.
The processing is secured by locking the affected table from any other use.
With TOI method, the whole cluster has part of the database locked for the
duration of the DDL processing.
6.2 Rolling Schema Upgrade (RSU)
Rolling schema upgrade is new DDL processing method, where DDL will be
processed locally for the node. The node is disconnected of the replication
for the duration of the DDL processing, so that there is only DDL statement
processing in the node and it does not block the rest of the cluster. When
the DDL processing is complete, the node applies delayed replication events
and synchronizes back with the cluster.
The DDL can then be executed cluster-wide by running the same DDL statement
for each node in turn. When this rolling schema upgrade proceeds, part of
the cluster will have old schema structure and part of the cluster will have
new schema structure.
7. LIMITATIONS
1) Currently replication works only with InnoDB storage engine. Any writes to
tables of other types, including system (mysql.*) tables are not replicated.
However, DDL statements are replicated in statement level, and changes
to mysql.* tables will get replicated that way.
So, you can safely issue: CREATE USER...,
but issuing: INSERT INTO mysql.user..., will not be replicated.
2) DELETE operation is unsupported on tables without primary key. Also rows in
tables without primary key may appear in different order on different nodes.
As a result SELECT...LIMIT... may return slightly different sets.
3) Unsupported queries:
* LOCK/UNLOCK TABLES cannot be supported in multi-master setups.
* lock functions (GET_LOCK(), RELEASE_LOCK()... )
4) Query log cannot be directed to table. If you enable query logging,
you must forward the log to a file:
log_output = FILE
Use general_log and general_log_file to choose query logging and the
log file name
5) Maximum allowed transaction size is defined by wsrep_max_ws_rows and
wsrep_max_ws_size. Anything bigger (e.g. huge LOAD DATA) will be rejected.
6) Due to cluster level optimistic concurrency control, transaction issuing
COMMIT may still be aborted at that stage. There can be two transactions.
writing to same rows and committing in separate cluster nodes, and only one
of the them can successfully commit. The failing one will be aborted.
For cluster level aborts, MySQL/galera cluster gives back deadlock error.
code (Error: 1213 SQLSTATE: 40001 (ER_LOCK_DEADLOCK)).
7) XA transactions can not be supported due to possible rollback on commit.

View file

@ -8,5 +8,4 @@ The MariaDB manual can be found at:
http://kb.askmonty.org/ http://kb.askmonty.org/
The MySQL Reference Manual is available in various formats on The MySQL Reference Manual is available in various formats on
http://dev.mysql.com/doc; if you're interested in the DocBook XML http://dev.mysql.com/doc.
sources go to http://svn.mysql.com.

7
TODO
View file

@ -32,12 +32,10 @@ Short time TODO:
- add support for host_error() - add support for host_error()
- Enable performance_schema.host_cache in scripts/mysql_system_tables.sql - Enable performance_schema.host_cache in scripts/mysql_system_tables.sql
- Add full support for automatic timestamp.
(remove timestamp handling from ha_write())
- Timour is working on this
- Add Sys_my_bind_addr(); Needed for perfschema - Add Sys_my_bind_addr(); Needed for perfschema
- Add support for format_section_buff in unireg.cc and table.cc
- mysql_socket_shutdown() was removed from vio/viosocket.cc. - mysql_socket_shutdown() was removed from vio/viosocket.cc.
It was replaced with inline function in include/mysql/psi/mysql_socket.h It was replaced with inline function in include/mysql/psi/mysql_socket.h
but this doesn't call DisconnectEx(). We should check if we need to but this doesn't call DisconnectEx(). We should check if we need to
@ -60,4 +58,3 @@ Sergei's notes:
rpl_slave.cc rpl_slave.cc
XXX in mysql_client_test XXX in mysql_client_test
net_serv.cc net_serv.cc

View file

@ -4,5 +4,5 @@
# #
MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MAJOR=10
MYSQL_VERSION_MINOR=0 MYSQL_VERSION_MINOR=0
MYSQL_VERSION_PATCH=3 MYSQL_VERSION_PATCH=4
MYSQL_VERSION_EXTRA= MYSQL_VERSION_EXTRA=

View file

@ -15,6 +15,7 @@
INCLUDE_DIRECTORIES( INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/mysys_ssl
${ZLIB_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}
${SSL_INCLUDE_DIRS} ${SSL_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/libmysql ${CMAKE_SOURCE_DIR}/libmysql
@ -25,6 +26,9 @@ INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
) )
## We will need libeay32.dll and ssleay32.dll when running client executables.
COPY_OPENSSL_DLLS(copy_openssl_client)
ADD_DEFINITIONS(${SSL_DEFINES}) ADD_DEFINITIONS(${SSL_DEFINES})
MYSQL_ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc MYSQL_ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc
${CMAKE_SOURCE_DIR}/sql/sql_string.cc) ${CMAKE_SOURCE_DIR}/sql/sql_string.cc)
@ -78,7 +82,7 @@ ENDIF(WIN32)
ADD_EXECUTABLE(async_example async_example.c) ADD_EXECUTABLE(async_example async_example.c)
TARGET_LINK_LIBRARIES(async_example mysqlclient) TARGET_LINK_LIBRARIES(async_example mysqlclient)
SET_TARGET_PROPERTIES (mysqlcheck mysqldump mysqlimport mysql_upgrade mysqlshow mysqlslap mysql_plugin SET_TARGET_PROPERTIES (mysqlcheck mysqldump mysqlimport mysql_upgrade mysqlshow mysqlslap mysql_plugin async_example
PROPERTIES HAS_CXX TRUE) PROPERTIES HAS_CXX TRUE)
ADD_DEFINITIONS(-DHAVE_DLOPEN) ADD_DEFINITIONS(-DHAVE_DLOPEN)

View file

@ -1,5 +1,5 @@
/* /*
Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2001, 2012, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View file

@ -13,8 +13,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02111-1307, USA */ MA 02110-1301, USA */
#ifndef _HASH_ #ifndef _HASH_
#define _HASH_ #define _HASH_

View file

@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
/* /*
echo is a replacement for the "echo" command builtin to cmd.exe echo is a replacement for the "echo" command builtin to cmd.exe

View file

@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
/* /*
** Ask for a password from tty ** Ask for a password from tty

View file

@ -36,7 +36,7 @@ typedef struct st_line_buffer
extern LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file); extern LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file);
extern LINE_BUFFER *batch_readline_command(LINE_BUFFER *buffer, char * str); extern LINE_BUFFER *batch_readline_command(LINE_BUFFER *buffer, char * str);
extern char *batch_readline(LINE_BUFFER *buffer); extern char *batch_readline(LINE_BUFFER *buffer, bool binary_mode);
extern void batch_readline_end(LINE_BUFFER *buffer); extern void batch_readline_end(LINE_BUFFER *buffer);
#endif /* CLIENT_MY_READLINE_INCLUDED */ #endif /* CLIENT_MY_READLINE_INCLUDED */

View file

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2012, Oracle and/or its affiliates. Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2009, 2012, Monty Program Ab. Copyright (c) 2009, 2013, Monty Program Ab.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -152,6 +152,7 @@ static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0;
static uint my_end_arg; static uint my_end_arg;
static char * opt_mysql_unix_port=0; static char * opt_mysql_unix_port=0;
static int connect_flag=CLIENT_INTERACTIVE; static int connect_flag=CLIENT_INTERACTIVE;
static my_bool opt_binary_mode= FALSE;
static int interrupted_query= 0; static int interrupted_query= 0;
static char *current_host,*current_db,*current_user=0,*opt_password=0, static char *current_host,*current_db,*current_user=0,*opt_password=0,
*current_prompt=0, *delimiter_str= 0, *current_prompt=0, *delimiter_str= 0,
@ -1056,9 +1057,10 @@ static void initialize_readline (char *name);
static void fix_history(String *final_command); static void fix_history(String *final_command);
#endif #endif
static COMMANDS *find_command(char *name,char cmd_name); static COMMANDS *find_command(char *name);
static bool add_line(String &buffer,char *line,char *in_string, static COMMANDS *find_command(char cmd_name);
bool *ml_comment, bool truncated); static bool add_line(String &buffer, char *line, ulong line_length,
char *in_string, bool *ml_comment, bool truncated);
static void remove_cntrl(String &buffer); static void remove_cntrl(String &buffer);
static void print_table_data(MYSQL_RES *result); static void print_table_data(MYSQL_RES *result);
static void print_table_data_html(MYSQL_RES *result); static void print_table_data_html(MYSQL_RES *result);
@ -1077,6 +1079,45 @@ static sig_handler window_resize(int sig);
#endif #endif
const char DELIMITER_NAME[]= "delimiter";
const uint DELIMITER_NAME_LEN= sizeof(DELIMITER_NAME) - 1;
inline bool is_delimiter_command(char *name, ulong len)
{
/*
Delimiter command has a parameter, so the length of the whole command
is larger than DELIMITER_NAME_LEN. We don't care the parameter, so
only name(first DELIMITER_NAME_LEN bytes) is checked.
*/
return (len >= DELIMITER_NAME_LEN &&
!my_strnncoll(charset_info, (uchar*) name, DELIMITER_NAME_LEN,
(uchar *) DELIMITER_NAME, DELIMITER_NAME_LEN));
}
/**
Get the index of a command in the commands array.
@param cmd_char Short form command.
@return int
The index of the command is returned if it is found, else -1 is returned.
*/
inline int get_command_index(char cmd_char)
{
/*
All client-specific commands are in the first part of commands array
and have a function to implement it.
*/
for (uint i= 0; *commands[i].func; i++)
if (commands[i].cmd_char == cmd_char)
return i;
return -1;
}
static int delimiter_index= -1;
static int charset_index= -1;
static bool real_binary_mode= FALSE;
int main(int argc,char *argv[]) int main(int argc,char *argv[])
{ {
char buff[80]; char buff[80];
@ -1085,6 +1126,8 @@ int main(int argc,char *argv[])
DBUG_ENTER("main"); DBUG_ENTER("main");
DBUG_PROCESS(argv[0]); DBUG_PROCESS(argv[0]);
charset_index= get_command_index('C');
delimiter_index= get_command_index('d');
delimiter_str= delimiter; delimiter_str= delimiter;
default_prompt = my_strdup(getenv("MYSQL_PS1") ? default_prompt = my_strdup(getenv("MYSQL_PS1") ?
getenv("MYSQL_PS1") : getenv("MYSQL_PS1") :
@ -1598,6 +1641,13 @@ static struct my_option my_long_options[] =
"Default authentication client-side plugin to use.", "Default authentication client-side plugin to use.",
&opt_default_auth, &opt_default_auth, 0, &opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"binary-mode", 0,
"By default, ASCII '\\0' is disallowed and '\\r\\n' is translated to '\\n'. "
"This switch turns off both features, and also turns off parsing of all client"
"commands except \\C and DELIMITER, in non-interactive mode (for input "
"piped to mysql or loaded using the 'source' command). This is necessary "
"when processing output from mysqlbinlog that may contain blobs.",
&opt_binary_mode, &opt_binary_mode, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
}; };
@ -1873,29 +1923,64 @@ static int read_and_execute(bool interactive)
String buffer; String buffer;
#endif #endif
char *line= 0; char *line= NULL;
char in_string=0; char in_string=0;
ulong line_number=0; ulong line_number=0;
bool ml_comment= 0; bool ml_comment= 0;
COMMANDS *com; COMMANDS *com;
ulong line_length= 0;
status.exit_status=1; status.exit_status=1;
real_binary_mode= !interactive && opt_binary_mode;
while (!aborted) while (!aborted)
{ {
if (!interactive) if (!interactive)
{ {
line=batch_readline(status.line_buff);
/* /*
Skip UTF8 Byte Order Marker (BOM) 0xEFBBBF. batch_readline can return 0 on EOF or error.
Editors like "notepad" put this marker in In that case, we need to double check that we have a valid
the very beginning of a text file when line before actually setting line_length to read_length.
you save the file using "Unicode UTF-8" format.
*/ */
if (line && !line_number && line= batch_readline(status.line_buff, real_binary_mode);
(uchar) line[0] == 0xEF && if (line)
(uchar) line[1] == 0xBB && {
(uchar) line[2] == 0xBF) line_length= status.line_buff->read_length;
line+= 3;
/*
ASCII 0x00 is not allowed appearing in queries if it is not in binary
mode.
*/
if (!real_binary_mode && strlen(line) != line_length)
{
status.exit_status= 1;
String msg;
msg.append("ASCII '\\0' appeared in the statement, but this is not "
"allowed unless option --binary-mode is enabled and mysql is "
"run in non-interactive mode. Set --binary-mode to 1 if ASCII "
"'\\0' is expected. Query: '");
msg.append(glob_buffer);
msg.append(line);
msg.append("'.");
put_info(msg.c_ptr(), INFO_ERROR);
break;
}
/*
Skip UTF8 Byte Order Marker (BOM) 0xEFBBBF.
Editors like "notepad" put this marker in
the very beginning of a text file when
you save the file using "Unicode UTF-8" format.
*/
if (!line_number &&
(uchar) line[0] == 0xEF &&
(uchar) line[1] == 0xBB &&
(uchar) line[2] == 0xBF)
{
line+= 3;
// decrease the line length accordingly to the 3 bytes chopped
line_length -=3;
}
}
line_number++; line_number++;
if (!glob_buffer.length()) if (!glob_buffer.length())
status.query_start_line=line_number; status.query_start_line=line_number;
@ -1937,6 +2022,13 @@ static int read_and_execute(bool interactive)
#else #else
if (opt_outfile) if (opt_outfile)
fputs(prompt, OUTFILE); fputs(prompt, OUTFILE);
/*
free the previous entered line.
Note: my_free() cannot be used here as the memory was allocated under
the readline/libedit library.
*/
if (line)
free(line);
line= readline(prompt); line= readline(prompt);
#endif /* defined(__WIN__) */ #endif /* defined(__WIN__) */
@ -1946,6 +2038,8 @@ static int read_and_execute(bool interactive)
*/ */
if (opt_outfile && line) if (opt_outfile && line)
fprintf(OUTFILE, "%s\n", line); fprintf(OUTFILE, "%s\n", line);
line_length= line ? strlen(line) : 0;
} }
// End of file or system error // End of file or system error
if (!line) if (!line)
@ -1962,7 +2056,7 @@ static int read_and_execute(bool interactive)
(We want to allow help, print and clear anywhere at line start (We want to allow help, print and clear anywhere at line start
*/ */
if ((named_cmds || glob_buffer.is_empty()) if ((named_cmds || glob_buffer.is_empty())
&& !ml_comment && !in_string && (com=find_command(line,0))) && !ml_comment && !in_string && (com= find_command(line)))
{ {
if ((*com->func)(&glob_buffer,line) > 0) if ((*com->func)(&glob_buffer,line) > 0)
break; break;
@ -1974,7 +2068,7 @@ static int read_and_execute(bool interactive)
#endif #endif
continue; continue;
} }
if (add_line(glob_buffer, line, &in_string, &ml_comment, if (add_line(glob_buffer, line, line_length, &in_string, &ml_comment,
status.line_buff ? status.line_buff->truncated : 0)) status.line_buff ? status.line_buff->truncated : 0))
break; break;
} }
@ -1994,72 +2088,142 @@ static int read_and_execute(bool interactive)
#if defined(__WIN__) #if defined(__WIN__)
buffer.free(); buffer.free();
tmpbuf.free(); tmpbuf.free();
#else
if (interactive)
/*
free the last entered line.
Note: my_free() cannot be used here as the memory was allocated under
the readline/libedit library.
*/
free(line);
#endif #endif
/*
If the function is called by 'source' command, it will return to interactive
mode, so real_binary_mode should be FALSE. Otherwise, it will exit the
program, it is safe to set real_binary_mode to FALSE.
*/
real_binary_mode= FALSE;
return status.exit_status; return status.exit_status;
} }
static COMMANDS *find_command(char *name,char cmd_char) /**
It checks if the input is a short form command. It returns the command's
pointer if a command is found, else return NULL. Note that if binary-mode
is set, then only \C is searched for.
@param cmd_char A character of one byte.
@return
the command's pointer or NULL.
*/
static COMMANDS *find_command(char cmd_char)
{
DBUG_ENTER("find_command");
DBUG_PRINT("enter", ("cmd_char: %d", cmd_char));
int index= -1;
/*
In binary-mode, we disallow all mysql commands except '\C'
and DELIMITER.
*/
if (real_binary_mode)
{
if (cmd_char == 'C')
index= charset_index;
}
else
index= get_command_index(cmd_char);
if (index >= 0)
{
DBUG_PRINT("exit",("found command: %s", commands[index].name));
DBUG_RETURN(&commands[index]);
}
else
DBUG_RETURN((COMMANDS *) 0);
}
/**
It checks if the input is a long form command. It returns the command's
pointer if a command is found, else return NULL. Note that if binary-mode
is set, then only DELIMITER is searched for.
@param name A string.
@return
the command's pointer or NULL.
*/
static COMMANDS *find_command(char *name)
{ {
uint len; uint len;
char *end; char *end;
DBUG_ENTER("find_command"); DBUG_ENTER("find_command");
DBUG_PRINT("enter",("name: '%s' char: %d", name ? name : "NULL", cmd_char));
if (!name) DBUG_ASSERT(name != NULL);
DBUG_PRINT("enter", ("name: '%s'", name));
while (my_isspace(charset_info, *name))
name++;
/*
If there is an \\g in the row or if the row has a delimiter but
this is not a delimiter command, let add_line() take care of
parsing the row and calling find_command().
*/
if ((!real_binary_mode && strstr(name, "\\g")) ||
(strstr(name, delimiter) &&
!is_delimiter_command(name, DELIMITER_NAME_LEN)))
DBUG_RETURN((COMMANDS *) 0);
if ((end=strcont(name, " \t")))
{ {
len=0; len=(uint) (end - name);
end=0; while (my_isspace(charset_info, *end))
end++;
if (!*end)
end= 0; // no arguments to function
}
else
len= (uint) strlen(name);
int index= -1;
if (real_binary_mode)
{
if (is_delimiter_command(name, len))
index= delimiter_index;
} }
else else
{ {
while (my_isspace(charset_info,*name))
name++;
/* /*
If there is an \\g in the row or if the row has a delimiter but All commands are in the first part of commands array and have a function
this is not a delimiter command, let add_line() take care of to implement it.
parsing the row and calling find_command()
*/ */
if (strstr(name, "\\g") || (strstr(name, delimiter) && for (uint i= 0; commands[i].func; i++)
!(strlen(name) >= 9 &&
!my_strnncoll(&my_charset_latin1,
(uchar*) name, 9,
(const uchar*) "delimiter",
9))))
DBUG_RETURN((COMMANDS *) 0);
if ((end=strcont(name," \t")))
{ {
len=(uint) (end - name); if (!my_strnncoll(&my_charset_latin1, (uchar*) name, len,
while (my_isspace(charset_info,*end)) (uchar*) commands[i].name, len) &&
end++; (commands[i].name[len] == '\0') &&
if (!*end) (!end || commands[i].takes_params))
end=0; // no arguments to function {
index= i;
break;
}
} }
else
len=(uint) strlen(name);
} }
for (uint i= 0; commands[i].name; i++) if (index >= 0)
{ {
if (commands[i].func && DBUG_PRINT("exit", ("found command: %s", commands[index].name));
(((name && DBUG_RETURN(&commands[index]);
!my_strnncoll(&my_charset_latin1, (uchar*) name, len,
(uchar*) commands[i].name, len) &&
!commands[i].name[len] &&
(!end || (end && commands[i].takes_params)))) ||
(!name && commands[i].cmd_char == cmd_char)))
{
DBUG_PRINT("exit",("found command: %s", commands[i].name));
DBUG_RETURN(&commands[i]);
}
} }
DBUG_RETURN((COMMANDS *) 0); DBUG_RETURN((COMMANDS *) 0);
} }
static bool add_line(String &buffer,char *line,char *in_string, static bool add_line(String &buffer, char *line, ulong line_length,
bool *ml_comment, bool truncated) char *in_string, bool *ml_comment, bool truncated)
{ {
uchar inchar; uchar inchar;
char buff[80], *pos, *out; char buff[80], *pos, *out;
@ -2074,10 +2238,11 @@ static bool add_line(String &buffer,char *line,char *in_string,
if (status.add_to_history && line[0] && not_in_history(line)) if (status.add_to_history && line[0] && not_in_history(line))
add_history(line); add_history(line);
#endif #endif
char *end_of_line=line+(uint) strlen(line); char *end_of_line= line + line_length;
for (pos=out=line ; (inchar= (uchar) *pos) ; pos++) for (pos= out= line; pos < end_of_line; pos++)
{ {
inchar= (uchar) *pos;
if (!preserve_comments) if (!preserve_comments)
{ {
// Skip spaces at the beginning of a statement // Skip spaces at the beginning of a statement
@ -2117,7 +2282,7 @@ static bool add_line(String &buffer,char *line,char *in_string,
*out++= (char) inchar; *out++= (char) inchar;
continue; continue;
} }
if ((com=find_command(NullS,(char) inchar))) if ((com= find_command((char) inchar)))
{ {
// Flush previously accepted characters // Flush previously accepted characters
if (out != line) if (out != line)
@ -2193,7 +2358,7 @@ static bool add_line(String &buffer,char *line,char *in_string,
pos--; pos--;
if ((com= find_command(buffer.c_ptr(), 0))) if ((com= find_command(buffer.c_ptr())))
{ {
if ((*com->func)(&buffer, buffer.c_ptr()) > 0) if ((*com->func)(&buffer, buffer.c_ptr()) > 0)
@ -2312,9 +2477,7 @@ static bool add_line(String &buffer,char *line,char *in_string,
{ {
uint length=(uint) (out-line); uint length=(uint) (out-line);
if (!truncated && (length < 9 || if (!truncated && (!is_delimiter_command(line, length) ||
my_strnncoll (charset_info, (uchar *)line, 9,
(const uchar *) "delimiter", 9) ||
(*in_string || *ml_comment))) (*in_string || *ml_comment)))
{ {
/* /*
@ -3341,9 +3504,9 @@ print_table_data(MYSQL_RES *result)
{ {
uint length= column_names ? field->name_length : 0; uint length= column_names ? field->name_length : 0;
if (quick) if (quick)
length=max(length,field->length); length= MY_MAX(length,field->length);
else else
length=max(length,field->max_length); length= MY_MAX(length,field->max_length);
if (length < 4 && !IS_NOT_NULL(field->flags)) if (length < 4 && !IS_NOT_NULL(field->flags))
length=4; // Room for "NULL" length=4; // Room for "NULL"
field->max_length=length; field->max_length=length;
@ -3363,8 +3526,8 @@ print_table_data(MYSQL_RES *result)
field->name, field->name,
field->name + name_length); field->name + name_length);
uint display_length= field->max_length + name_length - numcells; uint display_length= field->max_length + name_length - numcells;
tee_fprintf(PAGER, " %-*s |",(int) min(display_length, tee_fprintf(PAGER, " %-*s |",(int) MY_MIN(display_length,
MAX_COLUMN_LENGTH), MAX_COLUMN_LENGTH),
field->name); field->name);
num_flag[off]= IS_NUM(field->type); num_flag[off]= IS_NUM(field->type);
} }
@ -3453,9 +3616,9 @@ static int get_field_disp_length(MYSQL_FIELD *field)
uint length= column_names ? field->name_length : 0; uint length= column_names ? field->name_length : 0;
if (quick) if (quick)
length= max(length, field->length); length= MY_MAX(length, field->length);
else else
length= max(length, field->max_length); length= MY_MAX(length, field->max_length);
if (length < 4 && !IS_NOT_NULL(field->flags)) if (length < 4 && !IS_NOT_NULL(field->flags))
length= 4; /* Room for "NULL" */ length= 4; /* Room for "NULL" */
@ -3471,6 +3634,7 @@ static int get_field_disp_length(MYSQL_FIELD *field)
@returns The max number of characters in any row of this result @returns The max number of characters in any row of this result
*/ */
static int get_result_width(MYSQL_RES *result) static int get_result_width(MYSQL_RES *result)
{ {
unsigned int len= 0; unsigned int len= 0;

View file

@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <m_string.h> #include <m_string.h>

View file

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2006, 2012, Oracle and/or its affiliates. Copyright (c) 2006, 2013, Oracle and/or its affiliates.
Copyright (C) 2010, 2012, Monty Program Ab. Copyright (c) 2010, 2013, Monty Program Ab.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -40,7 +40,7 @@ static char mysql_path[FN_REFLEN];
static char mysqlcheck_path[FN_REFLEN]; static char mysqlcheck_path[FN_REFLEN];
static my_bool opt_force, opt_verbose, debug_info_flag, debug_check_flag, static my_bool opt_force, opt_verbose, debug_info_flag, debug_check_flag,
opt_systables_only; opt_systables_only, opt_version_check;
static my_bool opt_not_used, opt_silent; static my_bool opt_not_used, opt_silent;
static uint my_end_arg= 0; static uint my_end_arg= 0;
static char *opt_user= (char*)"root"; static char *opt_user= (char*)"root";
@ -150,6 +150,12 @@ static struct my_option my_long_options[]=
&opt_not_used, &opt_not_used, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, &opt_not_used, &opt_not_used, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.", 0, 0, 0, {"version", 'V', "Output version information and exit.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version-check", 'k', "Run this program only if its \'server version\' "
"matches the version of the server to which it's connecting, (enabled by "
"default); use --skip-version-check to avoid this check. Note: the \'server "
"version\' of the program is the version of the MySQL server with which it "
"was built/distributed.", &opt_version_check, &opt_version_check, 0,
GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"write-binlog", OPT_WRITE_BINLOG, {"write-binlog", OPT_WRITE_BINLOG,
"All commands including mysqlcheck are binlogged. Enabled by default;" "All commands including mysqlcheck are binlogged. Enabled by default;"
"use --skip-write-binlog when commands should not be sent to replication slaves.", "use --skip-write-binlog when commands should not be sent to replication slaves.",
@ -291,6 +297,7 @@ get_one_option(int optid, const struct my_option *opt,
my_progname, optid == 'b' ? "basedir" : "datadir"); my_progname, optid == 'b' ? "basedir" : "datadir");
/* FALLTHROUGH */ /* FALLTHROUGH */
case 'k': /* --version-check */
case 'v': /* --verbose */ case 'v': /* --verbose */
opt_verbose++; opt_verbose++;
if (argument == disabled_my_option) if (argument == disabled_my_option)
@ -564,6 +571,8 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
static int extract_variable_from_show(DYNAMIC_STRING* ds, char* value) static int extract_variable_from_show(DYNAMIC_STRING* ds, char* value)
{ {
char *value_start, *value_end; char *value_start, *value_end;
size_t len;
/* /*
The query returns "datadir\t<datadir>\n", skip past The query returns "datadir\t<datadir>\n", skip past
the tab the tab
@ -576,7 +585,9 @@ static int extract_variable_from_show(DYNAMIC_STRING* ds, char* value)
if ((value_end= strchr(value_start, '\n')) == NULL) if ((value_end= strchr(value_start, '\n')) == NULL)
return 1; /* Unexpected result */ return 1; /* Unexpected result */
strncpy(value, value_start, min(FN_REFLEN, value_end-value_start)); len= (size_t) MY_MIN(FN_REFLEN, value_end-value_start);
strncpy(value, value_start, len);
value[len]= '\0';
return 0; return 0;
} }
@ -874,6 +885,55 @@ static const char *load_default_groups[]=
}; };
/* Convert the specified version string into the numeric format. */
static ulong STDCALL calc_server_version(char *some_version)
{
uint major, minor, version;
char *point= some_version, *end_point;
major= (uint) strtoul(point, &end_point, 10); point=end_point+1;
minor= (uint) strtoul(point, &end_point, 10); point=end_point+1;
version= (uint) strtoul(point, &end_point, 10);
return (ulong) major * 10000L + (ulong)(minor * 100 + version);
}
/**
Check if the server version matches with the server version mysql_upgrade
was compiled with.
@return 0 match successful
1 failed
*/
static int check_version_match(void)
{
DYNAMIC_STRING ds_version;
char version_str[NAME_CHAR_LEN + 1];
if (init_dynamic_string(&ds_version, NULL, NAME_CHAR_LEN, NAME_CHAR_LEN))
die("Out of memory");
if (run_query("show variables like 'version'",
&ds_version, FALSE) ||
extract_variable_from_show(&ds_version, version_str))
{
dynstr_free(&ds_version);
return 1; /* Query failed */
}
dynstr_free(&ds_version);
if (calc_server_version((char *) version_str) != MYSQL_VERSION_ID)
{
fprintf(stderr, "Error: Server version (%s) does not match with the "
"version of\nthe server (%s) with which this program was built/"
"distributed. You can\nuse --skip-version-check to skip this "
"check.\n", version_str, MYSQL_SERVER_VERSION);
return 1;
}
else
return 0;
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
char self_name[FN_REFLEN]; char self_name[FN_REFLEN];
@ -938,6 +998,9 @@ int main(int argc, char **argv)
die(NULL); die(NULL);
} }
if (opt_version_check && check_version_match())
die("Upgrade failed");
/* /*
Run "mysqlcheck" and "mysql_fix_privilege_tables.sql" Run "mysqlcheck" and "mysql_fix_privilege_tables.sql"
*/ */

View file

@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
/* maintaince of mysql databases */ /* maintaince of mysql databases */
@ -23,7 +23,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <mysql.h> #include <mysql.h>
#include <sql_common.h> #include <sql_common.h>
#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */ #include <welcome_copyright_notice.h>
#include <my_rnd.h>
#define ADMIN_VERSION "9.1" #define ADMIN_VERSION "9.1"
#define MAX_MYSQL_VAR 512 #define MAX_MYSQL_VAR 512

View file

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2012, Oracle and/or its affiliates. Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2009, 2012, Monty Program Ab Copyright (c) 2009, 2013, Monty Program Ab.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -207,10 +207,8 @@ void print_annotate_event(PRINT_EVENT_INFO *print_event_info)
} }
} }
static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info, static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *, const char*);
const char* logname); static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *, const char*);
static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
const char* logname);
static Exit_status dump_log_entries(const char* logname); static Exit_status dump_log_entries(const char* logname);
static Exit_status safe_connect(); static Exit_status safe_connect();
@ -859,7 +857,11 @@ static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
/* /*
end of statement check: end of statement check:
i) destroy/free ignored maps i) destroy/free ignored maps
ii) if skip event, flush cache now ii) if skip event
a) since we are skipping the last event,
append END-MARKER(') to body cache (if required)
b) flush cache now
*/ */
if (is_stmt_end) if (is_stmt_end)
{ {
@ -887,6 +889,12 @@ static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
*/ */
if (skip_event) if (skip_event)
{ {
// append END-MARKER(') with delimiter
IO_CACHE *const body_cache= &print_event_info->body_cache;
if (my_b_tell(body_cache))
my_b_printf(body_cache, "'%s\n", print_event_info->delimiter);
// flush cache
if ((copy_event_cache_to_file_and_reinit(&print_event_info->head_cache, result_file) || if ((copy_event_cache_to_file_and_reinit(&print_event_info->head_cache, result_file) ||
copy_event_cache_to_file_and_reinit(&print_event_info->body_cache, result_file))) copy_event_cache_to_file_and_reinit(&print_event_info->body_cache, result_file)))
return 1; return 1;
@ -2337,7 +2345,7 @@ static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
my_off_t length,tmp; my_off_t length,tmp;
for (length= start_position_mot ; length > 0 ; length-=tmp) for (length= start_position_mot ; length > 0 ; length-=tmp)
{ {
tmp=min(length,sizeof(buff)); tmp= MY_MIN(length,sizeof(buff));
if (my_b_read(file, buff, (uint) tmp)) if (my_b_read(file, buff, (uint) tmp))
{ {
error("Failed reading from file."); error("Failed reading from file.");

View file

@ -32,10 +32,6 @@
#define EX_USAGE 1 #define EX_USAGE 1
#define EX_MYSQLERR 2 #define EX_MYSQLERR 2
/* ALTER instead of repair. */
#define MAX_ALTER_STR_SIZE 128 * 1024
#define KEY_PARTITIONING_CHANGED_STR "KEY () partitioning changed"
static MYSQL mysql_connection, *sock = 0; static MYSQL mysql_connection, *sock = 0;
static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0, static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0,
opt_compress = 0, opt_databases = 0, opt_fast = 0, opt_compress = 0, opt_databases = 0, opt_fast = 0,
@ -51,7 +47,7 @@ static char *opt_password = 0, *current_user = 0,
*default_charset= 0, *current_host= 0; *default_charset= 0, *current_host= 0;
static char *opt_plugin_dir= 0, *opt_default_auth= 0; static char *opt_plugin_dir= 0, *opt_default_auth= 0;
static int first_error = 0; static int first_error = 0;
DYNAMIC_ARRAY tables4repair, tables4rebuild, alter_table_cmds; DYNAMIC_ARRAY tables4repair, tables4rebuild;
static char *shared_memory_base_name=0; static char *shared_memory_base_name=0;
static uint opt_protocol=0; static uint opt_protocol=0;
@ -784,8 +780,8 @@ static int handle_request_for_tables(char *tables, uint length)
org= ptr= strmov(strmov(query, op), " TABLE "); org= ptr= strmov(strmov(query, op), " TABLE ");
ptr= fix_table_name(ptr, tables); ptr= fix_table_name(ptr, tables);
strmake(table_name_buff, org, min((int) sizeof(table_name_buff)-1, strmake(table_name_buff, org, MY_MIN((int) sizeof(table_name_buff)-1,
(int) (ptr - org))); (int) (ptr - org)));
table_name= table_name_buff; table_name= table_name_buff;
ptr= strxmov(ptr, " ", options, NullS); ptr= strxmov(ptr, " ", options, NullS);
query_length= (uint) (ptr - query); query_length= (uint) (ptr - query);
@ -818,7 +814,6 @@ static void print_result()
MYSQL_RES *res; MYSQL_RES *res;
MYSQL_ROW row; MYSQL_ROW row;
char prev[(NAME_LEN+9)*2+2]; char prev[(NAME_LEN+9)*2+2];
char prev_alter[MAX_ALTER_STR_SIZE];
uint i; uint i;
my_bool found_error=0, table_rebuild=0; my_bool found_error=0, table_rebuild=0;
DBUG_ENTER("print_result"); DBUG_ENTER("print_result");
@ -826,7 +821,6 @@ static void print_result()
res = mysql_use_result(sock); res = mysql_use_result(sock);
prev[0] = '\0'; prev[0] = '\0';
prev_alter[0]= 0;
for (i = 0; (row = mysql_fetch_row(res)); i++) for (i = 0; (row = mysql_fetch_row(res)); i++)
{ {
int changed = strcmp(prev, row[0]); int changed = strcmp(prev, row[0]);
@ -843,18 +837,12 @@ static void print_result()
strcmp(row[3],"OK")) strcmp(row[3],"OK"))
{ {
if (table_rebuild) if (table_rebuild)
{ insert_dynamic(&tables4rebuild, (uchar*) prev);
if (prev_alter[0])
insert_dynamic(&alter_table_cmds, (uchar*) prev_alter);
else
insert_dynamic(&tables4rebuild, (uchar*) prev);
}
else else
insert_dynamic(&tables4repair, (uchar*) prev); insert_dynamic(&tables4repair, (uchar*) prev);
} }
found_error=0; found_error=0;
table_rebuild=0; table_rebuild=0;
prev_alter[0]= 0;
if (opt_silent) if (opt_silent)
continue; continue;
} }
@ -871,30 +859,11 @@ static void print_result()
printf("%-50s %s", row[0], "Needs upgrade"); printf("%-50s %s", row[0], "Needs upgrade");
else else
printf("%s\n%-9s: %s", row[0], row[2], row[3]); printf("%s\n%-9s: %s", row[0], row[2], row[3]);
if (opt_auto_repair && strcmp(row[2],"note")) if (strcmp(row[2],"note"))
{ {
const char *alter_txt= strstr(row[3], "ALTER TABLE");
found_error=1; found_error=1;
if (alter_txt) if (opt_auto_repair && strstr(row[3], "ALTER TABLE") != NULL)
{
table_rebuild=1; table_rebuild=1;
if (!strncmp(row[3], KEY_PARTITIONING_CHANGED_STR,
strlen(KEY_PARTITIONING_CHANGED_STR)) &&
strstr(alter_txt, "PARTITION BY"))
{
if (strlen(alter_txt) >= MAX_ALTER_STR_SIZE)
{
printf("Error: Alter command too long (>= %d),"
" please do \"%s\" or dump/reload to fix it!\n",
MAX_ALTER_STR_SIZE,
alter_txt);
table_rebuild= 0;
prev_alter[0]= 0;
}
else
strcpy(prev_alter, alter_txt);
}
}
} }
} }
else else
@ -906,12 +875,7 @@ static void print_result()
if (found_error && opt_auto_repair && what_to_do != DO_REPAIR) if (found_error && opt_auto_repair && what_to_do != DO_REPAIR)
{ {
if (table_rebuild) if (table_rebuild)
{ insert_dynamic(&tables4rebuild, (uchar*) prev);
if (prev_alter[0])
insert_dynamic(&alter_table_cmds, (uchar*) prev_alter);
else
insert_dynamic(&tables4rebuild, (uchar*) prev);
}
else else
insert_dynamic(&tables4repair, (uchar*) prev); insert_dynamic(&tables4repair, (uchar*) prev);
} }
@ -1030,9 +994,7 @@ int main(int argc, char **argv)
(my_init_dynamic_array(&tables4repair, sizeof(char)*(NAME_LEN*2+2),16, (my_init_dynamic_array(&tables4repair, sizeof(char)*(NAME_LEN*2+2),16,
64, MYF(0)) || 64, MYF(0)) ||
my_init_dynamic_array(&tables4rebuild, sizeof(char)*(NAME_LEN*2+2),16, my_init_dynamic_array(&tables4rebuild, sizeof(char)*(NAME_LEN*2+2),16,
64, MYF(0)) || 64, MYF(0))))
my_init_dynamic_array(&alter_table_cmds, MAX_ALTER_STR_SIZE, 0,
1, MYF(0))))
goto end; goto end;
if (opt_alldbs) if (opt_alldbs)
@ -1057,8 +1019,6 @@ int main(int argc, char **argv)
} }
for (i = 0; i < tables4rebuild.elements ; i++) for (i = 0; i < tables4rebuild.elements ; i++)
rebuild_table((char*) dynamic_array_ptr(&tables4rebuild, i)); rebuild_table((char*) dynamic_array_ptr(&tables4rebuild, i));
for (i = 0; i < alter_table_cmds.elements ; i++)
run_query((char*) dynamic_array_ptr(&alter_table_cmds, i));
} }
ret= test(first_error); ret= test(first_error);

View file

@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/* mysqldump.c - Dump a tables contents and format to an ASCII file /* mysqldump.c - Dump a tables contents and format to an ASCII file

View file

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. /* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2009, 2012, Monty Program Ab. Copyright (c) 2009, 2013, Monty Program Ab.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -63,8 +63,9 @@
#define SIGNAL_FMT "signal %d" #define SIGNAL_FMT "signal %d"
#endif #endif
#include <my_context.h>
static my_bool non_blocking_api_enabled= 0; static my_bool non_blocking_api_enabled= 0;
#if !defined(EMBEDDED_LIBRARY) #if !defined(EMBEDDED_LIBRARY) && !defined(MY_CONTEXT_DISABLE)
#define WRAP_NONBLOCK_ENABLED non_blocking_api_enabled #define WRAP_NONBLOCK_ENABLED non_blocking_api_enabled
#include "../tests/nonblock-wrappers.h" #include "../tests/nonblock-wrappers.h"
#endif #endif
@ -3590,7 +3591,7 @@ void do_remove_file(struct st_command *command)
' '); ' ');
DBUG_PRINT("info", ("removing file: %s", ds_filename.str)); DBUG_PRINT("info", ("removing file: %s", ds_filename.str));
error= my_delete_allow_opened(ds_filename.str, MYF(disable_warnings ? 0 : MY_WME)) != 0; error= my_delete(ds_filename.str, MYF(disable_warnings ? 0 : MY_WME)) != 0;
handle_command_error(command, error, my_errno); handle_command_error(command, error, my_errno);
dynstr_free(&ds_filename); dynstr_free(&ds_filename);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
@ -5950,8 +5951,10 @@ void do_connect(struct st_command *command)
if (opt_connect_timeout) if (opt_connect_timeout)
mysql_options(con_slot->mysql, MYSQL_OPT_CONNECT_TIMEOUT, mysql_options(con_slot->mysql, MYSQL_OPT_CONNECT_TIMEOUT,
(void *) &opt_connect_timeout); (void *) &opt_connect_timeout);
#ifndef MY_CONTEXT_DISABLE
mysql_options(con_slot->mysql, MYSQL_OPT_NONBLOCK, 0); if (mysql_options(con_slot->mysql, MYSQL_OPT_NONBLOCK, 0))
die("Failed to initialise non-blocking API");
#endif
if (opt_compress || con_compress) if (opt_compress || con_compress)
mysql_options(con_slot->mysql, MYSQL_OPT_COMPRESS, NullS); mysql_options(con_slot->mysql, MYSQL_OPT_COMPRESS, NullS);
mysql_options(con_slot->mysql, MYSQL_OPT_LOCAL_INFILE, 0); mysql_options(con_slot->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
@ -6482,9 +6485,9 @@ int read_line(char *buf, int size)
} }
else if ((c == '{' && else if ((c == '{' &&
(!my_strnncoll_simple(charset_info, (const uchar*) "while", 5, (!my_strnncoll_simple(charset_info, (const uchar*) "while", 5,
(uchar*) buf, min(5, p - buf), 0) || (uchar*) buf, MY_MIN(5, p - buf), 0) ||
!my_strnncoll_simple(charset_info, (const uchar*) "if", 2, !my_strnncoll_simple(charset_info, (const uchar*) "if", 2,
(uchar*) buf, min(2, p - buf), 0)))) (uchar*) buf, MY_MIN(2, p - buf), 0))))
{ {
/* Only if and while commands can be terminated by { */ /* Only if and while commands can be terminated by { */
*p++= c; *p++= c;

View file

@ -54,7 +54,7 @@ LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file)
} }
char *batch_readline(LINE_BUFFER *line_buff) char *batch_readline(LINE_BUFFER *line_buff, bool binary_mode)
{ {
char *pos; char *pos;
ulong out_length; ulong out_length;
@ -63,8 +63,17 @@ char *batch_readline(LINE_BUFFER *line_buff)
if (!(pos=intern_read_line(line_buff, &out_length))) if (!(pos=intern_read_line(line_buff, &out_length)))
return 0; return 0;
if (out_length && pos[out_length-1] == '\n') if (out_length && pos[out_length-1] == '\n')
if (--out_length && pos[out_length-1] == '\r') /* Remove '\n' */ {
out_length--; /* Remove '\r' */ /*
On Windows platforms we also need to remove '\r', unconditionally. On
Unix-like platforms we only remove it if we are not on binary mode.
*/
/* Remove '\n' */
if (--out_length && IF_WIN(1,!binary_mode) && pos[out_length-1] == '\r')
/* Remove '\r' */
out_length--;
}
line_buff->read_length=out_length; line_buff->read_length=out_length;
pos[out_length]=0; pos[out_length]=0;
return pos; return pos;
@ -226,7 +235,7 @@ char *intern_read_line(LINE_BUFFER *buffer, ulong *out_length)
for (;;) for (;;)
{ {
pos=buffer->end_of_line; pos=buffer->end_of_line;
while (*pos != '\n' && *pos) while (*pos != '\n' && pos != buffer->end)
pos++; pos++;
if (pos == buffer->end) if (pos == buffer->end)
{ {

View file

@ -1,7 +1,7 @@
#ifndef SQL_STRING_INCLUDED #ifndef SQL_STRING_INCLUDED
#define SQL_STRING_INCLUDED #define SQL_STRING_INCLUDED
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -226,6 +226,7 @@ public:
DBUG_ASSERT(!s.uses_buffer_owned_by(this)); DBUG_ASSERT(!s.uses_buffer_owned_by(this));
free(); free();
Ptr=s.Ptr ; str_length=s.str_length ; Alloced_length=s.Alloced_length; Ptr=s.Ptr ; str_length=s.str_length ; Alloced_length=s.Alloced_length;
str_charset=s.str_charset;
alloced=0; alloced=0;
} }
return *this; return *this;

View file

@ -173,12 +173,12 @@ IF(UNIX)
# Default GCC flags # Default GCC flags
IF(CMAKE_COMPILER_IS_GNUCC) IF(CMAKE_COMPILER_IS_GNUCC)
SET(COMMON_C_FLAGS "-g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing") SET(COMMON_C_FLAGS "-g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized")
SET(CMAKE_C_FLAGS_DEBUG "-O ${COMMON_C_FLAGS}") SET(CMAKE_C_FLAGS_DEBUG "-O ${COMMON_C_FLAGS}")
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_C_FLAGS}") SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_C_FLAGS}")
ENDIF() ENDIF()
IF(CMAKE_COMPILER_IS_GNUCXX) IF(CMAKE_COMPILER_IS_GNUCXX)
SET(COMMON_CXX_FLAGS "-g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing") SET(COMMON_CXX_FLAGS "-g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized")
SET(CMAKE_CXX_FLAGS_DEBUG "-O ${COMMON_CXX_FLAGS}") SET(CMAKE_CXX_FLAGS_DEBUG "-O ${COMMON_CXX_FLAGS}")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_CXX_FLAGS}") SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_CXX_FLAGS}")
ENDIF() ENDIF()

View file

@ -150,6 +150,16 @@ foreach my $option (@ARGV)
$cmakeargs = $cmakeargs." -DWITH_ZLIB=system"; $cmakeargs = $cmakeargs." -DWITH_ZLIB=system";
next; next;
} }
if($option =~ /with-libevent=/)
{
$cmakeargs = $cmakeargs." -DWITH_LIBEVENT=system";
next;
}
if($option =~ /with-libevent/)
{
$cmakeargs = $cmakeargs." -DWITH_LIBEVENT=bundled";
next;
}
if($option =~ /with-ssl=/) if($option =~ /with-ssl=/)
{ {
$cmakeargs = $cmakeargs." -DWITH_SSL=yes"; $cmakeargs = $cmakeargs." -DWITH_SSL=yes";
@ -247,6 +257,16 @@ foreach my $option (@ARGV)
print("configure.pl : ignoring $option\n"); print("configure.pl : ignoring $option\n");
next; next;
} }
if ($option =~ /with-client-ldflags/)
{
print("configure.pl : ignoring $option\n");
next;
}
if ($option =~ /with-mysqld-ldflags=/)
{
print("configure.pl : ignoring $option\n");
next;
}
$option = uc($option); $option = uc($option);
$option =~ s/-/_/g; $option =~ s/-/_/g;

30
cmake/cpu_info.cmake Normal file
View file

@ -0,0 +1,30 @@
# Copyright (c) 2009, 2011, 2012 Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Symbols with information about the CPU.
FIND_PROGRAM(GETCONF getconf)
MARK_AS_ADVANCED(GETCONF)
IF(GETCONF)
EXECUTE_PROCESS(
COMMAND ${GETCONF} LEVEL1_DCACHE_LINESIZE
OUTPUT_VARIABLE CPU_LEVEL1_DCACHE_LINESIZE
)
ENDIF()
IF(CPU_LEVEL1_DCACHE_LINESIZE AND CPU_LEVEL1_DCACHE_LINESIZE GREATER 0)
ELSE()
SET(CPU_LEVEL1_DCACHE_LINESIZE 64)
ENDIF()

89
cmake/libevent.cmake Normal file
View file

@ -0,0 +1,89 @@
# Copyright (C) 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
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
MACRO (MYSQL_USE_BUNDLED_LIBEVENT)
SET(LIBEVENT_LIBRARY event)
SET(LIBEVENT_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/libevent)
SET(LIBEVENT_FOUND TRUE)
SET(WITH_LIBEVENT "bundled" CACHE STRING "Use bundled libevent")
ADD_SUBDIRECTORY(libevent)
GET_TARGET_PROPERTY(src libevent SOURCES)
FOREACH(file ${src})
SET(LIBEVENT_SOURCES ${LIBEVENT_SOURCES} ${CMAKE_SOURCE_DIR}/libevent/${file})
ENDFOREACH()
ENDMACRO()
# MYSQL_CHECK_LIBEVENT
#
# Provides the following configure options:
# WITH_LIBEVENT_BUNDLED
# If this is set,we use bindled libevent
# If this is not set,search for system libevent.
# if system libevent is not found, use bundled copy
# LIBEVENT_LIBRARIES, LIBEVENT_INCLUDE_DIR and LIBEVENT_SOURCES
# are set after this macro has run
MACRO (MYSQL_CHECK_LIBEVENT)
IF (NOT WITH_LIBEVENT)
SET(WITH_LIBEVENT "bundled" CACHE STRING "By default use bundled libevent on this platform")
ENDIF()
IF(WITH_LIBEVENT STREQUAL "bundled")
MYSQL_USE_BUNDLED_LIBEVENT()
ELSEIF(WITH_LIBEVENT STREQUAL "system" OR WITH_LIBEVENT STREQUAL "yes")
SET(LIBEVENT_FIND_QUIETLY TRUE)
IF (NOT LIBEVENT_INCLUDE_PATH)
set(LIBEVENT_INCLUDE_PATH /usr/local/include /opt/local/include)
ENDIF()
find_path(LIBEVENT_INCLUDE_DIR event.h PATHS ${LIBEVENT_INCLUDE_PATH})
if (NOT LIBEVENT_INCLUDE_DIR)
MESSAGE(SEND_ERROR "Cannot find appropriate event.h in /usr/local/include or /opt/local/include. Use bundled libevent")
endif()
IF (NOT LIBEVENT_LIB_PATHS)
set(LIBEVENT_LIB_PATHS /usr/local/lib /opt/local/lib)
ENDIF()
find_library(LIBEVENT_LIB event PATHS ${LIBEVENT_LIB_PATHS})
if (NOT LIBEVENT_LIB)
MESSAGE(SEND_ERROR "Cannot find appropriate event lib in /usr/local/lib or /opt/local/lib. Use bundled libevent")
endif()
IF (LIBEVENT_LIB AND LIBEVENT_INCLUDE_DIR)
set(LIBEVENT_FOUND TRUE)
set(LIBEVENT_LIBS ${LIBEVENT_LIB})
ELSE()
set(LIBEVENT_FOUND FALSE)
ENDIF()
IF(LIBEVENT_FOUND)
SET(LIBEVENT_SOURCES "")
SET(LIBEVENT_LIBRARIES ${LIBEVENT_LIBS})
SET(LIBEVENT_INCLUDE_DIRS ${LIBEVENT_INCLUDE_DIR})
SET(LIBEVENT_DEFINES "-DHAVE_LIBEVENT")
ELSE()
IF(WITH_LIBEVENT STREQUAL "system")
MESSAGE(SEND_ERROR "Cannot find appropriate system libraries for libevent. Use bundled libevent")
ENDIF()
MYSQL_USE_BUNDLED_LIBEVENT()
ENDIF()
ENDIF()
ENDMACRO()

View file

@ -304,20 +304,22 @@ FUNCTION(GET_DEPENDEND_OS_LIBS target result)
SET(${result} ${ret} PARENT_SCOPE) SET(${result} ${ret} PARENT_SCOPE)
ENDFUNCTION() ENDFUNCTION()
MACRO(RESTRICT_SYMBOL_EXPORTS target) SET(VISIBILITY_HIDDEN_FLAG)
SET(VISIBILITY_HIDDEN_FLAG)
IF(CMAKE_COMPILER_IS_GNUCXX AND UNIX) IF(CMAKE_COMPILER_IS_GNUCXX AND UNIX)
CHECK_C_COMPILER_FLAG("-fvisibility=hidden" HAVE_VISIBILITY_HIDDEN) CHECK_C_COMPILER_FLAG("-fvisibility=hidden" HAVE_VISIBILITY_HIDDEN)
IF(HAVE_VISIBILITY_HIDDEN) IF(HAVE_VISIBILITY_HIDDEN)
SET(VISIBILITY_HIDDEN_FLAG "-fvisibility=hidden") SET(VISIBILITY_HIDDEN_FLAG "-fvisibility=hidden")
ENDIF()
ENDIF() ENDIF()
ENDIF()
IF(CMAKE_C_COMPILER_ID MATCHES "SunPro") IF(CMAKE_C_COMPILER_ID MATCHES "SunPro")
SET(VISIBILITY_HIDDEN_FLAG "-xldscope=hidden") SET(VISIBILITY_HIDDEN_FLAG "-xldscope=hidden")
ENDIF() ENDIF()
# We try to hide the symbols in yassl/zlib to avoid name clashes with
# other libraries like openssl.
FUNCTION(RESTRICT_SYMBOL_EXPORTS target)
IF(VISIBILITY_HIDDEN_FLAG) IF(VISIBILITY_HIDDEN_FLAG)
GET_TARGET_PROPERTY(COMPILE_FLAGS ${target} COMPILE_FLAGS) GET_TARGET_PROPERTY(COMPILE_FLAGS ${target} COMPILE_FLAGS)
IF(NOT COMPILE_FLAGS) IF(NOT COMPILE_FLAGS)
@ -327,5 +329,4 @@ MACRO(RESTRICT_SYMBOL_EXPORTS target)
SET_TARGET_PROPERTIES(${target} PROPERTIES SET_TARGET_PROPERTIES(${target} PROPERTIES
COMPILE_FLAGS "${COMPILE_FLAGS} ${VISIBILITY_HIDDEN_FLAG}") COMPILE_FLAGS "${COMPILE_FLAGS} ${VISIBILITY_HIDDEN_FLAG}")
ENDIF() ENDIF()
ENDFUNCTION()
ENDMACRO()

View file

@ -80,10 +80,6 @@ IF(MSVC)
STRING(REPLACE "/MD" "/MT" "${flag}" "${${flag}}") STRING(REPLACE "/MD" "/MT" "${flag}" "${${flag}}")
ENDFOREACH() ENDFOREACH()
# Remove support for exceptions
FOREACH(flag CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_INIT)
STRING(REPLACE "/EHsc" "" "${flag}" "${${flag}}")
ENDFOREACH()
# Fix CMake's predefined huge stack size # Fix CMake's predefined huge stack size
FOREACH(type EXE SHARED MODULE) FOREACH(type EXE SHARED MODULE)

View file

@ -368,4 +368,6 @@ SET(HAVE_EVENT_H CACHE INTERNAL "")
SET(HAVE_LINUX_UNISTD_H CACHE INTERNAL "") SET(HAVE_LINUX_UNISTD_H CACHE INTERNAL "")
SET(HAVE_SYS_UTSNAME_H CACHE INTERNAL "") SET(HAVE_SYS_UTSNAME_H CACHE INTERNAL "")
SET(HAVE_PTHREAD_ATTR_GETGUARDSIZE CACHE INTERNAL "") SET(HAVE_PTHREAD_ATTR_GETGUARDSIZE CACHE INTERNAL "")
SET(HAVE_UCONTEXT_H CACHE INTERNAL "")
SET(HAVE_SOCKPEERCRED CACHE INTERNAL "")
ENDIF() ENDIF()

View file

@ -1,4 +1,4 @@
# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -83,19 +83,22 @@ IF(NOT VERSION)
MATH(EXPR VER "${VER} -4") MATH(EXPR VER "${VER} -4")
SET(DEFAULT_PLATFORM "osx10.${VER}") SET(DEFAULT_PLATFORM "osx10.${VER}")
ENDIF() ENDIF()
LIST(LENGTH CMAKE_OSX_ARCHITECTURES LEN)
IF(LEN GREATER 1) IF(CMAKE_OSX_ARCHITECTURES)
SET(DEFAULT_MACHINE "universal") LIST(LENGTH CMAKE_OSX_ARCHITECTURES LEN)
IF(LEN GREATER 1)
SET(DEFAULT_MACHINE "universal")
ELSE()
SET(DEFAULT_MACHINE "${CMAKE_OSX_ARCHITECTURES}")
ENDIF()
ELSE() ELSE()
SET(DEFAULT_MACHINE "${CMAKE_OSX_ARCHITECTURES}") IF(64BIT)
IF(NOT DEFAULT_MACHINE) SET(DEFAULT_MACHINE "x86_64")
IF(CMAKE_SIZEOF_VOIPD EQUAL 4) ELSE()
SET(DEFAULT_MACHINE "i386") SET(DEFAULT_MACHINE "i386")
ELSE()
SET(DEFAULT_MACHINE "x86_64")
ENDIF()
ENDIF() ENDIF()
ENDIF() ENDIF()
IF(DEFAULT_MACHINE MATCHES "i386") IF(DEFAULT_MACHINE MATCHES "i386")
SET(DEFAULT_MACHINE "x86") SET(DEFAULT_MACHINE "x86")
ENDIF() ENDIF()

View file

@ -90,7 +90,8 @@ MACRO(MYSQL_ADD_PLUGIN)
AND NOT ARG_MODULE_ONLY) AND NOT ARG_MODULE_ONLY)
SET(WITH_${plugin} 1) SET(WITH_${plugin} 1)
ELSEIF(WITHOUT_${plugin}_STORAGE_ENGINE OR WITH_NONE OR ${plugin}_DISABLED) ELSEIF(WITHOUT_${plugin} OR WITHOUT_${plugin}_STORAGE_ENGINE OR
WITH_NONE OR ${plugin}_DISABLED)
SET(WITHOUT_${plugin} 1) SET(WITHOUT_${plugin} 1)
SET(WITH_${plugin}_STORAGE_ENGINE 0) SET(WITH_${plugin}_STORAGE_ENGINE 0)
SET(WITH_${plugin} 0) SET(WITH_${plugin} 0)

View file

@ -13,80 +13,227 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# We support different versions of SSL:
# - "bundled" uses source code in <source dir>/extra/yassl
# - "system" (typically) uses headers/libraries in /usr/lib and /usr/lib64
# - a custom installation of openssl can be used like this
# - cmake -DCMAKE_PREFIX_PATH=</path/to/custom/openssl> -DWITH_SSL="system"
# or
# - cmake -DWITH_SSL=</path/to/custom/openssl>
#
# The default value for WITH_SSL is "bundled"
# set in cmake/build_configurations/feature_set.cmake
#
# For custom build/install of openssl, see the accompanying README and
# INSTALL* files. When building with gcc, you must build the shared libraries
# (in addition to the static ones):
# ./config --prefix=</path/to/custom/openssl> --shared; make; make install
# On some platforms (mac) you need to choose 32/64 bit architecture.
# Build/Install of openssl on windows is slightly different: you need to run
# perl and nmake. You might also need to
# 'set path=</path/to/custom/openssl>\bin;%PATH%
# in order to find the .dll files at runtime.
SET(WITH_SSL_DOC "bundled (use yassl)")
SET(WITH_SSL_DOC
"${WITH_SSL_DOC}, yes (prefer os library if present, otherwise use bundled)")
SET(WITH_SSL_DOC
"${WITH_SSL_DOC}, system (use os library)")
SET(WITH_SSL_DOC
"${WITH_SSL_DOC}, </path/to/custom/installation>")
MACRO (CHANGE_SSL_SETTINGS string) MACRO (CHANGE_SSL_SETTINGS string)
SET(WITH_SSL ${string} CACHE STRING "Options are: no bundled yes(prefer os library if present otherwise use bundled) system(use os library)" FORCE) SET(WITH_SSL ${string} CACHE STRING ${WITH_SSL_DOC} FORCE)
ENDMACRO() ENDMACRO()
MACRO (MYSQL_USE_BUNDLED_SSL) MACRO (MYSQL_USE_BUNDLED_SSL)
SET(INC_DIRS SET(INC_DIRS
${CMAKE_SOURCE_DIR}/extra/yassl/include ${CMAKE_SOURCE_DIR}/extra/yassl/include
${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/include ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/include
) )
SET(SSL_LIBRARIES yassl taocrypt) SET(SSL_LIBRARIES yassl taocrypt)
SET(SSL_INCLUDE_DIRS ${INC_DIRS}) SET(SSL_INCLUDE_DIRS ${INC_DIRS})
SET(SSL_INTERNAL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL) SET(SSL_INTERNAL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL)
SET(SSL_DEFINES "-DHAVE_YASSL -DYASSL_PURE_C -DYASSL_PREFIX -DHAVE_OPENSSL -DMULTI_THREADED") SET(SSL_DEFINES "-DHAVE_YASSL -DYASSL_PREFIX -DHAVE_OPENSSL -DMULTI_THREADED")
CHANGE_SSL_SETTINGS("bundled") 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)
ADD_SUBDIRECTORY(extra/yassl/taocrypt) ADD_SUBDIRECTORY(extra/yassl/taocrypt)
SET(CMAKE_CXX_FLAGS ${SAVE_CXX_FLAGS})
GET_TARGET_PROPERTY(src yassl SOURCES) GET_TARGET_PROPERTY(src yassl SOURCES)
FOREACH(file ${src}) FOREACH(file ${src})
SET(SSL_SOURCES ${SSL_SOURCES} ${CMAKE_SOURCE_DIR}/extra/yassl/${file}) SET(SSL_SOURCES ${SSL_SOURCES} ${CMAKE_SOURCE_DIR}/extra/yassl/${file})
ENDFOREACH() ENDFOREACH()
GET_TARGET_PROPERTY(src taocrypt SOURCES) GET_TARGET_PROPERTY(src taocrypt SOURCES)
FOREACH(file ${src}) FOREACH(file ${src})
SET(SSL_SOURCES ${SSL_SOURCES} ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/${file}) SET(SSL_SOURCES ${SSL_SOURCES}
${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/${file})
ENDFOREACH() ENDFOREACH()
ENDMACRO() ENDMACRO()
# MYSQL_CHECK_SSL # MYSQL_CHECK_SSL
# #
# Provides the following configure options: # Provides the following configure options:
# WITH_SSL=[yes|no|bundled] # WITH_SSL=[yes|bundled|system|<path/to/custom/installation>]
MACRO (MYSQL_CHECK_SSL) MACRO (MYSQL_CHECK_SSL)
IF(NOT WITH_SSL) IF(NOT WITH_SSL)
IF(WIN32) IF(WIN32)
CHANGE_SSL_SETTINGS("bundled") CHANGE_SSL_SETTINGS("bundled")
ELSE() ELSE()
CHANGE_SSL_SETTINGS("no") SET(WITH_SSL "yes")
ENDIF() ENDIF()
ENDIF() ENDIF()
# See if WITH_SSL is of the form </path/to/custom/installation>
FILE(GLOB WITH_SSL_HEADER ${WITH_SSL}/include/openssl/ssl.h)
IF (WITH_SSL_HEADER)
SET(WITH_SSL_PATH ${WITH_SSL} CACHE PATH "path to custom SSL installation")
ENDIF()
IF(WITH_SSL STREQUAL "bundled") IF(WITH_SSL STREQUAL "bundled")
MYSQL_USE_BUNDLED_SSL() MYSQL_USE_BUNDLED_SSL()
ELSEIF(WITH_SSL STREQUAL "system" OR WITH_SSL STREQUAL "yes") # Reset some variables, in case we switch from /path/to/ssl to "bundled".
# Check for system library IF (WITH_SSL_PATH)
SET(OPENSSL_FIND_QUIETLY TRUE) UNSET(WITH_SSL_PATH)
INCLUDE(FindOpenSSL) UNSET(WITH_SSL_PATH CACHE)
FIND_LIBRARY(CRYPTO_LIBRARY crypto) ENDIF()
MARK_AS_ADVANCED(CRYPTO_LIBRARY) IF (OPENSSL_ROOT_DIR)
UNSET(OPENSSL_ROOT_DIR)
UNSET(OPENSSL_ROOT_DIR CACHE)
ENDIF()
IF (OPENSSL_INCLUDE_DIR)
UNSET(OPENSSL_INCLUDE_DIR)
UNSET(OPENSSL_INCLUDE_DIR CACHE)
ENDIF()
IF (WIN32 AND OPENSSL_APPLINK_C)
UNSET(OPENSSL_APPLINK_C)
UNSET(OPENSSL_APPLINK_C CACHE)
ENDIF()
IF (OPENSSL_LIBRARIES)
UNSET(OPENSSL_LIBRARIES)
UNSET(OPENSSL_LIBRARIES CACHE)
ENDIF()
ELSEIF(WITH_SSL STREQUAL "system" OR
WITH_SSL STREQUAL "yes" OR
WITH_SSL_PATH
)
# First search in WITH_SSL_PATH.
FIND_PATH(OPENSSL_ROOT_DIR
NAMES include/openssl/ssl.h
NO_CMAKE_PATH
NO_CMAKE_ENVIRONMENT_PATH
HINTS ${WITH_SSL_PATH}
)
# Then search in standard places (if not found above).
FIND_PATH(OPENSSL_ROOT_DIR
NAMES include/openssl/ssl.h
)
FIND_PATH(OPENSSL_INCLUDE_DIR
NAMES openssl/ssl.h
HINTS ${OPENSSL_ROOT_DIR}/include
)
IF (WIN32)
FIND_FILE(OPENSSL_APPLINK_C
NAMES openssl/applink.c
HINTS ${OPENSSL_ROOT_DIR}/include
)
MESSAGE(STATUS "OPENSSL_APPLINK_C ${OPENSSL_APPLINK_C}")
ENDIF()
# On mac this list is <.dylib;.so;.a>
# We prefer static libraries, so we revert it here.
IF (WITH_SSL_PATH)
LIST(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
ENDIF()
MESSAGE(STATUS "suffixes <${CMAKE_FIND_LIBRARY_SUFFIXES}>")
FIND_LIBRARY(OPENSSL_LIBRARIES
NAMES ssl ssleay32 ssleay32MD
HINTS ${OPENSSL_ROOT_DIR}/lib)
FIND_LIBRARY(CRYPTO_LIBRARY
NAMES crypto libeay32
HINTS ${OPENSSL_ROOT_DIR}/lib)
IF (WITH_SSL_PATH)
LIST(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
ENDIF()
# Verify version number. Version information looks like:
# #define OPENSSL_VERSION_NUMBER 0x1000103fL
# Encoded as MNNFFPPS: major minor fix patch status
FILE(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h"
OPENSSL_VERSION_NUMBER
REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x[0-9].*"
)
STRING(REGEX REPLACE
"^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9]).*$" "\\1"
OPENSSL_MAJOR_VERSION "${OPENSSL_VERSION_NUMBER}"
)
IF(OPENSSL_INCLUDE_DIR AND
OPENSSL_LIBRARIES AND
CRYPTO_LIBRARY
)
SET(OPENSSL_FOUND TRUE)
ELSE()
SET(OPENSSL_FOUND FALSE)
ENDIF()
MESSAGE(STATUS "OPENSSL_INCLUDE_DIR = ${OPENSSL_INCLUDE_DIR}")
MESSAGE(STATUS "OPENSSL_LIBRARIES = ${OPENSSL_LIBRARIES}")
MESSAGE(STATUS "CRYPTO_LIBRARY = ${CRYPTO_LIBRARY}")
MESSAGE(STATUS "OPENSSL_MAJOR_VERSION = ${OPENSSL_MAJOR_VERSION}")
INCLUDE(CheckSymbolExists) INCLUDE(CheckSymbolExists)
SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
CHECK_SYMBOL_EXISTS(SHA512_DIGEST_LENGTH "openssl/sha.h" CHECK_SYMBOL_EXISTS(SHA512_DIGEST_LENGTH "openssl/sha.h"
HAVE_SHA512_DIGEST_LENGTH) HAVE_SHA512_DIGEST_LENGTH)
SET(CMAKE_REQUIRED_INCLUDES) IF(OPENSSL_FOUND AND HAVE_SHA512_DIGEST_LENGTH)
IF(OPENSSL_FOUND AND CRYPTO_LIBRARY AND HAVE_SHA512_DIGEST_LENGTH)
SET(SSL_SOURCES "") SET(SSL_SOURCES "")
SET(SSL_LIBRARIES ${OPENSSL_LIBRARIES} ${CRYPTO_LIBRARY}) SET(SSL_LIBRARIES ${OPENSSL_LIBRARIES} ${CRYPTO_LIBRARY})
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
SET(SSL_LIBRARIES ${SSL_LIBRARIES} ${LIBSOCKET})
ENDIF()
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
SET(SSL_LIBRARIES ${SSL_LIBRARIES} ${LIBDL})
ENDIF()
MESSAGE(STATUS "SSL_LIBRARIES = ${SSL_LIBRARIES}")
SET(SSL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR}) SET(SSL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
SET(SSL_INTERNAL_INCLUDE_DIRS "") SET(SSL_INTERNAL_INCLUDE_DIRS "")
SET(SSL_DEFINES "-DHAVE_OPENSSL") SET(SSL_DEFINES "-DHAVE_OPENSSL")
CHANGE_SSL_SETTINGS("system")
ELSE() ELSE()
IF(WITH_SSL STREQUAL "system") IF(WITH_SSL STREQUAL "system")
MESSAGE(SEND_ERROR "Cannot find appropriate system libraries for SSL. Use WITH_SSL=bundled to enable SSL support") MESSAGE(SEND_ERROR "Cannot find appropriate system libraries for SSL. Use WITH_SSL=bundled to enable SSL support")
ENDIF() ENDIF()
MYSQL_USE_BUNDLED_SSL() MYSQL_USE_BUNDLED_SSL()
ENDIF() ENDIF()
ELSEIF(NOT WITH_SSL STREQUAL "no") ELSE()
MESSAGE(SEND_ERROR "Wrong option for WITH_SSL. Valid values are : yes, no, bundled") MESSAGE(SEND_ERROR
"Wrong option for WITH_SSL. Valid values are : "${WITH_SSL_DOC})
ENDIF()
ENDMACRO()
# Many executables will depend on libeay32.dll and ssleay32.dll at runtime.
# In order to ensure we find the right version(s), we copy them into
# the same directory as the executables.
# NOTE: Using dlls will likely crash in malloc/free,
# see INSTALL.W32 which comes with the openssl sources.
# So we should be linking static versions of the libraries.
MACRO (COPY_OPENSSL_DLLS target_name)
IF (WIN32 AND WITH_SSL_PATH)
GET_FILENAME_COMPONENT(CRYPTO_NAME "${CRYPTO_LIBRARY}" NAME_WE)
GET_FILENAME_COMPONENT(OPENSSL_NAME "${OPENSSL_LIBRARIES}" NAME_WE)
FILE(GLOB HAVE_CRYPTO_DLL "${WITH_SSL_PATH}/bin/${CRYPTO_NAME}.dll")
FILE(GLOB HAVE_OPENSSL_DLL "${WITH_SSL_PATH}/bin/${OPENSSL_NAME}.dll")
IF (HAVE_CRYPTO_DLL AND HAVE_OPENSSL_DLL)
ADD_CUSTOM_COMMAND(OUTPUT ${target_name}
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${WITH_SSL_PATH}/bin/${CRYPTO_NAME}.dll"
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${CRYPTO_NAME}.dll"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${WITH_SSL_PATH}/bin/${OPENSSL_NAME}.dll"
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${OPENSSL_NAME}.dll"
)
ADD_CUSTOM_TARGET(${target_name} ALL)
ENDIF()
ENDIF() ENDIF()
ENDMACRO() ENDMACRO()

59
cmake/wsrep.cmake Normal file
View file

@ -0,0 +1,59 @@
# Copyright (c) 2011, Codership Oy <info@codership.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# We need to generate a proper spec file even without --with-wsrep flag,
# so WSREP_VERSION is produced regardless
# Set the patch version
SET(WSREP_PATCH_VERSION "7.5")
# Obtain patch revision number
SET(WSREP_PATCH_REVNO $ENV{WSREP_REV})
IF(NOT WSREP_PATCH_REVNO)
EXECUTE_PROCESS(
COMMAND bzr revno
OUTPUT_VARIABLE WSREP_PATCH_REVNO
RESULT_VARIABLE RESULT
)
STRING(REGEX REPLACE "(\r?\n)+$" "" WSREP_PATCH_REVNO "${WSREP_PATCH_REVNO}")
#FILE(WRITE "wsrep_config" "Debug: WSREP_PATCH_REVNO result: ${RESULT}\n")
ENDIF()
IF(NOT WSREP_PATCH_REVNO)
SET(WSREP_PATCH_REVNO "XXXX")
ENDIF()
# Obtain wsrep API version
EXECUTE_PROCESS(
COMMAND sh -c "grep WSREP_INTERFACE_VERSION ${MySQL_SOURCE_DIR}/wsrep/wsrep_api.h | cut -d '\"' -f 2"
OUTPUT_VARIABLE WSREP_API_VERSION
RESULT_VARIABLE RESULT
)
#FILE(WRITE "wsrep_config" "Debug: WSREP_API_VERSION result: ${RESULT}\n")
STRING(REGEX REPLACE "(\r?\n)+$" "" WSREP_API_VERSION "${WSREP_API_VERSION}")
SET(WSREP_VERSION
"${WSREP_API_VERSION}.${WSREP_PATCH_VERSION}.r${WSREP_PATCH_REVNO}"
)
OPTION(WITH_WSREP "WSREP replication API (to use, e.g. Galera Replication library)" ON)
IF (WITH_WSREP)
SET(WSREP_C_FLAGS "-DWITH_WSREP -DWSREP_PROC_INFO -DMYSQL_MAX_VARIABLE_VALUE_LEN=2048")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WSREP_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WSREP_C_FLAGS}")
SET(COMPILATION_COMMENT "${COMPILATION_COMMENT}, wsrep_${WSREP_VERSION}")
SET(WITH_EMBEDDED_SERVER OFF CACHE INTERNAL "" FORCE)
ENDIF()
#

View file

@ -2,7 +2,7 @@
Version 2, June 1991 Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc. Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111 USA 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed. of this license document, but changing it is not allowed.
@ -305,7 +305,7 @@ the "copyright" line and a pointer to where the full notice is found.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Also add information on how to contact you by electronic and paper mail. Also add information on how to contact you by electronic and paper mail.

View file

@ -18,7 +18,7 @@
You should have received a copy of the GNU General Public License along You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if !defined (_STDLIB_H_) #if !defined (_STDLIB_H_)
#define _STDLIB_H_ 1 #define _STDLIB_H_ 1

View file

@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation, have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#define READLINE_LIBRARY #define READLINE_LIBRARY

View file

@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation, have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#define READLINE_LIBRARY #define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H) #if defined (HAVE_CONFIG_H)

View file

@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation, have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _CHARDEFS_H_ #ifndef _CHARDEFS_H_
#define _CHARDEFS_H_ #define _CHARDEFS_H_

View file

@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation, have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#define READLINE_LIBRARY #define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H) #if defined (HAVE_CONFIG_H)

View file

@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation, have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#define READLINE_LIBRARY #define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H) #if defined (HAVE_CONFIG_H)

View file

@ -19,8 +19,8 @@ dnl Process this file with autoconf to produce a configure script.
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# 02111-1307, USA. # MA 02110-1301, USA.
AC_REVISION([for Readline 5.2, version 2.61]) AC_REVISION([for Readline 5.2, version 2.61])

View file

@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation, have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#define READLINE_LIBRARY #define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H) #if defined (HAVE_CONFIG_H)

View file

@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation, have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if !defined (BUFSIZ) #if !defined (BUFSIZ)
#include <stdio.h> #include <stdio.h>

View file

@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation, have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#define READLINE_LIBRARY #define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H) #if defined (HAVE_CONFIG_H)

View file

@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation, have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#define READLINE_LIBRARY #define READLINE_LIBRARY

View file

@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation, have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* The goal is to make the implementation transparent, so that you /* The goal is to make the implementation transparent, so that you
don't have to know what data types are used, just what functions don't have to know what data types are used, just what functions

View file

@ -17,7 +17,7 @@
The GNU General Public License is often shipped with GNU software, and The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation, have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if !defined (_HISTLIB_H_) #if !defined (_HISTLIB_H_)
#define _HISTLIB_H_ #define _HISTLIB_H_

View file

@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation, have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* The goal is to make the implementation transparent, so that you /* The goal is to make the implementation transparent, so that you
don't have to know what data types are used, just what functions don't have to know what data types are used, just what functions

View file

@ -17,7 +17,7 @@
The GNU General Public License is often shipped with GNU software, and The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation, have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _HISTORY_H_ #ifndef _HISTORY_H_
#define _HISTORY_H_ #define _HISTORY_H_

View file

@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation, have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#define READLINE_LIBRARY #define READLINE_LIBRARY

View file

@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation, have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#define READLINE_LIBRARY #define READLINE_LIBRARY
#if defined (__TANDEM) #if defined (__TANDEM)

View file

@ -23,7 +23,7 @@
The GNU General Public License is often shipped with GNU software, and The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation, have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#define READLINE_LIBRARY #define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H) #if defined (HAVE_CONFIG_H)

View file

@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with Readline; see the file COPYING. If not, write to the Free along with Readline; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#define READLINE_LIBRARY #define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H) #if defined (HAVE_CONFIG_H)

View file

@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation, have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _KEYMAPS_H_ #ifndef _KEYMAPS_H_
#define _KEYMAPS_H_ #define _KEYMAPS_H_

View file

@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation, have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#define READLINE_LIBRARY #define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H) #if defined (HAVE_CONFIG_H)

View file

@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation, have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#define READLINE_LIBRARY #define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H) #if defined (HAVE_CONFIG_H)

View file

@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation, have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#define READLINE_LIBRARY #define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H) #if defined (HAVE_CONFIG_H)

View file

@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation, have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#define READLINE_LIBRARY #define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H) #if defined (HAVE_CONFIG_H)

View file

@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation, have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#define READLINE_LIBRARY #define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H) #if defined (HAVE_CONFIG_H)

View file

@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation, have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#define READLINE_LIBRARY #define READLINE_LIBRARY
#if defined (__TANDEM) #if defined (__TANDEM)

View file

@ -16,7 +16,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with Bash; see the file COPYING. If not, write to the Free along with Bash; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* This file should be included instead of <dirent.h> or <sys/dir.h>. */ /* This file should be included instead of <dirent.h> or <sys/dir.h>. */

View file

@ -16,7 +16,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with Bash; see the file COPYING. If not, write to the Free along with Bash; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _POSIXJMP_H_ #ifndef _POSIXJMP_H_
#define _POSIXJMP_H_ #define _POSIXJMP_H_

View file

@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with Bash; see the file COPYING. If not, write to the Free along with Bash; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* This file should be included instead of <sys/stat.h>. /* This file should be included instead of <sys/stat.h>.
It relies on the local sys/stat.h to work though. */ It relies on the local sys/stat.h to work though. */

View file

@ -19,7 +19,7 @@
The GNU General Public License is often shipped with GNU software, and The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation, have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#define READLINE_LIBRARY #define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H) #if defined (HAVE_CONFIG_H)

View file

@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation, have a copy of the license, write to the Free Software Foundation,
59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if !defined (_READLINE_H_) #if !defined (_READLINE_H_)
#define _READLINE_H_ #define _READLINE_H_

Some files were not shown because too many files have changed in this diff Show more